You are here

Uart speed problem - 115200bd | Cypress Semiconductor

Uart speed problem - 115200bd

Summary: 8 Replies, Latest post by Phateee_1677816 on 07 Nov 2016 11:53 AM PST
Verified Answers: 1
Last post
Log in to post new comments.
Phateee_1677816's picture
User
20 posts

Hello, 

can me somebody help with uart - speed?

When I set up the speed of uart to 19200bd, all is ok.

When I set up the speed of uart to 115200, I have a problem with receiving the characters.  When I send characters from PC, uart interrupt detects twice more character.

For example:

Send from PC: HELLO

Receive in processor: H, null,E,null,L,null,L, null, O, null. Between characters is received the character: 0 (dec). I use the interrupt:RX FIFO not empty.

But in 19200bd, processor does not receive the character 0(dec).

The uart actual speed is 115196bd  (The CLK of processor is 48MHz). 

I tried to change Oversampling, CLK of processor, Stop bits, but everything does not work. 

Thank you for help:)

user_1377889's picture
User
9596 posts

Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

 

Bob

 

Phateee_1677816's picture
User
20 posts

hello,

I am sending a project...There is CLK 47MHz a speed of uart 115196bd..

user_1377889's picture
User
9596 posts

Set UART "Byte mode" (UART advanced properties)

When you set the Rx and Tx Buffers to 260 and remove your interrupt handling you can use the internal routines. Check for RxBufferSize()  > 0 to see whether a character has been received.

 

Bob

Phateee_1677816's picture
User
20 posts

But it is strange...When I delete interrupt, I need to change logic of receiving datagrams...Sendig in 115200bd works good but receiving not...

user_1377889's picture
User
9596 posts

Probably you are spending too much time in your receiver interrupt handler. Use memset() instead of your for-loop, compile the module with code optimization (Do not forget to declare global vars changed in an interrupt handler as "volatile")

 

Bob

Phateee_1677816's picture
User
20 posts

But I use for-loop only, when the array is full. When I send 10 char, these characters are inserted in array without for loop...(Read char -> insert to array -> increase array pointer -> end)

I used very slow processor - ATmega8 and it has not any problem with speed:)

 

user_1377889's picture
User
9596 posts

See attached project which runs at 1Mbaud

 

Bob

Phateee_1677816's picture
User
20 posts

I find the problem...I call: 

   source = UART_GetRxInterruptSourceMasked();

   UART_ClearRxInterruptSource(source);

in the beginning of interrupt function. But it has to be in the end of this function...

Log in to post new comments.