Adding SD Functionality in host_msd_fatfs_freertos

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Adding SD Functionality in host_msd_fatfs_freertos

923 Views
charles2
Contributor II

Hi,

I am testing some functionalities on FDRM - K66 board. Currently, I would like to add SDDISK to the existing "Host_msd_fatfs_freertos" example, which is only working for the USB stick originally. 

I want to add the codes to test the speed that SD card can read/write data from USB stick. The codes I modified are in the function USB_HostMsdFatfsThroughputTest(..). Why it gives me error when I tried to use f_mount(&fatfs, test_file_name1, 1) with sprintf(test_file_name1, "%c:", SDDISK + '0');. If I change the last parameter of f_mount from 1 to 0, it works. Does it only allow one DISK mounting to FATFS each time?

If I changed the last parameter from 1 to 0, then it failed when I tried to use f_unlink() or f_open() for the SD card, they all return error code.

Any suggestions or documents I can read through?

0 Kudos
2 Replies

822 Views
charles2
Contributor II

Maybe I found why it doesn't allow SDDISK to be mounted, I guess I need to change something on ffconfig.h. Should I use different ffconfig.h, ff.h and ff.c for SD and USB? Because some variables setting are different in the file. For example, FF_FS_RPATH is 0 in USB, and 2 in SD card. FF_FS_RPATH shows up many times in ff.c. Should I change this variable FF_FS_RPATH as well as ff.c so that they are not conflict. 

Anyone has experience of using multi-drive in Fatfs can help me out?

Thanks,

Charles 

0 Kudos

822 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Charles:

Please refer to below link for the meaning of FF_FS_RPATH,  FatFs - Path Names 

In default configuration (FF_FS_RPATH == 0), it does not have a concept of current directory like OS oriented filesystem. Every object on the volume is always specified in full path name that followed from the root directory. Dot directory names (".", "..") are not allowed. Heading separator is ignored and it can be exist or omitted. The default drive is fixed to drive 0.

When relative path is enabled (FF_FS_RPATH >= 1), specified path is followed from the root directory if a heading separator is exist. If not, it is followed from the current directory of the drive set by f_chdir function. Dot names are also allowed for the path names. The default drive is the current drive set by f_chdrive function.

We have a sdcard_fatfs_freertos demo in SDK.

SDK_2.7.0_EVK-MIMXRT1064\boards\evkmimxrt1064\sdmmc_examples\sdcard_fatfs_freertos

Regards

Daniel