cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32F303] ADC1 watchdog high Threshold limited at min 3500???

Tobe
Senior III

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.

7 REPLIES 7

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

Damn! how could i miss this? This is embarassing...

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

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:


_legacyfs_online_stmicro_images_0693W00000bisLnQAI.pngAccording to this description, if you swap the thresholds, the status bit would be one all the time.

Jan

@peter BENSCH​ 

@Community member​ Pretty sure. The RM0316 says:

The AWD1 analog watchdog status bit is set if the analog voltage converted by the ADC:

  • is below a lower threshold
  • or above a higher threshold.

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

@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

@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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.