How to trigger the ADC with capture/compare event of TIM2?
Posted: Thu Jun 18, 2015 8:35 am
Hello,
i am working with the STM32F303CC. I want to trigger the ADC with the capture/compare event of the TIM2, but i don't know exactly how to initialize/configure the ADC/Timer
i call it with
Is there a specific order for calling the Driver? Are the configurations correct?
i am working with the STM32F303CC. I want to trigger the ADC with the capture/compare event of the TIM2, but i don't know exactly how to initialize/configure the ADC/Timer
Code: Select all
const ADCConversionGroup adcgrpcfg1 = {
TRUE,
ADC_GRP1_NUM_CHANNELS,
NULL,
NULL,
ADC_CFGR_EXTSEL_SRC(3) | ADC_CFGR_EXTEN_RISING, // CFGR
ADC_TR(0, 4095), // TR1
0, // CCR ADC_CCR_DELAY(4) | ADC_CCR_CKMODE_AHB_DIV2
{ // SMPR[2]
ADC_SMPR1_SMP_AN7(ADC_SMPR_SMP_601P5),
0
},
{ // SQR[4]
ADC_SQR1_SQ1_N(ADC_CHANNEL_IN7),
0,
0,
0
}
};
static const GPTConfig gpt2cfg1 = {
frequency: 100000U,
callback: NULL,
};
i call it with
Code: Select all
adcStart(&ADCD1, NULL);
adcStartConversion(&ADCD1, &adcgrpcfg1, adc_buffer, ADC_GRP1_BUF_DEPTH);
GPTD2.tim->EGR = STM32_TIM_EGR_CC2G
GPTD2.tim->CCMR1= STM32_TIM_CCMR1_OC2CE | STM32_TIM_CCMR1_OC2M(6)
gptStart(&GPTD2, &gpt2cfg1);
gptStartContinuous(&GPTD2, time);
Is there a specific order for calling the Driver? Are the configurations correct?