Problems with SPI Management

Hello friends!

  1. I use ODrive v3.5-48V
  2. Encoders: AS5047P-TS_EK_AB connected by SPI.
  3. Firmware: -

Set the settings:
odrv0.axis0.encoder.config.abs_spi_cs_gpio_pin = 4
odrv0.axis0.encoder.config.mode = 257
odrv0.axis0.encoder.config.cpr = 2**14


error = 0x0000 (int)
is_ready = True (bool)
index_found = False (bool)
shadow_count = 20872 (int)
count_in_cpr = 4487 (int)
interpolation = 1.0 (float)
phase = 1.8239965438842773 (float)
pos_estimate = 20872.3125 (float)
pos_cpr = 4489.6875 (float)
hall_state = 7 (int)
vel_estimate = -625.0 (float)
pos_abs = 4487 (int)
  mode = 257 (int)
  use_index = False (bool)
  abs_spi_cs_gpio_pin = 4 (int)
  pre_calibrated = False (bool)
  idx_search_speed = 10.0 (float)
  zero_count_on_find_idx = True (bool)
  cpr = 16384 (int)
  offset = 11282 (int)
  offset_float = 0.7106562852859497 (float)
  bandwidth = 1000.0 (float)
  calib_range = 0.019999999552965164 (float)
  ignore_illegal_hall_state = False (bool)

When turned on, the motor vibrates violently and jitter .
I use - move_to_pos and my engine shuts off with errors.

In [85]: hex(odrv0.axis0.motor.error)                                           
Out[85]: '0x10'

In [86]: hex(odrv0.axis0.controller.error)                                      
Out[86]: '0x1'

In [87]: hex(odrv0.axis0.error)                                                 
Out[87]: '0x200'

If disconnect <axis>.controller.config.vel_limit_tolerance = 0
Everything is working. But the vibration remains.

For some time the function even works move_to_pos.
But then everything turns off and an error pops up on the sensor.

In [94]: dump_errors(odrv0)                                                     
  axis: Error(s):
  motor: no error
  encoder: Error(s):
  controller: no error
  axis: no error
  motor: no error
  encoder: no error
  controller: no error
In [93]: hex(odrv0.axis0.encoder.error)                                         
Out[93]: '0x80'

Help please. Can eat the ideas?
Can drive vibrations due to ADC rattle?

Maybe there are those who used SPI?

Have you tried tuning your gains?

Tried, it’s unreal. An error: 0x80
Tell me, is this normal?

I use: start_liveplotter(lambda:[odrv0.axis0.encoder.pos_estimate, odrv0.axis0.controller.pos_setpoint])

Oh, wow. I thought you meant the jittering, sorry. Yes, that is very strange behaviour. I have no idea what would cause that.

The sensor is sending the absolute position right? Such a big jump, looks like something is wrong with the signal, or the sensor is picking up noise.

From what I see in the specs you should have 0.063 degrees of noise = \frac{0.063}{(\frac{360}{2^{14}})} = 3 steps, so the jittering seems normal. But that jump of 200 steps is really weird.

See if you can electrically isolate your sensor. Using a plastic spacer or axle or something. To see if the noise goes away. In my case I changed my motor mounts to plastic, after that my other sensors picked up a lot less noise.

i think
odrv0.axis0.encoder.config.cpr must be 4000