This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Access to SD-card from µController AND from USB possible?

Hello,

I use the Evalboard MCB4300 and µVision 5.14 MDK-ARM Professional.
Is it possible to initialize MCI0 to read/write to an SD-Card using fopen()..fwrite()..fclose(),
AND also allow the user to use the SD-card as a mass storage device via USB? (access not at the same time, user selects when the USB-connection is alive) ?

I'm trying to do this, but currently it does not work, but I also do not get any errors from the functions I call.
I call fopen(), fwrite() fputc(), fclose() without errors, but afterwards the file on the sdcard has not changed.
All function calls return without an error (fwrite(), USBD_Initialize(0),USBD_Connect(0),...)
Access to the card from USB works fine.

Am I doing something wrong, or is this basically not supported?

What's wrong with this:

finit("M0:");
fmount("M0:");
f=fopen("M0:test1.txt","a");
fputs("Hello!", f);
fclose (f);
funmount ("M0:");
funinit("M0:"); => file is correct on SDCard

stat=finit ("M0:"); // init again
=> stat=7(fsDriverError) : why?

Later in the code there would follow calls to
ustat=USBD_Initialize (0); /* USB Device 0 Initialization */
ustat=USBD_Connect (0);

Thank you.