[TM4C123] Question about extint module

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
Posts: 72
Joined: Sat Oct 20, 2018 4:02 pm

[TM4C123] Question about extint module

Post by ExXec » Tue Feb 19, 2019 5:39 pm


I have a question about the extint module.
The value of PYB_EXTI_NUM_VECTORS is defined as 23 in the STM32 port. What does that number represent?
Is it the number of NVIC registers or total number of interrupts?

And if possible, can someone briefly explain what the extint module does? bc there is already the irq module, whats the difference?



User avatar
Posts: 3241
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada

Re: [TM4C123] Question about extint module

Post by dhylands » Tue Feb 19, 2019 5:58 pm

The ExtInit module is the python interface to the STM32 EXTI module, which you can find documented in the reference manual.

Here's a link to the reference manual for the STM32F405: https://www.st.com/resource/en/referenc ... 031020.pdf

The PYB_EXTI_NUM_VECTORS reflects the number of "lines" which the EXTI peripheral supports. If you look on page 383 (12.2.5 External interrupt/event line mapping) it shows how the lines are mapped.

The first 16 lines map to GPIO pins, and lines 16-22 map to RTC/ethernet/USB/PVD signals. These mappings can be processor specific. The EXTI module can be used to detect changes on the GPIO lines (rising or falling edges) and to detect certainother events (like RTC Alarms).

The EXTI module also has interrupt lines in the NVIC. The NVIC table starts on page 372. Sometimes multiple EXTI lines are mapped onto a single interrupt line. For example, EXTI lines 5 thru 9 all map onto NVIC/irq vector 23. These mappings can also be processor specific.

I view the primary purpose of the ExtInt module to support pin change interrupts, as this is the only way on the STM32 to get notified of pin changes. Other processors support pin change on every GPIO. The STM32 doesn't. For example, you can't detect pin change on B12 and C12 at the same time, because they both get mapped to EXTI line 12.

Post Reply