cancel
Showing results for 
Search instead for 
Did you mean: 

Current sensing OPAMP gain is far higher than set up ( 5.Y.3 and 5.Y.4)

ALedi.1
Associate III

Hello community!

I use a custom motorcontrol PCB with the STSPIN32G4, using the µc's internal OPs with external resistors to setup the gain. I use the same resistors as EVSPIN32G4 only with 0.5mOhm shunt instead of 5mOhm (see picture).

0693W00000NsurGQAR.png0693W00000NsxjeQAB.pngWith this configuration, I should be able to sense currents of up to 450 Amp. When no current is flowing through the shunt, the measured voltage on the OP out is 1,65V which is correct. The problem is that at 15A flowing through the shunt, the OP output is at 2V already. So the gain is far higher than what I enter in the workbench (gain in workbench is 7,333 and with the observed voltage output at 15A I calculate that the actual gain is around 48). There seems to be something wrong with the gain settings. In the changelog of SDK 5.Y.4, it says, that in version 5.Y.3 standalone mode for STM32G4 could not be processed by cubeMX:

0693W00000NsxsWQAR.pngSo I thought maybe this is fixed in the new version, but apparently there is still something wrong.

 The OPAMP settings are as shown:

0693W00000Nt7tZQAR.pngAny help or suggestions and clues are appreciated!

EDIT: I changed the settings to an internal gain of 8, removed my external resistors R58 and R60, changed R53 and R59 to 75k, and R54 to 5,6k like it should be correct:0693W00000QKGGOQA5.pngand even now I can measure a too high voltage increase. I supply the PBC/µC with power, connect via debugger to motor pilot, and measure the voltage with a multimeter from VOUT to GND. At 0Amp through the shunts for example, I measure 1,733V. Then with a seperate current source I let 15 Amp through the shunts and I measure the voltage increase. At 15Amp, the voltage at VOUT is at 2,014V. This means the actual gain that I observe is around 37. I already confirmed the shunt resistance value so the error is not caused by wrong shunts.

Am I chasing a ghost here? Are the OPAMPs even fully functioning when I dont start the motor? Is there a way for me to verify the gain? Unfortunately, when I dont press "motor start" in the Pilot and I read out the registers of I_A and I_B, they dont show live values for the current measurement, even if current is flowing through the shunts, the displayed values are 0 .

1 ACCEPTED SOLUTION

Accepted Solutions
ALedi.1
Associate III

SOLVED: it seems that you can't measure the OP output voltage like I did... somehow the voltage measured with steady state current through the shunts when motor is not spinning is not the "real" output voltage that you would measure when the same current is flowing through the shunts when motor is spinning. When I measure OP OUT voltage with a differential voltage probe when motor is spinning and compare the measured voltage with the s16A value of I_A (logged by motor pilot), the values are correct.

0693W00000QKTGCQA5.png

View solution in original post

1 REPLY 1
ALedi.1
Associate III

SOLVED: it seems that you can't measure the OP output voltage like I did... somehow the voltage measured with steady state current through the shunts when motor is not spinning is not the "real" output voltage that you would measure when the same current is flowing through the shunts when motor is spinning. When I measure OP OUT voltage with a differential voltage probe when motor is spinning and compare the measured voltage with the s16A value of I_A (logged by motor pilot), the values are correct.

0693W00000QKTGCQA5.png