Caution: Removing the recording device while logging is enabled can result in corrupted data. The logger should be disabled before the media is removed.
Piksi® Multi is able to autonomously log data to a USB flash drive or SD card. This allows a minimal deployment of Piksi Multi without a connected PC. This feature can be used for logging during system integration and testing or for production use cases that require post-processing of Piksi Multi data.
Prerequisites
Connecting a USB drive to Piksi Multi
USB Host Connectivity
Piksi Multi provides USB host connectivity via the 60 pin high density connectors. Pinout information for this connection (USB1) can be found in the Piksi Multi Hardware Specification.
When using the Evaluation Board in conjunction with standalone logging, the USB drive may be simply connected to the USB Host port.
USB Drive Preparation
The standalone logging functionality of Piksi Multi requires the USB drive to be formatted as FAT (FAT16 / FAT32 / exFAT). Instructions for creating a FAT formatted drive can be found here:
Windows and Mac - http://www.alphr.com/features/390385/how-to-format-a-usb-drive-on-a-mac-or-windows
Linux - http://www.lostsaloon.com/technology/how-to-format-usb-drives-flash-drive-from-linux-command-line/
USB Logging Behavior
When enabled the USB logger exhibits the following behavior:
1 - Every 30 seconds, Piksi Multi checks the location specified by the output_directory setting to determine if it is available for writing. If it is unavailable, a warning (“Target dir unavailable”) is issued via SBP.
2 - If the output_directory is available for writing, check the free space remaining on the device. If the free space is less than the value specified by the max_fill setting, a warning (“Target dir full”) is issued via SBP.
3 - If there is space available on the device, the output_directory is searched for existing log files in order to determine the session number. If log files are found, the current session number will be set to the largest present session number +1. If no log files exist the session number is 1.
4 - Once the current session number is determined, a new log file will be created. This file will be named xxxx-yyyyy.sbp where xxxx is the current session number and yyyyy is the number of minutes this logging session has been running. The first log of a session will have yyyyy be 00000. An info log message with the filename will be issued via SBP. If log file creation fails, a warning with the error message will be issued via SBP.
5 - If the log file has been created successfully, SBP messages are written to this file as they are generated by Piksi Multi. When the number of minutes specified by the file_duration setting have past, the log will be closed and a “Rolling over log” message will be issued via SBP. Piksi Multi will then attempt to create the next log file using the steps outlined above.
Log File Contents
Data logged to the USB drive will be formatted as Binary SBP (Swift Binary Protocol). More information on SBP can be found SBP Protocol Specification.
By default all SBP messages generated by Piksi Multi for external consumption will be written to the log. The logging does not include additional timestamps or headers, and will appear equivalent to binary SBP data received from Piksi Multi over a serial port. Additionally, these messages will be logged at the same rate as the soln_freq setting.
Log File Naming Convention
Log files will be named according to the following convention:
xxxx-yyyyy.sbp
The first four digit number (xxxx) is the session counter that increments each time the process doing the logging is restarted or Piksi is power cycled. The starting session number is derived from parsing the files that exist already in the output_directory. If no files are present, the session number starts at 1 rather than 0.
The second 5 digit number (yyyyy) is the sequence label that reports the number of minutes since the current logging session began. The sequence label refers to the minutes elapsed at the beginning of the log file.
The files are timestamped on the file system according to the current time on Piksi Multi’s Linux core. Before a GPS fix is obtained, this time may begin at the start of Unix Epoch time.
Standalone Logging Settings
Settings available through the Swift Console are used to configure the logger and enable logging. These can be saved to flash to set the startup behavior. The following settings appear in the standalone_logging section:
Setting Name | Type | Description |
enable | BOOL | True triggers the logger to start trying to write logs to the output_directory. False will immediately close the current file and stop logging. Re-enabling logging will increment the session counter which is reflected in the log file names (see Log File Naming Convention section). |
output_directory | STRING | Sets the path to the directory to write the log files. By default this points to the first USB drive connected to the system “/media/sda1/”. To record data on SD card enter: /media/mmcblk0p1/ A warning message will be issued every 30 seconds if this path is invalid or unavailable. If this setting is changed while logging is enabled, it will go into effect on the next file created. The system will not create a folder that does not exist. |
max_fill | INT | Logging will be stopped when the drive in use reaches this percentage of utilization. Sets a limit (in percent) on how full the storage device can be before logging is stopped. If the drive is more than this percent full, no new log files will be created and a warning will be logged every 30 seconds. If this setting is changed while logging is enabled, it will go into effect on the next file that’s created. |
file_duration | INT | The number of minutes to output to each file before opening the next one. If this setting is changed while logging is enabled, it will go into effect immediately which will close the current file if its length exceeds the new duration. |
logging_file_system | STRING | Option is visible when Show Advanced Settings is enabled. Applicable to SD card only. Option configures the file-system used for standalone logging. Changing this settings will repartition and reformat the card upon next system re-boot. |
copy_system_logs | BOOL | Option is visible when Show Advanced Settings is enabled. Applicable to SD card only. When enabled the logger will copy the system logs to the SD card at regular intervals. |