Skip to main content
JStrz.1
Associate
August 3, 2021
Question

SPI encoder implementation.

  • August 3, 2021
  • 2 replies
  • 1477 views

Hi

I am looking for hints - how to implement the encoder from which I read the position via SPI?

Should I set the encoder with index in Motor Control Workbench? If so, where to write the position read after SPI to "pretend" an ordinary encoder? I also see that the encoder index (Z) raises an exception - this is where the motor speed is taken? Generally I want to use the motor in position mode with torque control.

Have any of you already run the SPI encoder with MCW?

This topic has been closed for replies.

2 replies

TDK
Super User
August 3, 2021

Does the encoder have an SP interface? They typically do not.

"If you feel a post has answered your question, please click ""Accept as Solution""."
JStrz.1
JStrz.1Author
Associate
August 4, 2021

Of course the encoder has an SPI. It's AS5147. I wrote a library for it and works beautifully in SPI interrupts with F446.

My question is where to overwrite current angle values in MCW generated libraries? And since it needs position control, I assume that the original encoder setting with index a is correct. However, for the proper operation of the application, I must replace the counting of pulses from the encoder by systematically substituting the angle value readed via SPI. Initially looking at the code, but I'm starting to wonder if I need the Motor Control Workbench in FULL version?

And if so - what are the conditions for receiving it? I applied once and was rejected.

Visitor II
October 5, 2023

Hi JStrz 1, I am also using same sensor but with stm32g474 MCU. Can you please send basic working Library AS5147 to tahirgavli@gmail.com