STM32F746 Disco, STM32CubeIDE 1.7.0, Win 10, CMSIS-only, C language, on registers.

I'm writing a UART transmit driver on interrupts (load data into buffer array, automatically fetch it from there with interrupts when byte is loaded into tx shift register). Development is mid-way.

I've set up UART, set up NVIC. No problems so far.

The question about UART side of interrupts: if TXE becomes set while TXEIE is 0 (UART TXE interrupt disabled), but then I enable TXEIE, will TXE interrupt fire or do I have to manually check the state of TXE at that moment?

State 1: TXE = 0, TXEIE = 0
State 2: TXE = 1, TXEIE = 0
State 3: TXE = 1, TXEIE = 1

Does interrupt fire?

Also, similar question about NVIC:

If USART1 (or whatever other) peripheral sends an interrupt, but it's not enabled in NVIC, will it trigger an interrupt when I enable this interrupt in NVIC? (according to programming manual and my logic, it should simply be ignored and discarded at the time of arrival from USART to NVIC, I think, but I want confirmation/debunk)

  • 2
    \$\begingroup\$ Why not test it? It's likely faster to test than to read reference manual. \$\endgroup\$
    – Justme
    Feb 1, 2022 at 13:29
  • \$\begingroup\$ @Justme true statement. I thought about it, given the code is pretty much ready to test it. Still, it would be nice if someone could also point to the specific piece of documentation that covers that. Knowing it is one thing, but having a general skill of sifting out this kind of knowledge from the docs is better. But yes, I agree with your statement in general. \$\endgroup\$
    – Ilya
    Feb 1, 2022 at 13:35

1 Answer 1


You could read up on interrupt handling by reading about NVIC in the programming manual.

Regarding this specific question, yes, the interrupt will fire as soon as the interrupt is enabled. The programming manual says the following:

If a pending interrupt is enabled, the NVIC activates the interrupt based on its priority. If an interrupt is not enabled, asserting its interrupt signal changes the interrupt state to pending, but the NVIC never activates the interrupt, regardless of its priority

  • \$\begingroup\$ I was just reading the programming manual about the NVIC. So do I get it right that the interrupt can become pending (pending register bit to 1) even if interrupt is disabled? It simply won't be executed? I thought initially that those interrupts that are not enabled also can't be pending. I take it this statement is wrong then. \$\endgroup\$
    – Ilya
    Feb 1, 2022 at 13:45
  • 1
    \$\begingroup\$ Yes, as the quote says, the disabled interrupt will be pending but not activated (ISR not called) if the interrupt is not enabled. As soon as the interrupt is enabled, it will be activated (ISR called) as it is pending in NVIC. \$\endgroup\$
    – Klas-Kenny
    Feb 1, 2022 at 13:50
  • \$\begingroup\$ thanks, that answers it. I just like having explicit confirmation. As for UART, I got a hint that the interrupt will fire as well (and will continously fire until I clear TXE). \$\endgroup\$
    – Ilya
    Feb 1, 2022 at 13:52
  • \$\begingroup\$ There is one important difference between enabling interrupt in the NVIC and in a peripheral. The above statement in the manual refers to the former while Ilya might be referring to the latter as per his question. So, an interrupt becomes pending when it is enabled and triggered in the peripheral. Then, if it's ALSO enabled in the NVIC, it begins to execute its ISR. \$\endgroup\$
    – neoxic
    Feb 19 at 23:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.