cancel
Showing results for 
Search instead for 
Did you mean: 

I have to use OPAMP2. I have to wires. I want to get the difference between these two and amplifiy the signal with a adjustable faktor. Can someone tell me in which mode i have to use the OPAMP and how to configurate in MXCUBE?

NPC
Associate

Mic: STM32H743

Atollic Truestudio 9.1.0

CUBEMX MX.5.3.0

4 REPLIES 4

I don't use Cube nor CubeMX, but the procedure to use the OPAMP as PGA is descibed in RM, OPAMP chapter, Programmable gain amplifier mode subchapter.

Note, that the adjustments is rough, in only 4 steps (or 5 if you count the follower mode too).

JW

NPC
Associate

Hi Waclawek,

at first i want to thank you for your answer.

I´ve already read the RM but i wasn´t able to solve my problem.

I have tested the OPAMP in this:

1000: Inverting gain=-1/ Non-inverting gain =2 with INM0 node for input or bias

1001: Inverting gain=-3/ Non-inverting gain =4 with INM0 node for input or bias

1010: Inverting gain=-7/ Non-inverting gain =8 with INM0 node for input or bias

1011: Inverting gain=-15/ Non-inverting gain =16 with INM0 node for input or bias

modes but it didn´t work. (these should be the possible amplifications don´t they?)

I checked the OPAMP2_CSR: 100100000001000001

It works if the inverting input is connected to a ground.

But whenever i connect the both inputs it becomes nearly 3.3V (even if i connect voltages around 1mV).

(Except i connect both inputs then it becomes zero)

The Inputs were set to: PE9(p), PE8(m)

The Output was set to: PE7

I´m sorry for not telling these at first but i thought it´s better to restart my entry to the OPAMP.

If i missing the forest through the treestell me please. (it´s my first project and i have no clue of this 😅)

Ah, sorry, I did not quite understand what did you want to accomplish - I see now, you want to build a difference amplifier with adjustable gain. This is far from being simple or trivial.

For that, you need a four-resistor network, you can't do that simply by programming the mcu:

https://en.wikipedia.org/wiki/Differential_amplifier#Operational_amplifier_as_differential_amplifier

and there is an error in resulting voltage from mismatch of the resistors, so I don't think this can be done easily with adjustable gain either.

Maybe it would be a better idea to build a standalone difference amplifier with fixed external resistors - either using the other OPAMP in the mcu, or using external opamp - and then feed its output to the OPAMP in the mcu which would perform as a "normal" single-ended PGA.

JW

Piranha
Chief II