When doing a multi-channel conversion in a sequence, only the first channel was getting converted. For example, I had a conversion group with num_channels = 4, SQ1 = CH4, SQ2 = CH8, SQ3 = VREF, SQ4 = SENSOR. When I run adcConvert(&ADCD1, &adcgrp, samples, 2), my buffer (of 8 adcsample_t's) contains almost identical values all corresponding to CH4.
Changing the first sequence to a different channel (for example, if I set SQ_1 to CH8), then I get almost identical samples of a different value corresponding to the analog voltage on CH8.
Inspecting the code,
os/hal/ports/STM32/STM32L1xx/hal_adc_lld.cline 227 sets SQR1 to the specified value, but ignores grpp->num_channels.
By contrast,
os/hal/ports/STM32/LLD/ADCv2/hal_adc_lld.cline 375 sets SQR1 to the specified value, OR'd with ADC_SQR1_NUM_CH(grpp->num_channels).
If I manually set sqr1 = ADC_SQR1_NUM_CH(4) in my ADC Conversion Group structure, all works as expected. The code comments in STM32L1xx/hal_adc_lld.h do state that sqr1 contains the sequence length, but the behavior is not the same as the other ADC drivers and the documentation.
I'm using the current master from github. My apologies in advance if I'm not submitting this the right way - I'm new to ChibiOS and the community. Also, thank you so much to all the ChibiOS developers!