Inertial Sensor and Logger Board

From ConceptCar
Jump to: navigation, search

Functionality Overview

This board has a widespread set of functionality:

  1. Measure acceleration, both longitudinal and lateral
  2. Measure yaw rate
  3. Measure voltage of the electrical system supply battery
  4. Log data to a SD-Card

Data Logging

This board can write data to a FAT16-formatted SD or MMC card that is inserted into the card reader slot. When the board is booted and a valid card is detected, a new file is created and data from all messages on the can bus is written into this file. There is no mechanism to specifically close the log file. Just remove the card or power down the board.

Log indicators

If logging is working and dumping precious driving data to the card, the red LED adjacent to the green power LED glows.

File naming scheme

The data is stored to a newly created file with the naming scheme LOG<nr>.CAN. The <nr> part is a consecutive number to name all files differently and not to overwrite an older log. An internal counter increments each time a new log file is written, and the counter state is conserved in EEPROM over reboots. Reflashing the board resets the counter to 0.

Requirements for the card

The SD or MMC card must meet the following conditions:

  • A partition table exists.
  • The "DOS compatibility flag" must be set.
  • There is exactly one primary partition.
  • The partition's type is "FAT16" (set partition code to 0x06 with fdisk).
  • The partition is formatted with FAT16, two fats.

Using a Unix/Linux system, if /dev/mmcblk0 is your MMC/SD card device,

> mkfs.vfat -F 16 /dev/mmcblk0p1

would create a valid FAT 16 partition.

Despite having the correct partition scheme and formatting, some cards just did not work. We can not tell you why and how, just check if the red LED indicates that the logger works. Cards with 2GB or more tend to be problematic, try using a 1GB card.

Log file format

The log file has a binary format, containing a dump of all CAN messages including a timestamp for each. For each CAN message, the following data fragment is written:

| Header | Timestamp | CAN ID  | Data Length |     Data    |
|  0xca  |  4 Bytes  | 2 Bytes |    1 Byte   | 0 - 8 Bytes |

The Header field is always one Byte with hex value 0xca. The Timestamp field holds the time in ms since the board was booted up. The remainder of the data fragment is the CAN message's id and content. For each received CAN message, a new fragment of this sort is appended to the log file. The writing format is set in [1]. Since there is no mechanism for explicitly closing the log file, the last message fragment in the log file is usually cut off.

Log file decryption