Error_Current_Unstable when braking with Lockin_spin

I’ve been using the Lockin_Spin feature from the dev branch and hover board motors to get the hardest possible stops. In my application the user spins the motor and it provides variable torque usually resisting (braking) and sometimes stopping very fast.

This works at lower speeds, but beyond a certain speed the board errors (Error_Current_Unstable) and basically provides no force.

I’ve tried to debug a couple of things myself.

  1. When the motor is spinning quickly there will be a lot of current to resist the spin of the motor, and if that isn’t dissipated through the resistor it might overvolt something. I don’t think that’s issue because I have the included resistors wired in and resistance set to .7ohm which is what I measured.
  2. I have a 24V board with a 24V power supply, maybe the excess power is overvolting the board. I decreased the power supply to 20v (no effect).
  3. I’m asking it to stop too fast, which requires too much current, and so in the general_lockin settings I’ve tried changing the ramp time up to 2s (no effect).
  4. I’ve capped the current too low to stop the motor that fast. Increased the lockin current to 20v (no effect)

I’m thinking now it may be that my power supply may not be able to deliver the requested current needed to stop the motor, or that the fast spin of the motor is momentarily causing the Odrive to ask for an absurd amount of power. Either way I’m starting to dig into the firmware both to understand the error and how to fix it. If you guys have any insight I’d love to hear from you.

upgraded to master 5.1, because:

  • Fixed bug where commanded velocity was extremely high just after sensorless ramp when using input_mode INPUT_MODE_VEL_RAMP caused by vel_setpoint and axis.config.sensorless_ramp.vel being in different units

but that wasn’t the problem.

Reconfigured my drive since I thought it may have been wiped in the update and the error I’m getting now is motor_error_current_limit_violation, which is more descriptive than before and sounds like it has to do with the current the motor is generating when braking.

Watching the voltages with liveplotter has shown that indeed the phase voltages peak very high when the motor starts braking, so increasing motor.config.current_lim up to 60V has greatly increased the speed I can move the motor before it shuts off.

I think this is safe because this amperage lasts for such a short duration that it won’t heat up the motor much, although it may now stupidly allow me to dump far too much current into the motor when I forget about this later.

New issue is that I’m overvolting the DC bus and tripping the current sense saturation. Still working on it


looking through old issues I found: this, and this.

The full issue, with solution:
Hoverboards generate a lot of power and torque. If you tell a hoverboard to stop suddenly it will instantly uses all the energy it is generating by spinning (back EMF) to brake. This power also gets dumped back into the board, which should then go into the braking resistor, BUT it’s a very large current that appears instantly and only lasts for a moment (because the braking torque is also incredibly high so it stops the motor quickly) and with my setup (running at 24v) the braking chopper (switch that activates the brake resistor) didn’t react in time before the voltage rose above the max voltage (26V) and my board shut down without stopping the motor.

The solution was to use a slightly weaker power supply (in my case 20V) and use the overvoltage ramp set to 20V, so that my board has time to react to power being generated by the motor. I also had to increase the maximum current allowance for the axis and the motor, with the understanding that this peak current would only be drawn for fractions of a second and wouldn’t heat the motor enough to damage it.