2025-03-17 3:58 AM
Hi
Recently, I am working on a 3-phase hub motor with hall sensor to be able to drive low speed accurately. I came across the EVSPIN32G4 and works fine with sensorless-PLL speed sensing by using the MC Workbench V6.3.2. I precedeed to modify the hardware board to a single-shunt resistor (Instead of 3 shunk resistors)
When changing the speed sensing to hall sensing, I started to see driver protection fault errors. Occasionally when I start ST Motor Pilot V1.2.12, the Driver Protection flickers between Orange and red, with no way of clearing the fault condition, unless I reset the STSPIN32G4 (Reset button).
I tried increasing the Driver protection digital filter duration (Default 47.06 ns) to 941.18ns but it made no difference.
I tried unplugging the hall sensor, but the fault condition still happens.
I checked the cubeMX code configuration and the driver protection pin (PE15) is set to Open drain with pull-up.
I later found out that it's something to do with boot-up issue, by checking the Motor Pilot Terminal FAULTS_FLAGS (Code: 0x0019).
Why does this happen when switching sensorless-PLL to hall sensing? Is there a way to check why it is not booting up correctly (Every time I run in debug on the STM32CubeIDE and step execute the code, it does not error out) - The firmware is as is from the code generated from the MC Workbench?
Any guidance on where to look for is greatly appreciated, as I am stomp on this situation.
Kind regards,
Jimmy
2025-03-17 6:55 AM
Hello @jimmydvr,
There is a race condition at STSPIN32G4 driver component initialization end that could trig such error (then not visible when debugging).
Could you try adding driver protection error clear after MCboot() function stpin32g4 initialization process in mc_task.c file?
/*************************************************/
/* STSPIN32G4 driver component initialization */
/*************************************************/
STSPIN32G4_init(&HdlSTSPING4);
STSPIN32G4_reset(&HdlSTSPING4);
STSPIN32G4_setVCC(&HdlSTSPING4, (STSPIN32G4_confVCC){.voltage = _12V,
.useNFAULT = true,
.useREADY = false });
STSPIN32G4_setVDSP(&HdlSTSPING4, (STSPIN32G4_confVDSP){.deglitchTime = _4us,
.useNFAULT = true });
STSPIN32G4_clearFaults(&HdlSTSPING4);
/* 2ms delay for nFault signal end of process */
HAL_Delay(2); /* New */
/* Clear pending BreakIn flag due to STSPIN32G4 initialization */
LL_TIM_ClearFlag_BRK(TIM1); /* New */
/* Applicative hook in MCBoot() */
MC_APP_BootHook();
2025-03-17 9:47 AM
Hi @GMA,
Adding the clearFaults and ClearFlag still causes the same output (Toggling between FAULT_OVER / FAULT_NOW).
The FAULTS_FLAGS is still code 0x0019
2025-03-18 1:16 AM
Hello @jimmydvr,
Could you share your generated project?
2025-03-18 1:51 AM
2025-03-18 6:10 AM
Hello @jimmydvr,
Can you provide the full project directory (containing .ioc file, full code directories...)?
2025-03-18 6:37 AM
2025-03-18 7:56 AM
Hello @jimmydvr,
I’m able to connect the MC Pilot and spin a motor with your project.
Did you modify your board according to "5.7 Single-shunt conversion" chapter in UM2850 document?
Have you made any other modifications besides those for the single shunt?
2025-03-18 8:43 AM
Hi GMA,
Yes, I have modified the board according to 5.7 in UM2850. At one point I have changed the gain resistors R45/R51/R54 from x7.3 to x110 (With a changed shunt resistor to 0.5mR) but reverted back to 5mR.
Other modification made before the current gain changes, were to decrease the pull-up of the hall-effect sensor R78/R79/R80 (From 10K to 330R), R81/R82/R83 (From 10K to 1K8) and changed the capacitors C34/C35/C36 (From 1nf to 10nf).