Skip to end of metadata
Go to start of metadata

This example detects the connection of a USB-to-serial adapter. After configuring the adapter, the example application sends back everything that was received from it, hence creating a loopback.

The following are the tasks accomplished by the example when a USB-To-Serial adapter device is connected:

  • Set baud rate to 115200
  • Set data characteristics to 8 data bits, no parity, and 1 stop bit
  • Disable hardware flow control
  • Disable software flow control

The example then waits for data to be received from the device. Once data is received, a task is triggered to send it back to the device.

You can use you favorite terminal tool and connect to the USB-to-serial adapter from your PC using a serial port. All the data you type in should be sent back.

The example will also display on the terminal any changes in the serial status.


The example implementation is located in /examples/usb/host/ex_usbh_usb2ser_loopback.c.


This example offers only one API named Ex_USBH_USB2SER_Init(). This function is normally called from a USB host core example.