I want drive the ADC with an external timer, as in the dac example. So, to do it, I have to set in the #adcgroupconvversion only the CR2 value..??
I work so. i define the TIMer7, with a callback that recall the ADC Conversion:
Code: Select all
static void gpt_adc_trigger (GPTDriver *gptp) {
(void)gptp;
adcStartConversion(&ADCD1, &adcgrpcfg1, &adc_message[0], BUF_SIZE);
}
// ----------------------------------------------------------------------------
// --- General Purpose Timer 7 configuration.
static const GPTConfig gpt7cfg1 = {
frequency : 600000U,
callback : gpt_adc_trigger,
cr2 : TIM_CR2_MMS_1, // MMS = 010 = TRGO on Update Event
dier : 0U
};
..and set the ADC so:
Code: Select all
static const ADCConversionGroup adcgrpcfg1 = {
circular : TRUE,
num_channels : ADC_CHANNELS,
end_cb : adccallback,
error_cb : adcerrorcallback,
cr1 : 0,
cr2 : ADC_CR2_EXTEN,
smpr1 : ADC_SMPR1_SMP_AN11(ADC_SAMPLE_15),
smpr2 : 0,
sqr1 : ADC_SQR1_NUM_CH(ADC_CHANNELS),
sqr2 : 0,
sqr3 : ADC_SQR3_SQ1_N(ADC_CHANNEL_IN11)
};
I set ADC pin, and start the ADC-self and TIMer7 in continuous mode.
Why, it doesn't work?