cancel
Showing results for 
Search instead for 
Did you mean: 

Not getting all ADC end of conversion interrupts

Vandermyer
Associate II

I'm using the STM32L475 processor with STM32CubeMX 6.11.1.

I have configured ADC1 to read two channels, an external input and the internal temperature - see configuration image in CubeMX. The code to drive the adc reading is simple:

int16_t Channel;
void Adc_Convert(void)
{
    Channel = 0;
    if (HAL_ADC_Start_IT(&hadc1) != HAL_OK)
    {
        for(;;) ;
    }
}

void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef * hadc)
{
    Adc.Result[Channel] = HAL_ADC_GetValue(hadc);
    Channel++;
}

void HAL_ADC_ErrorCallback(ADC_HandleTypeDef * hadc)
{
    uint32_t err = HAL_ADC_GetError(hadc);
}

Adc_Convert()  is called once every 2 seconds. I only ever get 1 end-of-conversion interrupt, so the temeprature input is never being read - I can see this both by looking at the Adc.Result array and by using breakpoints to confirm. HAL_ADC_ErrorCallbackI() is never called.

This seems quite a minimal example of trying to use the ADC with interrupts, so what is going on?

All suggestions or help appreciated.

0 REPLIES 0