UART and debugger questions/problems

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hello all,

   

I am using CY8CKIT-050. I built a simple UART project. However I have encountered two hurdles:

   

1) UART Tx is sending garbage. In the attached project I am trying to parse a known string, and send the parts of it to the remote com. Problem is when the string gets parsed the known good data strings UTCtime, Latitude, Longitude(verified in debug mode) is sending out as garbage which appears to be even longer in size then the declared size of the char arrays. There is no problem with sending out known static string, such as original sting or some other constant value.

   

 

   

2) The values of the char variable LatitudeNS changes as the sorting progresses (from 'N' right after correct sorting to '1' right before the transmitting out). The weird part it changes in the place of the code that has nothing to do with it. Right after change 1 is identified by red color in the debugger. 

   

What does the red color of variable in debug mode identify? Recently changed/accessed value?

   

Couple of things about these two things - I realize that they must be very basic and I am missing something very trivial or there is an explanation to this that makes complete sense. However I am failing to grasp it. Please help.

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

Welcome in the forum!

   

UART_PutString() handles C-Language strings which always have to be NULL-terminated. If your string lacks the terminator, the function will start to send chars out until it finds a \0 by accident.

   

PutString() and PutChar() are "blocking" functions which means that they check for themselves for a free buffer and wait until all their characters are stored (but not yet transmitted. So there is no need for you to wait for an empty FIFO.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

 Thank you. Null termination is exactly what I was missing.

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

You are always welcome!

   

 

   

Bob

0 Likes