Octopi USB issues on Raspberry Pi B+ with Ender 3

What is the problem?

Octoprint is awesome - but I can't get it to work reliably. There are 2 main issues I'm having:

  1. The printing glitches when I print with Octoprint. Sometimes the printer seems to ignore a command, so that the extruder doesn't stop and prints a line connecting two parts that shouldn't be connected. Sometimes the printer just misses out a small section so there is a small gap. And occasionally the print head just "wanders off" into nowhere leaving a string of fillament behind it!!

IMG_5468|666x500

  1. Occasionally the USB connection is lost momentarily causing it to reconnect. Even if I am printing from the SD card and just using Octopi to monitor the print this causes a massive problem because the Ender 3 printer restarts whenever the serial connection is reset, meaning that a short interruption in the USB connection causes the print to stop.

What did you already try to solve it?

I tried using 3 different USB cables including a very short one with a ferite core. I tried printing from a raspberry pi 2 instead (with no webcam installed). None of this has helped.

Complete Logs

I don't have easy access to the logs right now but I can get them if necessary.

There were lots of error messages about the printer requested a step to be resent, and some generic error messages about the USB disconnecting.

Additional information about your setup

Octoprint was the latest version a couple of days ago (4.1?). Ender 3 firmware is whatever was installed at the factory. I will update it at the weekend when my new motherboard arrives for it as it has the latest firmware on it.

They are always necessary, especially with this type of issue.

Here is a part of my octoprint.log (the full file was too big to upload):

octoprint.log (2.1 MB)

serial.log just has a message saying it is disabled.

Syslog has this in it:

Sep  7 22:51:31 octopi kernel: [ 1638.939643] ch341-uart ttyUSB0: usb_serial_generic_read_bulk_callback - urb stopped: -32
Sep  7 22:51:31 octopi kernel: [ 1638.939736] ch341-uart ttyUSB0: usb_serial_generic_read_bulk_callback - urb stopped: -32
Sep  7 22:51:31 octopi kernel: [ 1638.941041] usb 1-1.5: USB disconnect, device number 5
Sep  7 22:51:31 octopi kernel: [ 1638.941575] usb 1-1.5: failed to send control message: -19
Sep  7 22:51:31 octopi kernel: [ 1638.942151] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0
Sep  7 22:51:31 octopi kernel: [ 1638.942287] ch341 1-1.5:1.0: device disconnected

Here is full syslog:

syslog.log (262.7 KB)

There seem to be a lot of communication errors. Try using another (better) USB cable between the Pi and the printer. Preferably one with a ferrite core:

That is the big big hint for you to enable it :wink:

I did use 3 different cables and one of them did have a ferrite core. I can't tell for sure if it is shielded or not but I think it probably is as it seems good quality.

I will enable it and set up the octopi again and ruin some more prints to see what happens.

Why isn't it enabled by default?

Because it can negatively impact performance, as it says so right next to it :sweat_smile:

There is a lot of stuff like this appearing in my serial.log:

2020-09-10 14:35:59,188 - Send: N684 G1 F1500 X124.086 Y126.349 E113.72133*15
2020-09-10 14:35:59,220 - Recv: ok
2020-09-10 14:35:59,226 - Send: N685 G0 F9000 X123.52 Y126.349*112
2020-09-10 14:35:59,228 - Recv: Error:checksum mismatch, Last Line: 682
2020-09-10 14:35:59,231 - Recv: Resend: 683
2020-09-10 14:35:59,236 - Recv: ok
2020-09-10 14:35:59,240 - Send: N683 G0 F9000 X108.649 Y110.912*66
2020-09-10 14:36:00,075 - Recv: ok
2020-09-10 14:36:00,082 - Recv: Error:Line Number is not Last Line Number+1, Last Line: 682
2020-09-10 14:36:00,085 - Send: N684 G1 F1500 X124.086 Y126.349 E113.72133*15
2020-09-10 14:36:00,089 - Recv: Resend: 683
2020-09-10 14:36:00,113 - Recv: ok
2020-09-10 14:36:00,117 - Send: N685 G0 F9000 X123.52 Y126.349*112
2020-09-10 14:36:00,120 - Recv: Error:Line Number is not Last Line Number+1, Last Line: 682
2020-09-10 14:36:00,123 - Recv: Resend: 683
2020-09-10 14:36:00,128 - Recv: ok
2020-09-10 14:36:00,132 - Recv: ok
2020-09-10 14:36:00,136 - Send: N683 G0 F9000 X108.649 Y110.912*66
2020-09-10 14:36:00,140 - Recv: echo:Unknown command: "Êîoûæÿ÷wûÿn"
2020-09-10 14:36:00,142 - Recv: ok
2020-09-10 14:36:00,145 - Send: N684 G1 F1500 X124.086 Y126.349 E113.72133*15
2020-09-10 14:36:00,148 - Recv: echo:Unknown command: "÷ï÷÷÷ï÷ÿçï÷ÿ÷÷÷÷÷÷÷ÿ÷÷÷ÿýã"
2020-09-10 14:36:00,149 - Send: N685 G0 F9000 X123.52 Y126.349*112
2020-09-10 14:36:00,152 - Recv: ok
2020-09-10 14:36:00,157 - Send: N686 G1 F1500 X108.649 Y111.478 E114.42081*11
2020-09-10 14:36:00,159 - Recv: Error:Line Number is not Last Line Number+1, Last Line: 682
2020-09-10 14:36:00,162 - Recv: Resend: 683
2020-09-10 14:36:00,169 - Recv: ok
2020-09-10 14:36:00,173 - Send: N683 G0 F9000 X108.649 Y110.912*66
2020-09-10 14:36:00,595 - Recv:   TT::194.09194.09  //195.00195.00  BB::59.9759.97  //60.0060.00  @@::8787  BB@@::4040
2020-09-10 14:36:00,597 - Recv: 
2020-09-10 14:36:00,998 - Recv: ok
2020-09-10 14:36:01,002 - Send: N684 G1 F1500 X124.086 Y126.349 E113.72133*15
2020-09-10 14:36:01,002 - Recv: Error:Line Number is not Last Line Number+1, Last Line: 686
2020-09-10 14:36:01,006 - Recv: Resend: 687
2020-09-10 14:36:01,010 - Recv: ok
2020-09-10 14:36:01,017 - Send: N687 G0 F9000 X126.349 Y115.601*71
2020-09-10 14:36:01,019 - Recv: Error:Line Number is not Last Line Number+1, Last Line: 686
2020-09-10 14:36:01,023 - Recv: Resend: 687
2020-09-10 14:36:01,031 - Recv: ok
2020-09-10 14:36:01,037 - Send: N687 G0 F9000 X108.649 Y112.043*73
2020-09-10 14:36:01,040 - Recv: ok
2020-09-10 14:36:01,046 - Send: N688 G1 F1500 X122.955 Y126.349 E115.09372*15
2020-09-10 14:36:01,951 - Recv: ok
2020-09-10 14:36:01,967 - Send: N689 G0 F9000 X122.389 Y126.349*72
2020-09-10 14:36:01,979 - Recv: Error:Line Number is not Last Line Number+1, Last Line: 687
2020-09-10 14:36:01,985 - Recv: Resend: 688
2020-09-10 14:36:01,989 - Recv: ok
2020-09-10 14:36:01,993 - Recv: Error:Line Number is not Last Line Number+1, Last Line: 687
2020-09-10 14:36:01,996 - Send: N688 G1 F1500 X122.955 Y126.349 E115.09372*15
2020-09-10 14:36:01,997 - Recv: Resend: 688
2020-09-10 14:36:02,006 - Recv: ok
2020-09-10 14:36:02,009 - Send: N689 G0 F9000 X122.389 Y126.349*72
2020-09-10 14:36:02,011 - Recv: ok
2020-09-10 14:36:02,017 - Send: N690 G1 F1500 X108.649 Y112.609 E115.74001*7
2020-09-10 14:36:02,595 - Recv:   TT::194.55194.55  //195.00195.00  BB::59.9959.99  //60.0060.00  @@::7777  BB@@::3838
2020-09-10 14:36:02,598 - Recv: 
2020-09-10 14:36:02,939 - Recv: ok
2020-09-10 14:36:02,945 - Send: N691 G0 F9000 X108.649 Y113.175*75
2020-09-10 14:36:02,945 - Recv: Error:checksum mismatch, Last Line: 688
2020-09-10 14:36:02,949 - Recv: Resend: 689
2020-09-10 14:36:02,954 - Recv: ok
2020-09-10 14:36:02,958 - Send: N689 G0 F9000 X122.389 Y126.349*72
2020-09-10 14:36:02,960 - Recv: echo:Unknown command: "ä&îÿçfJ"
2020-09-10 14:36:02,963 - Recv: ok
2020-09-10 14:36:02,966 - Recv: Error:Line Number is not Last Line Number+1, Last Line: 688
2020-09-10 14:36:02,970 - Send: N690 G1 F1500 X108.649 Y112.609 E115.74001*7
2020-09-10 14:36:02,973 - Recv: Resend: 689
2020-09-10 14:36:02,981 - Recv: ok
2020-09-10 14:36:02,984 - Send: N691 G0 F9000 X108.649 Y113.175*75
2020-09-10 14:36:02,988 - Recv: ok
2020-09-10 14:36:02,993 - Recv: echo:Unknown command: "÷ÿ÷ÿÿÿÿïÿÿûF"
2020-09-10 14:36:02,995 - Send: N692 G1 F1500 X121.823 Y126.349 E116.35968*10
2020-09-10 14:36:03,017 - Recv: ok
2020-09-10 14:36:03,026 - Send: N693 G0 F9000 X121.258 Y126.349*77
2020-09-10 14:36:03,027 - Recv: echo:Unknown command: "÷ÿÿÿÿÿÿÿ÷ÿ§¬H€
                                                                    "
2020-09-10 14:36:03,030 - Recv: ok
2020-09-10 14:36:03,037 - Send: N694 G1 F1500 X108.649 Y113.74 E116.95276*48
2020-09-10 14:36:03,958 - Recv: ok
2020-09-10 14:36:03,964 - Send: N695 G0 F9000 X108.649 Y114.306*78
2020-09-10 14:36:03,993 - Recv: ok
2020-09-10 14:36:03,999 - Send: N696 G1 F1500 X120.692 Y126.349 E117.51923*7
2020-09-10 14:36:04,595 - Recv:   TT::195.00195.00  //195.00195.00  BB::60.0060.00  //60.0060.00  @@::6868  BB@@::3535
2020-09-10 14:36:04,610 - Recv: 
2020-09-10 14:36:05,009 - Recv: ok
2020-09-10 14:36:05,014 - Send: N697 G0 F9000 X120.126 Y126.349*66
2020-09-10 14:36:05,045 - Recv: ok
2020-09-10 14:36:05,051 - Send: N698 G1 F1500 X108.649 Y114.872 E118.05907*15
2020-09-10 14:36:05,053 - Recv: echo:Unknown command: "1.258 Y126.349"
2020-09-10 14:36:05,057 - Recv: ok
2020-09-10 14:36:05,062 - Send: N699 G0 F9000 X108.649 Y115.438*73
2020-09-10 14:36:05,064 - Recv: Error:Line Number is not Last Line Number+1, Last Line: 692
2020-09-10 14:36:05,068 - Recv: Resend: 693
2020-09-10 14:36:05,072 - Recv: ok
2020-09-10 14:36:05,076 - Recv: echo:Unknown command: "8.649 Y113.74 E116.95276"
2020-09-10 14:36:05,079 - Send: N693 G0 F9000 X121.258 Y126.349*77
2020-09-10 14:36:05,079 - Recv: ok
2020-09-10 14:36:05,086 - Send: N694 G1 F1500 X108.649 Y113.74 E116.95276*48
2020-09-10 14:36:05,088 - Recv: echo:Unknown command: "8.649 Y114.306"
2020-09-10 14:36:05,092 - Recv: ok
2020-09-10 14:36:05,095 - Recv: echo:Unknown command: "0.692 Y126.349 E117.51923"
2020-09-10 14:36:05,097 - Send: N695 G0 F9000 X108.649 Y114.306*78
2020-09-10 14:36:05,100 - Recv: ok
2020-09-10 14:36:05,103 - Recv: Error:Line Number is not Last Line Number+1, Last Line: 692
2020-09-10 14:36:05,108 - Recv: Resend: 693
2020-09-10 14:36:05,112 - Send: N696 G1 F1500 X120.692 Y126.349 E117.51923*7
2020-09-10 14:36:05,139 - Recv: ok
2020-09-10 14:36:05,146 - Recv: Error:Line Number is not Last Line Number+1, Last Line: 692
2020-09-10 14:36:05,150 - Send: N697 G0 F9000 X120.126 Y126.349*66
2020-09-10 14:36:05,155 - Recv: Resend: 693
2020-09-10 14:36:05,164 - Recv: ok
2020-09-10 14:36:05,168 - Send: N698 G1 F1500 X108.649 Y114.872 E118.05907*15
2020-09-10 14:36:05,170 - Recv: echo:Unknown command: ""
2020-09-10 14:36:05,173 - Recv: ok

It looks like the serial data is being corrupted.

Yes, as @fieldOfView already pointed out.

This is my setup:

You can see the short usb cable with the ferrite bead on it.

Somethings still missing with the serial communication however. This is an issue you'll need to solve before you can expect reliable operation from OctoPrint. It needs to be able to talk to your printer without half of the messages getting garbled in the process in order to do its job :woman_shrugging:

If I wrap my USB cable in foil and attach that to the ground pin of my powersupply (essentially just connected to the earth pin on a socket) would that shield the signal? Would that be enough to rule out a dodgy USB cable?

I have tried 4 different cables now but I can't be sure if any of them are shielded because you can't see through the insulation.

I think it's working:

I attached the foil to the chassis of the raspberry pi and the Ender 3. Looks like the corruption has stopped.

Here are the results:

The one on the left had no shielding.

I wrapped the cable in foil and attached it to the earth pin of my PSU and started to print again but it didn't work. I then ready that you need to attach it to the earth of the devices at each end of the connection so I hooked up more wires from the foil to the usb port's ground on the Raspberry Pi and the PSU of the Ender 3 and the messages stopped.

You can see a cross pattern on the bottom of the print on the right - this is from the corruption. I think the printer was not receiving the message to stop extruding. As soon as I fixed the shielding the crossing stopped!

Honestly, I thought all of this talk about shielding USB cables was a load of rubbish. Looks like I was wrong! Also goes to show how few USB cables have the proper shielding.

I have a shielded 15cm cable showing up tomorrow. I couldn't find one with a Ferrite Core but I don't think it matters. I'll test it tomorrow and let you know what happens.

Either way thanks for your help!

1 Like

If the shielded USB cable works, could you please post a link so others can easily order one?

Yes will do. It's due to arrive tomorrow so I will test and update this thread to say whether it works or not either tomorrow or the next day

The USB cable turned up today but it was too short. I ran it through an (also shielded) short USB extension but the problem was not fixed.

I've ordered a longer shielded cable and some clip on ferrite chokes which should arrive Monday - I will do some testing and report back here!

I'm not sure if anyone's still actually interested in this but I promised I would post when I'd solved the problem.

I ordered a USB cable but when I tested it it didn't work without my aluminium foil shielding, so I ordered another cable which didn't arrive until today. Over the weekend I upgraded the motherboard of my printer to a new silent motherboard (and it really does silence the stepper motors!) and then when the new cable turned up this morning I plugged it in and everything worked perfectly.

As always seems to be the case with 3D printing, there were too many variables to tell what had actually fixed it as I had upgraded the motherboard and swapped the cable, so I went back to my original cable that didn't used to work, this time without my extra shielding... and it worked!

So, switching the motherboard seemed to fix the corruption problem, not switching the cable!

The reason I was suspicious in the first place was that I had a conversation with an electrical engineer about the shielding thing and he seemed very surprised that none of my USB cables were shielded in the first place.

So my new question is, what was causing the problem?

I know it wasn't the cable as the old cable is now working. Was it the old stepper drivers - maybe as well as being noisy as hell they emit lots of electromagnetic noise too? Was it poor grounding on the old motherboard? There's a chance that my foil shielding wasn't actually doing anything but providing a low impedance path from the ground of the Raspberry Pi to the ground of my printer's power supply?

In the name of science I should probably refit the old motherboard and test some stuff, but it was a real pain to change over and there's no way I'm going through that process another couple of times.

If anyone else has this problem I would be very interested to see if it is fixed by running a jumper wire between ground of the two devices.

Sorry if this is not conclusive. I'm just glad I can retire my messy aluminium foil!