ERROR BRAKE CURRENT OUT OF RANGE error at high speeds

Great work @madcowswe and @Wetmelon, I can confirm the ripple is reduced to about a third, though the motor still errors at the same speed with the same error.

Interesting. I’ll try spooling it up to a higher speed here when I get the time.
Do you have a script to ramp up the speed, or how do you ramp the speed up in a controlled way for testing? That would be useful for my testing on this end.

I’ve been using this script to facilitate testing, I’ve only been using axis0, so its only really set up for that.

Thanks

Hi @madcowswe, have you had any time to run that motor to top speed?

Hi,
Sorry not just yet. I have the test rig all set up, and it’s at the top of my todo list. Hopefully in a day or two.

I have started investigating.
I found one issue, which seems to be that I have put too much capacitive loading on the current sense amplifier, so it overshoots. This plot is of the current sense outputs for phase B and C (channel 1, 2). Note that during some of the switching cycle the current doesn’t flow through the shunt, hence the square waves. On channel 4 I have a current clamp (that was reversed in this case) verifying the current in phase B.




At low modulation (low speed / voltage), we sample in the flat region, so it’s not a big deal. However at high modulation, we can end up sampling in the overshoot part. In the following diagram I have lined up the center vertical gridline to where it would sample. Note how it would be on the overshoot region in this case, and hence sample an incorrect (too large) value. (This time the current clamp is in the same direction as the ODrive measures).



The failure mode seems to be that the current controller goes unstable. The current limit was set to 10A, but here it oscillated up to 50A before erroring out with BRAKE_CURRENT_OUT_OF_RANGE.




So it seems there is this overshoot ring to the current sense, but after that the value seems completely usable. To test to see if we can fix it this way, I picked a new blanking time of 3.5us, and hence got a max modulation of 65%. I spun up the motor and unfortunately the current controller still went unstable at around the same speed (~6k RPM). I verified with the scope (didn’t save pics of that sorry), and with the new blanking time it would appear that the ADC should indeed read clean (after the ring) samples every time.

So there could be something else going on. Maybe the capacitive loading also means the sawtooth waveform of the current ripple gets skewed and gives a correlated error that causes the loss of control margin. Maybe it’s something completely different. One thing that is interesting is that 6k rpm mechanical is 700 Hz on this motor which is getting into the stop-band of the current controller bandwidth, and we are getting only about 12 control cycles per electrical rotation. So it could be an issue that presents itself at high eRPM.

I will keep investigating.

4 Likes

Is this what happens when 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

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

My setup:
odrive 3.5 48V
odrive motor D6374 150KV
16s lipo batteries

Load: Ballscrew with some friction

1 Like

Thanks for the detailed report. Yes it’s likely related.
We are still working on this, thanks for your patience (especially @Neil_FV, whos waited a long time I know).

Btw I have to ask:

Doesn’t that go over 48V?

Yes you’re right. I forgot how to math for a second there, it is 3*4s so 12s. I measured it to be 43v.

Based on this data, I seem to be able to calculate the limit value of ODrive’s erpm. 50000/8192x60x7=25634. Am I right about this? Oh. Is this an approximation of ODrive’s erpm?

Maybe that’s the case, but I’m not sure yet if it works exactly like that, or if the inductance of the motor and the back emf shape plays a role. Also the current controller bandwidth may play a role.

@Neil_FV I pushed a fix to devel just now (specifically this commit). I tested on the Propdrive v2 5050 580kv motor at 24V, I tested to 9000 RPM.

The issue was that I forgot to account for the phase shift between when the current is sampled and when the PWM is applied. I also changed some of the shunt amplifier passives on my test board, but I don’t think that was strictly necessary. Let me know how your tests go with the firmware changes, and if you still have issues you can try the following changes:

  • R26, R29, R44, R47 - 1kohm
  • C38, C39, C53, C54 - 82pF
  • R25, R30, R43, R48 - 22ohm
  • C36, C42, C51, C57 - 4700pF

I just tried it with that firmware and the issue remains :frowning: Do you maybe have the possibility to test it with D6374 150KV odrive3.5-48v using the same settings as I specified above? (it would be nice to be sure the issue can be replicated and solved before I bring out the solder iron.) Do you think switching resistors and capacitors will fix it?

1 Like

Thats great news Oskar, it’ll be a few days before I can test it. Thank you.

Blockquote
Launchpad-McQ

Is this what happens when 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

Sorry if this sounds noob, but why are you setting these twice?
odrv0.axis0.motor.config.current_lim = 60
odrv0.axis0.motor.config.calibration_current = 60

  • then
    odrv0.axis0.motor.config.current_lim = 10
    odrv0.axis0.motor.config.calibration_current = 10

Yeah that was a typo. A lot of typos in that post apparently :no_mouth:

Is there any updates about that issue? I’m having problems when i go faster than 1500rpm.
i haven’t change the resistor, but i have updated the firmware.
Any idea how to fix it?

1 Like

I haven’t had any luck with this change. Initially tried the firmware change which resulted in an uncontrolled oscillation around setpoint 1500 (3000rpm). So I made the hardware change to the resistors and capacitors and tried again, with the same result. Around setpoint 1500 (3000rpm), it goes in to an oscillation. The error produced is Current Sense Saturation.

Edit: Tried another motor (Scorpion HKIII-4025-650KV) which we also have loaded with a 1.2 Kg flywheel. Adjusted the vel_gain and vel_int_gain for a slow response. Reached around setpoint 1900 ( 3790 rpm) before failing with Current Sense Saturation.

I tested once again, when i ran the motor using LiPo batteries, i´m able to spin the motor up to 2500 rpm, when i use my 48V20A power suply, im not able to spin the motor faster than 1400 rpm.

What’s the difference between odrv0.axis0.motor.config.current_lim and odrv0.axis0.motor.config.requested_current_range? I’ve just tried doubling requested_current_range from 80A to 160A ( leaving current_lim at 80A) and acheived much higher rpm than ever before, almost 8000 rpm before an error occured, which incidently was ILLEGAL_HALL_STATE ( I’m using HALLs rather than an encoder).

Glad not to be getting the Current Sense Saturation error now, but I don’t understand why.