Hi Mario, The Tx Interrupt flag is Tx buffer empty. I disable the Tx interrupt until I wish to send something, at which point I put it in a Tx Buffer, Enable the Tx interrupt and forget it. In the Tx interrupt itself, clear the flag, if the buffer is not empty send the next 4 characters, if it is empty, disable the Tx interrupt. I hope that is clear, I was also confused by the Tx Interrupt until I realized it was working opposite to the way I expected. i.e. not like a PIC16. Cheers Chris On 11 December 2011 21:01, Electron wrote: > > Hi all, > > I'm trying to replace a "send one byte at a time" PIC32 routine into > an interrupt driven one, so that the sending gets into the background. > > I have a weird problem though, it seems like I didn't clear the TX Int > status flag, although I do. In other words, even if I don't send any > byte yet, the UART2 vector will be called (with the U2TX status flag > set), but I didn't send any byte yet and I cleared the Int status flag > before enabling the (multivectored, by the way) interrupts!! > > I do clear the flag in the interrupt routine (but the debugger doesn't > show any IFS1 register update, like if it was write-protected!!!), > however after the ERET instruction, the CPU immediately executes the > vector again, which is pretty easy to guess as the status flag doesn't > want to get cleared! (neither if I write the register, or use the CLR > version of it). > > I've read the datasheet and Family Reference a couple of times already, > I don't think I'm doing anything wrong, it even looks pretty clear and > simple to me what to do, but yet I'm stuck on this problem, which appears > like the interrupt status flags U2TX U2RX and U2E are always stuck at > "1" if the module is ON, and I can't clear them. > > Any idea? > > With kind regards, > Mario > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .