cancel
Showing results for 
Search instead for 
Did you mean: 

ADC1 and 2 dual (interleaved) mode, differential and fast channels

CyberNerd
Associate

Hi,

I'm new to stm32g4 series and problaby have a basic question.

I would like to check if it is possible to have this config:
- ADC1 IN3 and IN4 as differential input (signal A)
- ADC2 IN4 as single ended input (signal B)

Then perform adc conversions in dual (interleaved) mode and get close to 4msps for signal A as well signal B. My concern is that IN4 is used on both peripherals, not sure if this is a problem, if I read the reference manual, it should not be a problem as long as they are not sampled at the same moment, therefore you need interleaved dual mode if I'm correct.

Furthermore I would like to know if it's really possible to connect 3 peripherals to a single pin, like the PA0 pin:
- COMP1_INM
- COMP3_INP
- ADC1_IN1

If this is possible, are there any side effects that can occur?

4 REPLIES 4
AScha.3
Chief

Hi,

try to set it CubeMx , then you see: possible or not.

+

>If this is possible, are there any side effects that can occur?

Sure. When ADC is sampling, it switches its input cap to the pin.

IF you have no low impedance driving the pin, it will give a small voltage "spike", that might switch the comparator...

So : side effects depend on your circuit.

If you feel a post has answered your question, please click "Accept as Solution".
CyberNerd
Associate

Thanks, regarding STMCubeMX, yes I already knew its possible to connect multiple peripherals to a single pin, but I wanted to make sure if there is a catch. Good point about the net impedance, I will take that into account.

regarding this part:

I would like to check if it is possible to have this config:
- ADC1 IN3 and IN4 as differential input (signal A)
- ADC2 IN4 as single ended input (signal B)

do you also mean to just try in STMCubeMX to see if this is possible?

Right !

Maybe you cannot do all together (interleaved and normal mode), then try:

standard sequence in interleaved mode and the "extra" ADC1 IN3 as injected sequence.

If you feel a post has answered your question, please click "Accept as Solution".
AScha.3
Chief

Just...

why (most times) its not a "problem" of Cube, not allowing multiple connections on one pin:

AScha3_2-1718467250208.png

see rm, about gpio -> alternate functions :

AScha3_0-1718466304415.png

So you can set just ONE alternate function to a pin .

Maybe your lucky : ADC might have its own (analog) input multiplexer, so connecting adc1x and adc2x to same pin is no problem, both are on same pin setting (-> analog).

AScha3_0-1718469529478.png

AScha3_1-1718469703236.png

 

 

But if they need/use different AFSEL numbers (multiplexer), then ...no. (Say , ADCin + TIM external count in )

AScha3_1-1718467204734.png

 

Cube is just the fastest way, to see, whats possible. (But not always shows all possible combinations...)

So if you want to know for 100% sure, look in rm . (But most times Cube "is right" .) 🙂

If you feel a post has answered your question, please click "Accept as Solution".