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.

DRV8301-HC-EVM w/ Magnetic Rotary Encoder Issues

Other Parts Discussed in Thread: DRV8301, MOTORWARE

Hello,

I have the end goal of running the DRV8301-HC-EVM w/ an Electrocraft BLDC motor and AMS AS5040 Magnetic Rotary Encoder in the configuration shown in Figure 1-14, of the InstaSPIN-FOC and Motion User's Guide, with FAST providing commutation and the encoder being used to give position control over the motor.

I have run through all the MotorWare tutorials, and am currently on tutorial 12a. I've verified my magnetic encoder is working properly, and am attempting to hook it up to the DRV8301 board. The only information I can find is on P13 of the DRV8301 HW Guide, where it indicates the connections for J4 Header (for optional encoder) as:

Pin1 - E1A

Pin2 - E1B

Pin3 - E1C

Pin4 - VCC_5V

Pin5 - Gnd

I have attached my encoder in the following manner:

Pin1 - Encoder Channel A

Pin2 - Encoder Channel B

Pin3 - Encoder Index

Pin4 - Disconnected (running encoder circuit off separate power for now)

Pin5 - Gnd

My motor is connected with Phase A to DRV8301 A, Phase B to DRV8301 B, Phase C to DRV8301 C, so I assume it is connected properly.

I did have to change USER_IQ_FULL_SCALE_FREQ_Hz to a larger number, as my motor has only 2 poles, which was triggering the USER_ErrorCode_RoverL_estFreq_Hz_High error.

Upon changing gMotorVars.SpinTAC.VelIdRun to '1', I can hear a PWM whine coming from the motor, and the rotor locks, when I am assuming it should begin to spin. I have experimented with changing the order of the motor phases, but don't see a difference. Any ideas on what could be causing this problem?

Thanks,

Niels

  • Niels,

    When you ran the previous labs did you motor spin clockwise or anti-clockwise?  

    There are a couple of verification steps to take to ensure that your encoder is working correctly.  

    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.

  • Adam,

    LineStream - Adam Reynolds said:
    When you ran the previous labs did you motor spin clockwise or anti-clockwise?  

    In the previous labs (Lab 5a for example), with my current wiring, the motor spins anti-clockwise with regards to the magnetic rotary encoder.

    When I run your lab 12a verification steps, I did find that my encoder lines definition was not correct. I had assumed that because the magnetic rotary sensor had 10-bit accuracy, I could assume 2^10=1024 lines, but it seems that the equivalent # of lines actually = 256 (I am not very familiar with encoder terminology).

    I also found that rotating anti-clockwise gave me a value of -1. I switched two motor phases (A and C). Now I have been able to run Lab 12a and 12b with no problems.

    Thanks for the help, you have saved me many hours of debugging!

    Niels

  • Niels,

    I'm glad you were able to get it spinning!