martinayotteSeptember 15, 2015 at 10:44 am #4251
How to attached external SPI peripherals ?
Is it simply by hooking MOSI/MISO/SCLK to peripherals ? what about specific SPI_CS ? should it be driven by LEDs GPIOs ?jlsiliconOctober 11, 2015 at 6:16 am #4847
I have the same question…
How do we hookup and drive a SD Flash Card on the SPI ?alzhaoOctober 17, 2015 at 9:45 pm #5028
As the SPI is connected to the internal flash now, it is difficult to connect other devices at the same time. We provide a SPI/JTAG tile board which can be used to debrick your devices.lbattrawNovember 8, 2015 at 8:32 pm #6212
I’ve done quite a bit more research on this and it’s very straightforward to use other GPIO pins as SPI. You use the /sys FS interface to choose with pins are used for each function with a minimum of SCK, with optional MISO, MOSI, SS* lines, SPI mode, and clock speed. You echo a string to the SPI sysfs node with the numbers for each GPIO in order of function, use sysctl to pass the same arguments, pass the same arguments when insmod’ing the SPI-GPIO module, or via the kernel boot parameters if the code is compiled into the kernel. The module is called kmod-spi-gpio-custom, and is available in the package repos for OpenWRT CC. Check this page for complete info on loading the modules and passing the right arguments: https://randomcoderdude.wordpress.com/2013/08/15/spi-over-gpio-in-openwrt/
There’s also wide variety of info on configuring GPIO pins here: http://wiki.openwrt.org/doc/hardware/port.gpio and info on using MMC/SD cards on GPIOs: http://wiki.openwrt.org/doc/howto/mmc_over_gpio
You can always get a list of all GPIO lines and their current value and function by running this:
(Here’s an example of the output)
GPIOs 0-29, ath79:
gpio-0 (domino:blue:wlan ) out hi
gpio-1 (domino:white:usb ) out hi
gpio-6 (USB power ) out hi
gpio-11 (reset ) in lo
gpio-13 (domino:green:lan1 ) out lo
gpio-17 (domino:red:wan ) out lo
gpio-20 (wps ) in lo
gpio-26 (domino:yellow:wps ) out hi
gpio-27 (domino:orange:sys ) out hi
-LarryxxcnJanuary 13, 2016 at 4:57 am #10056
One way to do it is to follow lbattraw’s suggestion and use a bitbanged spi bus. There is an easy and hassle-free way provided by
Quick and easy.
You could also multiplex other devices on the hardware SPI bus, but that requires a kernel driver and custom machine setup code so that the SPI bus is shared properly.
- This reply was modified 2 years by xxcn.
You must be logged in to create new replies.