Is it possible to read files from both SD card and USB disk in a single project ?

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Is it possible to read files from both SD card and USB disk in a single project ?

    Hi,

    I need to copy some files from SD card to USB pen drive. Now the SD card and USB pen drive is working good separately. How to configure or switch the file system from SD card to USB host pen drive? Is it possible? ?(

    The post was edited 1 time, last by Paramasivan ().

  • Hello Paramasivan,

    Yes, it is possible to copy files from SD card to USB drive. All you have to do is to add the SD/MMC and the USB MSD drivers to your emFile configuration as in the following example:

    C Source Code

    1. void FS_X_AddDevices(void) {
    2. FS_AssignMemory(&_aMemBlock[0], sizeof(_aMemBlock));
    3. //
    4. // Add the USB MSD driver. Volume name: "msd:0:"
    5. //
    6. FS_AddDevice(&USBH_MSD_FS_Driver);
    7. //
    8. // Add and configure the SD/MMC driver. Volume name: "mmc:0:"
    9. //
    10. FS_AddDevice(&FS_MMC_CardMode_Driver);
    11. FS_MMC_CM_Allow4bitMode(0, 1);
    12. //
    13. // Enable the file buffer to increase performace when reading/writing small amounts of data.
    14. //
    15. FS_ConfigFileBufferDefault(512, FS_FILE_BUFFER_WRITE);
    16. }
    Display All