Encode 5047p connection

Hii everybody. There’s somebody that can show me how to connect asm 5047 encoder?

1 Like

Connect MISO-MISO, MOSI-MOSI, SCK-SCK.
Connect CS to any of the numbered GPIO pins, and then remember to set encoder.config.abs_spi_gpio_pin to the number of the pin

obviously you should set encoder.config.mode=ENCODER_MODE_ABS_SPI_AMS
it’s also useful to set encoder.config.pre_calibrated=True and motor.config.pre_calibrated=True to take advantage of having an absolute encoder, so you don’t have to calibrate on boot.
That’s it.

1 Like

thank you so much. I’ll tried immediately

Send rotation instruction buqizy

odrv0.axis0.controller.pos_setpoint = 1000
odrv0.axis0.controller.pos_setpoint = 0

Summary

Reconnected to ODrive 207035A1524B as odrv0
In [6]: odrv0.axis0.controller.pos_setpoint = 1000

Exception Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\fibre\shell.py in
----> 1 odrv0.axis0.controller.pos_setpoint = 1000

C:\ProgramData\Anaconda3\lib\site-packages\fibre\remote_object.py in setattr
(self, name, value)
252 attr.set_value(value)
253 else:
–> 254 raise Exception(“Cannot write to property {}”.format(nam
e))
255 elif not object.getattribute(self, “sealed”) or name in
object.getattribute(self, “dict”):
256 object.getattribute(self, “dict”)[name] = value

Exception: Cannot write to property pos_setpoint

In [7]:

In Wetmelon’s RazorsEdge, you must use odrv0.axis0.controller.input_pos instead of odrv0.axis0.controller.pos_setpoint

My setup for the AS5047P is:

odrv0.axis0.encoder.config.abs_spi_cs_gpio_pin = 4
odrv0.axis0.encoder.config.mode = 257
odrv0.axis0.encoder.config.cpr = 2**14
2 Likes

Hi towen. why i’m not able to set encoder.config.mode=ENCODER_MODE_ABS_SPI_AMS
there’s not the option
I find …config.mode=ENCODER_MODE_INCREMENTAL or
…config.mode=ENCODER_MODE_HALL
thank you

Nicola- You need to be using the RazorsEdge branch of the firmware for this.

You need to clone the Git repo from https://github.com/Wetmelon/ODrive and then use ‘tup’ to build the firmware. If you’re on Linux e.g. Debian or Ubuntu or even a Raspberry Pi running Raspbian, this is trivial - on Windows it’s a bit tricky.

sudo apt install git tup gcc-arm-none-eabi build-essential
git clone https://github.com/Wetmelon/ODrive.git
cd ODrive/Firmware
cp tup.config.default tup.config
nano tup.config # you need to edit this file to put in your board type and version
tup
cd ..
tools/odrivetool dfu Firmware/build/ODriveFirmware.hex   # to flash the firmware that you just built