[DONE][STM32F30x] ADC configuration
Posted: Sat Aug 09, 2014 11:17 am
Hi all,
i want to use adc hal in dual mode triggered by timer 1 ccr4. The timer feeds the pulses over TRGO and TRGO2 signals.
my ADCs 1_2 and 3_4 should both trigger on this signal. On both adcs i use 4 channels 2 for each HW ADC, and 8 Smaples / i also tried 32 samples.
But my application runs endless ly through the DMA ISR. any one an idea what is set up wrong?
ADC Config
start code for adc
Greetings
Tec
i want to use adc hal in dual mode triggered by timer 1 ccr4. The timer feeds the pulses over TRGO and TRGO2 signals.
my ADCs 1_2 and 3_4 should both trigger on this signal. On both adcs i use 4 channels 2 for each HW ADC, and 8 Smaples / i also tried 32 samples.
But my application runs endless ly through the DMA ISR. any one an idea what is set up wrong?
ADC Config
Code: Select all
_adcConvGrp1_2({
TRUE, /* circular mode */
U8_NBR_OF_CHANNELS,
NULL,
NULL,
/*
* external trigger from TRGO2 of TIM1 on rising edge
*
*/
ADC_CFGR_EXTSEL_SRC(10) | ADC_CFGR_EXTEN_RISING, /* CFGR */
ADC_TR(0, 4095), /* TR1 */
ADC_CCR_DUAL(1), /* CCR */
{ /* SMPR[2] */
/*
* 20 ADC Cycles Conversion time with 7.5 clocks sample time to get a litle
* extra filtering, OPAMP1 as Input
*/
ADC_SMPR1_SMP_AN2(ADC_SMPR_SMP_7P5),
0
},
{ /* Current Phase A */ /* SQR[4] */
ADC_SQR1_SQ1_N(ADC_CHANNEL_IN2)| ADC_SQR1_SQ2_N(ADC_CHANNEL_IN2),
0,
0,
0
},
/*
* 20 ADC Cycles Conversion time with 7.5 clocks sample time to get a litle
* extra filtering, OPAMP2 as Input
*/
{ /* SSMPR[2] */
ADC_SMPR1_SMP_AN7(ADC_SMPR_SMP_7P5),
0
},
{ /* DC Bus Voltage */ /* SSQR[4] */
ADC_SQR1_SQ1_N(ADC_CHANNEL_IN7) | ADC_SQR1_SQ2_N(ADC_CHANNEL_IN7),
0,
0,
0
}
}),
_adcConvGrp3_4({
TRUE, /* circular mode */
U8_NBR_OF_CHANNELS,
NULL,
NULL,
/*
* external trigger from TRGO2 of TIM1 on rising edge
*
*/
ADC_CFGR_EXTSEL_SRC(10) | ADC_CFGR_EXTEN_RISING, /* CFGR */
ADC_TR(0, 4095), /* TR1 */
ADC_CCR_DUAL(1), /* CCR */
{ /* SMPR[2] */
/*
* 20 ADC Cycles Conversion time with 7.5 clocks sample time to get a litle
* extra filtering, OPAMP1 as Input
*/
0,
ADC_SMPR2_SMP_AN12(ADC_SMPR_SMP_7P5)
},
{ /* Current Phase C */ /* SQR[4] */
ADC_SQR1_SQ1_N(ADC_CHANNEL_IN12) | ADC_SQR1_SQ2_N(ADC_CHANNEL_IN12),
0,
0,
0
},
/*
* 20 ADC Cycles Conversion time with 7.5 clocks sample time to get a litle
* extra filtering, OPAMP2 as Input
*/
{ /* SSMPR[2] */
ADC_SMPR1_SMP_AN3(ADC_SMPR_SMP_7P5),
0
},
{ /* External Setpoint */ /* SSQR[4] */
ADC_SQR1_SQ1_N(ADC_CHANNEL_IN3) | ADC_SQR1_SQ2_N(ADC_CHANNEL_IN3),
0,
0,
0
}
})
start code for adc
Code: Select all
/*
* Activates the ADC1 driver and the temperature sensor.
*/
adcStart(&ADCD1, NULL);
adcStart(&ADCD3, NULL);
/*
* Starts an ADC continuous conversion.
*/
adcStartConversion(&ADCD1, &_adcConvGrp1_2, (adcsample_t*)_samples1_2, U8_SAMPLES_PER_CHANNEL);
adcStartConversion(&ADCD3, &_adcConvGrp3_4, (adcsample_t*)_samples3_4, U8_SAMPLES_PER_CHANNEL);
Greetings
Tec