Content originally posted in LPCWare by simonbr on Thu Mar 25 02:04:53 MST 2010
Hi,
I want to use the U0FIFOLVL register to see how many characters can still be loaded into the Tx FIFO. But for some reason this does not work.
The relevant piece of code in my "putcom" routine is:
if ((LPC_UART->FIFOLVL&0xF00)!=0xF00) // any space left in FIFO?
{[INDENT] LPC_UART->THR = databyte; // write the character
[/INDENT]}
else
{[INDENT] (...)
[/INDENT]}
What I'm seeing is that the condition never becomes false (a breakpoint in the "else" part never triggers), while after 16 characters the next character is transmitted corrupted; apparently the FIFO is overwritten when full.
I also tried with
if ((LPC_UART->FIFOLVL&0xF00)!=0x800)
but that did not make a difference.
I'm wondering what mistake I made, or whether the FIFOLVL register actually does not show the Tx FIFO level correctly.
Best regards,
Simon Brouwer