Micro logger

From PaparazziUAV
Jump to navigation Jump to search

Introduction

The micro logger is simply a memory chip (S25FL128S or S25FL256S) connected to one SPI port of your autopilot.

Advantages

  • very light (hard to do lighter)
  • no bad connexions (the memory needs to be soldered)

Disadvantages

  • hard to remove
  • slower than other loggers


Capability

This logger is capable of logging the entire IMU (9 axis) on 32 bits values at 512Hz. This is possible when you erase completely the memory at the beginning of the log (ERASE_MEMORY_AT_START set to 1).

In case of buffer overflow, the reading tool is capable of "rebuilding" the missed values. It is going to put zeros where we missed values.

How to use it

Configuration of the module

To configure the messages you want to log, you will need to edit the module c file in : sw/airborne/modules/loggers/high_speed_logger_direct_memory.c. At the top of the file you will have a section containing all the parameters that you can change. Among those you got :

  • ERASE_MEMORY_AT_START : if set to 1 the memory will be erased completly when starting a new log. This will take a little bit less than a minute, but afterwards you will be able to log values at a higher rate than if you didn't do it. If you let it to 0, the module is going to erase the memory block by block of 4K when needed.
  • SIZE_OF_LOGGED_VALUES : the number of Bytes that each value logged must be (in memory). You can write a 4 Bytes values in a 2 Bytes slots, you just need to be certain that you don't have any overflows.
  • NBR_VALUES_TO_LOG : the number of messages you want to log. This value is equivalent to the size of the values_to_log array.
  • SKIP_X_CALLS_BETWEEN_VALUES : you might want to slow down the logger instead of losing values (because of buffer overflows). if that value is set to 0, a new value of every logged messages will be added to the buffer. If set to 2, we will wait two calls to the module, then during the third one we will write the values to the buffer. By default this modules is called at 512Hz.

Then you have two arrays :

  • values_to_log : containing the pointer to the values to log.
  • name_of_the_values : the name of the messages logged. This is simply an aesthetic configuration, for you to know which message were logged.

Logging values

To use the micro logger you simply need to load the module "high_speed_logger_direct_memory" in your airframe file. You might want to be certain of the frequency at which the module is called by loading it like that :

 <modules main_freq="512">
   <load name="high_speed_logger_direct_memory.xml"/>
 </modules>


Then you are going to have to add the GUI to your GCS by adding to your settings the file : "settings/modules/high_speed_logger_direct_memory.xml".

GCS mem.png

Then in the GCS you can go in the tab settings, then logger. In this tab you will have only one command to change the status of the module.

At the start the module is in idle mode. To start logging you will need to prepare the memory first. To do that simply select the initialize mode and validate. The module will work. To test if the module have completed it's work you can click on the value to the left of the drop down menu. Once completed the status will be back to idle.

Then you can start actually logging values by selecting the "start log" mode and validating.

Once you are done with your log you need to select the "stop log" mode and validate.

Reading the values back

Micro logger.png

WARNING !!! : On some boards the UART port is used also by the GPS. The soft behind the GPS might read all the values on the port instead of the logger module. To solve that issue you simply need to use an other UART port for the logger module (configured in : conf/modules/high_speed_logger_direct_memory.xml). The other solution is to move the GPS in you board makefile.

For this operation you will need to get the reader application available here. The source code is available here.

To read the values back you simply need to connect to your autopilot using a serial connexion. Then start the micro logger application, at the top right of the interface you get a drop down menu containing all the serial ports available on your computer, select the one corresponding to your autopilot. Then simply click on the "Dump memory" button. The application is going to fetch all the values stored in the memory (warning this operation might be slow, up to 40 minutes if you used the entire memory).

Finally you can click on the export button at the bottom of the window to save the values in a csv file.