cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743II:why can't AWD2 and AWD3 monitor ADC3 but AWD1 can?

LLLLxy_0904
Associate

Post edited by ST moderator to be inline with the community rules for the code sharing. In next time please use </> button to paste your code. Please read this post: How to insert source code.

HI ALL:

    In my project, I use AWD1 to monitor ADC3_CHN1, then set the high and low threshold, it works very well. 

     However, when I switch to AWD2 and AWD3, there is no interrupt triggered, the setting codes are below:

    The configuration for AWD1:

AnalogWDGConfig.WatchdogNumber = ADC_ANALOGWATCHDOG_1;
AnalogWDGConfig.WatchdogMode = ADC_ANALOGWATCHDOG_SINGLE_REG;
AnalogWDGConfig.Channel = ADC_CHANNEL_1; // output1 current
AnalogWDGConfig.HighThreshold = 800; 
AnalogWDGConfig.LowThreshold = 500; /
AnalogWDGConfig.ITMode = DISABLE; 
HAL_ADC_Stop(&hadc3);
if (HAL_ADC_AnalogWDGConfig(&hadc3, &AnalogWDGConfig) != HAL_OK) {
Error_Handler();
}
HAL_ADC_Start(&hadc3);


LL_ADC_ClearFlag_AWD1(hadc3.Instance);
LL_ADC_EnableIT_AWD1(hadc3.Instance); 

 

The configuration of AWD2 and 3:

AnalogWDGConfig.WatchdogNumber = ADC_ANALOGWATCHDOG_2;
AnalogWDGConfig.WatchdogMode = ADC_ANALOGWATCHDOG_SINGLE_REG;
AnalogWDGConfig.Channel = ADC_CHANNEL_1; // output1 current
AnalogWDGConfig.HighThreshold = 800; 
AnalogWDGConfig.LowThreshold = 500; /
AnalogWDGConfig.ITMode = DISABLE; 
HAL_ADC_Stop(&hadc3);
if (HAL_ADC_AnalogWDGConfig(&hadc3, &AnalogWDGConfig) != HAL_OK) {
Error_Handler();
}
HAL_ADC_Start(&hadc3);


LL_ADC_ClearFlag_AWD2(hadc3.Instance);
LL_ADC_EnableIT_AWD2(hadc3.Instance); 

 

The configurations are almost same, I wonder that whether the AWD2 and AWD3 support ADC3?  If support adc3,  Where is the problem with my code?

 

2 REPLIES 2
LLLLxy_0904
Associate

someone?

waclawek.jan
Super User

Contrary to watchdog 1, which can check only one channel (or all), watchdogs 2 and 3 can be set to check a set of channels, see Analog window watchdog subchapter of ADC chapter in RM. I wouldn't be surprised if this difference would mean a different API in Cube/HAL. I don't use Cube/HAL, but it's open source so you can check yourself.

I suggest to start with observing the ADC registers and comparing them between those two (working/non-working) cases; and then wind that back to how Cube sets those registes.

JW