cancel
Showing results for 
Search instead for 
Did you mean: 

Evspin32G4 - dual

ItzSam
Associate II

Hello All,
I just Bought an Evespin32G4 dual Board.

https://www.st.com/en/evaluation-tools/evspin32g4-dual.html 

I completed the configuration using the X-CUBE-MCSDK-6.

Goal: I will command 2 motors 36V, 4A (Moteur Hoverboard)

I generated the cube ide project. When I run mc_startMotor1 (), the motor 1 starts training, then I tested the second motor mc_startMotor2 () and is turning.

Then I tried to run the 2 function one after the other to turn the 2 motor at the same time, for some reason just one of them turn, when I reset it seems like sometimes the first motor turn, and other times the second motor turn.

So please any idea, it can be something in the configuration.

1 ACCEPTED SOLUTION

Accepted Solutions
ASA
ST Employee

Hello,

This issue has been fixed with the solution proposed above in our new MCSDK 6.3.0 release,
so feel free to download it and try if it solved correctly your issue reported in this post.

Kind Regards.

Amina.

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

View solution in original post

8 REPLIES 8
GMA
ST Employee

Dear ItzSam,

May be an error occurs after mc_startMotor2() call that prevents the motor to spin.
You can check errors using "MC_GetCurrentFaultsMotor2()" API or using Motot pilot tool.

 

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA
ItzSam
Associate II

hey,
sorry for the delay,
i just tested the project i just call 
mc_startMotor1 ()
then i call 
mc_startMotor2 ()

just one of them turn 
this is a screenShot of the handler of the 2 motors 

Capture.PNG

as you can see the state of the first motor is RUN, and the other is FAULT_OVER 
with pastFaults code 1024 and some times both dont start 

ItzSam_0-1707505567432.png

 

edit : i found out that theose error linked to dirver protecttion and overcurrent 
i fixed them , now i am getting the FOC duration Fault, with the same problem one motor turn the other try to run for a second , then one of them just stop with FOC duration Fault.


thank you in advance.

GMA
ST Employee

Hello,

In case of FOC duration fault, please decrease the PWN Generation Frequency or increase Current sensing regulator execution time to give more time to MCU to process FOC.

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA
ItzSam
Associate II

Hello and thank you for your reply,

Sorry, but I am not able to run both motors on the EVSPING4-Dual, for now I have a problem linked to the overcurrent with the same behavior the first motor starts fine when I try to start the second either one of them stop with overcurrent fault or both, but separately they work fine.
I am using:

MCW Version: 6.2.0 + evspinG4 Dual

Trying to turn 2 hoverboard motors (I don't have their full caractersitcs): 36V/15A 500rpm with hall sensors and 15 pole pairs.

I disabled the over current protection for stage 2.

And now I get the overcurrent problems, both motor runs with no load and I start with low speed then I increase.

Here is the link to the workbench Project, please can you check it and and find where is my mistake.

https://drive.google.com/file/d/1u24FDPWdu0OykvhSL4KgBAJoid3Gnju0/view?usp=sharing 

Best regards.

 

GMA
ST Employee

Hello,

Thank you for this problem report.
We are investigating the issue, and we will come back to you asap.

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA
GMA
ST Employee

Hello,
We noticed that TIM1 and TIM8 did not start in a synchronized way as expected.
Could you please try by modifying the TIM1/8 starting procedure?
On main.c file, comment following lines:
In MX_TIM1_Init:

//  sSlaveConfig.SlaveMode = TIM_SLAVEMODE_TRIGGER;
//  sSlaveConfig.InputTrigger = TIM_TS_ITR1;
//  if (HAL_TIM_SlaveConfigSynchro(&htim1, &sSlaveConfig) != HAL_OK)
//  {
//    Error_Handler();
//  }

In MX_TIM8_Init:

//  sSlaveConfig.SlaveMode = TIM_SLAVEMODE_TRIGGER;
//  sSlaveConfig.InputTrigger = TIM_TS_ITR1;
//  if (HAL_TIM_SlaveConfigSynchro(&htim8, &sSlaveConfig) != HAL_OK)
//  {
//    Error_Handler();
//  }

Add them in pwm_common.c startTimers() function:

__weak void startTimers(void)
{
  uint32_t isTIM2ClockOn;
  uint32_t trigOut;
  TIM_HandleTypeDef htim = {0};
  TIM_SlaveConfigTypeDef sSlaveConfig = {0};

  htim.Instance = TIM1;
  sSlaveConfig.SlaveMode = TIM_SLAVEMODE_TRIGGER;
  sSlaveConfig.InputTrigger = TIM_TS_ITR1;
  HAL_TIM_SlaveConfigSynchro(&htim, &sSlaveConfig);

  htim.Instance = TIM8;
  sSlaveConfig.SlaveMode = TIM_SLAVEMODE_TRIGGER;
  sSlaveConfig.InputTrigger = TIM_TS_ITR1;
  HAL_TIM_SlaveConfigSynchro(&htim, &sSlaveConfig);

  isTIM2ClockOn = LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_TIM2);

And replace r1_ps_pwm_curr_fdbk.c R1_TIMxInit() function by:

void R1_TIMxInit(TIM_TypeDef *TIMx, PWMC_R1_Handle_t *pHandle)
{
  if (pHandle->pParams_str->TIMx == TIM1)
  {
    /* TIM1 Counter Clock stopped when the core is halted */
    LL_DBGMCU_APB2_GRP1_FreezePeriph(LL_DBGMCU_APB2_GRP1_TIM1_STOP);
  }
  else
  {
    /* TIM8 Counter Clock stopped when the core is halted */
    LL_DBGMCU_APB2_GRP1_FreezePeriph(LL_DBGMCU_APB2_GRP1_TIM8_STOP);
  }
  /* Disable main TIM counter to ensure a synchronous start by TIM2 trigger */
  LL_TIM_DisableCounter(TIMx);

  LL_TIM_SetCounterMode(TIMx, TIM_CR1_CMS_1);

  /* Disable ADC trigger */
  LL_TIM_SetTriggerOutput(TIMx, LL_TIM_TRGO_RESET);

  LL_TIM_OC_DisablePreload(TIMx, LL_TIM_CHANNEL_CH1);
  LL_TIM_OC_DisablePreload(TIMx, LL_TIM_CHANNEL_CH2);
  LL_TIM_OC_DisablePreload(TIMx, LL_TIM_CHANNEL_CH3);
  LL_TIM_OC_DisablePreload(TIMx, LL_TIM_CHANNEL_CH4);
  LL_TIM_OC_EnablePreload(TIMx, LL_TIM_CHANNEL_CH5);
  LL_TIM_OC_EnablePreload(TIMx, LL_TIM_CHANNEL_CH6);

  if (2U == pHandle->pParams_str->FreqRatio)
  {
    if (HIGHER_FREQ == pHandle->pParams_str->IsHigherFreqTim)
    {
      if (3U == pHandle->pParams_str->RepetitionCounter)
      {
        /* Set TIMx repetition counter to 1 */
        LL_TIM_SetRepetitionCounter(TIMx, 1);
        LL_TIM_GenerateEvent_UPDATE(TIMx);
        /* Repetition counter will be set to 3 at next Update */
        LL_TIM_SetRepetitionCounter(TIMx, 3);
      }
      else
      {
        /* Nothing to do */
      }
    }
    else
    {
      /* Nothing to do */
    }
    if (M1 == pHandle->_Super.Motor)
    {
      LL_TIM_SetCounter(TIMx, (uint32_t)(pHandle->Half_PWMPeriod) - 1U);
    }
  }
  else /* bFreqRatio equal to 1 or 3 */
  {
    if (M1 == pHandle->_Super.Motor)
    {
      if (3U == pHandle->pParams_str->RepetitionCounter)
      {
        /* Set TIMx repetition counter to 1 */
        LL_TIM_SetRepetitionCounter(TIMx, 1);
        LL_TIM_GenerateEvent_UPDATE(TIMx);
        /* Repetition counter will be set to 3 at next Update */
        LL_TIM_SetRepetitionCounter(TIMx, 3);
      }
      else
      {
        /* Nothing to do */
      }
      LL_TIM_SetCounter(TIMx, (uint32_t)(pHandle->Half_PWMPeriod) - 1U);
    }
    else
    {
      /* Nothing to do */
    }
  }

  LL_TIM_ClearFlag_BRK(TIMx);
  LL_TIM_ClearFlag_BRK2(TIMx);
  LL_TIM_EnableIT_BRK(TIMx);

  /* Enable drive of TIMx CHy and CHyN by TIMx CHyRef */
  LL_TIM_CC_EnableChannel(TIMx, TIMxCCER_MASK_CH123);
}

 Could you tell us if behavior is improved on your side?

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA
ASA
ST Employee

Hello,

This issue has been fixed with the solution proposed above in our new MCSDK 6.3.0 release,
so feel free to download it and try if it solved correctly your issue reported in this post.

Kind Regards.

Amina.

If you agree with my answer, please accept it by clicking on 'Accept as solution'.
ItzSam
Associate II

Hello,

Thank you. I have read the release notes and saw that you took it into consideration. I tested version 6.3.0, and it works now.

Best regards.