FileX on USB Mass Storage Issues

Hi -

I am working with FileX on USB Mass Storage on a custom design and having a few problems.  To start with, I can navigate folders, create, read and write files on the USBMSC without any issues, but when I try to create a new directory the program hangs after entering fx_directory_create().  Here is an example of the code:

 

// Get the pointer to FileX Media Control Block for a USB flash device
p_media = g_fx_media0_ptr;

// Retrieve the volume name of the opened media from the Data sector
fx_return = fx_media_volume_get(p_media, volume, FX_DIRECTORY_SECTOR);

if( fx_return != FX_SUCCESS )
break;

fx_return = fx_directory_create(p_media, "factory"); // Create new directory - MY PROGRAM NEVER RETURNS FROM THIS FUNCTION CALL
if( fx_return != FX_SUCCESS )
break;

 

I then tried adding the FileX source to see if I could determine where the function call was breaking.  In doing so I created another problem that results in a build failure:

makefile:99: recipe for target 'm908_rcu.elf' failed
make (e=87): The parameter is incorrect.

make: *** [m908_rcu.elf] Error 87

Removing the FileX source again resolves this issue, but I cannot debug the fx_directory_create() problem.  I have read that this error is associated with path length, but it is unclear how to resolve it without changing path names.

 

If anyone has any suggestions for either issue I would greatly appreciate your help.  

 

  • Hi Jamie,

    What is the stack size of the thread invoking fx_directory_create? When FileX is used on USB Mass Storage, each FileX call will propagate several layers down before it reaches low-level USB driver so stack usage may be extensive. Stack overflows are trapped inside the NMI_Handler so that's where the debugger should take you when you pause your project after the call to fx_directory_create.

    Regards
  • Hi Karol -
    Thank you for your reply. The stack size for that thread is 1024. I will try increasing it and post an update once i have tested. Do you have any ideas about the make error?
    - jamie
  • In reply to Jamie:

    Hi Karol -
    Increasing the USB MSC thread stack size to 2048 resolved the issue with the fx_directory_create() call. Generally speaking is 2048 adequate for typical applications of this framework implementation?
    Thank you.
  • In reply to Jamie:

    Hello Jamie,

    2048 bytes should be sufficient for FileX on USB Mass Storage. Default settings used in ThreadX enable stack filling with a known pattern (0xEF) - this can aid measurements of the actual stack usage. Once your application is running, you can go to Renesas Views -> Partner OS -> RTOS Resources. New pane should show up in your window (usually at the bottom). You can navigate to "Stack" tab to view stack usage for each of the threads in your application (you may have to pause and resume application few times to let the plugin fetch necessary data).

    Regards