UART Buffer Issue

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I have configured the UART for Buffered operation with a buffer size of 128 running at 57.6Kbps.  Using UART_PutArray I have issues sending more than a few characters.

   

At 5 characters, they are all sent correctly, and 6 breaks it.  It looks as if the problem is related to interrupts.  As long as the UART_PutChar routine puts the character directly into the PSOC UART send data register the character are sent.  If the UART_PutChar routine places the character into the buffer then the buffer continues to fill and none of the characters are sent.  The UART_TxBufferWrite increments correctly and the UART_TxBuffer Read stays at zero.

   

The TX - On FIFO Empty interrupt is turned on and it seems like the interrupt is just not firing.

   

Any Ideas?

0 Likes
5 Replies
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Just out of the blue: did you enable global interrupts?

   

Maybe you can post your project here (create a workspace bundle), so we can have a look at it.

0 Likes
Anonymous
Not applicable

Enable Global Interrupts.  Such a simple concept. 

   

I've been writing Assembler and some C programs for 35 years and am once again humbled.

   

Thank you for your quick response.

   

Peter

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I extracted all that initialization stuff into a separate routine named InitializeHardware(). To be honest, more than once i forgot to call it in main().

   

 

   

You are not alone in the dark

   

Bob

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Sometimes this crystal ball thingie on my desk really works

   

What also helps is that I amde this error more than once - this helps learning... Now I started to look, everytime I start a project, through the whole generated/provided code (especially main) and either delete the line or add a comment why I leave it in. This helps me preventing such mistakes.

0 Likes
Anonymous
Not applicable

Hi PeterHouse,

   

 

   

Also, if you are using Interrupt on Rx or Tx, please ensure that the Interrupt is configured to "Level" triggered instead of "Rising" or "Derived". Since UART is a Datapath based component, the interrupt on FIFO's status will remain high till is is cleared. Configuring it as "rising" might result in missing of bytes.

0 Likes