cancel
Showing results for 
Search instead for 
Did you mean: 

I am having trouble controlling ADC interrupt routine

joemccarr
Senior

I am using the ADC on an stmf030 nucleo board

I am having trouble with controlling the interrupts.

I am scanning two channels, have eoc & eos enabled to cause an interrupt

I am using software trigger.

My main issue is:  

The ADC ISR keeps firing away without waiting for a trigger. This was

confirmed using a counter in the ISR that increments each time the routine is run.

Software trigger was confirmed by the function LL_ADC_REG_GetTriggerSource(ADC1). 

Intially I trigger the ADC in an init routine to get the first conversion started. 

Anyone have any ideas, I've spent a lot of time with this, and I should of figured it out by now.

Thanks

3 REPLIES 3

ADC_CFGR1.CONT == 1 ?

Read out the ADC registers and check then whether they are set as you expect them to be.

JW

joemccarr
Senior

I wish it was that easy : )

As long as EOC interrupt is enabled EOCIE=1 the ADC keeps converting. Supposed to stop converting after the sequence is done so I really don't know what's going on here. I am converting the two internal channels, temperature and Vref.

The only way to stop the interrupts from happening is to disable the eoc, eos interrupts in the Interrupt Enable Register. EXTEN[2:0] =0 so no external triggers and EXTSEL[2:0] =0 so only software triggering.

CONT = 0 single conversion. Weird, My embedded life.

joemccarr
Senior

BTW, how do I remove "McCarron Consulting" from my user name. Someone at ST must of been getting bored that day.