cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32G0] Analog watchdog interrupt always activated even when the voltage in the guarded window

Houssem
Associate II

Hello,

I am experiencing the AWD interrupt always being activated when using the analog watchdog on the STM32G0B0 to guard channel 0. Here is my configuration:

systemclock = 64MHz
 
ADC ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4
 
Resolution = 12B
 
ContinuousConvMode = ENABLE
 
overrun = ADC_OVR_DATA_OVERWRITTEN
 
SamplingTimeCommon2 = 160.5
 
 OversamplingMode = ENABLE
 
 Oversampling.Ratio = ADC_OVERSAMPLING_RATIO_32
 
 Oversampling.RightBitShift = ADC_RIGHTBITSHIFT_5
 
 Oversampling.TriggeredMode = ADC_TRIGGEREDMODE_SINGLE_TRIGGER
 
 TriggerFrequencyMode = ADC_TRIGGER_FREQ_HIGH

and for the AWD config:

 AnalogWDGConfig.WatchdogNumber = ADC_ANALOGWATCHDOG_2;
 
 AnalogWDGConfig.WatchdogMode = ADC_ANALOGWATCHDOG_SINGLE_REG;
 
 AnalogWDGConfig.Channel = ADC_CHANNEL_0;
 
 AnalogWDGConfig.ITMode = ENABLE;
 
 AnalogWDGConfig.HighThreshold = 0xFFF;
 
 AnalogWDGConfig.LowThreshold = 3000;

In this configuration, the AWD interrupt was consistently triggered even when the guarded channel was directly wired to 3.3V, and the measured ADC value that triggered the interrupt was 0xFFF! After making some (illogical) updates, the interrupt is no longer being generated, indicating that the AWD is now functioning properly. These updates include:

  1. Lowering the LowThreshold to a value less than 300, even though the measured value was 4095!
  2. Updating the RightBitShift according to the Ratio using the following method: Referring to Table 63 in the reference manual, the RightBitShift should be the first value after the truncation. This means that:
  • A ratio of 32 should have a shift value of 1
  • A ratio of 64 should have a shift value of 2"
  • ...

0693W00000bhCQLQA2.pngThe behavior of the AWD being consistently triggered is present on both AWD2 and AWD3. However, according to the errata sheet, only AWD1 has some limitations.

Can you please explain the behavior to me and how to fix that?

Thanks.

1 REPLY 1
Houssem
Associate II

Hello @Amel NASRI​ 

Could you please check this problem, and if there is a workaround to be used?

for my application, I need ratio 32 and bitshift 5

Thanks in advance