2025-04-08 12:28 PM - edited 2025-04-08 12:29 PM
I am starting to experiment with stm32f411vet6 (discovery), looking forward to learn and help.
On Live Expressions (Debug by STM32CubeIDE, I choose to run by Resume).
Without a code "HAL_ADC_Start_DMA(&hadc1,(uint32_t*) &ADC_Value, 1);" : The program works and "Count_While" works right!
However, when the code is available "HAL_ADC_Start_DMA(&hadc1,(uint32_t*) &ADC_Value, 1);" : The value of "ADC_Value" is always constantly updated, but "Count_While" stops at the value of 1. I try to run with "Step Over" then: I can't continue "Step Over" after running the code: "HAL_Delay(500);". My program is stopped here! So what are the fault possibilities?
Thanks!
uint16_t Count_While = 0;
uint16_t ADC_Value;
int main(void)
{
HAL_Init();
MX_GPIO_Init();
MX_DMA_Init();
MX_ADC1_Init();
HAL_ADC_Start_DMA(&hadc1,(uint32_t*) &ADC_Value, 1);
while (1)
{
Count_While ++;
HAL_Delay(500);
}
}
2025-04-08 1:05 PM
I suggest to use volatile keywords because your code looks so easy, that the compiler optimized out some unused variables and second one, look in assembly code what is doing your uE.