You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Christian,
I've been experimenting with your library and I found out something odd about set_microstepping_resolution method.
#setting all bits to zerochopconf=chopconf& (~tmc_reg.msres0|~tmc_reg.msres1|~tmc_reg.msres2|~tmc_reg.msres3)
I would this to set bits on positions corresponding to MRES to 0 (bit positions 24, 25, 26, 27) as the comment says. But it does not affect the value of CHOPCONF register at all.
Yes you are right. 4043309055
is indeed 11110000111111111111111111111111
in binary.
Line 597 actually applies the correct mask. Lines 593-594 should do the same thing but do not. I guess that is the reason why might the line 597 be there. 🤔
Well then i suggest to replace | with & and delete the line 597. The output should be the same and readability would increase.
I found out about this when I was trying to interface TMC2209 from RPi Pico running micropython using snippets from this library. I was just setting the microstepping resolution and reading back the chopconf in a while loop and read backs were somewhat inconsistent. That was possibly due to copypasting few snippets and not using the library as a whole. I guess that the function still works and this finding is a pure coincidence 😄
Pato-99
added a commit
to Pato-99/TMC2209_Raspberry_Pi
that referenced
this issue
Oct 14, 2024
Hi Christian,
I've been experimenting with your library and I found out something odd about
set_microstepping_resolution
method.I would this to set bits on positions corresponding to MRES to 0 (bit positions 24, 25, 26, 27) as the comment says. But it does not affect the value of CHOPCONF register at all.
See:
Isn't it a typo?
|
instead of an&
?But this next line is a complete mystery for me:
Why there is that hardcoded value? It could overwrite CHOPCONF settings prior to this method call.
Permalink to the snippet:
https://github.com/Chr157i4n/TMC2209_Raspberry_Pi/blob/8e3a695c61803b03ce32a49b6617e79265f6993e/src/TMC_2209/_TMC_2209_comm.py#L592C4-L598C44
The text was updated successfully, but these errors were encountered: