AnsweredAssumed Answered

FreeRTOS + FatFs (STM3240G) -> FR_DISK_ERR

Question asked by jacob.ariel on Dec 4, 2014
Latest reply on Nov 4, 2015 by sid.m
Hello,
I've modified FatFs_uSD_RTOS example to write in a loop (32k files), which works fine on its own (Task SDCardStream()).
When I add another task Process() which only has a calculation loop:
static void ThreadProcessing(void const *argument)
{
    portTickType NextProcess, tmp;
    for( ;; )
    {
        tmp = xTaskGetTickCount();
        if ((tmp % 100 == 0) && (tmp != NextProcess))
        {
            NextProcess = tmp;
            for (int i = 0; i < 13186; i++)
            {
                res += sqrt((i*i) / 37);
            }
        }
        vTaskDelay(1);
    }
}

SDCardStream() will fail with the error FR_DISK_ERR.

The only way to resolve that error is by wrapping all of  FatFs functions with a critical question, e.g.:
taskENTER_CRITICAL();
f_mkdir(&filename[0]);
taskEXIT_CRITICAL();

Did anyone experience that?
Do you have any idea what can cause this?
Any lead would be appreciated :)

Attachments

Outcomes