Hi all,
I am a beginner in RTOS.
I want to write a file on the SD card in ESP32 with FreeRTOS.
One of the tasks is from the serial port to send data to the queue and receive the data from the queue to write the SD Card in another task.
actually, this may be due to a defect SD card. Do yourself a favor and use industry quality SD cards only. My customers have wasted many many hours hunting after inexplicable behavior that at the end of the day could be attributed to poor quality consumer SD cards.
yes, that is a consumer card. Try another one. It MAY save you a lot of time. A “brand name” is no guarantee whatsoever for quality. Query the net a little, you will be surprised how much trash is out there, even with a good name.
So you already verified that the write is done twice using e.g. a simple counter value ? Just to avoid being trapped by your current test code.
If it turns out that the write/flush is broken in your application try to track the write and flush call with a debugger to see where the problem is. And maybe post what versions (FreeRTOS + FAT-FS) you’re using. If there was a bug it might be fixed in recent versions.
Although I don’t think that a SDK was released with such an obvious problem.
Is the low-level SD-Card driver known to work properly ?
They are built-in FreeRTOS v8.2 and sd_mmc API.
I try to increase the length of array_sd and queue.
It seems to work fine.
Can anybody explain this question?
Without knowing anything about the Serial- and recData_s functions I guess there was or is an issue with a 0 terminator of the strings assumed or not. I’d re-read the docs where it’s needed or automatically appended (maybe overwriting the reserved buffer).