Skip to main content
Associate II
December 20, 2023
Question

Check PWM Duty Cycle on Motor Control

  • December 20, 2023
  • 1 reply
  • 2402 views

Hi.., Currently, I'm using STSPIN32F0601 and driving the BLDC motor using ST-MCSDK-5.4.5 and I'm very new to it. After spending a couple of weeks studying, I know how to call the API to check parameters like VBUS, Motor Speed, Motor Power, Phase current, and so on. The problem that I'm facing is I would like to check the Duty Cycle of the PWM signal when the motor is running. So.., may I know how I can see the real-time duty cycle of the PWM.

Thanks for your reply and help.

This topic has been closed for replies.

1 reply

SRedd.5
Senior III
December 22, 2023

I use MCSDK 6.2.0 the duty cycles are available in the function

 

__weak uint16_t PWMC_SetPhaseVoltage(PWMC_Handle_t *pHandle, alphabeta_t Valfa_beta)

 pHandle->lowDuty = (uint16_t)wTimePhA;
 pHandle->midDuty = (uint16_t)wTimePhB;
 pHandle->highDuty = (uint16_t)wTimePhC;
 pHandle->CntPhA = (uint16_t)(MAX(wTimePhA, 0));
 pHandle->CntPhB = (uint16_t)(MAX(wTimePhB, 0));
 pHandle->CntPhC = (uint16_t)(MAX(wTimePhC, 0));

 uint16_t CntPhA; /**< PWM Duty cycle for phase A. */
 uint16_t CntPhB; /**< PWM Duty cycle for phase B. */
 uint16_t CntPhC; /**< PWM Duty cycle for phase C. */

The function is called in FOC routine.

AggaAuthor
Associate II
December 22, 2023

Thanks for your help.

I will try to test it.