Max CPR for SPI encoder

Hi

I’m working on adding support for my Mitsubishi servo encoder.
It is RS485 encoder so I’m aware that there is no easy way to do it. My approach is that I’ll have a microcontroller (stm32/esp32) that will basically translate RS485 protocol to SPI which is supported by odrive.
I already have sort of working code but my question is what is max CPR supported by odrive firmware?
I can see that default variable type for the position is uint_16 which means 16bit.
My encoder is 18bit and I’d like to use all of its potential. Is it enough to just change the variable type to uint_32?
I added another encoder mode and everything, it’s just the question if the rest of the code can handle it.

1 Like

“Suck it and see” :slight_smile:

There might be an issue with update rate. How many times per second can this encoder send it’s data via RS485?

For now I limited the resolution to 16bit.
Update rate won’t be a problem, encoder works with 2.5mbps baud rate and I can “ask” for position like 6 times in the time of one spi transaction. The tricky part is getting the microcontroller to work prooperly as slave spi device.
First tests went sort of okay. Got the motor calibrated but there is a lot of EMI going, so now it’s time to fight the interferences.

Btw. this really looks like a good solution if you use servo like mistubishi or yaskawa which use RS485 protocol. Those encoders are really fast and precise.

New update. It works! So, output from the encoder is 24bit. I believe it’s 18bit interpolated. After checking the checksum, I send it over SPI to odrive. I changed the variable type to uint_32 and it worked.
Funny thing, scope connected to miso line has been messing up the signal.

2 Likes

Great that you got it going!

Hehe yeah, that can happen! Probing is harder than people think.

Odrive Pro supports RS485 encoders out of the box. Which encoder specifically did you get? Might be interesting to support it on Pro.