March 16, 2025

Black Pill boards - F411 USB -- Interrupts and the STM32 NVIC

The NVIC is the "nested vector interrupt controller". The TRM gives no details and refers you to another document, namely PM0214. This is a 262 page PDF file and it is not all about the NVIC (thank goodness), but is a general programming manual for Cortex-M4 based STM32 chips like the F411 and F429

Pages 208 to 220 cover the NVIC.

I am going to bypass digging into this right now.

Currently the serial drive for Hydra just has a super simple non-interrupt routine to send characters. It spins until the transmitter is empty, then sends the character.

The word "nested" in NVIC makes me curious. What happens if both the USB and the serial port are using interrupts and one interrupts while an interrupt for the other is already being handled? Can we really handle nested interrupts if the device interrupting is higher priority?

The NVIC allocates an 8 bit priority field for each interrupt. So it would seem that 256 interrupt priority levels are available. This will be worth digging into someday to ensure that USB is high enough priority when things like timers and serial ports start generating interrupts.


Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org