User Tools

Site Tools


projects:crazyflie2:expansionboards:microsd

This is an old revision of the document!


micro-SD expansion deck

Adds the possibility to read and write files to a micro SD card.

Specification

  • micro-SD card socket connected in SPI mode.
  • 1-wire memory for automatic expansion deck detection
  • Designed for mounting above or under the Crazyflie 2.0
  • Mechanical specification:
    • Weight: 1.7g
    • Size (WxHxD): 21x28x4mm

Schematic

micro-SD expansion deck schematic

Filesystem

We use FatFS as the file system handler. Have a look at the API and examples on the FatFS site fore usage information.

The FatFS module will be initialized by the micro-SD deck driver when the deck is detected. After that the API calls can be used such as f_mount, f_open, f_read, f_close etc.

Data Logging

Without any changes to usddeck.c there's a data logging functionality implemented. It can be enabled and configured by placing a config file on the µSD-Card. The File is being created by using the related python module which can be found in tools/usdlog. Just start the module as main. Logging 10dof data with 1kHz works quite good with a buffer of 120 elements. But you may have to try around a bit to get feeling on what is possible. If the buffer was too small or the frequency was too high there will be gaps in the log as you can see in the following picture:

µSD-Log-Gap

Config will be read only once on startup, therefore make sure that the µSD-Card is inserted before power up. If everything seems to be fine a µSD-task will be created and buffer space will be allocated. If malloc fails crazyflie will stuck with LED M1 and M4 glowing, otherwise data logging starts automatically after sensor calbriation. The logfiles will be enumerated in ascending order from 00-99 to allow multiple logs without the need of creating new config files. Just reset the crazyflie to start a new file. For performance reasons the logfile is a binary file, but the python module also contains a function which will return the data as dictionary. For decoding just call

import CF_functions as cff
logData = cff.decode(fileName)

where fileName is a file from the µSD-Card. For convenience there is also an example.py which shows how to access and plot the data.

projects/crazyflie2/expansionboards/microsd.1495462573.txt.gz · Last modified: 2017-05-22 16:16 by jan