USB ROM and MSC with removable devices and multiple LUNs

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by mubes on Sat Apr 12 04:32:21 MST 2014

I'm using the LPC13Uxx USB ROM to implement a composite device, one element of which is a MSC driver.

Unfortunately the MSC is talking 'through' to a SD card which could, on occasion, not be present, or could be removed during operation...it could also be replaced with another one I guess. I also have some on-board memory that it would be nice to export on a separate LUN.  The 'default' MSC handler (header in mw_usbd_mscuser.h) is a simple in/out affair that doesn't seem to cope with these scenarios.

Intriguingly, there is the facility to incorporate a custom Ep0 handler and the SCSI definitions too (in MSC_CTRL_T) which I suspect can be used to do what I need without having to hack up an entire stack.

So, the question is; can anyone point me in the right direction for examples or documentation to do such a thing?  There's a _lot_ of docs around for the usb stuff, but it all seems a big mass to someone just wading through this...

Thanks in advance for any help anyone can offer.