Showing results for 
Search instead for 
Did you mean: 

STM32U5A5ZJ comparator interrupts



We have a custom board based on the STM32U5A5ZJ, and are in the process of writing a zephyr driver for the two analog comparators on the MCU. Our use-case requires the driver to support interrupts on both comparators. Looking at the reference manual, it seems that the two comparator instances have dedicated interrupt lines going into the EXTI (lines 17 and 18). However, neither of these EXTI lines are mapped into the NVIC. Instead, the NVIC has a single IRQ line (no. 72) for COMP1/COMP2.

As a stop gap, we have enabled interrupts on COMP1, but are forced to use polling for detecting state changes on COMP2 (non-ideal). Hence, we were wondering how one could possibly use/enable both comparator interrupts simultaneously from a zephyr context?

Any tips/suggestions would be appreciated. Thanks!


Enabling the option CONFIG_SHARED_INTERRUPTS allows us to use two comparator nodes with the same IRQ number. This is a significant improvement over polling, with the minor caveat that the ISR still needs to determine which comparator triggered the interrupt. Given the lack of demonstrable examples using the EXTI controller with Zephyr, we'll be proceeding with the shared interrupts option in the interest of time.