cancel
Showing results for 
Search instead for 
Did you mean: 

Issue moving a BLDC motor with STM32F302 and IHM08M1 driver

JCarn
Associate

Hello,

We cannot move a BLDC motor (using the x-cube-spn8 demo software with IAR) with STM32F302 and IHM08M1 driver.

It attempts to move but is stuck and bound up. Once in a while immediately on starting app it would move a few revolutions before binding up. The demo ramps the velocity in cycles, which I can hear when it is driving.

Both the motor driver and HALL pins are connected to the IHM08M1 driver board.

We are using the latest version of the IAR compiler v 8.32 and this is where I downloaded the demo software:

https://my.st.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-spn8.license=1545308016142.product=X-CUBE-SPN8.version=1.0.1.html

When I opened the project file it converted the x-cube-spn8 project to be able to be used with the latest compiler. Is this OK or do you recommend a specific compiler version?

Are there any parameters that we should know that can cause the motor commutations to not fire in correct order for the motor we are using?

en.x-cube-spn8\STM32CubeExpansion_SPN8_V1.0.1\Projects\Multi\Examples\MotorControl\Inc\MC_SixStep_param.h

We did set the NUM_POLE_PAIRS to 4 to match our BLDC motor in this header file:

\en.x-cube-spn8\STM32CubeExpansion_SPN8_V1.0.1\Projects\Multi\Examples\MotorControl\Inc\MC_SixStep_param.h

We noticed via the scope that Pin 2 on J3 (HALL 2 - aka PB3) is at random cycling up and down even when the motor is turned by hand while the program is running. The other HALL Pins look OK:

Here is the associated code in the demo project related to setting up that pin.

Does this look correct?

This is from the file:

en.x-cube-spn8\STM32CubeExpansion_SPN8_V1.0.1\Projects\Multi\Examples\MotorControl\Src\stm32f3xx_hal_msp.c

 else if(htim_base->Instance==TIM2)

 {

 /* USER CODE BEGIN TIM2_MspInit 0 */

 /* USER CODE END TIM2_MspInit 0 */

  /* Peripheral clock enable */

  __TIM2_CLK_ENABLE();

  

  /**TIM2 GPIO Configuration   

  PB3   ------> TIM2_CH2 

  */

  GPIO_InitStruct.Pin = GPIO_PIN_3;

  GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

  GPIO_InitStruct.Pull = GPIO_NOPULL;

  GPIO_InitStruct.Speed = GPIO_SPEED_LOW;

  GPIO_InitStruct.Alternate = GPIO_AF1_TIM2;

  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

 /* USER CODE BEGIN TIM2_MspInit 1 */

 /* USER CODE END TIM2_MspInit 1 */

 }

-

This file describes "select configuration for workspace (normal, demo, comm or boot)".

We compiled with defaults but how do I pick a specific config for IAR compiler v 8.32 ?

\en.x-cube-spn8\STM32CubeExpansion_SPN8_V1.0.1\Projects\Multi\Examples\MotorControl\EWARM\STM32F302R8-Nucleo\readme.txt

Any help would be greatly appreciated.

Thanks, John

1 REPLY 1
Zied b.
ST Employee

Hello @JCarn ,
We would like to sincerely apologize for the delay in replying to your post.
If your point is still pertinent, can you try with MCSDK 6.1.2 and let me know if that solves your problem?
Regards

If you agree with my answer, please accept it by clicking on "Accept as solution".