What should I pay attention to when UART interrupts are used?

Viewed 47

I have some confusions below:

if the UART has a byte to read,so an interrupt is executing,when should I clear the RX mask?

  • if at the beginning,what will happen when a new rx interrupt is generated while current one has not finished yet?
  • if at the end,new interrupts may be missed.Two bytes are received(two inttrupts should have been generated) when last interrput is not finished.Then I will miss a byte.

Which way is better?

I've read some codes,disable the interrupt at the beggining of the irq handler and enable at the end.Under what situations should I do like this?

0 Answers
Related