Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoder Initialization by Hall sensors #32

Open
Ayoub-pixe opened this issue May 3, 2023 · 1 comment
Open

Encoder Initialization by Hall sensors #32

Ayoub-pixe opened this issue May 3, 2023 · 1 comment

Comments

@Ayoub-pixe
Copy link

Hello @trinamic,

I was examining the tmc4671_doEncoderInitializationMode2 function and I came across the following line of code:

int16_t hall_phi_e_estimated = *hall_phi_e_old + tmc4671_getS16CircleDifference(*hall_phi_e_new, *hall_phi_e_old)/2;

I was curious as to why this equation is not applied to the encoder abn_phi_e_actual. Specifically, I'm wondering why we don't calculate an abn_phi_estimated using a similar formula:

abn_phi_e_estimated = abn_phi_e_old + (abn_phi_e_new - abn_phi_e_old)/2

Then we could set the TMC4671_ABN_DECODER_PHI_E_PHI_M_OFFSET register to hall_phi_e_estimated - abn_phi_e_estimated. Can you please explain why the offset average is only calculated for the hall sensor and not the encoder?

https://github.com/trinamic/TMC-API/blob/4ced0291c5cdae49f54e7f082c3c651d03ca19e7/tmc/ic/TMC4671/TMC4671.c#L406

@croulvi
Copy link

croulvi commented May 17, 2023

Hella @trinamic .
I am working with @Ayoub-pixe.
We are asking this question because, we discovered that some encoder initialization were bad. Leading to a big error between phi-e and encoder.
This big error leads to higher current in the motor (and the regulation) to drive it with the same load.
We have identified that the high current is linked to offset error.
So before trying to modify the Encoder initialization function. We wanted to understand why this equation was used.
thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants