cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Participant
Participant
2,005 Views
Registered: ‎07-06-2017

Alternative to interrupt-driven XUartLite_RecvByte() function?

Jump to solution

Hello everyone,

 

I have what I think is a fairly straightforward question, I just can't find the documentation to answer it myself and was hoping someone has this knowledge from experience.  Is it possible that in place of the function  "XUartLite_RecvByte()" one could utilize the following:

 

char commandstr[32];

if( !XUartLite_IsReceiveEmpty(BaseAddress) )

{

         commandstr = XUartLite_ReadReg(BaseAddress, 0);

}

 

Is it possible to utilize the USB_Uart input as a non-interrupt driven input with a structure such as the one above utilizing the two given Uart functions?

 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Moderator
Moderator
3,253 Views
Registered: ‎10-06-2016

Re: Alternative to interrupt-driven XUartLite_RecvByte() function?

Jump to solution

Hi @liv37916

 

To be honest I'm not sure what are you trying to implement with that function :)

 

XUartLite_RecvByteis a blocking function that reads the Rx FIFO of the UART. Are you trying to create a non blocking function with the same purpose? in that case you function seems to be correct.

 

Just take into account that FIFO is one byte width so it does not take too much sense to store in a uint32_t variable ;)

 

Regards


Ibai
Don’t forget to reply, kudo, and accept as solution.

View solution in original post

3 Replies
Highlighted
Participant
Participant
1,983 Views
Registered: ‎07-06-2017

Re: Alternative to interrupt-driven XUartLite_RecvByte() function?

Jump to solution

My apologies, that was meant to be "uint32_t commandstr" such that the register contents of the USB_Uart register were stored.

0 Kudos
Highlighted
Moderator
Moderator
3,254 Views
Registered: ‎10-06-2016

Re: Alternative to interrupt-driven XUartLite_RecvByte() function?

Jump to solution

Hi @liv37916

 

To be honest I'm not sure what are you trying to implement with that function :)

 

XUartLite_RecvByteis a blocking function that reads the Rx FIFO of the UART. Are you trying to create a non blocking function with the same purpose? in that case you function seems to be correct.

 

Just take into account that FIFO is one byte width so it does not take too much sense to store in a uint32_t variable ;)

 

Regards


Ibai
Don’t forget to reply, kudo, and accept as solution.

View solution in original post

Highlighted
Participant
Participant
1,901 Views
Registered: ‎07-06-2017

Re: Alternative to interrupt-driven XUartLite_RecvByte() function?

Jump to solution
Ibaie,

I was trying to create a non-blocking function with the same purpose, although my function turned out to be extremely inefficient in comparison and I actually returned to using XUartLite_RecvByte() after figuring that out. Thank you very much for your reply, I had actually changed the storage to a uint8_t variable before reading this. Your post was great ideas for me all around, I appreciate you taking the time!
0 Kudos