‎2023-04-25 11:00 AM
Why is there such a limit? As good as this watchdog is, this limit makes it kind of useless. Its it a typo? It worked with 3300 though, when altereing the generated code.
‎2023-04-25 11:39 AM
You appear to have already set low threshold to 3500, and CubeMX tries to prevent you to set the upper threshold below the lower one.
JW
‎2023-04-25 12:46 PM
Damn! how could i miss this? This is embarassing...
‎2023-04-25 11:18 PM
It's all good, the community is a place to solve problems and answer questions. It's always perfectly clear - afterwards, right? ;)
Nevertheless, such questions should remain, because other users are guaranteed to stumble over them.
By the way, you can also swap the thresholds of the analogue watchdog so that no interrupt is triggered when you leave the area, but when you enter it. At the latest here, the limits of a programme generator like STM32CubeMX become clear, because it can check this case badly. But as Jan already said, you have all the freedom in the generated code.
Good luck!
Regards
/Peter
‎2023-04-26 05:11 AM - edited ‎2023-11-20 07:09 AM
Hi Peter,
> By the way, you can also swap the thresholds of the analogue watchdog so that
> no interrupt is triggered when you leave the area, but when you enter it.
Are you sure?
My reading of RM is different:
According to this description, if you swap the thresholds, the status bit would be one all the time.
Jan
@peter BENSCH​
‎2023-04-26 05:27 AM
@Community member​ Pretty sure. The RM0316 says:
The AWD1 analog watchdog status bit is set if the analog voltage converted by the ADC:
It does not say that the Higher Threshold HTx should have a larger value than the Lower Threshold LTx. So it should be possible to declare HTx smaller than LTx. Maybe not with CubeMX, but in the generated programme.
I had already had exactly this case with an older STM32, where an interrupt should be triggered when entering the area and not when leaving it - even if that was many years ago.
/Peter
‎2023-04-26 07:49 AM
@Peter BENSCH​ ,
I've just tried on an STM32F407, and it does not work in the way you've said - as soon as ADC_HTR<ADC_LTR, ADC_SR.AWD = 1 in all 3 bands (i.e. above LTR, below HTR, and in between).
Now my adage is that ADC is the most varying module across STM32 families, so this is not to say that it won't work in the way you've described on an 'F3 or on the older STM32 (was it an 'F1?).
Jan
‎2023-04-26 08:16 AM
@Community member​ Interesting, I had indeed done this with the F1, but had not yet tested it with the F3 and only extrapolated theoretically because the description is essentially identical. Thanks for checking, sorry to have raised false hopes. :|
/Peter