cancel
Showing results for 
Search instead for 
Did you mean: 

EOCIE set, EOSIE not set, but EOS triggers and EOC doesn't

rtl
Associate II

Hello!

I am having weird behaviour on my STM32G071 MCU.

I set up the ADC to measure in sequence and I want to get an interrupt when the sequence has finished. The ADC is set up with DMA and I am starting conversions manuallty within my loop that runs once a second.

In the interrupt handler I check for EOS and EOC. When I enable the EOS and EOC I get thousands of EOS interrupts in a second and no EOC interrupts.

When I enable the EOC and disable the EOS I get an EOS interrupt for every channel that I have in the sequencer, but no EOC interrupts. It seems like all the channels are measured during the interrupt, but I shouldn't even have these EOS interrupts. Although this kinda works for my application, this still isn't normal.

When I check the regs, the EOCIE is 1 and EOSIE is 0. I also added the reg data as a file. There you can see that the EOS flag is set, but the EOC is not, while EOCIE is set, but EOSIE is not.

My IRQHandler looks like this:

/**
 * @brief Interrupt handler for ADC.
 */
void ADC1_COMP_IRQHandler(void)
{
    if(ADC1->ISR & ADC_ISR_EOS)
    {   
        adc_seq_completed = 1;
        seq_it++;
        
        ADC1->ISR &= ~ADC_ISR_EOS;
    }
    
    if(ADC1->ISR & ADC_ISR_EOC)
    {   
        conv_it++;
        
        ADC1->ISR &= ~ADC_ISR_EOC;
    }
}

 Has anyone else experienced this? What could cause this?

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

> ADC1->ISR &= ~ADC_ISR_EOS;

This clears all flags except EOS. If you want to clear EOS:

 

ADC1->ISR = ADC_ISR_EOS;

 

 

 

TDK_1-1734031618575.png

 

 

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

3 REPLIES 3
rtl
Associate II

Did some more testing. When I start the ADC with DMA I get only one EOS IT and all channels are measured. Multiple ITs happen when I start a conversion manually by setting the ADSTART bit.

TDK
Guru

> ADC1->ISR &= ~ADC_ISR_EOS;

This clears all flags except EOS. If you want to clear EOS:

 

ADC1->ISR = ADC_ISR_EOS;

 

 

 

TDK_1-1734031618575.png

 

 

If you feel a post has answered your question, please click "Accept as Solution".
rtl
Associate II

Oh wow, thank you!