2025-10-14 8:00 PM
Hello Everybody,
Here are the software and boards in this case:
1. MC workbench 6.4.1
2. STM32 FW V1.28.2
I designed a project for my board, but the generated code has an error as illustrated in the picture, I didn't make any modification on the code and complie it directly after the generateion,
How can I fix the problem??Thank you!
Solved! Go to Solution.
2025-10-15 1:10 AM
Hello @DF_MC,
Thank you for your report.
A ticket will be created on our side for the missing ErrMask definition when only bus voltage sensing is enabled on the M2 path. You can add the errMask definition as follows:
__weak void TSK_SafetyTask_PWMOFF(uint8_t bMotor)
{
/* USER CODE BEGIN TSK_SafetyTask_PWMOFF 0 */
/* USER CODE END TSK_SafetyTask_PWMOFF 0 */
uint16_t CodeReturn = MC_NO_ERROR;
uint8_t lbmotor = M1;
const uint16_t errMask[NBR_OF_MOTORS] = {VBUS_TEMP_ERR_MASK, VBUS_TEMP_ERR_MASK2};
/* Check for fault if FW protection is activated. It returns MC_OVER_TEMP or MC_NO_ERROR */
/* Due to warning array subscript 1 is above array bounds of PWMC_Handle_t *[1] [-Warray-bounds] */
if (M2 == bMotor)
{
lbmotor = M2;
}
CodeReturn |= PWMC_IsFaultOccurred(pwmcHandle[lbmotor]); /* check for fault. It return MC_OVER_CURR or MC_NO_FAULTS
(for STM32F30x can return MC_OVER_VOLT in case of HW Overvoltage) */
if (M2 == bMotor)
{
uint16_t rawValueM2 = RCM_GetRegularConv(&VbusRegConv_M2);
CodeReturn |= errMask[bMotor] & RVBS_CalcAvVbus(&BusVoltageSensor_M2, rawValueM2);
}
2025-10-15 1:10 AM
Hello @DF_MC,
Thank you for your report.
A ticket will be created on our side for the missing ErrMask definition when only bus voltage sensing is enabled on the M2 path. You can add the errMask definition as follows:
__weak void TSK_SafetyTask_PWMOFF(uint8_t bMotor)
{
/* USER CODE BEGIN TSK_SafetyTask_PWMOFF 0 */
/* USER CODE END TSK_SafetyTask_PWMOFF 0 */
uint16_t CodeReturn = MC_NO_ERROR;
uint8_t lbmotor = M1;
const uint16_t errMask[NBR_OF_MOTORS] = {VBUS_TEMP_ERR_MASK, VBUS_TEMP_ERR_MASK2};
/* Check for fault if FW protection is activated. It returns MC_OVER_TEMP or MC_NO_ERROR */
/* Due to warning array subscript 1 is above array bounds of PWMC_Handle_t *[1] [-Warray-bounds] */
if (M2 == bMotor)
{
lbmotor = M2;
}
CodeReturn |= PWMC_IsFaultOccurred(pwmcHandle[lbmotor]); /* check for fault. It return MC_OVER_CURR or MC_NO_FAULTS
(for STM32F30x can return MC_OVER_VOLT in case of HW Overvoltage) */
if (M2 == bMotor)
{
uint16_t rawValueM2 = RCM_GetRegularConv(&VbusRegConv_M2);
CodeReturn |= errMask[bMotor] & RVBS_CalcAvVbus(&BusVoltageSensor_M2, rawValueM2);
}
2025-10-15 7:27 AM
Hello @GMA ,
Thanks for your reply. I really appreciate your help!