FreeRTOS + FAT Renesas RA

Hi,

I am using RA6M5 uC with 3 threads: one for app, another for CAN comunication and the last one like logger. This thread is configured to use TFAT library and USB to save data in pendrive every 5 seconds.
Starts ok, but after a while fails in ff_open function and analyzing it gives F_ERR_IOMAN_ACTIVE_HANDLES error.
This is what it is programmed:

Any idea what i am doing wrong?

Thanks in advance

As additional context, could you share the version of FreeRTOS+FAT you are using?

Hello @goniz,

It seems that F_ERR_IOMAN_ACTIVE_HANDLES means that The partition cannot be unmounted until all active file handles are closed.
I am not sure why would you be getting that when calling ff_fopen. If possible, can you give us the stack trace so that we can help with debugging?

Thank you,
Aniruddha

Hi,

I added that with e2Studio FSP version 5.5 and it adds the FreeRTOS+FAT V2.3.3. version.

Hi,

I’m not sure what you want, do you want the stack analysis file? I attached that…
Stack_trace.7z (67.8 KB)
If it isnt’t that what you want, can you say me how to get that information?

Thanks

The only 2 places where this error code is returned are the following:

Would you please put a breakpoint on both these lines and share the call-stack when one of this breakpoint is hit?

Hi,

Sorry for the delay responding.
The error occurs when in ff_fopen function calls to FF_FinDir and the error that gives is FF_ERR_FILE_INVALID_PATH, no FF_ERR_IOMAN_ACTIVE_HANDLES that I said you, I didn’t realize that prvFFErrorToErrno function changes the value of error.
I attached stack trace when the error occurs
stack_trace.7z (63.1 KB)

The error FF_ERR_FILE_INVALID_PATH means “The path of the file was not found.” This error is returned from the following places:

Please put breakpoints in these places and share call-stack when anyone of them is hit. I do not know how are you generating this “stack trace” but it does not seem to be what I am looking for. The “call-stack” shows the order in which functions are getting called when a breakpoint is hit. Your IDE should have a “call stack” window. If you are using GDB, you can use backtrace command to get the call-stack.

Hi,
It stopped on the second breakpoint.
The result of backtrace command is that:
Stack_ff_dir_791.7z (739 Bytes)

The stack trace shows that it failed to find directory /logger while trying to open /logger/206_001.txt. Did you create /logger directory by calling ff_mkdir?

Hi,

Yes I used ff_mkdir.
Here the folder creating code:

I am not so sure but can it because you are not using absolute paths? Can you try changing paths to /logger and /logger/206_001.txt?

I have tried it but the result is the same, it doesn’t work well with this pendrive. I will use another one, maybe there is something wrong with this one…

Let us know whatever you find!

Hello,
I have tried with other pendrives and they work fine. I don’t know why with this one it doesn’t work properly, but maybe the pendrive has some defect.

Thanks for your support!

Glad that you figured it. Thank you for sharing!