2023-08-29 09:45 AM
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?
2023-08-31 02:01 AM
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.
2023-09-01 07:55 AM
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.