This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/DRV8301-69M-KIT: Lab 12b problem with encoder resolution

Part Number: DRV8301-69M-KIT

Tool/software: Code Composer Studio

Hi,

I'm using a TMDSCNCD28069MISO Piccolo F28069M controlCARD. I'm working with lab 12b, the encoder resolution is 18000 PPR, my BLDC motor has 5 pole pairs. I defined encoder resolution as below 

#define USER_MOTOR_ENCODER_LINES        (18000)

and after compilation i have a warning: #62-D: integer operation result is out of range

I believe, in effect of warning the value of register QPOSMAX is equal 6462 (i think for encoder with resolution 18000 this value should be equal 4*18000=72000) and next issue is that when i manually rotate the motor 1 revolution clockwise  the value in "st_obj.vel.conv.Por_mrev" increases to 10, next decreases and after one revolution "st_obj.vel.conv.Por_mrev" is  approximately equal to -8,5.   

    

Is there any way to solve this problem?

Thanks for the help

  • Change the definition as below

    #define USER_MOTOR_ENCODER_LINES        (18000L)

    or

    #define USER_MOTOR_ENCODER_LINES        (18000.0F)


  • Thank you for your reply. I changed the definition of  USER_MOTOR_ENCODER_LINES and the warning dissapeared, the value of register QPOSMAX is correct 71998. I still have problem with "st_obj.vel.conv.Por_mrev", this variable is equal 1 when register QPOSCNT = 6465

    When manually rotate the motor 1 revolution clockwise the value in register QPOSCNT is equal 71998 and "st_obj.vel.conv.Por_mrev" is equal  -8,86

    Is the problem with  "mech_angle_gain" which converts the encoder counts to Q24 mechanical degrees?

  • Make sure that the physical connections of both motor and encoder are done correctly, run the lab02b to identify the motor parameters, and run the lab12a to identify the inertia and friction of the system.

    By the way, the calibration is necessary for a PMSM with encoder, that will be done automatically in the example lab.