2020-08-28 06:08 PM
I understand the TIMER event can automatically trigger an ADC conversion that gets saved to memory (via DMA)..
But if the ADC is configured to SCAN more than 1 channel, does that mean that sample rate per channel must be the TIMER rate divided by the number of channels? i.e. does each trigger event cause only one channel in the scan list to be converted... or does each timer event trigger the ADC to perform a conversion across all SCAN channels ("NbrOfConversion")?
Or is it a configurable option of the ADC how it will handle it?
2020-08-28 08:10 PM
It is configurable. You can configure the number of channels to convert per trigger with the ADC_CR1_DISCEN and ADC_CR1_DISCNUM fields. If DISCEN=0, it'll convert all channels in the sequence. There are corresponding options in CubeMX (Discontinuous Conversion Mode).
2020-08-29 05:25 PM
it appears to do one scan of all the channels then stop, when hadc1.Init.DiscontinuousConvMode = ENABLE. It does not seem to convert / DMA the number of samples specified in : HAL_ADC_Start_DMA
When hadc1.Init.DiscontinuousConvMode = DISABLE, it scans all channels, and fills the entire buffer. However, each channel is not sampling at the TIMER event. For example, when NbrOfConversion = 3 versus 1, then I get 3 times LESS the number of HI/LO samples per channel with the exact same square-wave input.
I tried hadc1.Init.EOCSelection = ADC_EOC_SEQ_CONV and ADC_EOC_SINGLE_CONV but it did not appear to impact the sample rate when more than 1 channel is converted;
2020-08-29 05:48 PM
2020-08-30 09:53 AM
Ideally, I'd like for the ADC to sample all the channels at the Timer Event rate.
The Timer Event is currently triggering the conversion, however, if there is more than 1 channel in the SCAN, then it seems only one channel gets converted per trigger event... it then converts the next channel in the scan list on the next trigger event, and so on.
Is it possible, for the ADC to scan all channels upon the Timer Trigger event?
2020-08-30 12:08 PM
> I'd like for the ADC to sample all the channels at the Timer Event rate.
Disable continuous conversion mode.
Disable discontinuous conversion mode.
With that, it'll convert one full sequence per trigger.
2020-09-02 01:40 PM
Disabling continuous and discontinuous, I still get half the number of samples for a single cycle of a square wave input when switching from NbrOfConversion = 1 , to NbrOfConversion = 2
It seems if I want to maintain a given sample rate, the timer needs to take into account the number of channels.
2020-09-02 03:14 PM
You may want to drop Cube/HAL lingo and discuss the issue in terms/register bits/fields given by RM.
In 'F4, there's a SCAN mode, enabled by SCAN bit in CR1, doing exactly this. It has a dedicated subchapter in the ADC chapter. I don't use 'H7 but I doubt there is nothing comparable there.
JW