Porting RF24 library to Chibios (and MRAA as a standard IO library for Linux)

I guess the cross platform part of this library is in it's infancy: Even though most of the ports have a class representing the SPI interface, they are all different classes, with different sets of methods. The interface should be a contract between the RF24 code and the hardware.

I've forked the original and got a Chibios port working using this approach.

I've also added something that implements a Chibios API - abstract sequential streams, which is so I can use some other Chibios utilities I use in the balancing robot. This is a little half baked and inefficient: I really need to use the RF24 interrupt signal, but it seems like a good idea to get it to work at all first. I should probably prove I have GPIO interrupts working in Chibios by porting one of the other examples first.

Now I need to figure out how much I want to apply these changes to the other platforms. I'm most interested in the Raspberry Pi, since it's my current bridge hardware, but it's also one of the ugliest ports: A great lump of IO support code is simply copied from somewhere into the distribution, and it's not obvious how SPI is meant to be used.

There's a much more attractive platform - both in terms of existing code in RF24 and in terms of well designed API: MRAA. It supports the Raspberry Pi, but also the UMFT4222EV connected to a USB port which would be very convenient for me. You can pick this up for ~£12 from Farnell.co.uk.

MRAA builds on the Pi as per it's instructions.

It's a little harder on Ubuntu Vivid: it doesn't have a new enough version of Swig. So I build and installed swig 3.0.7 from source. If you had the Ubuntu version of swig and replaced it with one built from source don't forget to delete you build directory and start again.

For FTDI support follow the instructions - install the llibft4222 first and to enable FT4222 support in MRAA add the option '-DFTDI4222=ON' E.g.

cmake -DFTDI4222=ON ..

So now I can get a bunch of platform support via MRAA.

I wonder if I could implement MRAA under Chibios: it doesn't exactly make sense: MRAA apps are Posix apps, but on the other hand, far fewer changes would be needed.



Popular posts from this blog

3D Printer ramblings

Balance Bot V2

Robot arm