I have built an application based on the device disk example.
I am able to have the device enumerate on a windows pc and look just like a thumb drive.
Using MFS I created a file on the disk and windows is able to read it with no errors.
The problem I am having is I update the file periodically but when I open it on the windows pc I only see the original file contents. I have verified that the file is modified correctly in the 52252 memory.
If I set a breakpoint on the USB_MSC_DEVICE_READ_REQUEST case in the Bulk_Transaction_Callback I never hit the breakpoint after the first time the file is opened on the windows pc. The only way i can see the updated file is to unplug the usb and then plug it back in to force it to enumerate.
Thoughts????
已解决! 转到解答。
Hi Mike,
no help here. The master is host side, so Windows manages write / read through cache. Its really up to windows when it will read contents of flash drive. Suspecting that device cannot write anything itself on USB, Windows does not have any reason to update file in its file cache.
Hi Mike,
no help here. The master is host side, so Windows manages write / read through cache. Its really up to windows when it will read contents of flash drive. Suspecting that device cannot write anything itself on USB, Windows does not have any reason to update file in its file cache.
Hi! There must be other ways to make windows refresh the data. Has anyone thought about disconnecting and reconnecting the usb in software? It is possible to write registers to set usb voltage so that the device disappears from windows. But after that it seems problematic to make the software reinitialise the usb mass storage device. In my application windows is allowed only to read files so disconnecting prematurely won't make any harm to files on device. Now advice is needed to accomplish reconnecting usb mass storage device without resetting the whole system (which works without physically disconnecting the device in the middle).
Thanks for the input. I thought that may have been the case but was hoping I was missing something.
I wound up running the device as a virtual comm port for the setup mode instead of emulating a disk. Originally I wanted to avoid having to provide a driver and program for the pc side but you can't win them all. Thanks again for the information.