Skip to main content
Graduate
December 22, 2025
Solved

FatFs returns FR_TIMEOUT

  • December 22, 2025
  • 1 reply
  • 68 views

Hello.

 

I have developed a firmware using FREEROTS and FatFS.

 

I have setted FREERTOS with :

- one thread (osPriorityNormal, 24) that perform massive read on uSD file (100MByte) to search a string (the search takes at least 40secs)

- a software timer (priority 2) that, in a certain moment, write a string in certain position in another file.

 

What I observe is that that FatFS f_lseek API called in software timer returns FS_TIMEOUT when the thread is performing massive read.

 

MauFanGilaMedical_0-1766416113673.png

I'm tempted to augment FS_TIMEOUT to 100 secs or augment software timer priority to a number greather than 24 (osPriorityNormal) but have you another suggestion ? Is it the right way ?

 

Thankyou in advance.

    This topic has been closed for replies.
    Best answer by TDK

    Maybe chunk up the read into smaller portions so you can yield to other threads needing access to the file.

    Increasing timeout is fine if you're okay with the other threads stalling.

    I don't think adjusting priorities will help here. Once the read starts, you're locked in.

    1 reply

    TDKAnswer
    Super User
    December 22, 2025

    Maybe chunk up the read into smaller portions so you can yield to other threads needing access to the file.

    Increasing timeout is fine if you're okay with the other threads stalling.

    I don't think adjusting priorities will help here. Once the read starts, you're locked in.

    Graduate
    December 22, 2025

    Ok, but If I chunk up the read into smaller portion and I call threadYield between this portions I think that I will obtain FS_TIMEOUT because of Timer low priority respect to the other thread, right ?