USBHID+USBSerial+USBStorage Best Practice

17 Oct 2012

Hi all,

I am in the process of speccing a custom PCB to include an mbed LPC1768.

We have done some prototyping work and we have seen that after a few minutes, screen program connected through the built-in USB connector will get disconnected. This would seem to make it unsuitable for reliably communicating with a host via RPC. In addition, every so often the mbed will stop being recognized as a mass storage device, and the only way to fix it is to completely disconnect all power to the mbed (reset does not help).

Once the PCB has been designed, we will need to be able to communicate with the mbed via some RPC-like method to send and receive data, be able to update the firmware and perform soft reset, and ideally record debugging information (currently just using printf)

For the PCB, I am thinking that maybe the best option would be to connect the built-in USB port to be used for updating firmware and recording debug info over serial, and to connect p31/32 and use USBHID and a custom protocol to send and receive data.

What do people think about this approach? Would you recommend a different method? Are there any specific things to avoid? I did figure out that writing log files to the LocalFileSystem is pretty much guaranteed to break any serial communication, but I assume that the USB connection on p31/32 would be unaffected by this?

18 Oct 2012

Hi Paul,

you have to differ between the "build in USB" and the LPC1768 usb on p31/32. The primary use of the build in usb is to program the mbed. The serial connection is also good for debug. If you access the LocalFileSystem from mbed, the mbed has to end the usb connection to pc. This is the only way to prevent data corruption on the filesystem. Both use the same flash. The mbed have to stop both - memory device and serial. I think it is not possible to stop only one usb endpoint for a composite device.

If you use the LPC1768 usb on p31/p32 the connection to the pc is not affected.