Full Duplex SPI using Software SPI : spi-gpio-custom
-
I have to do a software SPI because the chips I'm using can only communicate full-duplex. For others not so familiar with Linux...LEDE = OpenWRT (https://openwrt.org/packages/start), that caused me some confusion. I used the Onion documentation to point the opkg database to the standard LEDE/OpenWRT database of packages and was able to install kmod-spi-gpio-custom. After a reboot, I am able to insert this module and pass the settings, I found an example in another topic on this forum. I see the device listed in the /dev/ folder, so success!
Now I'm stuck on how to actually access this...anyone have suggestions? I get permission denied if I just try to access the psuedo file structure, which I'm not surprised about. I'm trying to look at the python-spidev project to get some guidance but...yikes, I'm stuck.
Anyone have tips?
The source for the module is here: https://github.com/openwrt/openwrt/blob/master/package/kernel/spi-gpio-custom/src/spi-gpio-custom.c
-
Ok since my device was available in the /dev/ folder as spidev1.0...given I assigned bus0 and deviceid 1 when I ran insmod...I was able to use the standard spidev library in Python to access this newly created spi device. The CS now goes low when I run my python script but I don't see any data or clock signals...I'll check for a conflict with the pins that I assigned to MISO, MOSI and SCK.
Will report back soon, if this works...then it's actually easy to implement software SPI.