This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

MSC and BLE UART

Hello,

I'm trying to use the USB MSC to show up as a file system, transfer the file into RAM, and send the file via BLE to an Android phone. This is with SDK 15.3 and S140.

I am able to initialize the block device in ram, create the file system and a dummy file (this shows up in Windows and shows the dummy file), but I am unable to read the file off of the file system to send it via bluetooth.

It appears that f_read is hanging, and I hit an assert in app_usbd_msc.c, function msc_buff_put, line 273. Is this because the host OS is disallowing the application to read the file system? Do I need to stop usb before reading from the FS?

If anyone has any insight or working examples, it would be greatly appreciated.

Thanks,

David

Parents
  • Is this because the host OS is disallowing the application to read the file system?

    Quite possibly.

    You probably need a whole extra layer to allow multiple concurrent access to the file system.

    Surely, you could easily check  by having your target not plugged into a Host?

    Would also be worth checking whether it's the whole file system that's "locked", or just a particular file...

  • Thanks for the response. Sorry I didn't clarify, the hardware setup is a USB dongle, that must be plugged into the host.

Reply Children
  • So have you tried it not plugged into the host? Does the f_read() then work?

    If it does, that would certainly suggest that it's the Host OS somehow "locking" it ...

  • I can't unplug the dongle from the host, because it is the only power source. 

    I did verify that if I stop the USB before reading, I can read the file okay. Although, I still hit the ASSERT on app_usbd_msc.c - line 273. I'm going to try and solder down an external QSPI chip to see if it's an issue with using RAM. It seems like QSPI is more supported by the SDK.

  • it is the only power source

    So just use a power-only USB socket.

  • Wanted to follow up. I was able to send a file that I created manually on the file system by stopping the USB.

    Now I want to see when a file gets transferred to the files system, disconnect USB, and then transfer the file. 

    I dug into app_usb_msc, and found a way to get an event when a file is transferred. But when I disconnect the USB and list out the file system, the file is not there. Any tips?

  • Hi,

    Can you elaborate on how the system is when you test this? I am particularly wondering what happens when you disconnect the USB, since you wrote initially that the file is stored in RAM. Is the device still powered, or is it reset?