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.
Hi,
I found an Application Note 273, Creating a USB Data Logger Application using Middleware and CMSIS.
Here I found 2 functions: USBD_MSC0_SetMediaOwnerUSB() and USBD_MSC0_SetMediaOwnerFS() Using something like this seems to be the correct was to swap the ownership and access the memory card either via USB MSC or file system.
Gunnar, you found the solution to that problem. Please note that we have implemented the Media Ownership control in the Middleware 6.3.0
Refer also to: www.keil.com/.../group__usbd__msc_functions.html under headline: Media Ownership
Let us know if you have further questions. Reinhard