cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G opamps routing to ADC and to comparator

PHard
Associate

My Question: If the opamp output multiplexer is configured to connect the output pin (OPAINTOEN set to zero) then can I still use the ADC to read the opamp output?

The wording in the reference manual is ambiguous – it implies that the output is either ADC or VOUT. I’m reading DM00605707 and specifically looking at STM32G474VE.

I don’t mind if I internally route opamp to ADC, or if I enable both ADC_IN and VOUT on the same pin. Either could and probably will work.

More detail:

I have an application where I wish to route the opamp output to both the ADC and to a comparator. We need the comparator for very fast over current protection and the ADC to measure the current.

It appears that there is no internal routing from opamp to comparator, so I have enabled the opamp VOUT and then routed it back into the comparator. This is okay, although I’m surprised ST haven’t allowed for this connection internally.

My guess is that I should be able to do what I am after, because it seems like a pretty obvious thing to do and the ST designers do a pretty good job of designing their chips. Furthermore, the CubeIDE lets me configure it this way.

An alternative which will also work great would be to connect both ADC and opamp VOUT to the same pin. Eg, I could configure pin PA2 as OPAMP1_VOUT, and then enable ADC1_IN3 on the same pin.

If I cannot connect both ADC and VOUT pin to the opamp concurrently nor use common pins I am likely to run out of spare pins.

2 REPLIES 2
Andrea Canepa
Senior

I agree with you that it would have been better if STM had internally connected the OPAMP outputs to the ADC and COMP inputs in parallel.

I also have a problem similar to yours and I solved it this way: I used the parallel connection of ADC and COMP placed on an input pin. Then I sent OPAMP to pin out and I connected this pin externally with the pin common to ADC and COMP.

For example: the OPAMP1 output goes on PA2, an external connection connects PA2 with PA1, while PA1 is connected in parallel on ADC1_IN2 and COMP1_INP. In this way, unfortunately, you have to waste two external pins, but you can achieve your goal.

Regards

Andrea

That is excellent, thank you. That is enough information for me to be able to continue with our current solution.

I expect it will be at least 1 or 2 months before we actually prototype this board and can confirm it also works for us.