Bridging USB to Embedded UARTs
VTOS Tools includes the ability to bridge a USB device connection to an embedded UART on your board design. This feature is part of the VTOS Scan USB Device task.
Use the USB to UART bridging to verify communication to any embedded device that uses a serial/RS232 interface for communication. Devices that provide a serial/RS232 communication interface include:
- Low power WiFi modules
- Bluetooth host controller modules
- GPS modules
Once you enable a USB to UART bridge, use a terminal emulator running on your PC to communicate and interact directly with the embedded device.
You can also use the bridging feature to run any Windows PC software provided by the device vendor. This includes software for performing calibration, updating firmware, and other tasks.
Enabling the USB to UART Bridge
Run this command from the Advanced Mode console or as part of a script to enable the USB to UART bridge.
<usb-id> <serial-channel-id> usb.device.serial.bridge
<usb-id> specifies the USB device interface that is connected to your Windows PC. This parameter should always be set to zero (0).
<serial-channel-id> specifies the serial channel or UART interface number. 0 represents the first available serial channel available on your embedded processor.
STM32L1 Serial Channel Aliases
For the STM32 family of microcontrollers, VTOS provides the following aliases to specify the serial channel or UART connection.
This example creates a bridge between the USB device connection and the embedded device connected to USART2 on an STM32L1 based board.
0 #STM32_USART2 usb.device.serial.bridge
Using the USB to UART Bridge
These are the basic steps for using the USB to UART bridge feature:
- Connect a USB cable between your Windows PC and your board.
- Run the command
usb.device.serial.bridgeas directed in the previous section.
- Find the serial port number assigned by Windows to the USB device.
- Start a terminal emulation program (such as TeraTerm) or another program that can communicate with Windows serial ports.
Please see the application note Kozio USB Virtual COM Port for details on installing the USB driver and finding the serial port number assigned by Windows.
Setting the Baud Rate of the Embedded UART
To set or change the baud rate of the embedded UART, you simply set the baud rate of the USB serial port from the terminal emulation program. For example, using TeraTerm select the Setup->Serial Port… menu option to bring up the serial port setup options.
Once the baud rate change is applied by the Windows program, the VTOS firmware automatically changes the baud rate of the embedded UART to match.
Disabling the USB to UART Bridge
To disable the USB to UART bridge, run this command:
<usb-id> should always be set to zero (0). After the command completes, VTOS disables the USB interface.