Error Code '0x60' and '0x400' when Running at High Velocity


#1

I am getting the error code ‘0x60’ when trying to run my motor/ODrive set up using the odrivetool and the command odrv0.axis0.controller.vel_setpoint = 500000. The motor revs up and then stops spinning completely and the ODrive becomes unresponsive to velocity commands. I am having similar troubles when running the ODrive with the Arduino. These are my full error codes:

In [30]: hex(odrv0.axis0.error)                                                                                                                                                    
Out[30]: '0x60

In [31]: hex(odrv0.axis0.motor.error)                                                                                                                                              
Out[31]: '0x400'

Nothing on the encoder error. I think, if I am reading the documentation right that I am getting these two errors on the axis error:

ERROR_MOTOR_DISARMED = 0x20, //<! the motor was unexpectedly disarmed
ERROR_MOTOR_FAILED = 0x40, // Go to motor.hpp for information, check odrvX.axisX.motor.error for error value 

These two I believe are adding together to the 0x60 axis error. But in the error motor flags I am not seeing 0x400 anywhere. Does anyone have any idea what is going on here and why I can’t run my motor at full speed. I want to be running at 7030 rpm or about 959829 [counts/s].


#2

UPDATE.

I was able to get slightly over 500000 [counts/s] when I lowered the amperage using to 5 amps using the command:

odrv0.axis0.motor.config.current_lim = 5

When I raised the amperage to 60 amps my ODrive would not even do a calibration sequence. When I would try to do it the motor would jump a coupe steps then stop moving and would give the axis error code ‘0x40’ and the motor error code ‘0x1’. This leads me to believe that there is something going on with the amperage setting that is causing my issues. Any ideas?


#3

Have you defined the correct number of pole pairs?


#5

I was starting to think that may be the issue as well. I actually reflashed my board and forgot to check the number so I was running at the default of 7. But the Odrive would work when this number is set to 7. It would calibrate and stop spinning at around 500000 [counts/s] as stated above.

The number that should be in the odrv0.axis0.motor.config.pole_pairs is the number of permanent magnets right? Not the number of magnets divided by two? Because I unmounted my motor and counted the magnets and there are 14. I set the number to 14 and tried running a full calibration sequence. The motor spins one direction and then stops and I get these errors:

In [5]: hex(odrv0.axis0.error)                                                                                                                                                     
Out[5]: '0x100'

In [6]: hex(odrv0.axis0.encoder.error)                                                                                                                                             
Out[6]: '0x2'

Here’s a quote from the getting started guide “This is the number of magnet poles in the rotor, divided by two. To find this, you can simply count the number of permanent magnets in the rotor, if you can see them.”

14 magnets, 28 poles, 14 pole pairs.

So now the mystery is, why is the ODrive only working (calibrating) when the number of magnetic pole pairs is set to exactly half the actual number???

Notes about my set up:

In [1]: odrv0.axis0.config                                                                                                                                                         
Out[1]: 
startup_motor_calibration = False (bool)
startup_encoder_index_search = False (bool)
startup_encoder_offset_calibration = False (bool)
startup_closed_loop_control = False (bool)
startup_sensorless_control = False (bool)
enable_step_dir = False (bool)
counts_per_step = 2.0 (float)
step_gpio_pin = 1 (int)
dir_gpio_pin = 2 (int)
ramp_up_time = 0.4000000059604645 (float)
ramp_up_distance = 12.566370964050293 (float)
spin_up_current = 10.0 (float)
spin_up_acceleration = 400.0 (float)
spin_up_target_vel = 400.0 (float)

In [2]: odrv0.axis0.motor.config                                                                                                                                                   
Out[2]: 
pre_calibrated = False (bool)
pole_pairs = 7 (int)
calibration_current = 10.0 (float)
resistance_calib_max_voltage = 2.0 (float)
phase_inductance = 2.3425634935847484e-05 (float)
phase_resistance = 0.0392509326338768 (float)
direction = -1 (int)
motor_type = 0 (int)
current_lim = 60.0 (float)
requested_current_range = 60.0 (float)
current_control_bandwidth = 1000.0 (float)

In [3]: odrv0.axis0.encoder.config                                                                                                                                                 
Out[3]: 
mode = 0 (int)
use_index = False (bool)
pre_calibrated = False (bool)
idx_search_speed = 10.0 (float)
zero_count_on_find_idx = True (bool)
cpr = 8192 (int)
offset = -4435 (int)
offset_float = -0.3785000443458557 (float)
bandwidth = 1000.0 (float)
calib_range = 0.019999999552965164 (float)

#6

14 magnets is 7 pole pairs.

There is a known problem with running a motor at such high speeds, see


#7

14 magnets = 7 pole pairs. Great glad that is cleared up.

Oh boy that’s a can of worms. Let me see if I can break this down a little.

This is the motor that I am running. Running this at 37 v and at the cut off RPM of 3662ish I should be getting a duty cycle of 78.1%. I am not sure what Lphase is here but plugging in the numbers it looks like I should be getting an amperage ripple of 114 amps at 8kHz. Less than yours. At 24kHz the number is 38 amps. I am not sure at what switching frequency I am running at or how to tell? But…

Maybe this doesn’t even matter because A: doing that didn’t seem to fix your problem and B: I don’t think we are having the same error are we? It looks like I am getting the error ERROR_CURRENT_SENSE_SATURATION and you were getting the error ERROR_BRAKE_CURRENT_OUT_OF_RANGE.

The last post there lost me a little but it sounds like you are still waiting for @madcowswe to get back to you. Oskar, do you want to weigh in here? Do you believe our problems are related or can you shed some light on why I am getting this error?

NOTE: I have an oscilloscope with one working probe right now if anyone has a suggestion for how to use it to gather some more data.

UPDATE: After reading this I started playing around with the various settings on ODrive tool and also hooked it up to my Arduino system where I was using a controller to play with stuff. I noticed a few things.

First, when I used the controller to slowly increase velocity I could get to a higher RPM than when I would start at a high velocity and turn it on from zero. When I turn it on from zero it will often shut off before it reaches even 3000 rpm. Also when this happens it seems to be happening when the motor first starts spinning or when it is turning it off. I believe when it is stoping this is because the motor has stored rotational energy and is acting as a generator and it is causing an amperage spike as this energy is pushed back into the ODrive. Not sure why this is happening when it is starting unless the ODrive is opening up the amperage all the way and causing a spike. Maybe it is trying to ramp too fast?

Second, when I slowly increase the speed it will still shutoff at around 3500 rpm. But this time I noticed that the motor starts to vibrate very hard before it shuts off. Do I need to run a tuning procedure? It doesn’t vibrate when stationary.


#8

I think we have the same problem.
I get ERROR_CURRENT_SENSE_SATURATION. I get this error when I try to run the 150kv odrive motor at speed of towards 4000rpm.

I have noticed that I can set vel_limit higher if I decrease vel_gain.
If I increase to vel_gain = 5/10000 I get 0x400 but at vel_gain = 3/10000 it seems to work at vel_limit 500000.

These are the parameters I’m using:
odrv0.axis0.motor.config.current_lim = 60
odrv0.axis0.motor.config.calibration_current = 60
odrv0.axis0.controller.config.pos_gain = 100
odrv0.axis0.controller.config.vel_gain = 3/10000
odrv0.axis0.controller.config.vel_integrator_gain = 0
odrv0.axis0.controller.config.vel_limit = 500000
odrv0.axis0.motor.config.current_lim = 10
odrv0.axis0.motor.config.calibration_current = 10

and I’m testing it by setting pos_setpoint = 10000 and pos_setpoint = 800000.

My setup:
odrive 3.5 48V
odrive motor D6374 150KV
8192 CPR ENCODER
4 4cell lipo batteries

Load: Ballscrew with some friction


#9

Thanks for your response @Launchpad-McQ. Unfortunately this didn’t help at all. Regrettably, I will be returning one of my ODrives and will be replacing it with a VESC to hopefully achieve what I am trying to do as high velocity is an integral part of my project. Here you can see a VESC operating with an encoder. I am not sure how well this works in comparison to the ODrive but it may be worth considering if you need high velocity in your project.