cancel
Showing results for 
Search instead for 
Did you mean: 

Why only one interrupt in two channels ADC sampling

lbapplem
Associate II

Hi experts:

I'm working on STM32U575 evk, using ADC1 including two channels enabe interrupt, attached file is my test project, only one interrupt in the callback function, I don't know why, if I changed the end of conversion selection to end of sequence of conversion, no interrupt triggered, please help to check if anything missing in my project, thanks.

Bill

1 REPLY 1
Saket_Om
ST Employee

Hello @lbapplem 

Your project "test_adc_evk" is correct.
Selection of end of conversion/sequence interruption is done in fie "adc.c":
- setting "hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;" will make ADC interruption trig at each end of conversion (EOC)
- setting "hadc1.Init.EOCSelection = ADC_EOC_SEQ_CONV;" will make ADC interruption trig at each end of sequence (EOS)

 

This configuration is done in function "HAL_ADC_Start_IT()":
      /* Enable ADC end of conversion interrupt */
      switch (hadc->Init.EOCSelection)
      {
        case ADC_EOC_SEQ_CONV:
          __HAL_ADC_ENABLE_IT(hadc, ADC_IT_EOS);
          break;
        /* case ADC_EOC_SINGLE_CONV */
        default:
          __HAL_ADC_ENABLE_IT(hadc, ADC_IT_EOC);
          break;
      }

 

Since interruption is working for initial setting EOC, there is no reason to not work for EOS.
Debug suggestion :
1. Watch ADC status register (SR) flags: when the 2 conversions of the sequence are done, flag EOS should be == 1
Can also be done with "LL_ADC_IsActiveFlag_EOS()".
2. In your current project, after start IT (only for debug), add:

LL_ADC_DisableIT_EOC();

LL_ADC_EnableIT_EOS();

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om