Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 3 months ago.
USB Stick removal
HI Norimasa, thanks for sharing this, and for doing the KLXX drivers port. Fantastic. Still working through the structure of it.
I've pulled it in to a FRDM-KL25z project, modified the board for USB Host powering and using it as part of AnalogIn for building a logger. Reading adc and writing results to a USB stick.
I have writes going through to the USB stick.
Two items that I'm wondering about
1) detecting removal of a USB stick.
2) starting up with a USB stick - and detecting the insertion.
I'm doing a check in
USBHostMSD msd("usbAa");
main.cpp
.. if (!msd.connected()) pc.printf(" USB Flash drive removed.\n\r"); ..
however it doesn't detect when the USB Stick is removed.
I am opening and closing the stream with no USB stick and that is working.
Should I be looking at some other function like a fprintf() fail
The other area is it requires the USB stick to be inserted before it completes initialization.
That is if I start the program with no USB Stick it waits for a USB stick to be inserted before it completes the initialization of msd("usbAa")
The seems to be implicit in the constructor .. unless I'm missing something.
USBHostMSD.cpp
USBHostMSD::USBHostMSD(const char * rootdir) : FATFileSystem(rootdir) {
Many thanks for any insights from anybody