Motor Stops after fixed time or rotations in Step/Dir mode

Hello all,
I am using an ODrive to control a Mill Spindle (and other axis in future) and am getting odrv0.axis0.error=5 after what seems to be a fixed amount of time or rotations.

The setup is as follows:
• PC Control Software = Mach4
• Motion Controller = Ethernet Smooth Stepper
• Step/Dir control on GPIO pins 1 and 2
• ODrive V3.5 48V (using Position Control)
• 36V PSU
• ODrive D6374 Motor
• CUI AMT102 encoder

If I continuously run the motor at 2000rpm, the motor will stop after about 2min 40sec. I confirmed that the Motion Controller is continuing to send signals and if I do nothing but reboot the Odrive (using ODriveTool), the motor will immediately start running again. Then after about another 2min and 40sec the motor will stop again.
If in the Mach4 control software I reverse the direction of the motor every 30 seconds, the motor will not stop or go into the error state (tested for about 15min of cycling every 30sec).

Has anyone seen type of issue?
Any ideas on what could be causing this?

Many thanks,

Sounds like the linear position count could be overflowing. 2 min 40 sec at 2000 rpm is…

160 seconds * 33.33 rev / sec = 5333.333 revolutions * 8192 counts / rev = ~ 43.7 million counts. That’s not very high. What’s your “counts per step” setting? odrv0.axis0.config.counts_per_step

Also, do you see any errors on the ODrive?

Wetmelon, thanks for the support.

The counts_per_step = 2
The only error I see is odrv0.axis0.error = 0x0005 (int)

After Reboot, I have the following…
error = 0x0000 (int)
enable_step_dir = True (bool)
current_state = 8 (int)
error = 0x0000 (int)
armed_state = 3 (int)
error = 0x0000 (int)
is_ready = True (bool)
index_found = False (bool)
shadow_count = -2 (int)
count_in_cpr = 8190 (int)
offset = -4586 (int)
interpolation = 0.5 (float)
phase = -0.5212392807006836 (float)
pos_estimate = -1.2123403549194336 (float)
pos_cpr = 8190.76708984375 (float)
hall_state = 6 (int)
pll_vel = 0.0 (float)
pll_kp = 2000.0 (float)
pll_ki = 1000000.0 (float)

After the motor stops running I have…
error = 0x0005 (int)
enable_step_dir = False (bool)
current_state = 1 (int)
error = 0x0000 (int)
armed_state = 0 (int)
is_calibrated = True (bool)
error = 0x0000 (int)
is_ready = True (bool)
index_found = False (bool)
shadow_count = -33552123 (int)
count_in_cpr = 2309 (int)
offset = -4779 (int)
interpolation = 1.0 (float)
phase = 0.35915088653564453 (float)
pos_estimate = -33552124.0 (float)
pos_cpr = 2306.774658203125 (float)
hall_state = 4 (int)
pll_vel = -184896.53125 (float)
pll_kp = 2000.0 (float)
pll_ki = 1000000.0 (float)

Any thoughts?

Update on efforts to get spindle motor to run for a longer amount of time…

Previously I had the CUIAMT102 encoder set to 8192 CPR. With this setting the motor would run for about 2min at 2500rprm before shutting down with axis error 5.

I lowered the encoder CPR to 2048 (512 ppr on encoder) and at 3000 RPM the motor would run for about 5min 20sec.

Does anyone have any ideas on what would cause this type of shutdown?

Many thanks.

The reason this happens is because we use floating point for position control and absolute encoder position tracking. Basically it’s not a good idea to rotate the motor further than 16,777,215 encoder counts, because higher than that is when it is no longer possible to represent single counts.
You actually made it twice as far, to the next loss in resolution at 33,554,430 counts:
shadow_count = -33552123 (int)
Probably what happened is at this point the velocity feedback will be super choppy, and the feedback current will be very noisy. Maybe that caused enough current ripple on your DC bus as to trip the over-voltage fault.

I’m curious, did the sound of the motor significantly change about half way through the test?

I actually have an idea for an incremental / circular position control mode that should let you incrementally advance the position of the motor forever. Until we have that, you can use velocity control mode instead, that supports spinning forever today.

EDIT: I added an issue to track this feature idea.

Thank you! This has been haunting me.
I don’t recall hearing a difference in motor sound. The motor would just stop.

In Velocity Control can I control the motor speed through the GPIO pins?

I am attempting to control the ODrive through a motion control board (Ethernet Smooth Stepper). It can output Step/Dir, PWM and a few others. If I can utilize this board without going through another interface, it would be great.

Any suggestions on the best control strategy?

Many thanks.

A post was merged into an existing topic: Velocity Control using PWM input