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)
Modprobe:
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:
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.
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
/dev/spidev1.0
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)?
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.
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.
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 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):
you need to change your spiService.adef in legato AF to adapt it to your module. I’ll explain :
As it is described in legato.io, Services APIs allows to access the APIs the associated services must be running on the Legato System before you can use the API.
In your case SpiService App allows to :
using LEGATO SPI API.
using /dev/spidev (bus. device)
by default, it uses /dev/spidev0.0 bus, but for wp77xx is different, because this module uses the /dev/spidev1.0 bus
TO CHANGE THE SPISERVICE :
Do: vi ~/legato_framework/legato-18.01.0/apps/platformServices/spiService.adef
and change the spidev.
The Legato 18.07.0 release was a bit screwed up. A commit snuck in which broke SPI. I have updated the Legato_patches repository for 18.07.0 to include a patch which corrects the SPI issue.
I tried to ensure that the TC module functionality with Arduino and RPi. It is working on both setups using SPI.
Please advise if I am missing something here on mangOH.
A quick update on the SPI on mangOH Red 18.07.0…
I tried to capture the CLK and CS0 on an oscilloscope. Unfortunately, CS0 is stuck at HIGH and CLK at LOW. No change in them, even at different frequencies (modified through spi_config).
Looks like something broken with SPI on RPI connector. Or Something not configured properly. @dfrey, @asyal need some help here to get SPI working on RPI connector.