A-D "Linear Buffer" conversion on 32L031
Posted: Sun Mar 31, 2024 5:57 pm
I'm trying to use the A-D on a STM32L031 in "Linear Buffer" mode - four samples each on 3 inputs, and haven't managed to get it to work. (I'm actually mostly using 20.3.4, but 21.11.3 didn't work any better).
Basic setup is simple:
Works as expected with ADC_GRP1_BUF_DEPTH = 1, but not with ADC_GRP1_BUF_DEPTH = 4
(I also tried with .circular = TRUE; just hangs).
Am I missing something, or is the feature not implemented on ADC1?
(I also looked at ADC5 for a comparison, and couldn't see that it was implemented there either)
Basic setup is simple:
Code: Select all
adcStart(&ADCD1, NULL);
adcSTM32EnableVREF(&ADCD1);
adcSTM32EnableTS(&ADCD1);
:
:
static const ADCConversionGroup adcgrpcfg1 =
{
.circular = FALSE,
.num_channels = ADC_GRP1_NUM_CHANNELS,
.end_cb = NULL,
.error_cb = adcerrorcallback,
// ADC_CFGR1_ALIGN | ADC_CFGR1_RES_12BIT, /* CFGRR1 - Left align data, 12-bit */
.cfgr1 = ADC_CFGR1_RES_12BIT, /* CFGRR1 - Right align data, 12-bit */
.cfgr2 = 0, /* CFGRR2 */
.tr = ADC_TR(0, 0), /* TR */
.smpr = ADC_SMPR_SMP_79P5, /* SMPR - Go for slow sampling/conversion */
.chselr = ADC_CHSELR_CHSEL1 | ADC_CHSELR_CHSEL4 | ADC_CHSELR_CHSEL5 /* CHSELR */
};
result = adcConvert(&ADCD1, &adcgrpcfg1, samples1, ADC_GRP1_BUF_DEPTH);
Works as expected with ADC_GRP1_BUF_DEPTH = 1, but not with ADC_GRP1_BUF_DEPTH = 4
(I also tried with .circular = TRUE; just hangs).
Am I missing something, or is the feature not implemented on ADC1?
(I also looked at ADC5 for a comparison, and couldn't see that it was implemented there either)