I am using the STM32CubeMX to generate low level library for the adc. The code I am using so far works normally using the adc in polling mode. However, I would like to improve my program and call an interrupt service routine (ISR).
I am not exactly sure how to make the program go to the ISR. Currently I have tried to write my ISR code in the stm32l4xx_it.c file like so:
void ADC1_IRQHandler(void)
{
/* USER CODE BEGIN ADC1_IRQn 0 */
uint8_t i;
if(LL_ADC_IsActiveFlag_EOC(ADC1))
{
adc_value[i] = LL_ADC_REG_ReadConversionData12(ADC1);
i ++;
LL_ADC_ClearFlag_EOC(ADC1);
}
else if(LL_ADC_IsActiveFlag_EOS(ADC1))
{
i = 0;
LL_ADC_ClearFlag_EOS(ADC1);
}
/* USER CODE END ADC1_IRQn 0 */
/* USER CODE BEGIN ADC1_IRQn 1 */
/* USER CODE END ADC1_IRQn 1 */
}
However, the program never enters this routine. Is there anyone who has some experience with this? or maybe an example code using stm LL libraries?
Thanks in advance!