Its not enough to just post code to get help, generally speaking.
There are other issues that can affect troubleshooting, like HW
Consider posting your project, makes life easier to troubleshoot.
“Create Workspace Bundle”
Do you get inside the while loop ?
This has conflicting data types -
The pattern of 256 values in send array repeats 16 times because you declared it
You might also want to increase your heap size -
The heap and stack size were reduced in 3.1, try restoring to 3.0 levels 4K and 16K respectively.
3.1 default settings are now 128 bytes and 2K.
So, I applied the changes as suggested, it seems smart to do. The problem that I'm having is, my program runs up to the while loop, and stays in the loop since neither of my if statements meet their conditions, so the program never advances past the while loop.
what I should ask is:
How does the status register update? shouldn't the status register of the UART automatically update?
for example if I'm reading the status register of the UART transmit, with it being intialized, but not used, shouldn't the follwing if statement evaluate to being true?
or am I approaching this idea from a wrong direction?
I am stumped. If the Tx FIFO is full when you enter
the while, then nothing gets sent out. I looked at init
description, says nothing about clearing Tx FIFO, so
could it be full on startup ? Just a thought.
Maybe Bob can take a look at this. He knows quite a lot about
What first jumps to my mind: Interrupts should be enabled (usually).
There is an error: insert a #include <stdio.h>
to have sprintf() resolved.
will fail: In the beginning, after initialization UART_TX_STS_FIFO_EMPTY will be set, too so the result will never be equal to your questioned UART_TX_STS_FIFO_NOT_FULL.
Better use if(UART_ReadTxStatus() & UART_TX_STS_FIFO_NOT_FULL ) which will be true, when the bit is set.
Same applies to _ReadRxStatus().
Lastly: in the embedded world you always hafe an infinite loop that repeats until powerr switched off. When your main() returns when reaching the end, do you know what will happen?
Better put an infinite loop at the end to wait or put the whole sending & revieving part into an infinite while-loop.
I looked at UART Init code, several ap notes, cannot see where
FIFOs get cleared ? So do they startup with "junk in them ?
I trust in the underlying UDB or FF block will be cleared at initialization, I tested and after _Start() the FIFO flags show not full and empty, no errors set.
I will post a case on this. No where in TRM, ap note on startup,
Datapath, etc.. does FIFO getting cleared stated.