MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.19k stars 19.22k forks source link

[BUG] Knocking noise when moving TMC2208 (UART) #14183

Closed oechslein closed 4 years ago

oechslein commented 5 years ago

Description

I switched from Marlin 1.1 (bugfix_1.1.x - 7cc1410070067aa056ee17a0a32d91d41cf599c9) to (bugfix_2.0.x 8e8e48f9004155897d572a099131b0b62592cee6). Without changing HW I'm now hearing always a knocking noise (slow or fast moves) on X, Y, Z. This noise wasn't there before.

I do have an Ender 3 with an MKS Gen L board, TMC2208 UART on X, Y, E and a ST820 on E (and BLTOUCH).

Steps to Reproduce

Use my config and probably also my printer...

Expected behavior: Same noise level as with 1.1 Actual behavior: Knocking noise

Additional Information

20190529_Bug_Report_Noise.zip

Videos are here: https://www.dropbox.com/sh/ip6kgwu06ekkdgu/AAAhQOQFqq-Jsm_XOYGWIPZga?dl=0

jokejoke commented 5 years ago

I have the similar problem (maybe the same). Could you try to change in Configuration_adv.h:

#define MONITOR_DRIVER_STATUS to: //#define MONITOR_DRIVER_STATUS

After this change the strange "grinding/koncking" noise are gone.

My configuration:

oechslein commented 5 years ago

Thanks, that helps!

It looks like I'm hearing the calls to "monitor_tmc_driver()". After I doubled (internal value) MONITOR_DRIVER_STATUS_INTERVAL_MS the noise frequency is halved. Maybe the Arduino is not fast enough for that feature?

If this isn't a bug we should add a comment to MONITOR_DRIVER_STATUS that it could lead to "grinding/knocking" noise.

jokejoke commented 5 years ago

It has bothered me last 5 days, before I found this "lucky" settings :) What do you think @teemuatlut? Is it bug?

teemuatlut commented 5 years ago

Sounds plausible as the AVR SoftwareSerial disables interrupts when receiving data. I won't consider it a bug, but maybe at some I can take a look if the read commands can be fewer in TMC monitoring.

vadsh commented 5 years ago

I have exactly the same symptoms.

viper93458 commented 5 years ago

I have noticed a random knock as well, I will test disabling the MONITOR_DRIVER_STATUS to see if it helps.

-William

vadsh commented 5 years ago

I've noticed also that if m122 command sent to terminal during the print - the same noise happens

vadsh commented 5 years ago

commenting //#define MONITOR_DRIVER_STATUS worked for me too. But I'd like to be able to use this function. v1.1.9 was ok with this option uncommented.

vadsh commented 5 years ago

noise disappeared when I switched the board to 32 bit skr 1.3. Marlin code is almost identical (copy-paste config mostly). Old card (mks gen 1.4) was working at the edge of its performance.

I believe the noise appears as a result of card's inability to send step pulses at constant speed as m122 command uses a lot of resources.

xeddog commented 5 years ago

This sounds like the same problem I had with my CR-10S using a MKS GEN 1.4 controller flashed with Marlin 2.0. I had 2208s on X,Y,Z,and E, with X and Y using stealthchop2, and Z and E in spreadcycle. I have been having issues with extrusions so I tried swapping back to a DRV8825 for E and after a fresh pull, and then re-flashing the noise was there. Going back to the 2208 for E. . . still there. Tried 8825's on Z and E . . . still there. Put all 8825 in and noise gone.

It has been a week since I put the 8825's in, so is this still a problem, or has it been resolved yet.

Grogyan commented 5 years ago

Please, try this again, as the TMC library has recently been updated

OneOfEleven commented 5 years ago

I get a loud knocking noise as the TMC2208's switch down from spead-cycle to stealth-chop mode every time. The only solution I've so far found is to set the max feedrate just low enough to remain in stealth-chop mode (or just disable hybrid_threshold).

TheFlash12314 commented 5 years ago

Sounds plausible as the AVR SoftwareSerial disables interrupts when receiving data. I won't consider it a bug, but maybe at some I can take a look if the read commands can be fewer in TMC monitoring.

@teemuatlut but the malin version 1.1.9 does not have this problem while monitor_driver_status enabled

xeddog commented 5 years ago

I finally got my platformio issues resolved, at least enough to load firmware. SO I re-installed my 2208's, re-flashed the firmware, and I see no improvement. I still get that noise while X and Y are moving.

Wayne

Please, try this again, as the TMC library has recently been updated

Well, I would really like to try this again, but now I am having another problem compiling Marlin using platformio with Atom. I will definitely try again when I can get it to compile.

gmg23 commented 5 years ago

I am having the same problem after updating from 1.1.x to 2.0.x. With no other changes, the steppers have a most awful knocking sound. I would love to be able to get rid of this. ]

Quick Update: the previous posters are correct, MONITOR_DRIVER_STATUS_INTERVAL_MS in tmc_util.h has a direct effect on the noise. The higher the interval, the less frequent the noise. I am running at 2000 currently and it's not too bad. Hoping reducing the polling interval this much doesn't create an issue.

michaelsheridan23 commented 5 years ago

Any new news on this issue?

I just loaded 2.0 onto my MKS Gen L with TMC2208 in UART and I am getting the knocking noise with all axiis. I also verified that with Marlin 1.1.9 the knocking noise goes away. I’m wondering if something changed in the TMC library because with 1.1.x you have to use the TMC2208 specific library where as with 2.0 you use the more generic TMCSteppers library. Not sure what the difference is that causing the problem.

xeddog commented 5 years ago

Any new news on this issue?

I just loaded 2.0 onto my MKS Gen L with TMC2208 in UART and I am getting the knocking noise with all axiis. I also verified that with Marlin 1.1.9 the knocking noise goes away. I’m wondering if something changed in the TMC library because with 1.1.x you have to use the TMC2208 specific library where as with 2.0 you use the more generic TMCSteppers library. Not sure what the difference is that causing the problem.

You can disable MONITOR_DRIVER_STATUS in configuration.adv.h and the chopping sound goes away, but the issue with the 2208 and Linear Advance is still there. I wound up swapping the 2208 on E for a LV8729 so I could use Linear Advance.

michaelsheridan23 commented 5 years ago

I did that and it does go away but so does the ability to monitor the serial lines. I managed to get linear advance to work with my 2208 by setting my E axis to SpreadCycle. But I'm having some serious over heating on my extruder so I’m planning swap for a different driver anyway.

porlock commented 5 years ago

same for me, any luck with this one ?

teemuatlut commented 5 years ago

You can try the test branch of the library which reverts UART changes back to what it is in TMC2208Stepper which is used by Marlin 1.1.9. https://github.com/teemuatlut/TMCStepper/tree/revert_uart If that helps, then I know the issue is with the library code. If not, then I need to look into the Marlin monitoring code which was reworked some time ago.

In any case the M122 needs to be better optimized to cache register values and reduce the number of reads from the drivers.

gmg23 commented 5 years ago

I’ve had this issues on multiple printers with 2208’s in uart. It happens once you go to Marlin 2.0x. Dropping to 1.1.9 resolves.

There is a polling event in either tmc-util or stepper indirection I don’t remember which and increasing that interval directly affected the knocking noise. Slower interval, less knocks. More frequent, more knocking.

On Wed, Sep 4, 2019 at 10:25 PM teemuatlut notifications@github.com wrote:

You can try the test branch of the library which reverts UART changes back to what it is in TMC2208Stepper which is used by Marlin 1.1.9. https://github.com/teemuatlut/TMCStepper/tree/revert_uart If that helps, then I know the issue is with the library code. If not, then I need to look into the Marlin monitoring code which was reworked some time ago.

In any case the M122 needs to be better optimized to cache register values and reduce the number of reads from the drivers.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/14183?email_source=notifications&email_token=AL4RFDNGGWVZYOP2YRYIA6DQICJ4BA5CNFSM4HQXRAAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD553UVI#issuecomment-528202325, or mute the thread https://github.com/notifications/unsubscribe-auth/AL4RFDMVOU47V6AXHMGUS53QICJ4BANCNFSM4HQXRAAA .

thinkyhead commented 5 years ago

If it is confirmed that the revert_uart branch resolves it, a patch will follow soon.

xeddog commented 5 years ago

If it is confirmed that the revert_uart branch resolves it, a patch will follow soon.

I am very new to all of this, so how do I revert to the test branch? I use VSCode/Platformio.

porlock commented 5 years ago

Reverting to tree/revert_uart lib does not help for me, but connection issues that i describe in https://github.com/MarlinFirmware/Marlin/issues/15096 get back.

jacekk015 commented 5 years ago

If someone is interested I've had Marlin 2.0 package configured for MKS GEN L from April 2019 which works without knocking. Marlin-bugfix-2.0.x_Knocking_recent_30_09_2019.zip Marlin-bugfix-2.0.x_OK_April_2019.zip Someone could compare files to find some bugs. https://github.com/teemuatlut/TMCStepper/issues/61#issuecomment-538147022

michaelsheridan23 commented 4 years ago

I can confirm with @jacekk015 the April 12, 2019 commit, Tree #57aaa9110b, does not exhibit the knocking noise with the latest version for TMCStepper, 0.5.1. Here are the files configured for my ender 3 with an MKS Gen L and TMC2208s for X, Y, and Z. This does appear to be a bug with Marlin that developed between April of this year and now.

Marlin-bugfix-2.0.x - MKSv1 Ender 3 - 2019-04-12.zip

boelle commented 4 years ago

so this one is not solved yet? is @oechslein still with us?

michaelsheridan23 commented 4 years ago

I do not know if it as been officially solved but using the April 12th commit does fix the issue with the UART setting. You get full functionality back without the knocking noice. I will say with this commit I have had some intermittent issues with my BL Touch but I’m sure that was fixed in later commits. Hopefully someone can use this to create a new commit that fixes the issue.

jacekk015 commented 4 years ago

@boelle It knocks like a woodpecker. I needed to downgrade.

boelle commented 4 years ago

does 12V or 24V make a difference?

jacekk015 commented 4 years ago

@boelle Ender3 with MKS GEN L - I have only 24V. I've downloaded present version of 2.0.0 and will upload it in a minutes

boelle commented 4 years ago

@teemuatlut does the zip files from @jacekk015 give any clues? (he posted 9 days ago)

jacekk015 commented 4 years ago

@boelle Here you go. Newest, present Marlin MKS GEN L + TMC2208 UART mode, 24V Only compile + upload + Initialize EEPROM https://www.youtube.com/watch?v=orh1zmRos6s Configuration.zip

boelle commented 4 years ago

yeah that is a strange one, sound like skipping steps, or a very slow woodpecker :-/

are the drivers active cooled? is TMC debug enabled?

jacekk015 commented 4 years ago

Yep 2x60mm FANS TMC_DEBUG enabled - isn't that needed for UART mode of TMC2208?? IMG_6254 IMG_6208

boelle commented 4 years ago

no debug just gives extended info on serial port

what does the serial look like if you first send G28 X then G0 X150?

jacekk015 commented 4 years ago

Nothing special:

22:27:42.587 : N18 G28 X0*98
22:27:45.906 : X:0.00 Y:0.00 Z:10.00 E:0.00 Count X:0 Y:0 Z:4000
22:27:55.998 : N19 G0 X150*93

Funny is that the knocking loudness depends on speed. If you put a hand on the X stepper motor you feel knocking even for G0 X150 F500 RMS and MAX current output is very high - according to set current.

M122 output:

22:38:13.286 : X    Y   Z   E
22:38:13.324 : Enabled      true    false   false   false
22:38:13.326 : Set current  600 600 600 700
22:38:13.361 : RMS current  1049    581 581 673
22:38:13.403 : MAX current  819 1479    1479    949
22:38:13.405 : Run current  18/31   18/31   18/31   21/31
22:38:13.407 : Hold current 9/31    9/31    9/31    10/31
22:38:13.437 : CS actual    9/31    9/31    0/31    10/31
22:38:13.470 : PWM scale    0   11  32  12
22:38:13.506 : vsense       1=.18   0=.325  1=.18   1=.18
22:38:13.533 : stealthChop  true    true    true    false
22:38:13.562 : msteps       16  16  16  16
22:38:13.627 : tstep        max max 0   0
22:38:13.627 : pwm
22:38:13.627 : threshold    98  98  658 283
22:38:13.658 : [mm/s]       1613    100 3   30
22:38:13.701 : OT prewarn   false   false   false   false
22:38:13.701 : OT prewarn has
22:38:13.702 : been triggered   false   false   false   false
22:38:13.739 : off time 0   4   0   4
22:38:13.768 : blank time   24  24  24  24
22:38:13.768 : hysteresis
22:38:13.798 : -end     -3  2   2   2
22:38:13.823 : -start       1   1   1   1
22:38:13.823 : Stallguard thrs
22:38:13.827 : DRVSTATUS    X   Y   Z   E
22:38:13.875 : stst     *   *   *   *
22:38:13.902 : olb
22:38:13.930 : ola
22:38:13.959 : s2gb
22:38:13.992 : s2ga
22:38:14.034 : otpw
22:38:14.064 : ot
22:38:14.082 : 157C
22:38:14.120 : 150C
22:38:14.143 : 143C
22:38:14.170 : 120C
22:38:14.171 : s2vsa
22:38:14.171 : s2vsb
22:38:14.173 : Driver registers:
22:38:14.179 : X    0xC0:09:00:00
22:38:14.183 : Y    0xC0:09:00:00
22:38:14.190 : Z    0xC0:09:00:00
22:38:14.194 : E    0xC0:0A:00:00
22:38:14.202 : Testing X connection... OK
22:38:14.213 : Testing Y connection... OK
22:38:14.217 : Testing Z connection... OK
22:38:14.223 : Testing E connection... OK

Again after restart G28 + M122

22:41:57.191 : N18 G28*42
22:42:40.656 : X:165.00 Y:127.00 Z:15.00 E:0.00 Count X:13200 Y:10160 Z:6000
22:42:46.043 : N19 M122*26
22:42:46.048 : X    Y   Z   E
22:42:46.109 : Enabled      true    true    false   false
22:42:46.111 : Set current  600 600 600 700
22:42:46.153 : RMS current  581 1049    1049    673
22:42:46.180 : MAX current  819 1479    819 949
22:42:46.182 : Run current  18/31   18/31   18/31   21/31
22:42:46.184 : Hold current 9/31    9/31    9/31    10/31
22:42:46.218 : CS actual    9/31    9/31    9/31    10/31
22:42:46.239 : PWM scale    34  34  31  12
22:42:46.268 : vsense       0=.325  1=.18   1=.18   1=.18
22:42:46.287 : stealthChop  true    true    true    true
22:42:46.331 : msteps       16  16  16  16
22:42:46.367 : tstep        max max max max
22:42:46.367 : pwm
22:42:46.367 : threshold    98  98  658 283
22:42:46.409 : [mm/s]       100 100 3   480
22:42:46.450 : OT prewarn   false   false   false   false
22:42:46.450 : OT prewarn has
22:42:46.453 : been triggered   false   false   false   false
22:42:46.484 : off time 4   4   4   4
22:42:46.517 : blank time   24  24  16  16
22:42:46.518 : hysteresis
22:42:46.574 : -end     -3  -3  2   2
22:42:46.597 : -start       1   1   1   1
22:42:46.597 : Stallguard thrs
22:42:46.599 : DRVSTATUS    X   Y   Z   E
22:42:46.629 : stst     *   *   *   *
22:42:46.656 : olb      *
22:42:46.685 : ola
22:42:46.714 : s2gb
22:42:46.733 : s2ga
22:42:46.775 : otpw
22:42:46.804 : ot
22:42:46.842 : 157C
22:42:46.874 : 150C
22:42:46.917 : 143C
22:42:46.949 : 120C
22:42:46.949 : s2vsa
22:42:46.949 : s2vsb
22:42:46.951 : Driver registers:
22:42:46.962 : X    0xC0:09:00:00
22:42:46.966 : Y    0xC0:09:00:00
22:42:46.981 : Z    0xC0:09:00:00
22:42:46.985 : E    0xC0:0A:00:00
22:42:46.993 : Testing X connection... OK
22:42:47.004 : Testing Y connection... OK
22:42:47.010 : Testing Z connection... OK
22:42:47.025 : Testing E connection... OK
xeddog commented 4 years ago

I am still interested in the outcome of this, but for now I can't do any testing with it. I am running an SKR Pro V1.1, and it will not compile using Marlin's tmcstepper library. I still have to use the BTT version, but at least that one works.

Patag commented 4 years ago

@jacekk015 RMS and MAX currents are really strange on some axis regarding their respective SET currents

jacekk015 commented 4 years ago

Reverted back to the April Marlin 2.0 On that version I can do G0 X200 F8000 and it's going "quiet" in the SpreadCycle hybrid mode. With feedrate F4000 in the StealthChop2 mode sitting next to printer I can't hear the X stepper motor.

  #define HYBRID_THRESHOLD

  #define X_HYBRID_THRESHOLD     100  // [mm/s]
  #define X2_HYBRID_THRESHOLD    100
  #define Y_HYBRID_THRESHOLD     100
  #define Y2_HYBRID_THRESHOLD    100
  #define Z_HYBRID_THRESHOLD       3
  #define Z2_HYBRID_THRESHOLD      3
  #define Z3_HYBRID_THRESHOLD      3
  #define E0_HYBRID_THRESHOLD     30

G28 + M122

17:29:51.283 : N16 G28*36
17:30:29.460 : X:165.00 Y:127.00 Z:15.00 E:0.00 Count X:13200 Y:10160 Z:6000
17:30:35.187 : N17 M122*20
17:30:35.193 : X    Y   Z   E
17:30:35.262 : Enabled      false   true    false   false
17:30:35.264 : Set current  600 600 600 700
17:30:35.289 : RMS current  581 581 581 673
17:30:35.323 : MAX current  1479    819 819 949
17:30:35.325 : Run current  18/31   18/31   18/31   21/31
17:30:35.327 : Hold current 9/31    9/31    9/31    10/31
17:30:35.365 : CS actual        9/31    9/31    9/31    0/31
17:30:35.390 : PWM scale    34  36  33  12
17:30:35.432 : vsense       0=.325  1=.18   0=.325  1=.18
17:30:35.462 : stealthChop  true    true    true    true
17:30:35.491 : msteps       16  256 16  16
17:30:35.526 : tstep        max max max max
17:30:35.527 : pwm
17:30:35.529 : threshold        98  98  658 283
17:30:35.573 : [mm/s]       1613.52 100.85  3.00    480.64
17:30:35.600 : OT prewarn   false   false   false   false
17:30:35.600 : OT prewarn has
17:30:35.602 : been triggered   false   false   false   false
17:30:35.634 : off time     4   4   4   4
17:30:35.672 : blank time   24  24  16  16
17:30:35.672 : hysteresis
17:30:35.705 : -end     2   -3  2   -3
17:30:35.737 : -start       1   1   1   1
17:30:35.737 : Stallguard thrs
17:30:35.741 : DRVSTATUS    X   Y   Z   E
17:30:35.769 : stst     X   X   X   X
17:30:35.816 : olb
17:30:35.854 : ola
17:30:35.877 : s2gb
17:30:35.904 : s2ga
17:30:35.932 : otpw
17:30:35.972 : ot
17:30:36.003 : 157C
17:30:36.037 : 150C
17:30:36.064 : 143C
17:30:36.100 : 120C
17:30:36.100 : s2vsa
17:30:36.100 : s2vsb
17:30:36.104 : Driver registers:
17:30:36.108 : X    0xC0:09:00:00
17:30:36.115 : Y    0xC0:09:00:00
17:30:36.119 : Z    0xC0:09:00:00
17:30:36.132 : E    0xC0:0A:00:00
17:30:36.140 : Testing X connection... OK
17:30:36.151 : Testing Y connection... OK
17:30:36.157 : Testing Z connection... OK
17:30:36.163 : Testing E connection... OK
jacekk015 commented 4 years ago

@boelle Check this issue there. https://github.com/teemuatlut/TMCStepper/issues/61#issuecomment-542870962 Disabling MONITOR_DRIVER_STATUS is the key here. There's need to be some bug somewhere between lines.

boelle commented 4 years ago

now that many updates has passed is this one still the same?

jacekk015 commented 4 years ago

No difference. Still knocks like before. Newest Marlin + newest TMCStepper library v.0.5.2

michaelsheridan23 commented 4 years ago

Has anyone tried the latest release of marlin yet to see if this issue is fixed? The list of updates references TMC2208s.

boelle commented 4 years ago

@michaelsheridan23 looks like you could take the plunge and try?

tobecwb commented 4 years ago

Tested today. The knocking noise still exists on latest release version (marlin and tmc library). Going back to marlin 1.1.9, the sound dissapear

tobecwb commented 4 years ago

Tried again with latest version (commit 5103cdc)... still the same knocking sound. if I disable MONITOR_DRIVER_STATUS, the sound dissapear.

looking at the April release seended by @jacekk015 , I see several differences when compared with latest release...

on tmc_util.cpp file, function TMC_driver_data get_driver_data(TMC2208Stepper &st), I see some changes... copied everything from April release to latest release, and the knocking sound persist.

one thing that I tried too, is use a hardware serial on TMC2208 instead of software serial... I don't even know if this is possible, but if enable the option #define Y_HARDWARE_SERIAL Serial1 on pins_ramps.h, the knocking sound dissapear (but the MONITOR_DRIVER_STATUS don't work...)

like some users said before, I think the Arduino it's not fast enough for this with Marlin 2.0 (that I believe consumes more resources)

anybody with a overclocked arduino? :P

sjasonsmith commented 4 years ago

MONITOR_DRIVER_STATUS with SoftwareSerial on an AVR will interfere with stepper timing in very large ways. Reading or writing a single byte will cause about 90 microseconds of jitter to the stepper timing, because interrupts have to be disabled for an entire byte duration.

thisiskeithb commented 4 years ago

MONITOR_DRIVER_STATUS with SoftwareSerial on an AVR will interfere with stepper timing in very large ways. Reading or writing a single byte will cause about 90 microseconds of jitter to the stepper timing, because interrupts have to be disabled for an entire byte duration.

Should a sanity check be added for this combination?

boelle commented 4 years ago

would not be a bad thing :-)