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.

Lab 12a: motor doesn't spin with encoder connected.

Other Parts Discussed in Thread: DRV8301

Hi all,

I'm using a TMDSCNCD28069MISO Piccolo F28069M controlCARD with DRV8301, with an Avago HEDS-5640 encoder.

When I try to do lab 12a (encoder connected), the motor doesn't spin. I have verified that the motor does spin without the encoder connected.

I am fairly certain that the cables are connected in the right way (at least if the GND pin is the one the farthest away from the J4 text on the inverter board).

I have followed the next troubleshooting procedure: 

1. Load the code for lab 12a into the C2000 DSP

2. Set gMotorVars.Flag_enableSys to 1

3. Add "st_obj.vel.conv.Pos_mrev" into the watch window, this is an IQ24 variable

4. Manually rotate the motor 1 revolution anti-clockwise.  Watch the value in "st_obj.vel.conv.Por_mrev" it should be approximately equal to 1.  

5. If the value in "st_obj.vel.conv.Pos_mrev" -1, the issue is the direction of the encoder, and you need to switch the A and B phases or switch two of the motor phases.

6. If the value in "st_obj.vel.conv.Pos_mrev" is less than 1, the issue could be with the encoder lines definition in the user.h file. 

7. If the value in "st_obj.vel.conv.Pos_mrev" is zero or nearly zero this indicates that your sensor might not be working.

Try these debug steps, this should help find the issue.

However, it is very hard for me to manually rotate the motor. Sometimes it spins 1/4 of a revolution and sometimes it doesn't. I have to do it by hand, because the shaft is not connected to anything yet. When I succeeded in rotating it one revolution, the value of st_obj.vel.conv.Pos_mrev was -100 (Q24), the same as before rotating. Rotating the shaft doesn't seem to change anything.

The value of USER_MOTOR_ENCODER_LINES is set at 500, which I found in the manual of the HEDS5640 encoder.

Thanks in advance.

  • In looking at the datasheet for the HEDS-5640 encoder, it seems like the pinout for this encoder is as follows:

    1 -> GND
    2-> Index
    3 -> Ch A
    4 -> Vcc
    5 -> Ch B

    While the pinout for J4 on the DRV8301 kit is as follows:

    1 -> Ch A
    2 -> Ch B
    3 -> Index
    4 -> Vcc (+5V)
    5 -> GND

    Have you corrected the cable so that the pins line up?  It seems like the encoder isn't reading anything.  Another test would be to use an oscilloscope on the encoder lines to make sure that when you spin the motor by hand, the encoder is sending out pulses.

    Also, in the encoder datasheet is mentions the 500 is CPR, which is usually the total counts around one mechanical revolution.  This typically means that USER_MOTOR_ENCODER_LINES should be set to 500 / 4 or 125.

  • I tried again, and now the value of "st_obj.vel.conv.Pos_mrev" does change when manually rotating the motor. The value started at 0.75 and rose approximately 4 per clockwise revolution, and this is with USER_MOTOR_ENCODER_LINES set at 125. So the encoder is actually reading something, but I still can't get the motor to rotate with lab 12a.

    Also, is it normal that I can't easily spin the motor manually? And when I do, it makes "jumps" of approximately 1/4 of one revolution.

    EDIT:

    I tried to run lab 12b. In this lab, the shaft still doesn't spin, but the motor vibrates strongly and makes a lot of noise. What can be the cause of this?

  • With lab 12a, the motor won't rotate by itself.  You need to set the variable gMotorVars.SpinTAC.VelIdRun to 1 before the motor will attempt to rotate.  Lab 12a is designed to do the inertia identification similar to lab 5c.  

    It sounds like your motor has a lot of cogging force, this happens it is very motor dependent.  Some motors are easier to spin by hand than others.  

    When you ran the sensorless labs which direction did the motor spin?  You need to make sure that when you rotate your motor in that same direction, the value in st_obj.vel.conv.Pos_mrev also increases.  This makes sure that the motor and encoder are aligned in the same direction.  Also are you allowing the motor to go through RsRecalc at startup?  We use this step to perform an initial alignment between the motor and the encoder.

  • LineStream - Adam Reynolds said:

    With lab 12a, the motor won't rotate by itself.  You need to set the variable gMotorVars.SpinTAC.VelIdRun to 1 before the motor will attempt to rotate.  Lab 12a is designed to do the inertia identification similar to lab 5c.  

    I have now set gMotorVars.SpinTAC.VelIdRun to 1, which results in the motor vibrating a lot and making noise, without the shaft rotating, like in lab 12b. What can be the cause of this? In previous labs the motor does spin like it should, even with the encoder connected.

    When you ran the sensorless labs which direction did the motor spin?  You need to make sure that when you rotate your motor in that same direction, the value in st_obj.vel.conv.Pos_mrev also increases.  This makes sure that the motor and encoder are aligned in the same direction.  Also are you allowing the motor to go through RsRecalc at startup?  We use this step to perform an initial alignment between the motor and the encoder.

    In the sensorless labs the motor spins in clockwise direction. Rotating the motor clockwise does result in an increase of st_obj.vel.conv.Pos_mrev, so they should be aligned in the same direction. The value of st_obj.vel.conv.Pos_mrev increases with approximately 4 per revolution, doesn't this mean that the value of USER_MOTOR_ENCODER_LINES should be set at 500 instead of 125?

    Also, RsRecalc is enabled.

  • Yes, I believe that the value for USER_MOTOR_ENCODER_LINES should be set to 500 instead of 125.  

  • LineStream - Adam Reynolds said:

    Yes, I believe that the value for USER_MOTOR_ENCODER_LINES should be set to 500 instead of 125.  

    Okay.

    Do you have an idea what could be the cause of the motor vibrating and making noise without the shaft spinning. This happens only in lab 12.

  • The vibration/noise means that there is an issue between the motor and the encoder.  So the FOC software is not getting a good angle to do motor control from.  Typically we see this if the encoder direction and motor direction are not aligned, if the encoder has the wrong number of counts configured, or if there is excessive noise on the encoder feedback lines.

  • Adam,

    One more question, to make sure the encoder cables are connected properly: What is the meaning of the triangle sign drawn near every jumper on the DRV8301 board? Is it used to show it's pin #1?

    In the attached picture, I have encircled two of these signs with a red circle.

  • Thomas,

    The triangle sign should indicate pin 1.