USB serial host

06 Oct 2012

Hi all,

I want to use my mbed as a usb host for a serial device, to which I want to read and write.

I have tried with BlueUSB, USBHostLite, and USBHostShield, which all look rather similar.

They all recognize my device but I cannot figure out how to write to the USB device and read out its answer.

Can anyone help?

Thomas

12 Oct 2012

Hi there. i am also looking for an answer on this topic.

17 Oct 2012

It has been a while since I did this. This interface is standard (CDC). As far as I remember there are two bulk endpoints (in and out), a control endpoint and an interrupt endpoint. You find the endpoint numbers in the descriptors. The bulk endpoints are for the serial data, the other endpoints for modem commands, flow control, break, baudrate etc. The specification is available on the internet for free. USBHost (also part of BlueUSB) has functions to read and write endpoints.

18 Oct 2012

What type of device do you want to connect to the mbed host ?

18 Oct 2012

i have a SIMCOM5218E 3G modem that opens up 4 virtual ports on my PC. there are two i am interested in ( AT command serial port and the NMEA serial port) When i connect the modem to the NXP-1768 the BlueUSB application registers them but i have no clue on how to communicate to the virtual ports registered.

Thanks in advance

18 Oct 2012

I want to connect a rotary encoder from Gurley that comes with a serial-usb converter based on FTDI's FT232BM. Using BlueUSB the device is recognised when plugged in, at the name etc is read correctly. The device has a control endpoint and two bulk endpoints (for reading and writing). I can write to the write endpoint (USBBulkTransfer returns the correct number of bytes wrote) but the device does not respond correctly. It may be related to the communication protocol of the FTDI chip. I can use the device on a PC and a RaspberryPI with the D2XX library.

18 Oct 2012

AFAIK FTDI devices are not standard CDC devices and require an FTDI driver. I don't know if FTDI has laid open their protocol. Otherwise use USBSnoop to snoop the USB bus while using the device from your PC. Then try to correlate the USB data with your serial data. The difference is the stuff that FTDI adds.

18 Oct 2012

The mbed usb host can only parse some generic devices.

If a usb device is pluged in, the host is reading bytes from the device - the descriptors. I'dont know if the mbed code is working with composite devices. (more than one usb function in one device). The name of the device is recognized, but after that all descriptors has to be parsed. If your modem has more than one CDC - you have to add code to enumerate this devices one after another. Pick up the devices you need and set up two CDC's. This will end in 2 * 4 endpoints. USBSnoop will also help to identify things.

You will have to dig into the usb protocol :-(

Debugging a USB host is easyer than debugging a usb slave. Most time you have a bug in a usb slave the PC host will crash and you have to reboot...

18 Oct 2012

thanks for the reply. will attempt...

19 Oct 2012

I have had a look at the code for the linux driver ftdi_sio (http://yosemitefoothills.com/Electronics/my_ftdi.c) since this C file reveals which bytes are actually sent to the USB port, I believe. However, even using the same byte patterns, I am still not able to read anything from the USB device. I suspect that I need to send some control sequence to the device to make it respond to my bulk input. I may have a look at USBsnoop.