Hi all,
I would like to use my STM32F4Discovery board as a USB-UART bridge, using the USB port onboard (the USB-CDC driver) and connecting it to a physical UART port. But I'm not sure how to connect them together, I would need to know the baud rate and other params which the host software on Windows uses to open the port, and then configure the UART peripheral at that baudrate, and also how to couple them both.
I would be obliged if anyone could help me how to start and proceed in this regard.
Best Regards
Abhishek
Using STM32F4 Discovery and CDC to create a USB-UART bridge
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Using STM32F4 Discovery and CDC to create a USB-UART bri
Hi,
The CDC driver already decodes messages for baud rate and other settings, you have to modify it to do the physical setup of a serial driver.
In order to connect them you need a thread that read/write USB<->Serial, you can use events from the two drivers in order to wake up it when there is data do move.
Giovanni
The CDC driver already decodes messages for baud rate and other settings, you have to modify it to do the physical setup of a serial driver.
In order to connect them you need a thread that read/write USB<->Serial, you can use events from the two drivers in order to wake up it when there is data do move.
Giovanni
Re: Using STM32F4 Discovery and CDC to create a USB-UART bri
Does this mean I have to modify the serial_usb.c file in the os/hal folder or make my own copy and do the modifications?
What I infer is:
-> sduRequestHook will get me the baud rate information in the linecoding structure
-> sduDataTransmitted and sduDataReceived will get me the data, and then I will have to adjust in these functions the transmit and receive functions.
What I infer is:
-> sduRequestHook will get me the baud rate information in the linecoding structure
-> sduDataTransmitted and sduDataReceived will get me the data, and then I will have to adjust in these functions the transmit and receive functions.
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Using STM32F4 Discovery and CDC to create a USB-UART bri
You have to customize the request hook but you can use everything else as-is and read/write directly the queues.
Giovanni
Giovanni