ODrive: Stuck in DRV8301_readSpi infinite loop when using absolute encoders

Here’s my setup: ODrive 3.6-56V with AMT203-V absolute encoders with chip select pins connected to GPIO pins 7 and 8 for axis 0 and 1 respectively, running the latest firmware from devel (essentially the 0.5.0-rc). I was able to flash the new firmware, run the latest odrivetool, set the encoder CPR to 4096 and encoder mode to SpiAbsCui for axis0, then run motor calibration, encoder offset calibration, and go into closed loop control mode. Everything seemed great. However, when I powered the device off then powered it back on again, it refused to respond to requested_state commands. I flashed a debug version of the firmware and connected via ST-LINK, and found it was getting stuck on the following line in drv8301.c:

while((DRV8301_readSpi(handle,DRV8301_RegName_Status_1) & DRV8301_STATUS1_FAULT_BITS) != 0);

The value 0xFFFF was being returned each time, causing that check to fail.

If I set the encoder mode to 0 (Incremental) for both axes, save_configuration(), and reboot() I can get past that. Then, I can set the encoder mode back to 0x100 (SpiAbsCui) and set requested_state to AXIS_STATE_ENCODER_OFFSET_CALIBRATION. Then finally, closed loop control. But if I leave the encoder mode as SpiAbsCui and power cycle, I’m stuck back in that same startup loop.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Adding 1k res to the MISO line in series between encoder and ODrive fixes it.