Mbed as USB host for a USB Serial device

18 Apr 2012

I would like to connect to an mbed a certain (slave) USB dongle, which normally supports the USB serial protocol.

Given there are some great mbed-as-USB-host samples (i.e. the BlueUSB and the Mass-Storage examples) as well as mbed-as-USBSerial-slave code, I presume this should be doable in a couple of lines, but being new to the USB protocol and having browsed around the various functions in there for quite a while by now, I got lost.

So far my guess is that I should probably reuse USBHost.h and USBHost.cpp from the BlueUSB project, call USBInit somewhere on startup, then USBLoop in a loop, and use USBBulkTransfer for communication. However, I don't exactly understand all the details (e.g. if USBBulkTransfer is sending data, then how do I receive it, is there any specific initialization that needs to be done, etc).

Is there anyone here who perchance could spare me from the pains of learning the details of USB and hours of useless experimentation by suggesting the correct way to transfer data back and forth between mbed-host and the dongle-usbserial-slave?

Thank you.