Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A13 => Topic started by: BJFreeman on May 01, 2013, 07:57:17 PM

Title: Linux driver for SPI
Post by: BJFreeman on May 01, 2013, 07:57:17 PM
I am working towards using SPI in the linux environment, as NOOB.
there are many examples of I2C and Uart, but did not find any for SPI using SPI2.
in my quest I found this as a starting place.
http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/include/linux/spi/
I am also following the Hardware implementation thread.

Title: Re: Linux driver for SPI
Post by: jeroends on May 02, 2013, 03:45:49 AM
To create a spidev device, the following topic could be usefull: https://www.olimex.com/forum/index.php?topic=835.0 (https://www.olimex.com/forum/index.php?topic=835.0)
The next thing to experiment with could be the spidevtest program: http://armbedded.eu/node/318 (http://armbedded.eu/node/318)
Keep in mind that the spi driver is'nt full duplex, so either you are receiving or you are sending. That's why there's being talked about zeroing out a buffer.
Change for example in the test spi code:


.rx_buf = (unsigned long)rx,to



.rx_buf = 0,

this will give you a working spi output.
Title: Re: Linux driver for SPI
Post by: vinifr on May 02, 2013, 06:14:30 AM
http://www.jumpnowtek.com/?option=com_content&view=article&id=57&Itemid=62 (http://www.jumpnowtek.com/?option=com_content&view=article&id=57&Itemid=62)

https://www.kernel.org/doc/Documentation/spi/spi-summary (https://www.kernel.org/doc/Documentation/spi/spi-summary)