2024-12-12 05:04 AM
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?
2024-12-12 05:21 AM
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.