View previous topic :: View next topic |
Author |
Message |
benoitstjean
Joined: 30 Oct 2007 Posts: 566 Location: Ottawa, Ontario, Canada
|
Handling of INT_UART1E interrupt [CLOSED] |
Posted: Thu Nov 26, 2020 10:07 am |
|
|
Device: PIC24EP512GP806
Compiler: 5.026
Hi guys.
Very (very) rarely, the INT_UART1E interrupt is triggered. Don't know when and don't know what causes it and unless I'm not seeing this right, I can't seem to find much info in the full spec sheets or extra specs "Section 17. UART" document. In the full specs, it is referred-to as <U1E – UART1 Error Interrupt> but can't find any much more info.
But when that error happens, it seems that the MCU doesn't process anything afterwards and is stuck there.
In the interrupt routine, I print the status of the following registers and they seem fine but they always seem to have the same values so maybe I should print others?
Code: |
U1STA : 0x0510
U1MODE : 0x8000
U1TXREG: 0x0000
U1RXREG: 0x000A
|
As a temporary measure, I guess I could simply reset the MCU but that's not ideal. Any suggestions or ideas on what else I should look at and how to handle this so that the code simply carries-on?
Thanks.
Ben
Last edited by benoitstjean on Sun Nov 29, 2020 8:12 am; edited 1 time in total |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19515
|
|
Posted: Thu Nov 26, 2020 11:02 am |
|
|
Framing error probably.
You have to read the character. The error clears itself when a character
is read. Untill it is cleared it'll stay set. |
|
|
benoitstjean
Joined: 30 Oct 2007 Posts: 566 Location: Ottawa, Ontario, Canada
|
|
Posted: Thu Nov 26, 2020 11:10 am |
|
|
So in the INT_UART1E interrupt, should I just do a blind getc( UART )? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19515
|
|
Posted: Thu Nov 26, 2020 12:22 pm |
|
|
Yes, the UART errors all 'attach' to the character currently at the top
of the buffer. So when this is read the errors disappear with it (unless there
are multiple errors). |
|
|
benoitstjean
Joined: 30 Oct 2007 Posts: 566 Location: Ottawa, Ontario, Canada
|
|
Posted: Sun Nov 29, 2020 8:11 am |
|
|
Ok thanks. In the interrupt routine, I've added a simple if( kbhit()) getc();
Ben |
|
|
|