cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ 5, 3 & 1

JoBr_1593366
Contributor II

I got the USBUART example working, but all that does is show up as a COM port and echo characters back to the computer.  Is there a bridge example, so it shows up as a COM port, but passes the characters through to a hardware UART component, out of a hardware pin, and vice versa?

0 Likes
1 Solution
JoBr_1593366
Contributor II

I've combined the USBFS_UART example with the UART_Full_Duplex example, modifying them so they send to each other instead of sending back to the source, and it seems to work.  I'm not sure how to handle changes in baud rate, etc. though.  I don't really understand UART or which end controls those parameters.

1. Yes, passing from the CDC COM port to the hardware pins of of an external IC and vice versa, like a FT232 or similar

2. CY8C3446LTI-073

3. Yes, but the Full_Duplex one seemed more appropriate

View solution in original post

0 Likes
6 Replies
Aashita_Raj
Moderator
Moderator

Hi @JoBr_1593366 ,

Going through the subject of your thread, I understand that you have already gone through the available USB-CDC-ECHO code example and it does not suffice your requirement. Can you please answer us the following queries ?

1. Are you looking for a code example, where you want to send data to the SCB block that belong to USB-UART bridge using the UART pins externally that is, with the help of wires?

2. Which device are you using?

3. Have you gone through our already available UART_Rx and UART_Tx code example ( https://www.cypress.com/documentation/code-examples/ce95388-uart-receive-psoc-345lp) developed for PSoC 5LP? In this code example, the data typed on the hyper-terminal is sent through the serial port and displayed on the LCD. You can got through this for your reference.

Please let us know your comments.

Best Regards,

Aashita

 

0 Likes
JoBr_1593366
Contributor II

I've combined the USBFS_UART example with the UART_Full_Duplex example, modifying them so they send to each other instead of sending back to the source, and it seems to work.  I'm not sure how to handle changes in baud rate, etc. though.  I don't really understand UART or which end controls those parameters.

1. Yes, passing from the CDC COM port to the hardware pins of of an external IC and vice versa, like a FT232 or similar

2. CY8C3446LTI-073

3. Yes, but the Full_Duplex one seemed more appropriate

0 Likes
JoBr_1593366
Contributor II

My combination of the two projects is working now that I've used the interrupt method for the return path. The polling method was dropping many of the characters without transmitting then to the computer.

 

I'm not clear on how the baud rate is controlled though. I just have the computer software set to match the UART component in the project. But can it be changed?  It's not clear to me which ends controls the parameters like baud rate, parity, stop bit etc

0 Likes
JoBr_1593366
Contributor II

According to this link, the baud rate doesn't matter for the USB communication, which makes sense, it just gets sent so that the device can configure the baud rate of the hardware it is connected to.  But it doesn't seem like the UART component can be configured like this?  The bits per second is set in the component permanently?  I guess the way is to use an external clock and then configure that clock to change rates?

0 Likes
RaAl_264636
Contributor II

Hi JoBr,

for the USB part, the speed is always the same. A virtual COM port over USB gets the speed change by a special request sent from the VCP driver to the USB device, which then changes the speed of the physical UART. If I remember correctly, the USB component provides functions for detecting this, check the USB component datasheet with keyword 'line changed' and 'bits per second'. Those functions should enable you to detect a change in configuration and read out the requested UART baudrate.

For the UART component, unfortunately they don't provide run-time configuration regarding speed or databits, etc.
You can use an external clock component and try to configure the divisors, or you use a fixed clock frequency component in combination with a dedicated clock divider component. There's no way to change the number of databits at runtime.
Devices with SCB (Serial communication Block) like PSoC4 (not PSoC 5LP) would support run-time config.

Regards

JoBr_1593366
Contributor II

Thanks.  Your message ended up in my spam folder, but I did find these pages describing it and have gotten it working:

https://community.cypress.com/t5/Knowledge-Base-Articles/How-to-Change-the-UART-Baud-Rate-During-the...

https://community.cypress.com/t5/PSoC-6-MCU/How-to-change-UART-baud-rate-during-run-time/m-p/155225#...

(With PLL/Master clock generating 44.308 MHz, which divides down to every standard rate with <.2% accuracy but is still close to the 50 MHz max clock of the IC)

 

if (USBUART_IsLineChanged())
{
    uint32 new_rate;  // Could be as high as 1843200
    new_rate = USBUART_GetDTERate();  // Data rate in bits/s
    if(new_rate != data_rate)
    {
        UART_CLK_SetDividerValue(44308000/(new_rate*8));
        data_rate = new_rate;
    }
}

 

0 Likes