This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
projects:crazyflie2:expansionboards:microsd [2017-01-25 12:46] tobias [micro-SD expansion deck] |
projects:crazyflie2:expansionboards:microsd [2021-06-24 16:13] (current) kimberly |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | This page has deprecated and moved to the new documentation framework of the main Bitcraze website. Please go to [[https:// | ||
+ | [[https:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
====== micro-SD expansion deck ====== | ====== micro-SD expansion deck ====== | ||
Adds the possibility to read and write files to a micro SD card. | Adds the possibility to read and write files to a micro SD card. | ||
- | {{: | + | {{: |
===== Specification ===== | ===== Specification ===== | ||
Line 21: | Line 29: | ||
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. | 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 // | ||
+ | < | ||
+ | Frequency | ||
+ | Number of buffers | ||
+ | File name | ||
+ | log entry 1 | ||
+ | log entry 2 | ||
+ | log entry 3 | ||
+ | ... | ||
+ | </ | ||
+ | Frequency is an integer value in Hertz, for example 250 means that a data block is written every 4ms. The number of buffers is used to decouple the writing to the card and the data logging. Higher frequencies require more buffers, otherwise some data might be lost. Logging 10dof data with 1kHz works well 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: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | The file name should be 10 characters or less and a running number is appended automatically (e.g., if the file name is log, there will be files log00, log01, log02 etc.). The log entries are the names of logging variables in the firmware. | ||
+ | |||
+ | The config.txt file 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 calibration. The logfiles will be enumerated in ascending | ||
+ | <code python> | ||
+ | import CF_functions as cff | ||
+ | logData = cff.decode(fileName) | ||
+ | </ | ||
+ | where fileName is a file from the µSD-Card. For convenience there is also an [[https:// | ||
+ | |||
+ | ===== Current limitations [SOLVED] ====== | ||
+ | The SD-Card is using the SPI bus on the deck port to communicate. This has turned out to have some implications for the other decks that use the SPI bus. The effected decks are the Loco-deck and the Flow v1,v2 deck. An [[https:// | ||
+ | |||
+ | - First thing the SD-card deck needs to be patched, CS-> | ||
+ | - Compile the firmware with " | ||
+ | - If you want to use the Loco-deck at the same time, the alternative pins for this must be used. This means cutting GS1 and GS2 underneeth the loco-deck and soldering the bridged GS3 and GS4. Then add " | ||
+ | |||
+ | |||
+ |