Thursday, December 14th 2017, 10:45am UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Paramasivan

Beginner

Date of registration: Oct 24th 2014

Posts: 3

1

Friday, December 26th 2014, 9:33am

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? ?(

This post has been edited 1 times, last edit by "Paramasivan" (Dec 26th 2014, 9:34am)


SEGGER - Marius

Super Moderator

Date of registration: Aug 10th 2011

Posts: 31

2

Monday, January 12th 2015, 1:51pm

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/C++ Source code

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