I've been using embedded printf's to try and track down a couple of nebulous problems, but I suspect the printf's might be causing some of their own! The issue I am experiencing is Uart overruns, which only appear to occur when a printf is active.
The uart uses a receive ISR to capture and buffer any incoming traffic (its a bit non-deterministic). When a user request for data is made, it is serviced from this buffer, or stalled until the data is available (a bit more complex than this, but that's the general gist). Since I've started inserting some printf's (all at user mode) , I am seeing some sporadic overruns from the receive ISR.
I have been able to engineer these failures by splitting the user data request into two parts - the first part requests part of the message, and as soon as control is returned to user mode with this data, it executes a printf to the console. Meanwhile, in the background, the receive ISR will still be (or should be) receiving the remainder of the data message, but it will promptly fail with an overrun error. If I remove the printf, it all works fine.
The only mechanism I can see that would explain this, is if the printf is itself suppressing EUSCI (or general) interrupts to the extent that the Uart is losing data. Does this sound reasonable, or is there some other direction I should be investigating? I'm sure I have read some earlier comments that indicated the printf implementation used some uart capability to manage traffic via the JTAG, which may give some credence to this, but it's all of a black box to me.
Any advice, ideas, or comments gratefully received. The console print capabilities are great, but maybe not usable when a uart is active?
Andrew
BTW, I'm using the GCC toolchain, CCS V11.