Hello All,
I'm using the keil USB middleware on LPC4357. The usb is configured as MSC SD card device.
I want to implement that
1. SD card can be access by file system functions when not connected to anything 2. SD card can be access by file system functions when connected to a power adaptor 3. SD card should be a MSC device in PC when connected to PC.
I already implement the first and third points by checking the presence of vbus.
If vbus is present, call USBD_Initialize(), USBD_Connect() to initialize the USB, and if vbus is not present, call USBD_Uninitialize(), USBD_Disconnect() to uninitialize the USB, and re initialize file system.
About this implementation, I also have a question. At first, I use the USBD_MSC0_SetMediaOwnerFS() and USBD_MSC0_SetMediaOwnerUSB() functions to do this, but I don't know why it indroduce a big delay. I dropped this way.
So, the last question is how to implement point 2
These two function USBD_Initialize(), USBD_Connect() return zero(OK) no matter what the USB is connected to the PC or adaptor
I would like to check the USB reset event. So is there any USB reset callback can be used in MSC mode? If not, I have to modify the USB interrupt routine.
Reset event is not available for MSC handling, so you will have to add this handling into the driver yourself.
In next version of middleware user events will be available so you will be able to check reset event for the device.