ADC interrupt never gets called
Hi, i'm struggling with this piece of code here:
int main(void){
UART2_Tx_init();
ADC_interrupt_init();
while(1){
}
}
/***********ADC***********/
void ADC_interrupt_init(void){
RCC->AHB1ENR |= (1U<<0); //GPIOA clock enable
GPIOA->MODER |= ((1U<<10) | (1U<<11)); //set PA5 analog mode
RCC->APB2ENR |= (1U<<8);//ADC1 clock enable
ADC1->SQR3 |= (0x05<<0); //Ch5 in 1st regular sequence
ADC1->SQR1=0;//only 1 ch used
ADC1->CR1 |= (1U<<5);//EOCIE: end of conversion interrupt
NVIC_EnableIRQ(ADC_IRQn);//enable ADC interrupt in NVIC
ADC1->CR2 |= (1U<<1); //CONT: continuous conversion
ADC1->CR2 |= (1U<<0);//ADON: enable ADC
ADC1->CR2 |= (1U<<30); //SWSTART: start conversion
}
void ADC_IRQHandler(void){
if((ADC1->SR & ADC_SR_EOC)!=0) //Check if end-of-conversion interrupt occurred
{
ADC1->SR &= ~ADC_SR_EOC; //Clear EOC flag
uint32_t adc_value = ADC1->DR;
printf("%d \n\r", (int)adc_value);
}
}I'm trying to get an interrupt every time the ADC module complete a conversion and then print the result through an USART interface. I tried the USART interface separately and it seems work fine. Also the ADC1-DR register gets increased or decreased by the action of the potentiometer. The problem in my opinion is that the interrupt function "void ADC_IRQHandler(void)" never gets called so i'm trying to understand why. Someone have an idea? I'm using an STM32F401RE. Thanks in advance