STM32 USART Lecture 13 – USART interrupt discussion

  • Post author:
  • Post category:Blog

 

USART interrupt discussion

 

 

In this article, let’s discuss USART interrupts.

The interrupt events triggered by the USART peripheral are, as listed in Figure 1, and in the third column, you can see the respective control bits.

In the event flag column, you can see the flags corresponding to each event, which will get set when the corresponding event happens during the UART communication, and the setting of any of these flags have the capacity to generate interrupts only if the respective control bits are enabled.

USART interrupt discussion
Figure 1. USART interrupt requests.

 

Some important interrupt events triggered by the USART peripheral is listed as follows:

  1. Transmit Data Register Empty: This is actually a TXE interrupt.
  2. CTS flag: this is to do with hardware flow control. That means when a CTS flag is set, it can generate an interrupt if the CTSIE control bit is enabled.
  3. Transmission Control (TC)
  4. Received Data Ready to be Read: This is actually an RXNE interrupt.
  5. Overrun Error Detected: Whenever an overrun happens during the reception, then it can generate an interrupt if the RXNEIE control bit is enabled.
  6. Idle Line Detected: After transmitting all the frames, the line becomes idle, which is actually an idle line. Whenever an idle line is detected, it can also generate an interrupt if the IDLEIE bit is enabled in the control register.

 

In Figure 2, you can see a USART interrupt mapping diagram. In which you can see that there is only one line that goes from each USART peripheral, and it will hit the NVIC engine of the processor.

In I2C, you saw two lines coming out from each USART peripheral. One for the error and another for the event. But here, it is not like that. You can analyze the USART interrupt mapping diagram from the reference manual.

USART interrupt discussion
Figure 2. USART interrupt mapping diagram.

 

Exercise:

  1. Complete the interrupt APIs. The implementation of interrupt APIs should be done similar to what you did for I2C and SPI.
  2. After that, give the USART IRQ definition macros in the MCU specific header file.

 

FastBit Embedded Brain Academy Courses

Click here: https://fastbitlab.com/course1

 

FastBitLab

The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.

Leave a Reply