cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G4 ADC Input channel switch errata for intermixed regular and injected channels

Singh.Harjit
Senior II

I have an application where I'm using dual ADCs (let's say ADC 1 and 2) on an STM32G474.

The desired regular channel sequence is:

ADC1: channel 1, stop, channel 1, stop

ADC2: channel 2, stop, channel 2, stop

The ADC conversion is triggered by a timer. I want to do one set of conversions and then stop. When the next trigger happens, do the next set of conversions which happens to be the same channel.

At the same time, I use injected channels:

ADC1: channel 3, stop, channel 4, stop, channel 5, stop

ADC2: channel 6, stop, channel 7, stop, channel 8, stop

The ADC conversion is triggered by a timer. I want to do one conversion and then stop. When the next trigger happens, do the next set of conversions, etc..

From reading the Errata (ES0430, Revision 1), it says:

As the device operates the multiplexer during the ADC conversion, either to select the following input of a scan sequence or to open all multiplexer inputs (idle mode), this disturbance source may affect all operating modes except continuous and except bulb sampling.

AN536 says:

The multiplexer is switched to the next programmed channel in the middle of the successive approximation (in case of scan mode). If the ADC is used in single mode or at the end of the scan sequence, the multiplexer is switched to the internal channel (Channel 31).

Please confirm that the corrective action for the regular channels is to do two conversions and throw away the second result - even though I'm staying on the same channel, because of the "stop", the mux switches to channel 31 and corrupts the conversion. The sequence will be:

ADC1: channel 1, channel 1, stop, channel 1, channel 1, stop

ADC2: channel 2, channel 2, stop, channel 2, channel 2, stop

Please confirm that for the injected channels, I cannot use JDISCEN and instead, I have to use the Queue of context for injected conversions and do the following:

Queue entry (See RM0440 revision 2, page 593)

P1:

ADC1: channel 3, channel 3, stop

ADC2: channel 6, channel 6, stop

P2:

ADC1: channel 4, channel 4, stop

ADC2: channel 7, channel 7, stop

P3:

ADC1: channel 5, channel 5, stop

ADC2: channel 8, channel 8, stop

Or is there a simpler way that I'm missing?

For example, let's say I can lock down my conversion pattern between regular and injected channels and then use a timer with SMPTRIG (See RM0440 Rev 2, page 578)? Or is the multiplexer channel switching logic such that when a sample period ends, it switches the channel (even though a conversion is in progress)?

Thanks.

1 REPLY 1
Singh.Harjit
Senior II

Some good news and some bad news (for me).

Good news: There is a new Revision Y of this part that fixes the "ADC Input channel switching disturbs ongoing conversions" errata.

So, I should have more channels to use with regular channels and injected channels.

Bad news: It is the same part number as the old Revision Z, I have a bunch of those which I get to throw away and there isn't a clear way to explicitly order Revision Y.