cancel
Showing results for 
Search instead for 
Did you mean: 

Motor spins and triggers a fault with STSPIN32F0A and the SPIN3202 6-step library

Hrishikesh
Senior

A few Qs about the 6-step library. I have a 350W, 36V motor that I'm trying to control using the STSPIN32F0A. I've got the 6-step library working ... sort of. The motor rotates for a few moments and then a fault state is triggered (USER2 LED). In the short time the motor rotates, the RPM does not match what is defined in the motor spec sheet header file. Also, I do not see any zero crossing and commutation event monitoring on PA5 and PA15 and I have enabled those in the motor header file.

As stated in the guide, I've lowered the ACC value way down to 60. I have enabled the voltage mode in the defines and I'm using hall sensors for the commutation process. I've attached the motor spec .h file here.

First Q: Not sure where to start debugging. As per the guide (pg. 32), I know that the RPM of my motor needs to be ~150. The motor has 15 pole pairs and with this value, I calculated the step-time to be 4.4ms. Based on this I calculated the LF_TIMxduration. Using the LF prescaler of 24 and a system clock of 48MHz, I get LF_TIMxduration to be 8800 counts. I'm guessing this is the LF_TIMx_ARR value in the motor spec .h file. Is this the right way to calculate this?

Second Q: How do I start tweaking the PI values?

Here are the defines:

USE_HAL_DRIVER,STM32F031x6,NO_UART_COMM,NO_PID,HALL_SENSORS,NO_ALL_WINDINGS_ENERGIZATION,NO_FIXED_HALL_DELAY,NO_PWM_ON_BEMF_SENSING,NO_MC_FAN_4PP_24V,NO_MC_RS_57BL54,NO_MC_2036_U_024_B_K312,NO_MC_BR2804_1700_KV_1,MC_360W_36V_BLDC,COMPLEMENTARY_DRIVE,VOLTAGE_MODE,POTENTIOMETER,NO_CURRENT_SENSE_ADC,NO_VBUS_SENSE_ADC,NO_TEMP_SENSE_ADC,NO_BEMF_RECORDING,NO_SPEED_SENDING,NO_SPEED_RAMP

1 REPLY 1
ANahh
Associate II

Hello Hrishikesh

I've managed to run it by including some of the header files. You find the needed information in the documentation UM2310 page 14.

Regards

Amr