2025-09-05 8:29 PM - last edited on 2025-09-06 6:49 AM by mƎALLEm
您好,我已经在STM32G431上成功配置了 6.4.0 SDK 包。 但是,当我按下按钮并开始预充电过程时,报告了硬件故障。 如果我在预充电过程中将上侧 PWM 波的刻度值从 0% 更改为 90%,程序将在 RUN 后进入 STOP 状态,然后进入故障状态。故障代码为 40,定义为 #define MC_BREAK_IN ((uint16_t)0x0040) /**< @brief 错误:紧急输入(过流)。 */
Post edited by ST moderator to follow the community rule which is using English language. So in next time please use English as it's an international community and to let others to understand your post. Thank you for your understanding.
Translation:
Hello, I have successfully configured the 6.4.0 SDK package on my STM32G431. However, when I press the button to initiate the pre-charge process, a hardware fault is reported. If I change the duty cycle of the upper PWM waveform from 0% to 90% during the pre-charge process, the program enters a STOP state after running, and then enters a fault state. The fault code is 40, which is defined as #define MC_BREAK_IN ((uint16_t)0x0040) /**< @brief Error: Emergency input (overcurrent) */
2025-09-08 8:14 AM
Hello @BY1,
Which boards are you using?
When connecting the Motor Pilot Tool, what was the first triggered error?
The second error, 0x40, is overcurrent (defined in the mc_type.h
file). This error is due to the 90% Charge Boot Capacitor Duty parameter.
2025-09-08 6:18 PM
Sorry, my previous description was not detailed enough. Please let me rephrase it. I am using STM32G431CBT6. After downloading the foc control code generated by MCSDK6.4.0 to STM32G431CBT6, I connected the brushless DC motor and pressed the button. After that, Mci [M1]. State successfully changed from IDLE to OFFSET-CALIB and executed R3_2_TurnOnlowSides (pwmcHandle [M1], M1_CARGE_BOOT_CAP_SUT_CYCLES); Afterwards, the code will enter HardFault-Header and occasionally NMI_Handler. If I change the value of M1_CARGE_BOOT_CAP_SUT_CYCLES from the default 0 to (uint322-t) (0.6 * ((uint322-t) PWM-PERIOD_CYCLES/2U)), then Mci [M1]. State can successfully change from IDLE to RUN, but it will soon change to FAULTRA-OVER, and the value of MCI_CetCurrentFaults (&Mci [M1]) is 0x40, and the motor does not rotate. I tried to write my own code and directly use a 6-step square wave to control it. The motor can rotate, and my motor and Hall sensor should be working properly.
2025-09-08 6:29 PM
I am not sure about the specific reason for entering HardFault-Hader and NMI_Handler, but I can provide a detailed description of the observed phenomenon. If the Mci [M1]. State is changed directly from IDLE to RUN after pressing the button, the program will not enter HardFault-Hader and NMI_Handler. Therefore, I suspect that the error was caused by modifying certain registers in the OFFSET-CALIB and CHARGE.BOOT.CAP states. Then I changed the Mci [M1]. State from IDLE directly to CHARGE.BOOT.CAP, and found that the error still occurred. However, by doing so, we can see the square wave of the ch pin. If we enter OFFSET-CALIB from IDLE and then enter CHARGE.BOOT.CAP, we can see the square wave of the ch pin., executed R3_2_TurnOnLowSides (pwmcHandle [M1], M1_CARGE_BOOT_CAP_SUT_CYCLES); If PWM is preloaded, no waveform can be seen, so it is possible that after modifying the PWM related registers, it entered HardFault Handler and NMI-Handler in a very short time (less than one PWM cycle)
2025-09-10 2:34 AM
Hello @BY1,
I assume that you are using a custom board. Is-it an inverter board or you are using an ST power board?
Could you check that MCU inputs VDD/VSS, RST, Clocks are not impacted during the Charge Boot Cap period?
2025-09-10 2:57 AM
Hello, I am using an inverter board. After I modified the value of the charging capacitor, I will no longer report hardware faults. Now, overcurrent will continue to be reported regardless of the value of M1-CARGE-BOOT_CAP_SUT_CYCLES. Even if I set the value of Cut off frequency to the minimum (100) rad/s. Then I tried to turn off the overcurrent protection, but unfortunately, all of them were destroyed. My six MOSFETs were directly damaged, and I am preparing to weld a new board for testing. Do you have any good ideas
2025-09-10 3:00 AM
This is my configuration for current detection
2025-09-15 6:39 AM
2025-09-15 6:40 PM
sorry, I think it's my expression error. The motor still cannot rotate. My latest post is to ask if the PWM output of my MCU is normal, because its CH1 duty cycle is different from the other CH2 and CH3