Openlog

From PaparazziUAV
Revision as of 13:05, 19 May 2015 by NeoFromMatrix (talk | contribs) (typo)

Jump to: navigation, search


In general OpenLog is a Module from Sparkfun that contains an Atmega328P and a Micro-SD-Slot. It can handle FAT16 and FAT32 microSD cards up to 16GB. Once installed into the wiring (parallel to the dataradio) it records every message the UAS sends. That is very handy for using it as some kind of blackbox or for data-logging purposes if no Modem was involved. It is also nice for reconstructing what happened after a crash, since the radio-communication is gone, once the plane is near the ground. 2GB is enough to log a comlete season (several hundred flights). The general logging is done in two steps: First you record your log using the telemtry in transparent mode, with the openlog-module loaded. the normal paparazzi-protocal does not contain timestamps and the openlog-module adds timestamps to the datastream to have a reference for the time. Second the recorded logs are extracted from the SD-Card to the normal logfiles. For doing so, there is a tool calles openlog2tlm to convert the recorded files to the TLM-format of the SD-logger. Next the created TLM-file is added to the logs by sd2log. There is a helper-script that does this job.

Hardware

Openlog.jpg

The OpenLog is simply connected to the TX-Line of the AP. Once the AP is powered, it starts to record. In general there is one Problem with the stock-firmware of the OpenLog. If it gets an escape-character (CTRL+Z) it switches into command-mode and stops logging. But the telemetry stream is nearly arbitrary. So we have to deactivate this feature, it isn't needed for our application at all. Therefore we have to reprogram the OpenLog. You need an AVR-programmer like the i.e. usbasp. You have to wire the ISP to the accoring pins of the OpenLog. You need the avrdude package installed.

First you need to checkout the modified OpenLog firmware on github:

git clone https://github.com/chni/OpenLog.git -b OpenLog_V1_noescape

then change to the directory where the hexfile is:

cd OpenLog/Code

The hexfile is contained by the directory, so you can flash it.

You should power the OpenLog with the Programmer, not by the LPC in the same time. The programming is done by running

avrdude -c usbasp -pm328p -U flash:w:openlog_noescape.hex -Ulfuse:w:0xff:m -Uhfuse:w:0xda:m -Uefuse:w:0x0:m

After running this, the OpenLog has a custom firmware making it ignore the escape-characters.

Software

First of all the OpenLog needs to be configured. If it was powered one time without being configured, but with SD-Card plugged, it creates a file named CONFIG.txt or CONFIG.TXT (depends on the version of the firmware). You need to configure the Baudrate, it defaults to 9600-8-N1. In case you use 57600 Baud it should look like:

File: CONFIG.TXT
57600,26,3,0

Furthermore you need to add the OpenLog-module to your airframe.

File: conf/airframes/yourairframe.xml
[...]
  <modules>
    <load name="openlog.xml"/>
     [...]
  </modules>
[...]

Then compile, flash your AP and do your flight. Afterwards take the SD-Card from the logger and import the logs:

christoph@christoph:~/paparazzi/aktueller$ sw/logalizer/getopenlog LOG00003.TXT 
now converting LOG00003.TXT to LOG00003.TXT.tlm
The conversion from the logfile from the SD to TLM seems to be successful, 567 have been converted, 2 packages have been broken
Renaming produced file ...
12_06_17__01_59_45_SD.data file produced
Looking for 4ae62580cb19d37d2b30aa8d31cc20dc conf...
12_06_17__01_59_45_SD.log file produced
12_06_17__01_59_45_SD.tlm file saved

You can also do batch processing like:

christoph@christoph:~/paparazzi/aktueller$ sw/logalizer/getopenlog /media/disk-1/LOG*

In this case all logs will be imported. Afterwards you can find the logs as usual in var/logs/*_SD.log

If someting goes wrong during the import have a close look to the error messages, since openlog2tlm tries to identify the most common problems.