-
Notifications
You must be signed in to change notification settings - Fork 0
Firmware
##Development environment
Development utilizes the Arduino programming environment, based on
- the broad user base means there are many libraries already on the internet
- programming the device is easily accessible to anyone, without needing to know how to install a cross-compilation environment.
However, there are some issues with the Arduino environment:
- there is some behind-the-scenes voodoo before compilation, notably the include path is inferred from which files are included in the primary source file (the .ino file)
- many libaries make assumptions, like using the stock Wire library instead of a platform specific version. This means multiple copies of libraries, or lots of #ifdef cruft.
##Event loops, timing A key challenge for the freebird is running the various peripherals at reasonably fast speeds and low latencies. The latency for writing to the SD card is often minimal, but the whole system must be robust against an occasionaly slow write. The solution has been to divide the work load into two categories - synchronous and asynchronous. The synchronous tasks use blocking functions, and include
- Reading commands from the user
- Writing status/info messages back to the user
- Writing data to the SD card
While asynchronous tasks are triggered by [RTC] pulses, and include
- Incrementing the integer clock
- Starting A/D conversions
- Starting IMU conversions
- Reading A/D conversions
- Reading IMU conversions
Simple testing shows that reading the A/D, reading the IMU, reading the magnetometer, and finally triggering new conversions for each of those peripherals, all takes about 1.2ms. There's not a lot of extra time, but so far this has been robust at 512Hz operation, showing no signs of errors over runs of up to 14 hours.