SPI on RTEMS RPi BSP (4.12)

William Busacker wbusacker at outlook.com
Mon Nov 20 06:12:47 UTC 2017

No longer an issue, but replying for future reference if anyone else has 
the same problem.

As noted in the GSoC project intro 
https://asuolgsoc2014.wordpress.com/2015/05/03/project-intro/ the SPI 
bus for the RPi still uses the libi2c api. As far as I can tell, that 
means the standard Linux Spidev interface still doesn't work, nor does 
the spi01 test originally mentioned work. However, the test cases 
referenced https://github.com/asuol/RTEMS_rpi_testing do work. The 
instructions saying that the device driver must be placed in libchip/i2c 
can be ignored, just copy the files local to init.c and change the 
include reference to a local instead of compiler directory. Also, his 
blogpost says that the configure.ac script must have BSP_ENABLE_SPI in 
it to work, but doesn't say how to do so. In the file 
rtems-git/c/src/lib/libbsp/arm/raspberrypi/configure.ac include the line 
RTEMS_BSPOPTS_SET([BSP_ENABLE_SPI],[*],[1]) anywhere then re-run the 
makefile in the build directory for raspberry pi. Assuming you followed 
Alan Cudmore's instructions this should be build-rtems-rpi.

To some this solution may seem obvious, but for those who are just 
starting out with rtems (like I am right now) hopefully this sheds some 
light on the subject.

On 11/14/2017 07:21, William wrote:
> Hello All,
> I am trying to get a minimum working example for using SPI on the 
> raspberry pi, however I have been unable to get anything on the SPI 
> ports for several weeks now.
> I have tried using the Linux spidev library as recommended by the user 
> guide, however that fails to work. The function calls don't send any 
> errors out, however nothing happens (I've been checking both SPI port 
> pins for activity). A similar thing happens when I run the spi test 
> program located at rtems-git/testsuites/libtests/spi01 in the RTEMS 
> source distribution. None of the assertions fail, but again, nothing 
> happens on either SPI Bus.
> Following the GSoC submission for SPI on the RPi 
> (https://devel.rtems.org/wiki/GSoC/2013/Raspberry_Pi_BSP_Peripherals) 
> it says that those steps should enable the board to run SPI, however I 
> am unable to replicate his results of proof that SPI works. The 
> autotools parts in the git repo linked on that page won't run as 
> configure.ac is missing. Admittedly my knowledge of autotools is 
> rather limited so that may simply be operator error, but the effort 
> that I've put into getting this working is telling me there has got to 
> be a better way.
> All I really want is a short list of functions to call and parameters 
> to pass in for spi control and then a simple rx and tx subroutine 
> (hence my first attempt at using spidev).
> Any advice or help would be much appreciated,
> Will Busacker

More information about the users mailing list