Prints freezes and resumes with OctoPi on RPi3B+

I have been printing to a Creality Ender 3 via USB from OctoPrint 1.3.8 on Octopi 0.15.1 on Raspberry Pi 3B+. The gcode was generated on Cura 3.4.1, and was stored on the Pi SD card.

Intermittently, the printer would freeze for a minute or so then resume automatically. Temperature seems to be fine, and there was no error displayed on either the printer or the Octoprint web interface.

(More details below) I am just wondering, could this be a Raspberry Pi 3B+ problem? Something wrong with my USB cable? Am I printing too fast (I'm running at 50mm/s)?

Thanks!

-- Details --

Digging further, I found a number of the following logs in /var/log/syslog over a period of an hour during the print (the print is still ongoing):

octopi kernel: WARN::dwc_otg_handle_mode_mismatch_intr:68: Mode Mismatch Interrupt: currently in Host mode

In octoprint.log around the time the above logs occur, something like this shows up:

2018-07-23 20:36:47,968 - octoprint.util.comm - INFO - Got a resend request from the printer: requested line = 9371, current line = 9374
| Last lines in terminal:
| Recv: ok
| Send: N9366 G1 X91.16 Y102.304 E405.2695288
| Recv: ok
| Send: N9367 G1 X91.301 Y102.163 E405.27615
98
| Recv: ok
| Send: N9368 G1 X91.442 Y102.304 E405.2804499
| Recv: ok
| Send: N9369 G1 X95.651 Y106.514 E405.47844
100
| Recv: ok
| Send: N9370 G1 X95.792 Y106.655 E405.4850797
| Recv: ok
| Send: N9371 G1 X95.933 Y106.514 E405.48935
110
| Recv: echo:Unknown command: "55"
| Recv: ok
| Send: N9372 G1 X103.469 Y98.977 E405.84385111
| Recv: echo:Unknown command: ""
| Recv: ok
| Send: N9373 G1 X103.61 Y98.836 E405.85048
85
| Recv: Error:Line Number is not Last Line Number+1, Last Line: 9370
| Recv: Resend: 9371

Or

2018-07-23 21:08:48,708 - octoprint.util.comm - INFO - Got a resend request from
the printer: requested line = 54169, current line = 54172
| Last lines in terminal:
| Send: N54163 M204 S500086
| Recv: ok
| Send: N54164 M205 X30 Y30
39
| Recv: ok
| Send: N54165 G0 F6000 X80.732 Y93.95669
| Recv: ok
| Send: N54166 G0 X80.832 Y93.956
41
| Recv: ok
| Send: N54167 M204 S50098
| Recv: ok
| Send: N54168 M205 X20 Y20
43
| Recv: ok
| Send: N54169 G1 F2700 X80.973 Y94.097 E1525.9247859
| Communication timeout while printing, trying to trigger response from printer.
Configure long running commands or increase communication timeout if that happe
ns regularly on specific commands or long moves.
| Send: N54170 M105
32
| Recv: echo:Unknown command: "088
@@
"
| Recv: ok
| Send: N54171 M105*33
| Recv: Error:Line Number is not Last Line Number+1, Last Line: 54168
| Recv: Resend: 54169

Probably the first thing to check would be the serial cable. It needs to have a nice tight connection on both ends, it either needs to have a metallic sheath inside or one or two ferrite cores at one/both ends to block electrical noise.

Occam’s Razor! Replaced the cable and the symptom seems to have disappeared!

Maybe I’ll go get a better cable for the long run.

Thanks!