UART1_Handler, Clear Pending Interrupt

AT91SAM9 Evaluation Boards

Moderator: nferre

MAJIKAT
Posts: 2
Joined: Fri Jun 27, 2014 10:02 pm

UART1_Handler, Clear Pending Interrupt

Thu Jul 03, 2014 8:38 pm

Hi, everyone. I'm writting a program that uses the UART1_Handler, the poblem I have is that I can't figure out how can I clear the Pending Status of an Interrupt. I have already used the function NVIC_ClearPendingIRQ(UART1_IRQn), but It still don't work; It still gets looped in the Handler.

If you could give me and avise or a hint It'll be very useful.

Thanks, MAJIKAT
blue_z
Location: USA
Posts: 1547
Joined: Thu Apr 19, 2007 10:15 pm

Re: UART1_Handler, Clear Pending Interrupt

Thu Jul 03, 2014 9:39 pm

MAJIKAT wrote:I have already used the function NVIC_ClearPendingIRQ(UART1_IRQn), but It still don't work; It still gets looped in the Handler
For that operation to be effective, you need to first remove the condition(s) that caused the interrupt. As long as the underlying condition(s) persists, the (enabled) interrupt will be triggered.

The general procedure for servicing or handling a UART interrupt is:

1. determine the cause of the interrupt (i.e. read status registers)

2. alleviate or service the cause(s) of the interrupt(s).
If it's a receive interrupt, then read from the RxD register to empty that register for the next byte.
If it's a transmit interrupt, then write to the TxD register to load that register with the next byte. If transmission is complete, then transmission should be disabled as an interrupt source.
If it's an error condition, then clear the error.

3. acknowledge the interrupt by clearing the pending interrupt.

Regards
Last edited by blue_z on Thu Jul 03, 2014 11:20 pm, edited 1 time in total.

Return to “Evaluation and Development Boards”

Who is online

Users browsing this forum: No registered users and 1 guest