2023-06-09 05:40 PM
I am using an STM32H743ZIT6, and attempting to have COMP1 generate an NVIC interrupt when INP2 is lower than 1/4 Vref_comp.
To this end, I set the POLARITY bit in the comparator configuration register to "1", which successfully 'inverts' the "cmp1_out" value (which is outputting "0"). Unfortunately, as soon as I set "ITEN" to "1" (enable), I get a comparator NVIC interrupt. It is my understanding (per RM0433 Figure 211) that this interrupt should only trigger when "cmp1_out" is "1". I have stepped through the program, and this interrupt is triggering immediately after "ITEN" is set, and "cmp1_out" is still "0".
I have used every comparator speed setting, and every hysteresis option. There is no relevant errata for this device, and I cannot think of any explanation other than the interrupt being triggered by the actual comparator output before polarity inversion.
2023-06-09 11:41 PM - edited 2023-11-20 03:31 AM
you should never get an int , when setup the comp, because :
-> enable comp after doing all settings !
and in comp , change output polarity while comp active, should give a int-signal, just because you generate a transition at the output of comp: