prusa3d / Prusa-Firmware

Firmware for Original Prusa i3 3D printer by PrusaResearch
GNU General Public License v3.0
2.02k stars 1.05k forks source link

[BUG] Extraneous NULL characters when using Serial -> GPIO to talk to RPi and OctoPrint #2686

Closed corporategoth closed 11 months ago

corporategoth commented 4 years ago

Please, before you create a new bug report, please make sure you searched in open and closed issues and couldn't find anything that matches.

Printer type - MK3S Printer firmware version- 3.9.0

Describe the bug This is not new with 3.9.0, but I have noticed that there are often NULL (\x00) characters in the gcode response stream coming from the Prusa to the Raspberry Pi (on which I have Octoprint).

I am using a Raspberry Pi 4B, and I have it connected to the Rambo board using the serial interface (ie. /dev/ttyAMA0 on the RPi).

Randomly during prints, I would notice that I would get a timeout from Octoprint. Enabling the serial log showed that the OK response was screwed up - having a NULL character in it.

2020-05-24 21:45:40,088 - Send: N39194 G1 X153.358 Y56.554 E0.19487*89
2020-05-24 21:45:40,209 - Recv: ok
2020-05-24 21:45:40,219 - Send: N39195 M73 Q43 S189*37
2020-05-24 21:45:40,229 - Recv: NORMAL MODE: Percent done: 43; print time remaining in mins: 185
2020-05-24 21:45:40,235 - Recv: SILENT MODE: Percent done: 43; print time remaining in mins: 189
2020-05-24 21:45:46,259 - Communication timeout while printing, trying to trigger response from printer. Configure long running commands or increase communication timeout if that happens regularly on specific commands or long moves.
2020-05-24 21:45:46,282 - Send: N39196 G1 X156.453 Y59.649 E0.14817*90
2020-05-24 21:45:46,291 - Recv: oo^@k
2020-05-24 21:45:52,306 - Communication timeout while printing, trying to trigger response from printer. Configure long running commands or increase communication timeout if that happens regularly on specific commands or long moves.
2020-05-24 21:45:58,326 - Communication timeout while printing, trying to trigger response from printer. Configure long running commands or increase communication timeout if that happens regularly on specific commands or long moves.
2020-05-24 21:46:04,341 - Communication timeout while printing, trying to trigger response from printer. Configure long running commands or increase communication timeout if that happens regularly on specific commands or long moves.
2020-05-24 21:46:10,387 - Communication timeout while printing, trying to trigger response from printer. Configure long running commands or increase communication timeout if that happens regularly on specific commands or long moves.
2020-05-24 21:46:16,421 - Communication timeout while printing, trying to trigger response from printer. Configure long running commands or increase communication timeout if that happens regularly on specific commands or long moves.
2020-05-24 21:46:22,452 - No response from printer after 6 consecutive communication timeouts, considering it dead. Configure long running commands or increase communication timeout if that happens regularly on specific commands or long moves.
2020-05-24 21:46:22,517 - Changing monitoring state from "Printing" to "Offline (Error: Too many consecutive timeouts, printer still connected and alive?)"
2020-05-24 21:46:22,539 - Connection closed, closing down monitor

This bug seems to be related to this issue: https://github.com/OctoPrint/OctoPrint/issues/2454

I enabled the plugin mentioned there (https://gist.github.com/cesarvandevelde/6e4b54ce1977cb89ffa875d095c550af) so I could see for myself what was going on. Sure enough, I am seeing lots of random null characters in responses from the printer:

2020-05-24 23:45:36,959 Send: M105
2020-05-24 23:45:36,959 Recv: ok T:24.8 /0.0 B:25.5 /0.0 T0:24.8 /0.0 @:0 B@:0P^@:25.5 A:30.7
2020-05-24 23:57:42,192 Send: M73 P0 R325
2020-05-24 23:57:42,206 Recv: NORMAL MODE: Percent done: 0; print time remaining in mins: 325
2020-05-24 23:57:42,208 Recv: SILENT MODE: Percent done: 255; i^@nt time remaining in mins: -1
2020-05-25 00:10:30,115 Send: M73 P0 R324
2020-05-25 00:10:30,115 Recv: NORMAL MODE: Percent done: 0; print time remaining in mins: 324
2020-05-25 00:10:30,115 Recv: SILENT MODE: Percent done: 0; pre^@maining in mins: 331
2020-05-25 00:52:10,808 Send: M105
2020-05-25 00:52:10,809 Recv: ok T:200.0 /200.0 B:54.9 /55.0 T0:200.0 /200.0 @:28 B@:42 P:45.7:^@39.6
2020-05-24 17:40:24,303 - Send: N0 M110 N0*125
2020-05-24 17:40:24,343 - Recv: e^@cho:busy: paused for user
2020-05-24 23:59:49,870 - Send: N75 G1 X20.0 E6  F1000.0*116
2020-05-24 23:59:49,887 - Recv: ^@ok

These seem to happen most often on M73 and M105 commands. Not entirely though.

It can even cause some garbling:

2020-05-24 17:58:58,949 - Send: N978 M105*33
2020-05-24 17:59:04,983 - Communication timeout while printing, trying to trigger response from printer. Configure long running commands or increase communication timeout if that happens regularly on specific commands or long moves.
2020-05-24 17:59:05,000 - Send: N979 M73 P2 R317*21
2020-05-24 17:59:05,009 - Recv: ok T:200.1 /200.0 B:55.5 /55.0 T0:200.1 /200.0 @:26 B@:0 P:44.5 N^@ORMAL MODE: Percent done: 2; pr ^@time remaining in mins: 317
2020-05-24 17:59:05,018 - Send: N980 G1 X103.940 Y56.687 E0.01680*89
2020-05-24 17:59:05,038 - Recv: SILENT MODE: Percent done: 2; print time remaining in mins: 324
2020-05-24 17:59:05,045 - Recv: ok

If that garbling/merging happens to effect an OK, well:

2020-05-24 18:51:34,507 - Send: N11153 M73 Q18 S271*47
2020-05-24 18:51:34,519 - Recv: NORMAL MODE: Percent done: 18; print time remaining in mins: 265
2020-05-24 18:51:40,541 - Communication timeout while printing, trying to trigger response from printer. Configure long running commands or increase communication timeout if that happens regularly on specific commands or long moves.
2020-05-24 18:51:40,566 - Send: N11154 G1 X75.592 Y106.914 E0.19487*86
2020-05-24 18:51:40,575 - Recv: SILENT MODE: Percent done: 18; print time remaining in mins: 27o^@k
2020-05-24 18:51:46,585 - Communication timeout while printing, trying to trigger response from printer. Configure long running commands or increase communication timeout if that happens regularly on specific commands or long moves.

Nothing is safe:

2020-05-24 18:52:24,321 - Send: M20
2020-05-24 18:52:26,501 - Recv: ok
2020-05-24 18:52:26,506 - Recv: Begin file list
2020-05-24 18:52:26,543 - Recv: MK3S_P~1.GCO 409041
2020-05-24 18:52:26,548 - Recv: MK4DCB~1.GCO 796054
2020-05-24 18:52:26,557 - Recv: MK9CB5~1.GCO 7550751
2020-05-24 18:52:26,562 - Recv: MKC12B~1.GCO 18235410
2020-05-24 18:52:26,566 - Recv: MK3S_P~2.GCO 4042561
2020-05-24 18:52:26,568 - Recv: MK3S_P~3.GCO 10370557
2020-05-24 18:52:26,571 - Recv: MK3S_P~4.GCO 1169490
2020-05-24 18:52:26,575 - Recv: MK4FC8~1.GCO 320939
2020-05-24 18:52:26,582 - Recv: MKDAC1~1.GC1^@9928963
2020-05-24 18:52:26,587 - Recv: MK8853~1.GCO 7839966
2020-05-24 18:52:26,591 - Recv: MK9041~1.GCO 25035842
2020-05-24 18:52:26,595 - Recv: MK83D6~1.GCO 6136347
2020-05-24 18:52:26,598 - Recv: MK5EE4~1.GCO 239362
2020-05-24 18:52:26,602 - Recv: MK9EAA~1.GCO 23835763
2020-05-24 18:52:26,604 - Recv: MKC061~1.GCO 2313309
2020-05-24 18:52:26,607 - Recv: MK4F32~1.GCO 6726536
2020-05-24 18:52:26,623 - Recv: PLA_S3~1.GCO 22392
2020-05-24 18:52:26,629 - Recv: PET_S3~1.GCO 22424
2020-05-24 18:52:26,636 - Recv: End file list
2020-05-24 18:52:26,652 - Recv: ok

To Reproduce Use the printer, directly connected to RPI's GPIO and the Einsy board RPi pins.

Expected behavior There would NOT be random NULL characters in the output. I should not need to use that ackackack plugin to detect garbled/random null characters in the output coming from the printer.

github-actions[bot] commented 11 months ago

This issue has been flagged as stale because it has been open for 60 days with no activity. The issue will be closed in 7 days unless someone removes the "stale" label or adds a comment.

github-actions[bot] commented 11 months ago

This issue has been closed due to lack of recent activity.