WP7702 using SPI



I am using a WP7702 module and I was wondering if anyone has gotten the spidev working on a similar module? Outcome of running spidev seen below. Related post on Legato forum:

Jan 31 07:03:30 | supervisor[7972]/supervisor T=main | app.c GetDevID() 644 | Could not get file info for ‘/dev/spidev0.0’. No such file or directory.
Jan 31 07:03:30 | supervisor[7972]/supervisor T=main | app.c SetCfgDevicePermissions() 754 | Failed to set permissions (rw) for app ‘spiService’ on device ‘/dev/spidev0.0’.

Spisvc is installed, and lsmod gives this:

root@swi-mdm9x28:~# lsmod
Tainted: G
spisvc 1069 0 - Live 0xbf000000 (O)


root@swi-mdm9x28:~# modprobe spidev
modprobe: module spidev not found in modules.dep

There is one spidev installed on the module, but it is not working:

root@swi-mdm9x28:~# ls /dev/spi

Is this just a firmware / kernel issue?


On the wp76xx and wp77xx, the primary i2c bus is 1 (instead of 0 on the wp85 and wp75). I think we just need to add a few ifdefs to make it work. I will try to do that now.


I have submitted a pull request to the legato-af repository. If you apply this change to your Legato source code and then add the spisvc kernel module to your SDEF, then it should be possible to use the spiService app on the wp77xx or wp76xx platforms.


Hi @dfrey,

Left a comment on your pull request. You can now start spiService with those changes, but it does not read anything from the spi bus. I have a HX711 ADC converter (with a weight sensor) I have used with the WP8548 which works fine, but no readings when connected to WP7702.

root@swi-mdm9x28:~# lsmod
Tainted: G
spisvc 1069 0 - Live 0xbf052000 (O)
9_mangoh_red_dv5 8893 0 - Live 0xbf04b000 (O)
4_bmi160_i2c 1396 0 - Live 0xbf047000 (O)
3_bmp280_i2c 2631 0 - Live 0xbf043000 (O)
3_bmi160 5472 1 4_bmi160_i2c, Live 0xbf03e000 (O)
2_bmp280 9493 1 3_bmp280_i2c, Live 0xbf033000 (O)
0_ltc294x 5575 0 - Live 0xbf02a000 (O)
0_iot_slot 14701 0 - Live 0xbf022000 (O)
0_cp2130 20486 0 - Live 0xbf007000 (O)
0_bq24296 10844 0 - Live 0xbf000000 (O)

root@swi-mdm9x28:~# ls /dev/spi

And I did change my code to check for spidev1.0, not 0.0 as for WP8548. Is there some configuration I am missing? Are the parameters / SPI-pins different for WP7702 (MOSI, MISO, CLK)?


I’m going to look at the SPI pins on a logic analyzer and see if anything looks off. I will update later today.


Did you find anything? Just something I forgot previously: changing the speed of the spi device did give different readings (le_spi_Configure()). But the readings were always static, there was no difference. I used 96000bps for WP8548, tried that and different speeds on WP7702 but nothing.


Some other stuff came up so I didn’t get to it. I haven’t forgotten about it though. Will update here when I have some new information.


I ran this code and observed the expected pattern on the CS, CLK and MOSI lines.

    LE_INFO("===========> SPI application has started");

    le_result_t res;

    spi_DeviceHandleRef_t spiHandle;
    res = spi_Open("spidev1.0", &spiHandle);
    LE_FATAL_IF(res != LE_OK, "spi_Open failed with result=%d", res);

    LE_INFO("Configuring SPI");
    spi_Configure(spiHandle, 0, 8, 960000, 0);

    LE_INFO("Performing a SPI write of 16 bytes");
        const uint8_t writeData[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
        LE_ASSERT_OK(spi_WriteHD(spiHandle, writeData, NUM_ARRAY_MEMBERS(writeData)));
    LE_INFO("SPI write completed successfully");


I will try to connect a device now to test the read behavior.


I successfully performed a loopback test and also did a read of a register on the CAN IoT card and got a valid value back. One small detail is that I’m using a WP76 using release 8, not a WP77, but I don’t expect there to be a difference.

Can you try a loopback test?


Hi @dfrey,

With loopback test you simply sent data master->slave->master and checked data was still the same? So using spiWriteReadFD / spiWriteReadHD function?

I can do some testing on Monday. There is only Release 7 available, maybe there were some changes to Release 8? Could you provide me with a beta version of the new release so I can try it out as well?
Our contact person who provided us with the WP77xx module said he would look into it and see if we could try it out. Thanks, and have a great weekend!


The loopback test is achieved by wiring the MOSI and MISO lines together and then using spiWriteReadFD. The spiWriteReadHD function is useless in this case because there will be no data being driven on MOSI when MISO is being read. I think wp76 release 8 will show up in the next couple days on source.sierrawireless.com. I looked at the changes though and I don’t see anything relating to SPI so I doubt that will make a difference.


Unfortunately looks like I will not have time right now to do further testing with the SPI. But I will get back to you if/when I have tried it out.


Hi @dfrey,

Unfortunately it is a bit difficult for me to run the loopback test, but I have been testing the weight sensor again with WP77. For some reason I cannot get it reading properly. Have you, or someone else, tried with a WP77?

This is the function I am running (if you want I can give the whole code):

int32_t readWeightSensor(){
size_t readBufferSize = NUM_ARRAY_MEMBERS(rxData);
res = le_spi_WriteReadFD(spiHandle, txData, NUM_ARRAY_MEMBERS(txData), rxData, &readBufferSize);
LE_FATAL_IF(res != LE_OK, “le_spi_WriteReadFD failed with result=%s”, LE_RESULT_TXT(res));
int32_t weight = transform_to_weight_bits(rxData);
return (weight-683500)/2180; // Calibration

And the init:

LE_INFO(“Opening SPI file handle”);
res = le_spi_Open(“spidev1.0”, &spiHandle);
LE_FATAL_IF(res != LE_OK, “le_spi_Open failed with result=%s”, LE_RESULT_TXT(res));
LE_INFO(“Configuring SPI”);
le_spi_Configure(spiHandle, 3, 8, 960000, 0);

This same code is working on a WP8548 (except for the change to spidev 0.0). Any help here would be appreciated! Thanks.