View previous topic :: View next topic |
Author |
Message |
kmp84
Joined: 02 Feb 2010 Posts: 354
|
USB<->UART Bridge |
Posted: Wed May 27, 2020 2:58 am |
|
|
Hello,
I'm using CCS usb cdc uart bridge with no problems. Is it possible to set uart baud rate when opened in windows application?
Best Regards! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Wed May 27, 2020 6:45 am |
|
|
Yes, but you will have to write your program to do it.
The 'bridge' over the USB, runs at a constant rate. Baud rate changes
don't change anything about this. Typically one packet is sent every mSec
giving a maximum of 64000bytes/second.
When you change the baud rate on the virtual port, Windows sends a
'set line coding' request to the USB device. This is automatically copied into
the usb_cdc_line_coding structure by the receive code. The first 32bits of this
structure is an int32, containing the baud rate required.
So your code would need to read the value in this, and change the physical
UART rate to match it. The line coding is normally always re-transmitted as
part of opening the port. |
|
|
kmp84
Joined: 02 Feb 2010 Posts: 354
|
|
Posted: Wed May 27, 2020 6:56 am |
|
|
Hi Mr.Ttelmah,
Yes, I saw also example "ex_usb_to_serial.c" in ccs's exaples folder.
Thanks and Best Regards! |
|
|
kmp84
Joined: 02 Feb 2010 Posts: 354
|
|
Posted: Wed May 27, 2020 7:23 am |
|
|
I forgot to ask one more important question:
Is it possible and easy to emulate two serial ports with this driver?
Best Regards! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Wed May 27, 2020 7:38 am |
|
|
You would have to generate a composite device. Look at the example for
keyboard and mouse which shows how this is done. |
|
|
|