-
Notifications
You must be signed in to change notification settings - Fork 101
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
Comments
Hella @trinamic . |
Hello everyone, The logic behind the hall-based ABN init goes back to the geometry of hall sensors: A digital hall encoder will divide into 6 separate 60° sections. The first section is at 0°, the second at 60° and so forth. For an ABN encoder, each individual step is a much smaller angle change than 60°. Averaging two adjacent positions would not yield any practical improvement.
[1]: PPR and CPR are related as such: |
For initializing an ABN, the choice in strategy matters a lot. A hall-based initialization as discussed here gives decent results only if:
For a more precise initialization, the ABN channel - if available - would be the best choice. Since the TMC4671 has the capability to directly process that input, no communication or processing delays are imposed like the hall. Since the N signal is part of the ABN itself, it will yield repeateable initialization. It does however require up to a full rotation of the mechanical axis to find the initially unknown N position. Depending on your application, a multi-tier initialization strategy might also be feasible. Start with the current hall sector position estimate (+-30° error possible), then turn to identify an edge, lessening the error with at most 60° electrical rotation ( |
(Feel free to reopen if there are any further questions) |
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
The text was updated successfully, but these errors were encountered: