cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
NasimS
Visitor
Visitor
283 Views
Registered: ‎12-09-2020

No data received without xil_printf

Hello,

I have developed a code for a peripheral that needed to be controlled by ZCU111. The below lines show part of that code; with xil_printf("SentBytesCount? = %d \n", SentCount), the data is being received but upon commenting out this line, there is not any received data. I was wondering whether you could provide some feedback on how to address this issue because, in the final version of the code, xil_prinft should be commented out.

Sincerely,

Nasim

 

 

Code:

SentCount = XUartLite_Send(&Uart, &SendBuffer_mon[MC], MN);

xil_printf("SentBytesCount? = %d \n", SentCount);

ReceivedCount = XUartLite_Recv(&Uart, &RecvBuffer[0],ii);

Tags (2)
0 Kudos
5 Replies
Nikhil_Thapa
Explorer
Explorer
265 Views
Registered: ‎05-28-2020

Hi @NasimS ,

upon commenting out this line, there is not any received data.

How did you verify that was not receiving any data?

In my view, you can store SentCount value to another integer variable to check.

Hope this might help you.

 

Regards,

nikhil@logictronix.com
:::::Do not forget to Accept as solution, give Kudo and Share a post that you think is helpful:::::
NasimS
Visitor
Visitor
231 Views
Registered: ‎12-09-2020

Thanks, Nikhil, I have used a while loop around this part of the code and upon commenting out the xil_printf, the loop never ends. Any help is highly appreciated.

0 Kudos
Nikhil_Thapa
Explorer
Explorer
173 Views
Registered: ‎05-28-2020

Hi @NasimS ,

I have used a while loop around this part of the code

What was the condition that you used for while loop statement? If you used infinite loop condition, like, while(1), then loop never ends whatever code inside the statement until break statement occurs.

Regarding my previous reply, can you store the SentCount value to another variable and then print its value? or you can use simply if-else statement that if certain sent count value is matched, then execute if statement otherwise else statement.

For sent count value matching, you can sent value or character that you already know it.

Hope this might help you.

 

Regards,

nikhil@logictronix.com
:::::Do not forget to Accept as solution, give Kudo and Share a post that you think is helpful:::::
0 Kudos
florentw
Moderator
Moderator
162 Views
Registered: ‎11-09-2015

Hi @NasimS 

You might want to look at the following example application which is doing what you are looking to do:

https://github.com/Xilinx/embeddedsw/blob/master/XilinxProcessorIPLib/drivers/uartlite/examples/xuartlite_polled_example.c

I want to draw your attention to the comment before the receive command:

* Receive the number of bytes which is transferred.
* Data may be received in fifo with some delay hence we continuously
* check the receive fifo for valid data and update the receive buffer
* accordingly.

So what you are experiencing is probably the delay it takes to get the data into the FIFO. This is why the printf is helping, because it is adding delay to your code.


Florent
Product Application Engineer - Xilinx Technical Support EMEA
**~ Don't forget to reply, give kudos, and accept as solution.~**
NasimS
Visitor
Visitor
110 Views
Registered: ‎12-09-2020

Thanks a lot for the feedback, it was helpful.

 

Sincerely,

Nasim

0 Kudos