...
FATFS is a file system library that allows for file management on the SD card
It requires a couple of low level functions specific to the hardware platform in order to operate
See
Code Block sd_diskio.h, bsp_driver_sd.h
File names by default are 8.3 format (max 8 character file name, max 3 character file extension)
There are two utility functions written the abstract over the FATFS API, one for reading, one for writing found in
log_util.h
Code Block FRESULT logWrite(char*, void*, UINT, UINT*); FRESULT logRead(char*, void*, UINT, UINT*);
Debugging
Ensure SD cards are formatted using MS-DOS (FAT32) using MBR (Master Boot Record)
Ensure SD card is not over 32GB in capacity
Ensure the clock for SDMMC is set according to your SD card speed, (i.e. if your card is rated for 10MB/s speed, set the SDMMCCLK to just under that, something like 8MB/s with 0 clock divider)
Ensure file names follow 8.3 format
All FATFS function calls return a
FRESULT
error code, printing them out is helpfulFATFS Error Codes: http://elm-chan.org/fsw/ff/doc/rc.html
Links
SD Drivers PR: https://github.com/UWARG/efs-zeropilot-3.5/pull/45
...
HAL Docs for STM32 Nucleo L5: https://www.st.com/resource/en/user_manual/um2659-description-of-stm32l5-hal-and-lowlayer-drivers-stmicroelectronics.pdf
FATFS Docs: http://elm-chan.org/fsw/ff/
FATFS Driver unit tests: http://elm-chan.org/fsw/ff/res/app4.c
View file | ||
---|---|---|
|