Atmega324p USART UDRIE interrupt and UDRE flag

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi I have a simple question regarding the USART Data Register Empty flag. If the USART Data Register Empty Interrupt Enable bit is set in the UCSR0B register will the ISR(USART0_UDRE_vect) constantly interrupt until data is placed into the Transmit buffer?

This topic has a solution.

--CJ7--

Last Edited: Mon. Nov 6, 2017 - 07:07 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Yes.
Interrupt processing will occur again even if it exits from an interrupt unless you place transmit data or disable interrupts.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kabasan wrote:
unless you place transmit data or disable interrupts.
...or disable that particular interrupt.

 

A straightforward question.  How would I go about answering it?  I'd go to the datasheet.  What would a typical AVR8 datasheet say?

 

...

When the Data Register Empty Interrupt Enable (UDRIEn) bit in UCSRnB is written to one, the
USART Data Register Empty Interrupt will be executed as long as UDREn is set (provided that
global interrupts are enabled). UDREn is cleared by writing UDRn. When interrupt-driven data
transmission is used, the Data Register Empty interrupt routine must either write new data to

UDRn in order to clear UDREn or disable the Data Register Empty interrupt, otherwise a new
interrupt will occur once the interrupt routine terminates.

...

 

But true, one has to actually read the USART chapter to find the above; it is not in the register/bit descriptions.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.