Raspberry Pi BSP SPI bus

Andre Marques andre.lousa.marques at gmail.com
Tue Jul 29 09:06:01 UTC 2014


Hello,

The Raspberry Pi SPI bus on the P1 GPIO header is already working, both 
through polling and interrupts on the bus FIFOS, and has been tested 
with a microchip 23k256 SRAM device.

The bus code can be found in:

https://github.com/asuol/rtems/blob/GPIO_API/c/src/lib/libbsp/arm/raspberrypi/i2c/spi.c

The 23k256 SRAM minimal device driver (based in the 
libchip/i2c/spi-memdrv driver) used to test the bus can be found in:

https://github.com/asuol/rtems/blob/GPIO_API/c/src/libchip/i2c/23k256.c

The application that tests the device can be found in:

https://github.com/asuol/rtems/blob/GPIO_API/testsuites/samples/SPI_23k256_TEST/init.c

Alan, from what I have seen of your adafruit FRAM device datasheet I 
recon that it should also work with my 23k256 driver if you comment out 
lines 65 through 106, as it just sets the device in sequential mode 
which your device already uses.

The current pending issues with the SPI implementation are:

- Currently the bus is registered in the system through a function 
called on an application. Should it stay this way or should the bus be 
registered in the system in the predriver-hook during the BSP startup?

- It can currently work either in polling or interrupt mode, as well as 
in either 3-wire mode (miso, mosi, and sclk) or in 2-wire mode 
(bi-directional mode by turning the bus around in the mosi data line, 
although this stills needs to be tested with another device). These 
configuration options are currently made staticaly during the SPI bus 
initialization, but they should be made elsewhere by the user. Should 
these options be passed to the bus register function or through define 
constants?

Thanks,
André Marques.


More information about the devel mailing list