2019-01-17 06:08 PM
Hi all,
I am currently learning how to interface with a USB using an stm32f2 as a host.
I am using the fatfs library and it is working quite well.
I have a question relating how removing a USB from the system. Similar to Windows for example, they have an "eject" button so you can safely remove a USB.
Is there a way to do this on an STM32 system so I don't corrupt the USB or is it not necessary?
Currently I mount the drive, open a file and write to it, then close the file and unmount. Is there anything I should do after this prior to removing the USB?
I have been testing this on the Nucleo F207ZG.
Thanks for you help!
Solved! Go to Solution.
2019-01-17 08:35 PM
The flush and unmount should be sufficient, the STM32 isn't caching a whole bunch of data, or doing deferred writes to the media.
You can warn the drive via a SCSI LOAD/UNLOAD command, which would give it an opportunity to find its safe space.
2019-01-17 08:35 PM
The flush and unmount should be sufficient, the STM32 isn't caching a whole bunch of data, or doing deferred writes to the media.
You can warn the drive via a SCSI LOAD/UNLOAD command, which would give it an opportunity to find its safe space.