Log in

View Full Version : Bit Banging SPI Slave on CRIO


Joohoo
07-02-2013, 23:14
Our team is currently in the process of trying to bit bang out a SPI slave client so we can talk to our co-processor (raspberry pi)that we want to have running our image processing. Since the co-processor does not have a SPI slave client built in I have decided to explore writing our own software based(Bit Banged) SPI slave client to accomplish this.

We are currently working with Java and Command Based robot

My initial idea going forward is to have an interrupt 'listening' for both rising and falling edged of the master's clock signal, then based on the edge, write out or read in off of the MISO/MOSI pins.

Now back in Pre Crio days we were working directly with the micro-controller to do something like this. However with command based robot, the FPGA, Squawk, etc etc are all in the way of real time responses, there have to be some caveats I don't know about.

My question is has any one gone and created a synchronous interrupt inside of command based robot? What did you learn? Can you even get to that level to be able to do this at all in Java?

In the spirit of sharing we will start posting our findings here and our code, when we have something meaningful finished.

Joe Ross
08-02-2013, 21:09
I haven't tried to bit bang SPI on the cRIO, but it does seem like it would difficult in Java. In college I did it on a microcontroller, and it wasn't too bad with easy access to interrupts.

I've been playing with the SPI library posted here: http://www.chiefdelphi.com/forums/showthread.php?t=99803 It might be easier to use that, and bit bang an SPI slave on the Raspberry Pi.