ArduPilot Mega sensor shield testing report II


Hi all,
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:
Main test code: APM_Core_Test2.zip

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...

Jose.

Views: 3281

Comment by passunca on March 24, 2010 at 12:25pm
Very cool.
just a side note... DataFlash log functions on military aircrafts like the the AW101 Merlin from my avatar are called HUMS (Health Usage Monitoring System), the difference is that these type of aircrafts monitor 1000s of parameters. But I am not suggesting that name for this feature or something.

3D Robotics
Comment by Chris Anderson on March 24, 2010 at 1:27pm
Nice work, Jose! How exactly do you retrieve the data? Do you need a desktop app to get it via serial, or can you mount the flash memory via USB like a drive in Windows?
Comment by passunca on March 24, 2010 at 1:28pm
what is the size of the flash?

Developer
Comment by Jose Julio on March 24, 2010 at 2:46pm
Thanks,
This is how I implemented this on this test code. We have a switch on the board, one position is record mode, so all the information from IMU and GPS is recorded on the DataFlash memory. The other position of the switch is for download the information. We need to connect the board to the PC (via USB), open a serial terminal, and all the information is downloaded (you can save to a file to analize...).
The second option (mount the flash memory like a drive) is not posible because we are using an FTDI chip that is a serial to USB converter, so the PC detect it as a COM port.

Pedro, the size of the flash memory is 16Mbits, that is, 2Mbytes. This is more than enough to save a lot of info of the autopilot...
Comment by Rana on March 24, 2010 at 2:59pm
Nice work Jose !

Developer
Comment by Doug Weibel on March 24, 2010 at 3:23pm
Hi Jose,

Can you clarify on downloading info from the DataFlash. Does the PC via USB have direct access through hardware to the DataFlash?? Or do we have some portion of the firmware on the 1280 handle this function?

Developer
Comment by Jose Julio on March 24, 2010 at 3:39pm
Doug, the Atmega1280 handle this function, the DataFlash is connected only to Atmega1280 via the SPI port...
This code is on the setup() function. If we start the Ardupilot and the switch is on download position, the code starts to read the DataFlash memory and send the info via standard serial port...
But this is only a test code, the final solution could be different...
Comment by Morli_ on March 24, 2010 at 3:45pm
Jose , good work, finally the mega picture is getting complete for those who want to imagine the complete setup. thanks for the picture.

Developer
Comment by John Arne Birkeland on March 24, 2010 at 6:21pm
Again, nice and crisp code. Well commented. Good work!
You mentioned the UBLOX library is hard coded to serial/serial1. What if you did something like,

#if defined(__AVR_ATmega1280__)
#define GPS_Serial Serial1
#else
#define GPS_Serial Serial
#endif

...
GPS_Serial.Begin(38400);


This way you only need to use GPS_Serial for the rest of the code without all the #ifdefs. Also makes it easier for someone to use a different serial port.
Comment by Kim Skatun on March 25, 2010 at 2:08am
What about adding sdcard? Small heaps of atorage space and can easily be used to store differnet setup, log files etc..

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

Groups

Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service