USB communication with mBed without computer

Hello,

I am new to the Mbed platform. I am using a common NPX development board based on the LCP1768 chip.

I am trying to connect a USB device to the Mbed (it’s an USB to RS232 converter. Note that i want to connect the USB side to the Mbed and want it to send informations. I don’t want to use the dedicated Tx and Rx pin, i need to use the USB connection).

However, the device doesn’t seem to turn on when plugged to the Mbed. It just flashes once and stays off, doesn’t seem to recognize the Mbed as something it would communicate with.

I tried connecting the four USB pins to GND, +5V, and then IF- and IF+ pins (which are the standard pins used by the mini-usb connecter for programming the board), and also tried the D- and D+ pins (pins 31 and 32 on the board).

As i want to send Serial data, I tried using BufferedSerial (USBRX, USBTX, Baudrate). The way I implemented it works fine over a standard USB cable connected to the computer. However, the same code just doesn’t work with the USB to RS232 converter.
I also tried using USBSerial, and other USB Api’s.
I tried to set the blocking parameter to false.
It just doesn’t want to communicate with the Mbed.

Maybe i am missing something obvious ?

Thanks for you help !
Paul

Hello,

the problem is you mixing few things together. BufferedSerial and similar APIs are just UART’s higher layers.
USB APIs are really via USB interface, however USB has a few operation modes.

  • DEVICE - Mouse, Keyboard, Flash Drive, and other devices what could be connected to a HOST.
  • HOST - is a master for DEVICE.

So if you want connect the converter to your board over USB then you need to do that over USB pins. However, Mbed officially support only USB in DEVICE mode. So Mbed boards are dedicated as USB DEVICE.

There were a library USBHost in the past, but this library was made for old Mbed2 library. I do not know if is possible to use it with newest versions of MbedOS (probably not), you must try. Or you can try to create Mbed2 project in KeilStudioCloud and import this library to it.

BR, Jan

Ok, thank you for this fast answer, that was helpfull !
Paul