cancel
Showing results for 
Search instead for 
Did you mean: 

MCU code for Motor Driver signals EN_U, EN_V and EN_W doesn't show pins getting set ??

BTrem.1
Senior II

I am using a STM32G431 MCU and a custom driver using the STSPIN233. My driver doesn't appear to be enabled so I'm debugging code. I do not see where the ow-side EN_U, EN_V and EN_W pins get set high. In the mode I'm using these signals are GPIO outputs and should always be high when the driver is enabled.

The code MX_GPIO_Init shows the following for these pins:

 /*Configure GPIO pin Output Level */
 
 HAL_GPIO_WritePin(GPIOB, M1_PWM_WN_U_Pin|M1_PWM_EN_V_Pin|M1_PWM_EN_W_Pin|STBY_RES_Pin, GPIO_PIN_RESET);
 
 /*Configure GPIO pins : M1_PWM_WN_U_Pin M1_PWM_EN_V_Pin M1_PWM_EN_W_Pin */
 GPIO_InitStruct.Pin = M1_PWM_WN_U_Pin|M1_PWM_EN_V_Pin|M1_PWM_EN_W_Pin;
 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
 GPIO_InitStruct.Pull = GPIO_NOPULL;
 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

I can't find anywhere they get set high. When I use MCWB 5.4.4 and generate a generic project using a STM32G431 and a IH16M1 driver I get the same code for the drive stage. The IH16M1 board uses the STSPIN830 with the same driver mode. The low-side enables should always be high. --- What am I missing here ?

1 ACCEPTED SOLUTION

Accepted Solutions
BTrem.1
Senior II

[Solved] Well, I'll answer my own question. I specifically added user code to set those enables high just as I entered main. Now the driver is activated and the motor spins. This is the problem when you use middleware and are not sure if "should I do this or is it already done?"

View solution in original post

1 REPLY 1
BTrem.1
Senior II

[Solved] Well, I'll answer my own question. I specifically added user code to set those enables high just as I entered main. Now the driver is activated and the motor spins. This is the problem when you use middleware and are not sure if "should I do this or is it already done?"