I have come across a very obscure problem. I have a UART running, which collects bytes and interrupts the code to transfer the byte into a circular buffer (nothing exceptional here) and increments the byte count/write pointer.
In my main code loop I periodically check to see if there is a byte received, if so it hangs around a little longer to wait for a second byte to be received (this second byte is sent immediately after the first so it's a very short time). In reality i'm looking for a 5A 5A pair which indicates the start of a new message.
Alowing the program to free run (ie I don't actually read back anything from the buffer), the interrupt triggers and copies my data into the buffer (the debugger shows it and for my test set up I only receive one message), execution is normal.
However, if I put a while() loop in to just hang around for a bit (okay, I'll admit this is debug grade but the proper implementation with a timer doesn't work any better).
volatile uint32_t u32Counter = 0;
while(u32Counter < 0xFFFF);
return 0;
running this code totally blocks this (and all other interrupts in the M4) from running. Similar code with a timer driving a flag is also totally blocked. However the code runs normally, eventually exits and returns to the rest of the execution (where the systick has also stopped and only the super loop runs).
I am at a bit of a loss as to where to start as I have never known interrupts be disabled by while loops. My interrupts still seem to be enabled although I haven't managed to identify a global interrupt disable/enable to check.
The code is being compiled in Rowley Crossworks, uses the SDK supplied by NXP (i'd tell you what version but I can't find one) and otherwise seems to run normally. I wouldn't consider myself a beginner - I've been writing code for some years. I am however foxed on this (inherited) project and would welcome any pointers (no pun intended).