cancel
Showing results for 
Search instead for 
Did you mean: 

There is a problem when working with SD cards on STM32L476+ FreeRTOS+FatFS from CubeMX.

AChuk
Associate

Please help me to deal with the problem with sd cards. 

 After several recordings and erasures of files on the sd card dramatically increases the recording time of one block of recorded data. And this is fixed only after full formatting in Windows or checking for errors in the program Check Flash (which is interesting, in this case there is no formatting). In this case, all SD card checks in windows on the pc are successful, there are no errors and testing the card for read and write speed is also normal. I can not understand what is happening with the map and how to get rid of this phenomenon.

The device constantly records data from microphones in the form of WAV files up to 0-50 MB size and periodically transfers the compiled files (approximately 2-3 GB), after the transfer removes them from the SD card and starts recording new files.

Used:

Microcontroller STM32F476 + FreeRtos + FatFS, interface SDIO 4 bit, 9 MHz.

The project is created using Cybex and other libraries only from ST.

SD card is SANDISK 16 GB microsdHC class 10.

FAT32 file system, 32 GB cluster size. The file is written to a pre-opened file in 2048 byte portions (without using f_sync), after 10 minutes of recording the file is closed and a new file is written.

No features work with files, all standard using FatFs driver to operate the SD card from CubeMX: creating, opening, writing, reading, deletion, counting number of files

The increase in recording time is displayed on the waveforms. On oscilogram green: the green line show periods perform the function f_write to write data blocks at 2048 bytes, and the red line shows the periodin perform the function SD_write from file sd_diskio.c. (water that when the data is written to a file by the f_write function, the SD_write function is executed twice.) Attached two images, one displays the processes on the normal SD card, the second displays the processes on the SD card with slow recording.Remind: the cards are the same, only so slowly works has been used for 1 week.

0 REPLIES 0