10 years, 2 months ago.  This question has been closed. Reason: Issue resolved

How to change the baud rate for USBSerial

Hi:

The Serial library has a function named baud, which sets the baud rate for the serial interface. However, I do not see a similar function for USBSerial. Is if fixed to 9600?

Thank you! T.H.

1 Answer

10 years, 2 months ago.

Serial has a baudrate, USBSerial only emulates a Serial connection, and has no actual baudrate, so you cannot set it.

I understand there is no baud rate in the virtual com port, but the protocol has the ability to set the baud rate. Is there any way in mbed to read those configuration commands so that you can change the baud on a real UART if you are passing the data to the real UART like an FTDI part?

posted by Greg Steiert 23 Feb 2014

Hi Erik: That makes sense, but then why does the USBSerial only work if my Tera Terminal on the PC side is set at 9600? If I changed the PC terminal baud rate, I can no longer see the print output from USBSerial. Is the problem on the Windows driver side? Thanks!

posted by T.H. Lu 23 Feb 2014

Sorry, I take that back. I just did another test and it looks like the baud rate setting is irrelevant. The USBSerial printf works properly for me regardless of what baud rate I used for the PC terminal. Thanks for your help!

posted by T.H. Lu 23 Feb 2014