Terminating a thread that is using f_write() from FatFS
Posted: Fri Mar 29, 2013 1:25 am
I have a thread that is running a loop at 200Hz and in that loop it periodically calls f_write(). This is the only thread to use any of the FatFs calls, and this thread has the highest priority. While the thread is running, the system is responsive (the shell works). When I invoke a shell command to stop this thread, following the recommendations of [0], the shell becomes unresponsive and the system gets stuck in the idle thread. Using a debugger, I was able to determine that chThdWait() never returns, and this is why the shell thread remains blocked. If remove the calls to f_write(), this problem goes away and the thread terminates just fine. Is there something I should be doing differently when terminating this thread?
[0] -- http://www.chibios.org/dokuwiki/doku.ph ... os:stop_os
[0] -- http://www.chibios.org/dokuwiki/doku.ph ... os:stop_os