Welcome! Log In Create A New Profile

Advanced

Super weird - Marlin SD print stutter when not connected via serial

Posted by matias2k 
Super weird - Marlin SD print stutter when not connected via serial
September 27, 2023 08:04PM
Hello, this is my first post here. I have used Marlin for years, ran into countless problems, but this one is new to me...

Long story short(ish), my printer ran fine. It's got a RAMPS 1.4, Arduino Mega, some TMC2208s and some DRV8825s. I replaced some wires for the X gantry and forgot to put the resistor divider on the z probe signal line, so I injected 12V through the Z min pin. Immediately after that, one of the TMCs died and the UART chip on the Arduino (16u2 mcu that acts as uart to usb) stopped working. No problem, I just replaced the TMC and decided to fix the serial issue some other day. but right after that, prints started to stutter just as if I was printing a highly detailed model through serial (stutters a lot when moving, like an empty buffer).
So I took apart the RAMPS, removed the Arduino, desoldered the bad 16u2 and broke out the serial0 pins (tx/rx, rst via cap, gnd, 5v), and wired them up to a CP2102 UART to USB converter, to see if the printer was throwing some TMC overheat error or something... It didn't stutter even once.

TL;DR: The lack of a serial connection to my PC makes my printer stutter while printing, as if the output buffer overflowed. I have no idea how to proceed other than leaving it connected all the time (which is impractical as it's connected by two usb extension cables in series). Any ideas?
Re: Super weird - Marlin SD print stutter when not connected via serial
September 28, 2023 02:34AM
I'm impressed - a lot of work to rescue that ramps board.

Unforunately, 12V has been applied to the 5V rail which makes EVERY chip suspect. It's obvious that you have walking wounded chips. If you value your sanity then replace the ENTIRE system. The alternative is to play whack-a-mole. Been there - don't recommend it.
Re: Super weird - Marlin SD print stutter when not connected via serial
September 28, 2023 06:06AM
Oh, but everything works as intended if there's a PC just *listening* via serial. I just have Arduino IDE's serial monitor at 500k baud showing the occasional temperature status message. If it's standalone, everything is fine too, but it starts stuttering. Reducing print speed improves it a bit, just as you would expect.

Plus there aren't a lot of chips anyways grinning smiley the only chips that could be "wounded" are the MCU (no obvious issues, apart from this), LCD drivers (ok), stepper drivers (i replaced the one that died), 5v regulator (tested ok) and USB to UART (obviously died), and the fact that it runs just as it should when plugged in points to something to do with a buffer in software imo.

The easy way out would be to replace the Arduino (or even the entire board with an SKR or something as new, which would make sense at this point in time) but I'd prefer to save this one as it's just a backup printer. Hence why I'm asking if anyone knows whether the lack of a UART termination can make Marlin pile up stuff on some buffer (or what the hell could be going on).
Re: Super weird - Marlin SD print stutter when not connected via serial
September 28, 2023 08:28PM
When printing from the SD card, the printer stutters if the serial cable is disconnected.

When printing from the SD card, the printer works fine if the serial cable is connected.

---

Try re-compiling Marlin with all the serial ports disabled.

A possibility is to tie the serial receive pin to ground or to +5V. One of them should make Marlin think that nothing was coming in.

---

Marlin uses interrupts to tranfer data from the uart receiver to the circular input buffer. Data is discarded if the buffer is full. The input buffer is scanned by the idle loop. If a command is decoded then it is added to the command queue. If not a valid command, then an "invalid command" response is sent.

I expect the stuttering is due to the CPU servicing the input & output buffers that it doesn't have enough time to keep the print queue from running out.
Re: Super weird - Marlin SD print stutter when not connected via serial
October 05, 2023 11:20PM
I finally got around to trying that. A resistor between RX and gnd fixed it. i might make sort of a termination to keep it grounded while not using serial. the poor thing is operational once again, thanks!
Re: Super weird - Marlin SD print stutter when not connected via serial
October 06, 2023 05:25AM
Wonderful!!
Sorry, only registered users may post in this forum.

Click here to login