Motor runs once then never again

I’m new to odrives, building OpenDog from youtube.

I’m trying to setup the motor, a Eaglepower LA8308 KV90 - with a AMS AS5047P encoder.

The motor tunes with the first…
odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
command, but never again.

Here is everything I did:

n [2]: odrv0.axis0.motor.config.pole_pairs = 20

In [3]: odrv0.axis0.motor.config.torque_constant = 0.09188

In [4]: odrv0.axis0.motor.config.motor_type = 0

In [5]: odrv0.axis0.encoder.config.cpr = 16384

In [6]: odrv0.save_configuration()

In [7]: odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

In [8]: odrv0.axis0.controller.input_pos = 1

In [9]: odrv0.axis0.encoder.config.mode = ENCODER_MODE_INCREMENTAL

In [10]: odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL

In [11]: odrv0.axis0.controller.input_vel 1.5
File “”, line 1
odrv0.axis0.controller.input_vel 1.5
^
SyntaxError: invalid syntax

In [12]: odrv0.axis0.controller.input_vel = 1.5

In [13]: odrv0.axis0.requested_state = AXIS_STATE_IDLE

In [14]: odrv0.axis0.motor.config.motor_type = MOTOR_TYPE_HIGH_CURRENT

In [15]: odrv0.axis0.motor.config.calib_range = 0.05

AttributeError Traceback (most recent call last)
~\anaconda3\Lib\site-packages\odrive\pyfibre\fibre\shell.py in
----> 1 odrv0.axis0.motor.config.calib_range = 0.05

~\anaconda3\Lib\site-packages\odrive\pyfibre\fibre\libfibre.py in setattr(self, key, value)
671 def setattr(self, key, value):
672 if self.sealed and not key in dir(self) and not hasattr(self, key):
→ 673 raise AttributeError(“Attribute {} not found”.format(key))
674 object.setattr(self, key, value)
675

AttributeError: Attribute calib_range not found

In [16]: odrv0.axis0.encoder.config.calib_range = 0.05

In [17]: odrv0.axis0.motor.config.calibration_current = 10.0

In [18]: odrv0.axis0.motor.config.resistance_calib_max_voltage = 12.0

In [19]: odrv0.axis0.controller.config.vel_limit = 5

In [20]: odrv0.axis0.encoder.config.mode = ENCODER_MODE_SPI_ABS_AMS

In [21]: odrv0.reboot()
Oh no odrv0 disappeared

Reconnected to ODrive 2071307D534B as odrv0
In [22]: odrv0.axis0.encoder.config.use_index = True

In [23]: odrv0.axis0.requested_state = AXIS_STATE_ENCODER_INDEX_SEARCH

In [24]: odrv0.axis0.error
Out[24]: 1

At line 7 in runs in one direction buy never runs in the other direction like it says it should.
And it will move under this same command if I disconnect power and reconnect. Same thing again, one direction only.

In [52]: dump_errors(odrv0)
system: not found
axis0
axis: Error(s):
UNKNOWN ERROR: 0x00000100
motor: no error
sensorless_estimator: no error
encoder: Error(s):
ENCODER_ERROR_ABS_SPI_COM_FAIL
controller: no error
axis1
axis: no error
motor: no error
sensorless_estimator: no error
encoder: no error
controller: no error

What did I leave out or do wrong? tia

You seem to be very confused about whether the AS5047P is in SPI mode or Incremental mode. Which one are you using?

I am trying to use it in SPI mode. I’m trying to build OpenDog designed by James Bruton on youtube:

I am doing a lot of guessing I guess, I’m trying to learn.

I have the entire dog printed, I just need to figure out the Odrives.

I would really appreciate any guidance you can give me.

I try to follow the Odrive startup instructions, they seem hard to follow sending me here and there. Normally I can find what I need on youtube, but there isn’t much I can find.
Can you please tell me what I’m doing wrong? Thank you

I see I set it to both modes, but at one point it seems to say to do so. I’ll start over and not do that.

What says that? The documentation?

I have figured a lot out since my last post, but for starters the boards have 0.5.1 firmware and so far I have been unable to update them. My setup now looks like this:

odrv0.config.brake_resistance = 0

odrv0.config.dc_max_negative_current = -5

.motor.config.pole_pairs = 20

.encoder.config.abs_spi_cs_gpio_pin = 4

.encoder.config.mode = ENCODER_MODE_SPI_ABS_AMS

.encoder.config.cpr = 16384

.requested_state = AXIS_STATE_MOTOR_CALIBRATION (the moor bleeps like it should)

.motor.config.pre_calibrated = True

.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION (should turn 180’ and turn back again, but it only turns about 120’ in one direction and never turns back any. The only way to get it to turn again is to reset it to factory and start over, but always get the same result)

.error (should be 0 or very close but comes back at 256 )

.encoder.config.pre_calibrated = True

odrv0.axis0.controller.config.vel_limit = math.inf

.save_configuration()

After reboot:
.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL (should turn the motor on, but does not)

The boards are clones out of China, I am guessing that is why I am having problems reflashing and getting them to work. I hope this can be overcome.

Re the flashing, odrivetool dfu doesn’t work for you?

You don’t have an index pin with the AS5047P, and don’t need to do (and shouldn’t try to do) the index search. Just do

odrv0.config.brake_resistance = 0
odrv0.config.dc_max_negative_current = -5
odrv0.motor.config.pole_pairs = 20
odrv0.encoder.config.abs_spi_cs_gpio_pin = 4
odrv0.encoder.config.mode = ENCODER_MODE_SPI_ABS_AMS
odrv0.encoder.config.cpr = 16384
odrv0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

# Check for errors
dump_errors(odrv0)

odrv0.motor.config.pre_calibrated = True
odrv0.encoder.config.pre_calibrated = True
odrv0.controller.config.vel_limit = 60
odrv0.save_configuration()

# After Reboot
odrv0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL

It does not work, this was with the switch in dfu mode:

(base) C:\Users\kinne>odrivetool dfu
ODrive control utility v0.5.4
DFU is unreliable on Windows. If it fails, please use the DFU switch to force DFU mode. You can also try the developer preview of odrivetool with python -m pip install odrive --upgrade --pre.
Also see https://docs.odriverobotics.com/odrivetool#upgrading-firmware-with-a-different-dfu-tool for other options.
Waiting for ODrive…
Exception in thread Thread-1:
Traceback (most recent call last):
File “C:\Users\kinne\anaconda3\lib\threading.py”, line 973, in _bootstrap_inner
self.run()
File “C:\Users\kinne\anaconda3\lib\threading.py”, line 910, in run
self._target(*self._args, **self._kwargs)
File “C:\Users\kinne\anaconda3\lib\site-packages\odrive\dfu.py”, line 496, in find_device_in_dfu_mode_thread
devices[0] = find_device_in_dfu_mode(serial_number, find_odrive_cancellation_token)
File “C:\Users\kinne\anaconda3\lib\site-packages\odrive\dfu.py”, line 250, in find_device_in_dfu_mode
stm_devices = usb.core.find(idVendor=0x0483, idProduct=0xdf11, find_all=True)
File “C:\Users\kinne\anaconda3\lib\site-packages\usb\core.py”, line 1309, in find
raise NoBackendError(‘No backend available’)
usb.core.NoBackendError: No backend available

In [11]: dump_errors(odrv0)
system: not found
axis0
axis: Error(s):
UNKNOWN ERROR: 0x00000100
motor: no error
sensorless_estimator: no error
encoder: Error(s):
ENCODER_ERROR_NO_RESPONSE
controller: no error
axis1
axis: no error
motor: no error
sensorless_estimator: no error
encoder: no error
controller: no error

In [12]:

I have 3.3v to 3.3v - gnd to gnd - MISO to MISO - MOSI to MOSI - CLK to SCK - and CSn to pin 4 and I do the .encoder.config.abs_spi_cs_gpio_pin = 4 I jumped the 3.3v and I removed r1 and jumped r2

Does that all seem correct?

This is what I get when I try to flash without the switch in the dfu position:

(base) C:\Users\kinne>odrivetool dfu
ODrive control utility v0.5.4
DFU is unreliable on Windows. If it fails, please use the DFU switch to force DFU mode. You can also try the developer preview of odrivetool with python -m pip install odrive --upgrade --pre.
Also see https://docs.odriverobotics.com/odrivetool#upgrading-firmware-with-a-different-dfu-tool for other options.
Waiting for ODrive…
Exception in thread Thread-1:
Traceback (most recent call last):
File “C:\Users\kinne\anaconda3\lib\threading.py”, line 973, in _bootstrap_inner
self.run()
File “C:\Users\kinne\anaconda3\lib\threading.py”, line 910, in run
self._target(*self._args, **self._kwargs)
File “C:\Users\kinne\anaconda3\lib\site-packages\odrive\dfu.py”, line 496, in find_device_in_dfu_mode_thread
devices[0] = find_device_in_dfu_mode(serial_number, find_odrive_cancellation_token)
File “C:\Users\kinne\anaconda3\lib\site-packages\odrive\dfu.py”, line 250, in find_device_in_dfu_mode
stm_devices = usb.core.find(idVendor=0x0483, idProduct=0xdf11, find_all=True)
File “C:\Users\kinne\anaconda3\lib\site-packages\usb\core.py”, line 1309, in find
raise NoBackendError(‘No backend available’)
usb.core.NoBackendError: No backend available
Found ODrive 2071307D534B (v3.6-56V) with firmware v0.5.1-dev
Checking online for newest firmware… found v0.5.4
Downloading firmware v0.5.4…
Putting device 2071307D534B into DFU mode…

NoBackendError Traceback (most recent call last)
~\anaconda3\Scripts\odrivetool in
147 “Also see https://docs.odriverobotics.com/odrivetool#upgrading-firmware-with-a-different-dfu-tool for other options.”)
148 import odrive.dfu
→ 149 odrive.dfu.launch_dfu(args, logger, app_shutdown_token)
150
151 elif args.command == ‘unlock’:

~\anaconda3\lib\site-packages\odrive\dfu.py in launch_dfu(args, logger, cancellation_token)
510 firmware = FirmwareFromFile(args.file) if args.file else None
511
→ 512 update_device(device, firmware, logger, cancellation_token)
513
514

~\anaconda3\lib\site-packages\odrive\dfu.py in update_device(device, firmware, logger, cancellation_token)
389 find_odrive_cancellation_token = Event(cancellation_token)
390 put_into_dfu_mode(device, find_odrive_cancellation_token)
→ 391 stm_device = find_device_in_dfu_mode(serial_number, cancellation_token)
392 find_odrive_cancellation_token.set()
393 dfudev = DfuDevice(stm_device)

~\anaconda3\lib\site-packages\odrive\dfu.py in find_device_in_dfu_mode(serial_number, cancellation_token)
248 “”"
249 while not cancellation_token.is_set():
→ 250 stm_devices = usb.core.find(idVendor=0x0483, idProduct=0xdf11, find_all=True)
251 for dev in stm_devices:
252 try:

~\anaconda3\lib\site-packages\usb\core.py in find(find_all, backend, custom_match, **args)
1307 break
1308 else:
→ 1309 raise NoBackendError(‘No backend available’)
1310
1311 if find_all:

NoBackendError: No backend available

(base) C:\Users\kinne>

Try pin 8. There’s historically been some trouble with pin 4. But the fact that you get no response at all is strange. Can you put an oscilloscope on the MOSI or MISO traces?

I am having a friend with a linux sys is going to try to flash one of them and see if that works.
I haven’t had time to try pin 8 yet, but will today.
Thank you very much for your help, I really appreciate it.

I tried pin 8 and I did not get any errors when I ran dump_errors(odrv0) but when I ran odrv0.axis0.error i got 257

I received 3 more odrives today, I am having the same issues with odrive drives, not clones. They too came with 0.5.1 firmware, how do I flash them? I have tried dfu with the switch and without, I did the Zadig thing ( STM BOOTLOADER to libusb-win32 (v1.2.6.0) , it said it was successful, still wont flash :cry:

(base) C:\Users\kinne>odrivetool dfu
ODrive control utility v0.5.4
DFU is unreliable on Windows. If it fails, please use the DFU switch to force DFU mode. You can also try the developer preview of odrivetool with python -m pip install odrive --upgrade --pre.
Also see https://docs.odriverobotics.com/odrivetool#upgrading-firmware-with-a-different-dfu-tool for other options.
Waiting for ODrive…

IndexError Traceback (most recent call last)
~\anaconda3\Scripts\odrivetool in
147 “Also see https://docs.odriverobotics.com/odrivetool#upgrading-firmware-with-a-different-dfu-tool for other options.”)
148 import odrive.dfu
→ 149 odrive.dfu.launch_dfu(args, logger, app_shutdown_token)
150
151 elif args.command == ‘unlock’:

~\anaconda3\lib\site-packages\odrive\dfu.py in launch_dfu(args, logger, cancellation_token)
510 firmware = FirmwareFromFile(args.file) if args.file else None
511
→ 512 update_device(device, firmware, logger, cancellation_token)
513
514

~\anaconda3\lib\site-packages\odrive\dfu.py in update_device(device, firmware, logger, cancellation_token)
307 logger.debug(“OTP:”)
308 dump_otp(dfudev)
→ 309 hw_version = get_hw_version_in_dfu_mode(dfudev) or (0, 0, 0)
310
311 else:

~\anaconda3\lib\site-packages\odrive\dfu.py in get_hw_version_in_dfu_mode(dfudev)
267 if otp_data[0] == 0:
268 otp_data = otp_data[16:]
→ 269 if otp_data[0] == 0xfe:
270 return (otp_data[3], otp_data[4], otp_data[5])
271 else:

IndexError: array index out of range

(base) C:\Users\kinne>

In [1]: odrv0.config.brake_resistance = 0

In [2]: odrv0.config.dc_max_negative_current = -5

In [3]: odrv0.axis0.motor.config.pole_pairs = 20

In [4]: odrv0.axis0.encoder.config.abs_spi_cs_gpio_pin = 8

In [5]: odrv0.axis0.encoder.config.mode = ENCODER_MODE_SPI_ABS_AMS

In [6]: odrv0.axis0.encoder.config.cpr = 16384

In [7]: odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE ****** motor spins about 1/4 turn

In [8]: dump_errors(odrv0)
system: not found
axis0
axis: Error(s):
UNKNOWN ERROR: 0x00000100
motor: no error
sensorless_estimator: no error
encoder: Error(s):
ENCODER_ERROR_NO_RESPONSE
controller: no error
axis1
axis: no error
motor: no error
sensorless_estimator: no error
encoder: no error
controller: no error

In [9]: odrv0.axis0.motor.config.pre_calibrated = True

In [10]: odrv0.axis0.encoder.config.pre_calibrated = True

In [11]: odrv0.axis0.controller.config.vel_limit = 60

In [12]: odrv0.save_configuration()

In [16]: odrv0.reboot()
Oh no odrv0 disappeared

Reconnected to ODrive 306D347F3131 as odrv0
In [17]: odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL

In [18]: dump_errors(odrv0)
system: not found
axis0
axis: Error(s):
AXIS_ERROR_INVALID_STATE
UNKNOWN ERROR: 0x00000100
motor: no error
sensorless_estimator: no error
encoder: Error(s):
ENCODER_ERROR_ABS_SPI_COM_FAIL
controller: no error
axis1
axis: no error
motor: no error
sensorless_estimator: no error
encoder: no error
controller: no error

In [19]: