I can't setup my configuration : ODrive + AS5047P + GIM4310

I’m trying to use AS5047P(It was included with my motor, I think it’s quite different from the well-known version) with my motor, GIM4310, but having some troubles.

I connected the motor to M1 and connected the wire of the encoder like this :

(AS5047P → ODrive)
5V(blue) → 5V
GND(white) → GND
MISO(yellow) → MISO
MOSI(green) → MOSI
CLK(black) → SCK
CSn(red) → GPIO 4

Because the pin map of my encoder is weird :
unnamed

the encoder error state is 0 but when I run the calibration command, nothing happens.(nothing happens in the terminal, and the motor is never moving)

When I run this code, an error was returned.

import odrive
import time

# ODrive를 찾습니다.
odrv0 = odrive.find_any()

# 엔코더 위치와 속도 값을 출력합니다.
print(f"Encoder Position: {odrv0.axis1.encoder.pos_estimate}")
print(f"Encoder Velocity: {odrv0.axis1.encoder.vel_estimate}")
23:50:10.561281600 [LEGACY_PROTOCOL] received request but server support is not compiled in

This is my code, and the same error returned.

import odrive
import time

# ODrive를 찾습니다.
odrv0 = odrive.find_any()

# M1에 연결된 엔코더를 설정합니다.
axis = odrv0.axis1

# SPI 인터페이스를 통해 엔코더를 설정합니다.
axis.encoder.config.mode = odrive.enums.ENCODER_MODE_SPI_ABS_AMS
axis.encoder.config.cpr = 16384  # AS5047P의 경우 CPR 값은 16384입니다.
axis.encoder.config.spi_mode = 0
axis.encoder.config.spi_cs_gpio_pin = 4  # GPIO 4에 CSn을 연결한 경우

# 설정을 저장합니다.
odrv0.save_configuration()

# ODrive 보드를 재시작합니다.
odrv0.reboot()

# 다시 연결합니다.
odrv0 = odrive.find_any()

# 엔코더 및 모터 캘리브레이션을 실행합니다.
odrv0.axis1.requested_state = odrive.enums.AXIS_STATE_FULL_CALIBRATION_SEQUENCE

# 캘리브레이션이 완료될 때까지 기다립니다.
while odrv0.axis1.current_state != odrive.enums.AXIS_STATE_IDLE:
    time.sleep(0.1)

# 모터를 닫습니다.
odrv0.axis1.requested_state = odrive.enums.AXIS_STATE_CLOSED_LOOP_CONTROL

# 설정이 올바르게 적용되었는지 확인합니다.
print(f"Encoder Position: {odrv0.axis1.encoder.pos_estimate}")
print(f"Encoder Velocity: {odrv0.axis1.encoder.vel_estimate}")
23:52:26.858220800 [LEGACY_PROTOCOL] received request but server support is not compiled in
23:52:36.868088100 [LEGACY_PROTOCOL] received request but server support is not compiled in
23:52:56.879706600 [LEGACY_PROTOCOL] received request but server support is not compiled in
23:53:16.886200000 [LEGACY_PROTOCOL] received request but server support is not compiled in

My entire setup is this.

Somebody ‘gosu’ please help me.

Hi there,

That appears to be a counterfeit ODrive, which we can’t help much with. They’re typically very low quality, and have lots of signal integrity issues. I would recommend purchasing a genuine ODrive S1 instead.

1 Like