Skip to main content
Associate II
September 3, 2025
Solved

Can OP-AMPS in STM32 G4 be used as DIFFERENTIAL AMPLIFIERS?

  • September 3, 2025
  • 2 replies
  • 462 views

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?

Best answer by Imen.D

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).

2 replies

Imen.DBest answer
Technical Moderator
September 3, 2025

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).

"When your question is answered, please close this topic by clicking ""Accept as Solution"".ThanksImen"
Sud_09Author
Associate II
September 3, 2025

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.

mƎALLEm
Technical Moderator
September 3, 2025

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.

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
Ozone
Principal
September 3, 2025

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.

Sud_09Author
Associate II
September 3, 2025

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)

Technical Moderator
September 3, 2025

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:

STM32CubeG4/Projects/STM32G474E-EVAL/Examples/OPAMP at master · STMicroelectronics/STM32CubeG4 · GitHub

"When your question is answered, please close this topic by clicking ""Accept as Solution"".ThanksImen"