Raspberry SPI

XCore Project reviews, ideas, videos and proposals.
User avatar
XCore Legend
Posts: 1118
Joined: Thu May 27, 2010 10:08 am

Raspberry SPI

Postby infiniteimprobability » Fri Dec 20, 2013 4:19 pm

Version: 0.1
Status: Alpha
License: BSD
Download: /files/project_builds/raspberry-spi.zip

This is a project to provide a module for communications between the RPI and the startKIT.

There are many ways to make the two talk, but a 26pin header is included on the startKIT which gives a 1:1 connection for SPI.

With this component (and enabling SPI on RPI), you can use XMOS as a real time I/O coprocessor, which it excels at.

This project implements a SPI slave, allowing the RPI to do the easy bit (SPI master). Becasue the slave always needs to be responsive, it runs in it's own core and acts a comms server to the application. The code uses new XC features (interfaces and movable pointers introduced in tools v13).

It currently supports a bi-directional exchange of a buffer of size n bytes (2B, 8B, 32B tested) and is running reliably at 3.9Mbps so far. I know with tweaking it will reach 7.8Mbps..

I've had C programs and Python programs on the RPI talking nicely with the xCORE using this interface. A sample python program is provided..

Being a SPI slave, transfers are initiated by the host, so the tx buffer has to be filled before the first rx. That's just SPI, and you already know that.

Final point - you may want to flash an empty app (which will leave all ports high Z) to avoid the pulsating LEDs demo. RPI doesn't like to be on the receiving end of that on it's I/O pins and sometimes hangs.

Enjoy, use at will, and happy to hear comments/feedback.


Who is online

Users browsing this forum: No registered users and 46 guests