2025-09-02 6:00 PM
I was going through the reference manual of STM32G4 series MCU. I saw information on using Op-Amps inside the STM32G4 as Inverting and Non-inverting amplifiers. There was no mention of them used as differential amplifiers, can they be used as differential amplifiers?
Solved! Go to Solution.
2025-09-02 9:43 PM - edited 2025-09-02 9:53 PM
Hello @Sud_09 and welcome to the Community,
Using OPAMPs of the STM32G4 series can indeed be used as differential amplifiers and supporting both inverting and non-inverting inputs. When using the OPAMPs as differential amplifiers, consider the following: gain settings, performance parameters, and environmental factors to ensure reliable operation.
I recommend you the Application note AN5306, which provides practical examples, including examples of OPAMP configuration (inverting and Non-inverting amplifier configurations).
2025-09-02 9:43 PM - edited 2025-09-02 9:53 PM
Hello @Sud_09 and welcome to the Community,
Using OPAMPs of the STM32G4 series can indeed be used as differential amplifiers and supporting both inverting and non-inverting inputs. When using the OPAMPs as differential amplifiers, consider the following: gain settings, performance parameters, and environmental factors to ensure reliable operation.
I recommend you the Application note AN5306, which provides practical examples, including examples of OPAMP configuration (inverting and Non-inverting amplifier configurations).
2025-09-03 1:37 AM
Operational amplifiers can always be used as differential amplifiers - this is what they are.
But I'm not sure you understand what this entails.
Such a device amplifies the difference between its (+) and (-) input, but the output will always remain within the bounds of the negative and positive supply voltages of the amplifier. Which are, in case of the STM32, +3.3V and GND.
The internal opamps are single-rail or single supply opamps, which implies the use of a virtual GND potential the output relates to. In most cases, this virtual GND potential is Vcc / 2.
2025-09-03 3:32 AM
I had one more question. The reference manual (RM0440) says 'The devices embed six operational amplifiers'. Can TWO of them be used as differential amplifiers simultaneously?
Thanks.
2025-09-03 3:39 AM
Hello @Sud_09 ,
If your original question has been answered by one of the contributors, please accept it as solution and open a new thread for the new one.
Thank you for your understanding.
2025-09-03 3:39 AM
Thank you for the information. I understand that they are not rail-to-rail. I am not looking to measure negative voltages. I just want to measure varying DC voltages (Line voltage after the rectifier). So I can use the full 0-3.3V range by connecting the Op-Amp ground to the system ground and feeding the output of the Op-Amp to the ADC, right? (Check attached picture)
2025-09-03 4:36 AM
Yes, STM32G4 OP-AMPs can be used as differential amplifiers to measure varying DC voltages, such as rectified line voltage. By connecting the OPAMP ground to the system ground and feeding the output to the ADC, you can utilize the full 0-3.3V range. For that, ensure proper configuration, calibration, and noise minimization for accurate measurements.
You can get inspired from available OPAMP examples, that will help your on how to configure the OPAMP and use the self-calibration right after Op-Amp init: