This is the weekly report of ardupilot mega development :-)
We have developed the library for the DataFlash log memory. This function is really interesting, because we
would record the flights without the need to carry the laptop and telemetry all times... For example, for
testing the code I simply connected an small battery to the ArduPilot Mega, go outside to make the tests
without need of laptop, cables,... and then I download the results on laptop to analyze it. I´d like it.
Finally we use the standard SPI for the DataFlash chip and we change the AP_ADC library to use the serial port 2 in SPI mode. This way we sepparate the ADC (that is running inside an interrupt) from the standard SPI, and users can use also the SPI for other external devices. Also the ADC code can run a bit more efficient (now all ADC stuff at 400Hz use 3.7% CPU).
The DataFlash library isolate the user of the complexities of the internal registers, double buffer and page
distribution of the AT45DB161D flash memory. The library provides the functions to make sequential write and
read sessions and it´s written to be very efficient in the write sessions (it takes about 28us to write a byte,
this is near ten times better than a stardard serial port at 38400).
We have also converted the GPS code (Ublox) to a standard library. We will implement in the future libraries for other GPS (NMEA, EM406, ...). If all the libraries share the same interface, to change the GPS you only need to include your GPS library. Also this libraries are usefull for other DIY projects and Arduino users... (We made the library compatible with Atmega1280 (on serial port1) and also Atmega168/328). I could work on the library for NMEA GPS´s (I already have an Locosys) but I don´t have EM406, so somebody could work on this...
Now we have all the core parts of the future Ardupilot Mega running succesfully.
I´d really like the aspect of the code with the new libraries... It seems more easy, and an easy code is easy to maintain and modify by users...
The test code uses this:
- APM_RC : library to read the radio and output to servos
- APM_ADC : library to read data from the analog sensors (accels, gyros, ...)
- DataFlash : library to write/read to the flash memory to record flight parameters (log)
- GPS_UBLOX : library to access to the Ublox GPS
- IMU DCM code
Here are the codes:
Note that this codes are betas and will change when Jordi release the final version of the sensor shield because there will be different pin assignments.
One more thing I´d like to comment is that the new Ardupilot Mega main boards comes with a 16Mhz crystal for
the PPM encoder and works very great!! Now, the noise on the radio input is below 1us, this is nearly perfect Jordi...