BLDC_SCALAR_XMC1302 motor running Fixed Pattern

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Bond_007
Level 3
Level 3
10 questions asked 25 sign-ins 10 replies posted

Hello Team,

We are working to run the BLDC motor. For that we need to do hall learning procedure after that we will get six patterns used to run the BLDC motor. We are doing this using Infineon Example code "BLDC_SCALAR_HALL_XMC13_Power_Tool" and the patterns read from hall sensors after hall learning procedure as below 
0x201
0x021
0x120
0x102
0x012
0x210

Here we are facing issue which motor is not running after updating six patterns in the code.
It is running only for fixed pattern if we update as below 

#define MOTOR0_BLDC_SCALAR_CCU8_PH_U_SLICE_NUM  (1U)
#define MOTOR0_BLDC_SCALAR_CCU8_PH_V_SLICE_NUM   (2U)
#define MOTOR0_BLDC_SCALAR_CCU8_PH_W_SLICE_NUM  (0U)

Is that issue related to Software ?

image (6).png

 

 

Can anyone help me to solve this issue ?

 

Thank you,
Vamshi.b

0 Likes
1 Solution
Krupashankar
Moderator
Moderator
Moderator
500 replies posted 50 likes received 25 likes received

Hi @Bond_007,

From your code we could see that after hall learning you have replaced the hexadecimal value instead of macro. Please try replacing the below code in power_tools_kit_DirectFET.h file.

#define MC_PAT_A WL_VOFF_UH /*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_A */
#define MC_PAT_B WOFF_VL_UH /*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_B */
#define MC_PAT_C WH_VL_UOFF /*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_C */
#define MC_PAT_D WH_VOFF_UL /*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_D */
#define MC_PAT_E WOFF_VH_UL /*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_E */
#define MC_PAT_F WL_VH_UOFF /*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_F */

 

Could you please capture the hall sensor output with respect to the back-emf of the motor to determine if there is any hall angle offset. Please capture the hall sensor output using the CRO to compare if the hall learning is same as the waveform captured in CRO.

 

Ques: Please tell me the reason to cause WHES bit set. why wrong hall is detecting. Am I missing anything ?

WHES will be enabled if the received hall output is not same as the expected hall pattern this will cause WHES 

For how WHES and CHES bit  is being set please refer to APPNOTE AP32289

 

Thanks,

Krupashankar

View solution in original post

0 Likes
9 Replies
Krupashankar
Moderator
Moderator
Moderator
500 replies posted 50 likes received 25 likes received

Hi @Bond_007 ,

Thanks for the post! 

Ques: Is that issue related to Software?

No, It is not due to the software. It is due to the output of hall sensors and three hall sensor placement W.R.T rotor. In your case we could see the hall sensor output is not matching with the UVW.  This can be matched by changing the hall pattern as you have done in your project to run the motor.

#define MOTOR0_BLDC_SCALAR_CCU8_PH_U_SLICE_NUM  (1U)
#define MOTOR0_BLDC_SCALAR_CCU8_PH_V_SLICE_NUM   (2U)
#define MOTOR0_BLDC_SCALAR_CCU8_PH_W_SLICE_NUM  (0U)

If you don't want to change the hall pattern in above method:

  • Please try interchanging the hall sensor cables to get the required hall sensor pattern in either direction of rotor.
  • You could also try changing the hall sensor sequence by choosing BLDC_SCALAR_HALL_SEQ_2.

             #define MOTOR0_BLDC_SCALAR_HALL_POSITIVE_DIR_SEQ                      (BLDC_SCALAR_HALL_SEQ_2)

 

Please let us know if this solves your problem.

 

Thanks,

Krupashankar

 

 

0 Likes

Thank you for the reply @Krupashankar ,

Yes I agree, but after hall learning procedure we got six patterns as below
0x201
0x021
0x120
0x102
0x012
0x210

I have updated above in the code as mentioned in "DEMO-PTOOL-300W user guide" at section 2.
But not running the motor.

What might be the issue ? What else I have to consider in this process for not running motor with acquired pattern.?

Any help would be very thankful.

Hall_Learning Process.PNG

0 Likes
Krupashankar
Moderator
Moderator
Moderator
500 replies posted 50 likes received 25 likes received

Hi @Bond_007,

Could you please share the power_tools_kit_DirectFET.h file this help us to understand and compare the hall pattern which you have changed.

Could you please tell if you are able to run the motor if you change the following along with the hall pattern in t power_tools_kit_DirectFET.h file:

#define MOTOR0_BLDC_SCALAR_CCU8_PH_U_SLICE_NUM  (1U)
#define MOTOR0_BLDC_SCALAR_CCU8_PH_V_SLICE_NUM   (2U)
#define MOTOR0_BLDC_SCALAR_CCU8_PH_W_SLICE_NUM  (0U)

 

Could please tell us how you obtained the hall pattern either by running  the motor in open loop or by rotating manually?

 

Thanks,

Krupashankar

0 Likes
Bond_007
Level 3
Level 3
10 questions asked 25 sign-ins 10 replies posted

Hi @Krupashankar ,

Sorry for the delay.

"Could you please tell if you are able to run the motor if you change the following along with the hall pattern in t power_tools_kit_DirectFET.h file:

#define MOTOR0_BLDC_SCALAR_CCU8_PH_U_SLICE_NUM  (1U)
#define MOTOR0_BLDC_SCALAR_CCU8_PH_V_SLICE_NUM   (2U)
#define MOTOR0_BLDC_SCALAR_CCU8_PH_W_SLICE_NUM  (0U) "
- Yes, Running motor as per pattern U-1, V-2, W-0. we are changing only above as per phases and proceeding for hall learning.


Could please tell us how you obtained the hall pattern either by running  the motor in open loop or by rotating manually?
- I've obtained hall pattern with hall learning process(Open loop) which we have to enable hall learning enable macro.

But facing problem in closed loop, where we are unable to run the motor with the obtained pattern.
Could you please tell me what should be considered/Understand to run motor in closed loop.?



0 Likes
Krupashankar
Moderator
Moderator
Moderator
500 replies posted 50 likes received 25 likes received

Hi @Bond_007,

Could you please share the power_tools_kit_DirectFET.h file after including the changes from hall learning?

Could you please confirm if there is any hall angle offset?

Please share the motor parameters and the configuration. Could you please tell what is the fault you are getting when you try to run the motor in closed loop.

 

Thanks,

Krupashankar

0 Likes

Hi @Krupashankar ,

3 Halls are placed at 120degrees.
 
changed the phase matching in software as well as in hardware manually. 
(U -> W, V -> V, W -> U)

 

#define MOTOR0_BLDC_SCALAR_CCU8_PH_U_SLICE_NUM  (0U)
#define MOTOR0_BLDC_SCALAR_CCU8_PH_V_SLICE_NUM  (2U)
#define MOTOR0_BLDC_SCALAR_CCU8_PH_W_SLICE_NUM  (1U)

 

 

below are the patterns got after hall learning process in open loop and I set those six MC patterns to run motor in "power_tools_kit_DirectFET.h" file as below

#define MC_PAT_A				(0x201U)							/*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_A */
#define MC_PAT_B				(0x021U)					/*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_B */
#define MC_PAT_C				0x120U)  							/*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_C */
#define MC_PAT_D				(0x102U) 							/*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_D */
#define MC_PAT_E				(0x012U) 							/*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_E */
#define MC_PAT_F				(0x210U)						/*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_F */

 
Hall Inputs are kept as it is from motor to XMC1300 controller connector X101.
"(H1 -> H1, H2 -> H2, H3 -> H3)"

Now I disabled Hall Learning Enable macro to run motor using the above six patterns.
as per "DEMO-PTOOL-300W user guide" motor has to run for the above six patterns.

I started rotating potentiometer but motor is not running in open loop. It is going to "Motor0_BLDC_SCALAR_HallEvent_ISR(void) " as below

 * \par<b>Description:</b><br>
 * Event is mapped to correct and wrong hall event of POSIF.\n
 * Correct hall - used ONLY in STATE_IDENTIFICATION state to get the speed, position and direction of the freely running motor.\n
 * Wrong hall - used to find direction reversal or real wrong hall event (hall failure) \n
 * For reverse hall, apply next hall and multi-channel pattern based on the intended direction.
 * For hall failure, stop the motor and change the state to ERROR.
 */
RAM_ATTRIBUTE void Motor0_BLDC_SCALAR_HallEvent_ISR(void)
{
  /* Wrong hall event */
  if (Motor0_BLDC_SCALAR_SPEED_POS_HALL_GetEventStatus(XMC_POSIF_IRQ_EVENT_WHE) == (uint8_t)1)
  {
#if (((MOTOR0_BLDC_SCALAR_ENABLE_BIDIRECTIONAL_CTRL == 1U) || (MOTOR0_BLDC_SCALAR_ENABLE_CATCH_FREE == 1U)))
    /* handle reverse hall event and correct the pattern */
    Motor0_BLDC_SCALAR_WrongHallEvent();
#elif (MOTOR0_BLDC_SCALAR_REVERSE_HALL == 1U)
    /* handle reverse hall event and correct the pattern */
    Motor0_BLDC_SCALAR_WrongHallEvent();
#else
    /* stop the motor in wrong hall event */
    Motor0_BLDC_SCALAR.error_status |= (uint32_t)1 << (uint32_t)BLDC_SCALAR_EID_WRONGHALL;
    Motor0_BLDC_SCALAR.msm_state = BLDC_SCALAR_MSM_ERROR;
    Motor0_BLDC_SCALAR_MotorStop();
#endif
  }
#if (MOTOR0_BLDC_SCALAR_ENABLE_CATCH_FREE == 1U)
  /* Correct hall event */
  else
  {
    Motor0_BLDC_SCALAR_CorrectHallEvent();
  }
#endif
}



I was trying to understand this from past 10 days but not getting idea Why it is going to "Motor0_BLDC_SCALAR_HallEvent_ISR(void) " ?

Any help would be very thankful @Krupashankar .

0 Likes
Krupashankar
Moderator
Moderator
Moderator
500 replies posted 50 likes received 25 likes received

Hi @Bond_007,

 

Every time when Hall trigger happens Motor0_BLDC_SCALAR_HallEvent_ISR will occur.

Could you please check if the WHES bit is set in the PFLG register? this happens if there is wrong hall event.

If the hall pattern is correct CHES bit is set in PFLG register 

Regarding PFLG register, Please refer to XMC1300 user manual 

For POSIF events and you could also refer to APPNOTE AP32289

Please check if there is noise in the hall sensor signal. Please capture your hall sensor output using CRO and compare it with the hall learning pattern to make sure HALL event is captured correctly.

 

Thanks,

Krupashankar

0 Likes

Hi @Krupashankar ,

I have checked the registers when motor is not running. WHES bit is High in PFLG register why wrong hall event is detecting. Motor has to run for the pattern I have set at line 115 to 120 as below figure. Please check the image below
Hall Event Registers.png


Also below is the phase matching in the file "bldc_scalar_mcuhw_config.h" 
#define MOTOR0_BLDC_SCALAR_CCU8_PH_U_SLICE_NUM    (0U)
#define MOTOR0_BLDC_SCALAR_CCU8_PH_V_SLICE_NUM     (1U)
#define MOTOR0_BLDC_SCALAR_CCU8_PH_W_SLICE_NUM    (2U)

Please tell me the reason to cause WHES bit set. why wrong hall is detecting. Am I missing anything ?
In the document he has mentioned that applying six patterns which got after hall learning procedure results to run the motor. But this is case happening every time to me.

Why motor is not running with the patterns after hall learning  procedure.?



Thanks
Vamshi.B

0 Likes
Krupashankar
Moderator
Moderator
Moderator
500 replies posted 50 likes received 25 likes received

Hi @Bond_007,

From your code we could see that after hall learning you have replaced the hexadecimal value instead of macro. Please try replacing the below code in power_tools_kit_DirectFET.h file.

#define MC_PAT_A WL_VOFF_UH /*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_A */
#define MC_PAT_B WOFF_VL_UH /*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_B */
#define MC_PAT_C WH_VL_UOFF /*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_C */
#define MC_PAT_D WH_VOFF_UL /*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_D */
#define MC_PAT_E WOFF_VH_UL /*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_E */
#define MC_PAT_F WL_VH_UOFF /*!< Phase pattern corresponding to MOTOR0_BLDC_SCALAR_HALL_PAT_F */

 

Could you please capture the hall sensor output with respect to the back-emf of the motor to determine if there is any hall angle offset. Please capture the hall sensor output using the CRO to compare if the hall learning is same as the waveform captured in CRO.

 

Ques: Please tell me the reason to cause WHES bit set. why wrong hall is detecting. Am I missing anything ?

WHES will be enabled if the received hall output is not same as the expected hall pattern this will cause WHES 

For how WHES and CHES bit  is being set please refer to APPNOTE AP32289

 

Thanks,

Krupashankar

0 Likes