I have an STM32F411VET and I want to have interrupt triggered after ADC conversion is finished. Documentation says following:
In Single conversion mode the ADC does one conversion. This mode is started with the CONT bit at 0 by either:
- setting the SWSTART bit in the ADC_CR2 register (for a regular channel only) Once the conversion of the selected channel is complete:
If a regular channel was converted:
- The converted data are stored into the 16-bit ADC_DR register
- The EOC (end of conversion) flag is set
- An interrupt is generated if the EOCIE bit is set
Then the ADC stops.
Thus, I have following code:
Enabling interrupts
SET_BIT(ADC1->CR1, ADC_CR1_EOCIE);      // enable interrupt generation
NVIC_EnableIRQ(ADC_IRQn);       // allow interrupt in NVIC
__enable_irq();     // change cpu flags to enable interrupts
Configuring ADC
void ConfigureADC()
{
    // PA1 - ADC_IN1
    SET_BIT(GPIOA->MODER, GPIO_MODER_MODE1_0 | GPIO_MODER_MODE1_1); 
    SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);      // enable ADC1 clock
    SET_BIT(ADC1->CR2, ADC_CR2_ADON);       // enable ADC1
    SET_BIT(ADC1->CR1, ADC_CR1_RES_1);      // 8-bit conversion
    SET_BIT(ADC->CCR, ADC_CCR_ADCPRE_0);    // prescaler - /4
    SET_BIT(ADC1->SQR3, 1);     // channel 1 (PA1)
    SET_BIT(ADC1->CR2, ADC_CR2_CONT);       // Continious mode
}
Interrupt handler
void ADC_IRQHandler()
{
    vConverted = true;
    CLEAR_BIT(ADC1->SR, ADC_SR_EOC);        // Software clears EOC flag
}
While in debug mode or reading directly from ADC1->DR register I get a fine result.
Thing that make me worry is that I cannot debug interrupt handler in uVision5 (IDE I'm using).
The problem is that interrupt handler is not being executed and I don't know how to debug it properly.
Thank everyone for help.
 
     
    