Skip to main content
Senior
February 9, 2024
Question

Interrupt mode for ADC reading does not work as expected.

  • February 9, 2024
  • 0 replies
  • 1031 views

hi,

I would like to use HAL_ADC_Start_IT to let the ADC peripheral call interrupt whenever conversion is completed continously. Then I would like to print that converted value via UART.

However, eventhough I select the continous conversion mode enabled, I dont see ADC values changing when I altered the potentiometer. Apparently, HAL_ADC_Start_IT is not called continously.

Please see my code and configuration attached.

On the other hand, when I add the HAL_ADC_Start_IT into callback function as below, then it works as expected. 

Could you pls help me resolve ?

 

 

/* USER CODE BEGIN PFP */

void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc)

{

adcVal = HAL_ADC_GetValue(&hadc1);

HAL_ADC_Start_IT(&hadc1);

 

}

 

/* USER CODE END PFP */

This topic has been closed for replies.