LPTIM count error on STM32L476RG
Hello,
I am experiencing counting errors (specifically overflow counting errors) on LPTIM1.
A bit of context first: the goal is to use the LPTIM1 to count pulses which are first treated by the COMP1 (to convert the input signal into an all-or-nothing signal).
The first round of testing was realised with an external source of power as COMP1's voltage reference (minus input), and there was no issue with the overflow count (which is necessary to allow counting continuity). Thing is: the final board has to be completely autonomous and use as little resources as possible, including the sources of power.
So, the idea was to switch to the DAC as COMP1's voltage reference. Since I've done that, the overflow counting isn't incrementing any more, and the pulse count is wrong. Another round of testing - this time routing COMP1's minus input to an external pin - revealed that if the program is initialised on the external power source, and then switched to the DAC's output, the counting works just fine. But, if the program is initialised with COMP1's minus input on the DAC output, it doesn't work at all (even when replugging the external power source later on).
I have no clue on how to fix this weird behaviour, so here I am.
Thanks in advance for the help.
