SPI bus working on the RoboRIO!

Greetings Everyone!

We can now say that we have the SPI interface working on the RoboRIO. We used the Sparkfun ADXL345 board as our test subject so folks could compare the I2C code for this part against the SPI code. There are definitely some weirdnesses over what you would see with an Arduino. The unit we have working is the Sparkfun ADXL345 module that we previously had working in I2C.

Additionally, the Sparkfun part is different from the one in the KOP in a couple of substantial ways. First, the Sparkfun unit is active low instead of active high. This alone will keep you from using the Sparkfun unit with the class that’s supplied in WPILib.

Also, I’m not entirely convinced that the SPI interface code in WPILib is doing everything that it should. I’ll reserve judgement until the WPILib is made publically available after kickoff and I can get a SPI bus analyzer on the lines. But, at a minimum, the return data has an extra byte artifact in the multi-byte return.

So, if you want to use the ADXL345_SPI class in the new WPILib, just be aware that this code will only work with the KOP ADXL345 sensor and likely not with any other unit that’s available from suppliers like Sparkfun or Adafruit.

As always, we’ll made our SPI bus code available to anyone who wants it. Cruse by https://www.facebook.com/FRC2015ControlsBeta for more info.


FRC #116