USB-Host support in latest MBED release

Hi,

when I search for USB-host support in MBED i reach a page that says the content may not longer be supported. Likewise a saw at least one unanswered psot in the forum regarding loss of USB-host support.
What is the status today and when and in what direction will it change in the future ?

Hello,

there were USBHost | Mbed and USBDevice | Mbed 10 year ago. But later was transfered to MbedOS only Drivers - USB DEVICE - API references and tutorials | Mbed OS 6 Documentation
I do not hear anything about a change of this, for last 5 years.

BR, Jan

Hello,
Has USBHost been ported to mbed OS 6 ?
I’m struggling to get it working for 2 days on an LPC1768.
I made the changes to “wait” calls, and to thread management that changed from older versions, it starts properly, detects the device, but cannot get the descriptor. Transfer ends sucessfully… with a negative transferred byte count.
Is there any good reason NOT to use this code on OS6 ?
Why is there absolutely nothing to connect a simple mouse, keyboard, or like me a simple sensor seen as a virtual com port ?

Hello,

Answer is above, nope.

What a sensor you want to connect?

BR, Jan

Hi,
Thanks for your message, I’m feeling like in the middle of the desert.
The sensor is a displacement sensor from TESA (GTL22USB).
It is seen as a virtual com port, and the protocol is extremely complex : send a “?” a you receive the position in ascii…
I’ve done this a thousand time on PCs, it kills me having to dig into a rather complex undocumented driver, read thousand pages of the processor manual, plus the USB OHCI standard and so on, just to send a single character… On a physical RS232, I would have done it in 5 minutes. Done this during the last 35 years, and I’m getting tired. I thought that lately the silicon manufacturers/designers at last had understood that providing proper divers and OSs could help selling their brilliant hardware, but obviously… not completely . I can imagine someone who developped an application for customers using this code, and cannot get it compiled nor run anymore.
Do you see any reason not to try to port this code ?
I’ve seen that there are some specific USB Host code for other MCUs (ST), that could be a solution, but it would need again to redesign the hardware…
Regards

I also do not understand why USBHost and Wifi TCP/UDP server were never implemented but it looks like Mbed decided to be device/client in many cases probably in a context of IOT.

In this topic some one else also tried something like you but with ST target. So if you will be lucky it will work also for LPC1768. And how I see, the library still contains HALs for LPC1768. So maybe you can try to create a new project based on MbedOS 5.15 and use USBHOST - USBHOST lib for STM | Mbed

If this will not work, then you can try a luck with the old library and old Mbed2 via Keil Studio Cloud where is Mbed2 still supported in limited mode.

BR, Jan

Hello again,
Thanks for the time you spent on this issue.
I had seen the library but did not look inside as it was told “for ST”. Good to know there is an HAL for Lpc1768.
I’ll have a look and it may help to have another code/port. Hope this person had more success than I do so far.
I guess I’m not far from having it running, but the difference between almost succeeding and not even trying is only the amount of useless work you provide. At the end it does not work…
Regards

I remembered one more thing. In MbedOS 5 was a folder Unsupported (yeah the name says something about the state but who know) what also contains USBhost - mbed-os/features/unsupported/USBHost at mbed-os-5.15.9 · ARMmbed/mbed-os (github.com)

BR, Jan

1 Like

there was a USBH host in mbed2 and left over as unsupported in mbed5. But afaik the implementation for LPC1768 was missing, because the USB memory did not fit into the mbed memory modell. There were no custom linker scripts or special target for the USB usage.
I have started the Cortex-M with LPC1769, the LPCXpresso board and the LPCXpresso IDE. There where some working examples from NXP for USB. Currently, I’m on vacaction, I can search for the old code later.

Another solution maybe an interface chip, there is some microchip controller MCP2210 that does USB host - SPI bridging.

edit:
there was some USB Host code for LPC176x in mbed-master in 2014.