cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Voyager
Voyager
265 Views
Registered: ‎05-11-2015

funny behavior with PS uart

Jump to solution

 

I'm using the PS uart (Zynq MPSoC) to receive commands I type on a terminal.

The function to receive is called regularly and uses XUartPs_IsReceiveData to determine if there is any new character.

Input characters are copied into a buffer array. If CR (0xD) was received, a flag is set and the whole buffer is copied to another array for another function to process it.

What I observe is:

- I need to hit enter twice to get the command executed, obviously I get the command processed and an 'empty command' error after.

I added a print to return each character typed and read. I expected an echo but what I get is:

- Nothing is printed until I press the first return, then it prints the first character typed. At the second return pressed the whole line is printed out.

The debug print above ends with '\r\n' to force printing.

I'm using Teraterm set up to send CR as a new line, I checked is CR and not CR+LF or LF.

Even funnier: this used to work well but I did some change and I didn't commit the previous code so now it takes longer for not spending a minute.

0 Kudos
Reply
1 Solution

Accepted Solutions
Voyager
Voyager
250 Views
Registered: ‎05-11-2015

 

Well, I found a solution, maybe there are others but this made my day:

I replaced getchar() by XUartPs_RecvByte and it does the job perfectly. It even echoes each character as I type them.

View solution in original post

1 Reply
Voyager
Voyager
251 Views
Registered: ‎05-11-2015

 

Well, I found a solution, maybe there are others but this made my day:

I replaced getchar() by XUartPs_RecvByte and it does the job perfectly. It even echoes each character as I type them.

View solution in original post