- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I am new in community and its my first question about PsoC4 - forgive me mistakes . I'm working with CY8C4248LQI-BL583 from Cy8ckit-042-BLE-A kit and i have problem with buffer when i use two separate UARTs.
So in details:
- I have two UART blocks (say UART_1 and UART_2) both are configured with buffer Rx and Tx 128 bytes.
- UART_1 baud is 115200;
- UART_2 baud is 460400 (used external clock generated by cy_clock)
- UART_1 nad UART_2 buffers are read in program without interrupt (main function)
- from UART_1 and UART_2 i want read data from buffer;
- UART_1 works ok (received data are stored in circular buffer up to 128 bytes)
- UART_2 not work ok (received data are stored in circular buffer up to 8 bytes - should be 128 as configured)
Now my question is that why second UART is not working ok like UART_1 ? Should i configure something special for it when i need to use two separate circular buffer ? or it's bug in Creator ?
I have no idea how resolve problem (of coursce i can try write own circular buffer for both UARTs i think, but why Creator works only with one UART)
With best regards
Wiktor
Solved! Go to Solution.
- Labels:
-
PSoC 4 Architecture
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello WiWi_4415241
I have attached a similar project with 2 uarts. This was found to be working at my end. Please try this and let us know the result.
Thanks and regardsHarigovind
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't know if this is a root cause.
You said the UART_2 uses an external clock generated by a cy_clock component.
What is the frequency of the external clock?
What is the oversampling rate of UART_2?
When UART_2 is configured as x12 oversampling rate and 460400bps baud rate, a warning appears saying "UART Tolerance exceeds recommended maximum of 2.5%" This means the UART interface may not be used for that baud rate.
Please try to change the oversampling rate to 8 for a better baud rate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm sorry for mistake - UART_2 baud should be 460800 (not 460400 as i write before).
In top design it looks:
Settings of UartCLK as external clock for UART_2:
And UART_2 configuration:
It's not exacly 460800bps but still is in tolerance.
One thing - when in project is only one UART_2 use it works with buffer ok. But problem occure when i add UART_1 with that same parameters with 115200 baud.
I will try change oversampling and see what will be the effect.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nothing change. Still that same problem - not used 128 bytes buffer but one thing is change. Not 8 bytes are stored but 9 (used SpiUartGetRxBufferSize() function).
Additional i see that second read byte is Null but should be "O" - 0x4F. In both situation is that same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It seems that the software buffer takes long time. Can you try to use a DMA at the RX part of the UART_2?
There is a code example "DMA_UART_PSoC4" using UART with DMA.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello WiWi_4415241
I have attached a similar project with 2 uarts. This was found to be working at my end. Please try this and let us know the result.
Thanks and regardsHarigovind
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello again, I am sorry for disappear for few days - short holidays.
Thank you AH_96 for sample. It looks like it solves my problem. I have no idea why in my configuration it was not working. Anyway i will use your code and adapt it to my project. let's see if it works
Thank you all for help.