Are your drivers outputting the current expected?
-
After recently making some changes to one of my printers, I was running into issues with layer shifting etc and I wanted to investigate further. I was lucky enough to be able to purchase one of @zapta fantastic stepper motor analysers and I thought now was the perfect time to put it to good use.
For reference, the machine in question has a Fly-E3-Pro installed (which has onboard 2209 drivers) utilising the STM32 port of RRF (3.4.1_102) and uses E3D high torque motors (1680 max peak, set to 1344ma in the firmware).
Here is a photograph of the readings taken using the stepper motor analyser.
As you can see, the readings (which are in peak on the stepper motor analyser), aren't the values that I was expecting.I ran a few more tests using the same board, setting different currents and was getting similar readings. I then switched to a Fly-E3 board I had on the bench, along with a Fly-2209 driver and was getting similar results as the Fly-E3-Pro.
I also tested a TMC5160 and that performed as expected so I have discounted the 5160 drivers from any further testing.
Discussions were then had with @gloomyandy to ensure that the STM32 port of RRF was calculating the current both as per the trinamic datasheet (pg 53 of https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC2209_datasheet_rev1.08.pdf) and in the same manner as the Duet version of RRF. It was confirmed it was, which prompted the need for wider testing to be carried out using both a Duet 3 Mini 5+ and an array of different drivers and boards running RRF, Klipper and Marlin.
It may have been apparent with the previous screenshot of the stepper motor analyser, that unfortunately, the current is output on a histogram rather than some actual values (yes, there are other screens but the none of them actually show the peak value and are merely real-time values). Luckily for me @Sindarius not only was willing to mod the firmware to display a reading on that screen, he also had a stepper motor analyser to hand for testing those changes. Without @Sindarius help, the testing below would not have been possible so a big shout out to him!
I gathered a collection of boards and tested an E3D high torque stepper (under no load conditions) to each of them in turn, adjusting the M906 requested current value. They all used the same config (x16 micro stepping and no interpolation) and the results can be seen below.
A can be seen, the Duet 3 mini 5+ performed consistently well up to 1400mA, with a little bit of current drop off above that. The Fly-E3-Pro-V3 also performed consistently well. The EZ 2209 drivers performed worst at 800mA where the output current was 12.2% lower than the requested current. The Fly 2209 ran consistently ~18-22% lower than the current requested and were the worst performing on the chart. Both the Fly-E3-Pro and BTT-RRF-E3 ran around 10-15% lower than requested.
I then ran the same current tests using an SKR3 EZ board. First running RRF
and then running Klipper
You may notice that the EZ drivers are missing from the Klipper results. This is due to me incorrectly flashing Klipper when I started the testing and it set them at full current and burnt them out. Please also note that the BTT 2226 v1.0 drivers use a different sense resistor (0.150 ohm) than standard 22XX drivers (0.110 ohm) and I adjusted accordingly for that when running the tests.
The results are pretty consistent between RRF and Klipper, which confirms the testing method and confirms that both firmwares calculate the required current using the sense resistor in a similar fashion.
So how we overcome this incorrect current setting? The ideal is for the driver manufacturers to produce drivers that perform as expected, but that doesn't really help users who already have poor performing hardware. Fortunately we can counteract this by adjusting the sense resistor value configured in the firmware (this has only just been added to the STM32 port of RRF in 3.4.1). I found that a sense resistor value of 0.125 resulted in the Fly-E3-Pro performing correctly (when testing with RRF) and a sense resistor value of 0.140 resulting in the Fly 2209 drivers performing correctly (when testing with RRF).
Further work needs to be carried out to validate the sense resistor values that users should be using with each driver to counteract poor driver performance
Here are my full results driver_readings.xlsx
-
I find it interesting that the MKS drivers are almost on par with the Duet readings, which kind of counters the point that this would be stepstick vs SMD mounted drivers.
It would be interesting to get some more readings ... easier said than done, but I am hopeful that I'll have a stepper analyzer some time next month. Then I can test, among other things, the Troodon Bigfoot stepper drivers (-:
-
@oliof yes, that surprised me as I originally thought it was down to using the stepstick design. The Fly-E3-Pro vs the Fly-E3-Pro-v3 also disproves this.
-
@jay_s_uk would you think the 6HC is similar to the 5+? great work by the way! or do you know the % drop at 1800?
-
@rexx from the limited testing I've done with 5160 drivers, they're spot on at whatever I set them at so I wouldn't be too concerned about them.
I currently also don't have a setup to test a 6HC -
@jay_s_uk thanks for your detailed report.
TMC5160 drivers have differential current sense inputs, which if they are used properly eliminates the effect of additional resistance in series with the sense resistors. TMC2209 drivers do not, so careful layout is essential to ensure that no significant additional resistance is added between the sense resistor and ground.