cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G431 shunt + opamp + comparator network values

dannypkchan
Associate II

I have changed the G431-ESC-1 shunt resistor to 0.001ohm, and gain network resistor values as attached pics, for 100A phase current max with 1mOhm shunt resistor after the off-set circuit, the voltage is 0.19V to comparator's + input (non-inverting) and DAC3 connected to - input (inverting), MCWorkbench generated code in .mc_parameters.c OPAMPParams with  .DAC_OCP_Threshold = 3773 (which is equal to 0.189v)

Now my question is, with 3773 DAC value, I couldn't start my little motor because OVERCURRENT fault triggered, I need to increase .DAC_OCP_Threshold value to say 8000 in order my motor can start, but do the maths 8000 = 0.4v threshold which is like 400A phase current pass through 0.001ohm shunt resistor ?

Anyone has experience on gain network issues ?

Thx

Danny

7 REPLIES 7
Laurent Ca...
Lead II

Dear @Community member​ 

Welcome to the STM32 Community

Could you give more details to the STM32 Community about your setup -the material you use- ?

(HW and also SW: CPU(s), tools and versions, board(s), motor(s) and so on)

And more especially did you use STM32 MC tools (such as MC_suite, STM32 MC Motor Profile, STM32 MC SDK, STM32 MC Workbench, the used example, the origin of the base of your application source code, and so on)?

Best regards

dannypkchan
Associate II

Hi,

I use both 5.Y.3, 5.4.7, HW B-G431B-ESC1board, but replaced with 0.001 ohm shunt resistor because I would like to sustain 100A current, I compare different configuration values generated from MC Workbench the COMPARATOR mainly compare the DAC3 output value 3770 which is equal to 0.19v from 100A to 0.001ohm and through offset network (see my last uploaded pic) and 0.19v (3770*3.3/65536), am I right ?

Now when I start throttle (external command) it will triggered over-current fault, I need to increase the DAC3 value from 3770 to at least 5000, but .DAC_OCP_Threshold = 5000 is more than 100A current through 1m Shunt resistor that doesn't make sure.

Can you help to tell me what other factor can affect Comparator trigger ?

Danny

cedric H
ST Employee

Hello @Community member​ ,

The B-G431B-ESC1 is designed for an output peak motor current of 40 A.

There is no way to reach 100A with this board. The board is so tiny that it is impossible to cool it properly to reach such current level. An other point is the dimension of the wires that are not aligned with such currents. So in few words : do not do that !

Regards

Cedric

dannypkchan
Associate II

Hi Cedric,

no, i just use tiny motor with little power supply, because my final product would like to handle 100A, so I replaced the shunt resistor with 0.001 ohm and change offset circuit's resistor according to MC Work bench suggested.

my problem is whenever motor started, it immediately jump to R3_2_BRK2_IRQHandler which is comparator triggered, if I increase the .DAC_OCP_Threshold = ~5000 which can startup but very easy to jump to R3_2_BRK2_IRQHandler

this doesn't make sense because my motor, my power supply and i closely monitor the current which is under 0.1A but according to the offset calculation the current to trigger comparator should be ~100A (.DAC_OCP_Threshold = 3770) but why now 0.1A can trigger it ?

Cedric, can you suggest how to narrow down or trace the problem ? 

herewith I test and compare with phase current value, that's why I don't think it's caused by noise (run can run smoothly) or over-current, but why comparator be triggered ?

max_phase_current = 249

max_phase_current_a = 2.743

S16_to_A = 0.01101

AMPLIFICATION_GAIN = 4.57

RSHUNT = 0.001

ADC_REFERENCE_VOLTAGE = 3.30

/* formula: Current[A] = [Current(s16A) * Vdd micro(V)] / [65536 * Rshunt(Ohm) * AmplificationNetworkGain] */

S16_to_A = ((float)(ADC_REFERENCE_VOLTAGE)) / ((float)((float)65535 * (float)RSHUNT * (float)AMPLIFICATION_GAIN));

phase_current = MC_GetPhaseCurrentAmplitudeMotor1();

phase_current_a = (float)phase_current * (float)S16_to_A;

if (max_phase_current < phase_current) {

 max_phase_current = phase_current;

}

if (max_phase_current_a < phase_current_a) {

 max_phase_current_a = phase_current_a;

}

MC_ProgramSpeedRampMotor1(1500, 100);

MC_StartMotor1();

Hi, do you slove your problem? I have designed a custom board from the prototype of B-G431B-ESC1.When I start the motor, it is also very easy to jump to R3_2_BRK2_IRQHandler.

Hey, did you find the cause of your problem? If not: measure the output voltage of the OP (the amplified shunt voltage) when the current is flowing that triggers the Overcurrent protection. My guess is, that the OP is propably amplifying the shunt voltage too high. I have the same problem with STSPIN32G4 which is based on STM32G431. It would be interesting for me to know if you experience the same

tmaun.1
Associate II

Hi,

I have exactly the same problem with the demoboard EVSPIN32G4 and also a motor control board using the STM32G431. The overcurrent detection using internal comparator triggers below the theory (10A insteand 100A for example). I tried to use as voltage reference Vrefint and also the internal DAC. I filtered the glitch of mosfet commutation but always the same result : the comp triggers too low

Is anyone find a solution to this problem ? many thanks