cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 external Timer trigger for ADC

VK.3
Associate II

Hi all.

I'm using STM32F103C and want the Timer1 Capture/Compare event to trigger ADC conversion. Two ADCs operate in dual regular simultaneous mode.

At the moment, I have a working Timer1 with CC1 and CC2 interrupts and two ADCs that operate in dual regular simultaneous mode (software trigger). This configuration works well.

I'm trying to modify the code to trigger ADC conversion with the CC2 event but to no avail.

The code modifications I have tried are

 

// ADC1 config
// ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC2;
ADC_ExternalTrigConvCmd(ADC1, ENABLE);	// added
...
// ADC2 config
// ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC2;
ADC_ExternalTrigConvCmd(ADC2, ENABLE); // added

 

Question: are there any other suggestions that I can try? Am I missing something in the configuration?

2 REPLIES 2
Sarra.S
ST Employee

Hello @VK.3

Make sure TIM1's MOE in TIM1_BDTR is set.

 

 

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.

VK.3
Associate II

Hi @Sarra.S .

Thanks for your reply.

The MOE bit was 0. I set it to 1. But the result is the same. The timer doesn't trigger ADC conversion.