-
Notifications
You must be signed in to change notification settings - Fork 20
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
TMC2209 - $14x setting is being affected by VREF pot #7
Comments
For reference it appears another workaround might be to set VREF to 2.5V via the potentiometer, which if I am reading the datasheet right should result in 100% of the value set via |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am trying out grblHAL on an STM32F4Discovery board with a BigTreeTech TMC2209 v1.3 driver board. I noticed a significant discrepancy in the current measurements I was getting from running motors when I used it in pure STEP/DIR mode with no UART control and setting current via potentiometer, versus using UART control and setting the current digitally using $140. The UART control mode was reading something like half of the current of the STEP/DIR mode.
After some investigating I discovered that changing the potentiometer still affects the current even when using $14x to configure the current. In other words, I actually played with the potentiometer while the motor was running and could see the current changing.
Looking at the source code, I can see in
tmc2209.c
inTMC2209_Init
:I admit it is not ultra clear in the datasheet, but it appears that when
I_SCALE_ANALOG
is left at 1, then the value on the TMC2209 VREF pin still modulates the actual output current, whereas if you set it to zero it uses an internal reference. After doing some digging it seems like Marlin explicitly sets this setting to 0 as does the Arduino TMC2209 library ( https://github.com/janelia-arduino/TMC2209 ).I changed my
TMC2209_Init
setup to setI_SCALE_ANALOG
to 0 inTMC2209_Init
and it then made my readings insensitive to changing the VREF potentiometer, and gave me values about what I expect.I do have some concerns that the straightforward fix could drastically change the current values people with existing machines will get after a firmware update. If they set their current limits based off of motor datasheets, I would guess they would mostly be OK, but if it they set this value empirically based on how hot the motors got or something it could be a nasty surprise.
The text was updated successfully, but these errors were encountered: