https://github.com/stm32-rs/stm32l4xx-hal/issues/180
There are quite some errata sheets that point to something suspiciously similar to what I have been experiencing..
I'm using a STM32L496 where I have a bunch of ADCs connected. We have built hundreds of these devices and sometimes, some of them just report 0 on an entire ADC Conversion Group (adc1) until restarted.
Heres the adc setting
Code: Select all
const ADCConversionGroup adc1_grpcfg = {
.circular = true,
.num_channels = ADC1_GRP_NUM_CHANNELS, /* number of Channels */
.end_cb = adc1_Callback, /* End Callback link */
.error_cb = adc1_ErrCallback, /* Error Calback link */
.cfgr = ADC_CFGR_EXTEN_RISING | /* Trigger on rising edge*/
ADC_CFGR_EXTSEL_SRC(11), /* TIM2 TRGO */
.cfgr2 = 0U,
.tr1 = ADC_TR(0, 4095), /* ADC Watchdog init*/
.smpr = {
ADC_SMPR1_SMP_AN0(ADC_SMPR_SMP_247P5) |
ADC_SMPR1_SMP_AN7(ADC_SMPR_SMP_247P5),
ADC_SMPR2_SMP_AN15(ADC_SMPR_SMP_247P5) |
ADC_SMPR2_SMP_AN16(ADC_SMPR_SMP_247P5) |
ADC_SMPR2_SMP_AN17(ADC_SMPR_SMP_247P5) |
ADC_SMPR2_SMP_AN18(ADC_SMPR_SMP_247P5)
},
.sqr = { /*Sampelsequence */
ADC_SQR1_NUM_CH(ADC1_GRP_NUM_CHANNELS)|
ADC_SQR1_SQ1_N(ADC_CHANNEL_IN7)|
ADC_SQR1_SQ2_N(ADC_CHANNEL_IN16)|
ADC_SQR1_SQ3_N(ADC_CHANNEL_IN0)|
ADC_SQR1_SQ4_N(ADC_CHANNEL_IN17),
ADC_SQR2_SQ5_N(ADC_CHANNEL_IN18) |
ADC_SQR2_SQ6_N(ADC_CHANNEL_IN15),
0U,
0U
}
};
And the adc settings look like this
Code: Select all
const ADCConfig adc1cfg = {
.difsel = 0U
};
I start the adc conversion like this:
Code: Select all
adcStartConversion(&ADCD1, &adc1_grpcfg,
g_ADCsamples[ADC_CONTROLLER_1], ADC1_GRP_BUF_DEPTH);
Heres the callback
Code: Select all
static void adc1_Callback(ADCDriver *adcp) {
if (adcIsBufferComplete(adcp)) {
g_DatabaseADC[ADC_DATA_VMEAS1] = g_ADCsamples[ADC_CONTROLLER_1][0];
g_DatabaseADC[ADC_DATA_TMEAS] = g_ADCsamples[ADC_CONTROLLER_1][1];
g_DatabaseADC[ADC_DATA_VREFINT] = g_ADCsamples[ADC_CONTROLLER_1][2];
g_DatabaseADC[ADC_DATA_TEMPSENSE] = g_ADCsamples[ADC_CONTROLLER_1][3];
g_DatabaseADC[ADC_DATA_VBAT] = g_ADCsamples[ADC_CONTROLLER_1][4];
g_DatabaseADC[ADC_DATA_BMSADAPTER] = g_ADCsamples[ADC_CONTROLLER_1][5];
}
else {
}
}
Now sometimes the entire g_ADCsamples[ADC_CONTROLLER_1] arrays just stays 0 for an entire lifecycle until restarted. I cannot find anything on the boards that would enable that behavior, has the fix thats mentioned in the link above been implemented in the chibiOS HAL as well?
I'm using HAL 7.1.5 and chibiOS 20.3.4
Can I update to HAL 8 without updating chibiOS?