Author Topic: Anyone with experience of NXP USBD LIB for MSD?  (Read 9512 times)

jmccabe

  • Member
  • ***
  • Posts: 6
Anyone with experience of NXP USBD LIB for MSD?
« on: March 28, 2018, 05:34:38 pm »
Hi,

I'm fairly new to USB programming but looking at trying to use USB On one of our LPC1778/88 based boards.

I started off by getting an LPC18S37 board (OM13076) with a general purpose device board (OM13082) going with the usbd_rom_msd_sdmmc example application running then tried porting it to the LPC1788 based on the library version of USBD provided with the LPCOpen package that's available for the Embedded Artists LPC1788 Dev Kit.

It appeared to work reasonably well, but I had a problem when, in Windows Explorer, I right-click and select "Eject". Every time I do that I get an error popup saying it didn't work. Going back to the USBD ROM based example on the LPC18S37 board showed the same problem.

Using Wireshark with usbpcap I could see all the messages being sent and it looks to me like what's happening is that the PC is sending a SCSI START STOP UNIT message, which is getting a "Command Failed" response, and then a SCSI TEST UNIT READY message which responds with "Good", so I imagine Windows is deciding that doesn't sounds like the eject has worked.

Has anyone else tried this and had it work properly at that point? I'm struggling a little with the API; there seem to be few callbacks available from the USB stack and I'm not sure if any of them will pass me the information from these commands so that I can implement my own handlers, like those described in the documentation for Segger's emUSB/emMSD stuff.

Any suggestions or help on this would be greatly appreciated.

Thanks
John

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Anyone with experience of NXP USBD LIB for MSD?
« Reply #1 on: March 28, 2018, 08:22:26 pm »
This isn't much actual help, but it sounds like the example application doesn't support it.

The SBC (SCSI block command) standard doesn't require devices to support SCSI START STOP UNIT.

You can run various mass-storage tests with USBCV:

http://www.usb.org/developers/tools/

jmccabe

  • Member
  • ***
  • Posts: 6
Re: Anyone with experience of NXP USBD LIB for MSD?
« Reply #2 on: March 29, 2018, 03:10:36 am »
Thanks. I'll see if I can try that and hopefully it might help show me a way forward.

FWIW I also tried using an nxpUsbLib example that did something similar, but also doesn't support SCSI START STOP UNIT. Having spotted that nxpUsbLib is a port of LUFA, I checked out the LUFA sources and noticed that SCSI START STOP UNIT support had been added, but it didn't do anything other than return a succeeded status.

John