2024-06-18 01:23 AM
[VERSION]:
MCSDK-6 : 6.3.0
STM32CubeMX : 6.11.1
STM32CubeIDE : 1.15.1
[TOOL]:-
[DETAILS]:
I am trying to drive a 12V BLDC Motor (Hall sensor) in current mode through STEVAL-SPIN3204.
Set the project parameters in MCSDK as shown in the picture, generate code in CubeMX, debug with CubeIde, and load it on STEVAL-SPIN3204.
It can be driven in MCSDK's Motor Pilot, but the RPM is fixed and cannot be adjusted.
I tried to write code in CubeIDE, but I don't know which part to touch.
----------------------------------------------------------------------------------------------
Additionally, the motor is currently driven by the user1 button. However, if I remove the USB that was used to debug the STEVAL-SPIN3204, the motor does not run even when I press the button. I don't know which part is wrong.
[EXPECTED BEHAVIOR]:
PWM or anything else is fine, so I want to control the speed, direction, start, and stop of the motor.
[HOW TO REPRODUCE]:
STEVAL-SPIN3204 - HallSensor(JP05,06,07 Close)(JP08,09,10 Open)
- Main Power(12V)
- BLDC U, V, W (Current Mode)
- USB(Debug)
Warriors,,,, Please save me..
2024-06-19 08:23 AM
Hi KIMHW,
first as recommended by the MCSDK6.3.0 workbench, on the board STEVAL-SPIN3204, i suggest you set jumper J11 to 2-3 position to allow the current mode driving mode (link of the PWM reference to AOP amplifier and comparator).
Secondly, you are perhaps facing an issue due to the low power and no loaded characteristics of your motor. To fit with your specification, i recommend you change the value of the RSHUNT of the board STEVAL-SPIN3204. The current 0.01ohm value (two parallel 0.02ohm resistors R26 and R27) allows a Readable current range: [0, 16 A]. That is surely too high. I suggest you desolder the existing resistors R26 and R27 and solder a new RSHUNT of 0.1ohm at resistor R26 location for example. This will generate a 10 times less Readable current range: [0, 1.6 A] In this condition you will be able to control the speed with the motor Pilot.
Hope this will help you.
Best regards
Fabrice
2024-07-07 05:23 PM - edited 2024-07-07 06:58 PM
Sorry for the late reply.
Currently, Motor Pilot is only used to check speed, and it has been confirmed that speed is converted through source modification within CubeIDE. However, because the automatically generated Init function is internally modified, it cannot be controlled arbitrarily. I want to use it in the Main function. Please tell me how to do it.
/ And, the motor is currently driven by the user1 button. However, if I remove the USB that was used to debug the STEVAL-SPIN3204, the motor does not run even when I press the button. I don't know which part is wrong.
/* USER CODE END TIM1_Init 1 */
htim1.Instance = TIM1;
htim1.Init.Prescaler = ((TIM_CLOCK_DIVIDER) - 1);
htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
htim1.Init.Period = ((PWM_PERIOD_CYCLES)*3); // Changing Motor Speed from here.
htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim1.Init.RepetitionCounter = (REP_COUNTER);
htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
//
Additional, using MC_ProgramSpeedRampMotor1 function does not change the speed of the motor, htim1.Init . Period = ((PWM_PERIOD_CYCLES) *3 ); / Only here, adjusting PWM_PERIOD_CYCLES changes the speed of the motor. MC_StartMotor1(); function works normally.
2024-07-08 11:01 PM
And, the motor is currently driven by the user1 button. However, if I remove the USB that was used to debug the STEVAL-SPIN3204, the motor does not run even when I press the button. I don't know which part is wrong.==========>MCU VDD is drived by USB5V;
You may set your PWM freq from 50KHz to 30KHz or lower to test;