A while ago I was experimenting with the usbd_msc
demo, trying to get the firmware working as RAM-disk-only storage, without any permanent storage like Flash or SDC. While that was easy enough to modify, there's one thing I can't figure out.
In each fatfs
wrapping function listed in the main.c
file, there's a check whether the USB cable is still connected (m_usb_connected
) which prevents the filesystem operation from being executed. The variable m_usb_connected
is modified by the usbd
event handler on connect and disconnect.
Is there any practical reason for this prevention of file operations? The system I'm trying to integrate with normally uses a USB stick, so it likely does not logically disconnect from the USB device until it's physically pulled out.
If the filesystem absolutely must not be modified while USB is connected, can I externally (i.e. through a FET) disconnect the VBUS
line to get the nRF82840
to detect a disconnect event, do my filesystem operations, and then return the VBUS
line to its normal state?