Trouble running virtual spring code with TI Evaluation Board

Hi!

My team has assembled a dual motor test bed: connected to a TI evaluation board running the motorware dual motor torque controller. To test that we have assembled our hardware correctly, we ran the “virtual spring” code provided. This was done by enabling the virtual spring option in code, and enabling the motors right after the system enable flag was raised.

We expected the virtual spring code to measure the deflection between the position of the encoder at start-up and the current position of the encoder, and produce an opposite and proportional torque to reduce the deflection. However, we found that the virtual spring code only added a constant resistance to the motion of the motors.

Furthermore, the motor defined as Motor 1 in code makes a high-pitched noise when enabled, while the motor defined as Motor 2 undergoes random oscillations. I believe this to be a control problem, as swapping out the physical motor assigned to Motor 1/2 in code results in the same observations. Digging into the code, I found that the control parameters assigned to motor 1 are different with motor 2.

My observations above may be specific to my test setup, but I would like to ask the following, more general questions:

  • What is the expected behavior of the virtual spring code for the dual motor test bed?
  • Does anyone have a similar experience with the virtual spring code, or can provide an explanation on why this may be happening to my test setup?
  • Is there a reason why the motor 1 control parameters are different from the motor 2 control parameters, despite them controlling identical motor/encoder pairs?

Thank you for your time and suggestions!

Hello,

In general the expected behaviour is exactly you expect, it is basically just a simple P-controller, holding it at the current position. I’m not sure what could cause the behaviour you describe. One thing you could check is if the motor phases are connected in the correct order. If they are wrong, the motor will not move correctly and typically get stuck every few degrees (not sure if this matches with the behaviour you are seeing, though).

Can you describe how exactly are you enabling the system/motors? Are you changing flags in the code directly or at runtime or via the debugger or via CAN? Also in which order are you setting flags?

Regarding the control paramters, are you referring to the values in user_mtr_on_j1/5.h? If I recall correctly, the PWMs of the two motors are intentionally running at slightly different rates so that the two control loops are less likely to block each other. I think this was based on some example code by TI but I can’t find a reference right now.

Best,
Felix

2 Likes

Update: Thanks! I followed the new instructions that you posted. I also changed the motor phase wires. The motor test bed is spinning pretty well now.

1 Like