Hi Guillaume,
I tested MQX 4.0.2.2 MFS sdcard example code at my TWR-K70F120M board and creating directory works fine on my side – without any unusual delay.
I created Main directory at SD card and test your code with added time measurement.
My result was 87miliseconds for creating subdirectory:
char * _DirectoryName;
char _str[] = "/Main/Secondary123";
TIME_STRUCT start_time, end_time, diff_time;
_time_get(&start_time);
_DirectoryName = strtok(_str, "\\");
while(_DirectoryName != NULL)
{
error_code = ioctl(filesystem_handle, IO_IOCTL_CHANGE_CURRENT_DIR, _DirectoryName);
if(error_code == FS_PATH_NOT_FOUND)
{
error_code = ioctl(filesystem_handle, IO_IOCTL_CREATE_SUBDIR, _DirectoryName);
error_code = ioctl(filesystem_handle, IO_IOCTL_CHANGE_CURRENT_DIR, _DirectoryName);
}
_DirectoryName = strtok(NULL, "\\");
}
_time_get(&end_time);
_time_diff(&start_time, &end_time, &diff_time);
printf("Time to create 1 subdirectory: %ld sec %ld millisec\n", diff_time.SECONDS, diff_time.MILLISECONDS);
printf ("directory created \n");
Could you please test different SD card or test it on some supported evaluation board for excluding any side effects?
If directory already exist, it returns in 1 millisecond.
Could you please specify exact version of your MQX and whether you use SPI or ESDHC driver for SD card?
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------