cancel
Showing results for 
Search instead for 
Did you mean: 

Triple ADC sequence

vincenthamp9
Associate III
Posted on January 09, 2015 at 19:13

Hello

Has anyone successfully got the triple adc mode with a sequence working?

Let's say I already got the ADC and the DMA working for 3x channels without any kind of sequence... what do I have to change in order to get the next three channels converted at the next trigger event?

So far I added the next three channels to the SQR3 register by calling ''HAL_ADC_ConfigChannel();'' and set the NbrOfConversion = 2 in the config of all three ADCs. Unfortunately that didn't do the trick.

Whenever I start the triple ADC conversion with ''HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t*)buffer, 3);'' I only get the first 3x channels of my sequence.

Any suggestions?

tia

/edit

How exactly does the ADC know which channel from the sequence is the present one?

Is there a register which counts through the sequence whenever a conversion is complete?

4 REPLIES 4
Posted on January 09, 2015 at 19:28

I don't think the ADC works the way you think it does.

Trying to decipher your question.

TWO Channels on ADC1, ADC2 and ADC3. Total of SIX samples, per triggering event.

In memory ADC1[0],ADC2[0],ADC3[0],ADC1[1],ADC2[1],ADC3[1]

After the first triplet completes the second triplet starts. The difference in sample time from the first to the second with be the sample+conversion time.

The ordering of the channels is defined by the Rank (Index) when programming the sequence.

HAL, can't help you with that.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
vincenthamp9
Associate III
Posted on January 09, 2015 at 19:46

Ok, so there is no way to do just 3x conversions at the first trigger followed by the next 3x conversions at the next trigger without re-configurating the channels?

Or to ask the question another way:

I need to measure 3x currents at a capture and compare event simultaneously. From time to time I'd also like to measure a bus voltage but with low priority. So my first thought was to simply create a sequence which at one point contains the channel for the bus voltage...

That way I could save myself the trouble to re-initialize the ADC the whole time?
Posted on January 09, 2015 at 20:05

Ok, so there is no way to do just 3x conversions at the first trigger followed by the next 3x conversions at the next trigger without re-configurating the channels?

Correct. There is an injection option, but how that plays with triple mode will be nightmarish to figure out and handle. Better to sample your three primary sources at the instant of the trigger, and then have it read the 3 other non-critical measurements in the follow up round of conversions. This way you don't have to keep reconfiguring the ADC and DMA.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
vincenthamp9
Associate III
Posted on January 09, 2015 at 20:26

Thank you very much! (for basically single-handedly answering 80% of all questions in this forum...)