2025-06-04 1:06 AM
Trying to model and use an inverting opamp circuit for current sensing
[PN]: STM32H755ZITx
[VERSION]: MCSDK 6.3.2
[TOOL]:MC WB, Board Designer, Firmware, MC PROFILER, etc..)
[DETAILS]: Using an inverting opamp for the current sensing circuitry. Goal is to run FOC closed loop position control but can't seem to get the current sensing working properly.
[EXPECTED BEHAVIOR]: Able to configure an inverting opamp instead of a non-inverting opamp when using a (three) shunt resistor setup.
Then once the project is created I want to use this to profile the motor parameters and run the motor in closed loop by using the current sensing circuitry.
[HOW TO REPRODUCE]:Try to use the board designer and configure a current sensing feature, the only option available when working with external opamps is the setup with a non-inverting opamp.
We noticed that our opamp circuitry is different from what the (MCSDK) workbench expects and see that the behaviour when trying to run the motor in closed loop or using the motor profiler is bad. Our supply source gets drained from the moment we try to start the profiler. Our problem seems to be related to how the current sensing is perfomed in the MCSDK.
This is our opamp circuit:
I wanted to have the model of it put into the Board Designer in order to use the workbench for our initial project generation but I'm unsure how to apply the fix for the inverting opamp circuit that we have?
I saw this post and tried it out but it doesn't seem to have the right effect https://community.st.com/t5/stm32-mcus-motor-control/how-to-invert-current-reading/m-p/669709#M9911
If someone would be able to point me in the right direction on how to resolve this issue that would be great because this is the only thing now blocking us from running the motor in closed loop.
The different parameters needed in the workbench are also very confusing (polarization offset, offset network attenuation, ...)
2025-06-04 1:44 AM
Currently tried runningn open loop to see how the MCSDK is handling the current sensing so I plotted phase a and phase b.
At 100 rpm Vref of 20% gave me these results:
At 1000rpm Vref of 20% gave me these results:
2025-06-04 4:36 AM
FYI: closed loop control seems to be working by using the bypass in the other post: https://community.st.com/t5/stm32-mcus-motor-control/how-to-invert-current-reading/m-p/669709#M9911
Both speed and position control seem to be working now for a motor on 48V.
That makes me shift my focus into thinking that the culprit here might be the Motor Profiler running, I assume he'll reset the gains for the PI controllers and causes an extreme compensation which completely draws my voltage source.