Benachrichtigungen
Alles löschen

MK4 - Corrupted gcode using PrusaLink  

  RSS
jstm88
(@jstm88)
Active Member
MK4 - Corrupted gcode using PrusaLink

So my MK4 extruder really wanted to travel. During the print, it started moving in random directions and often ended up outside the print area before immediately returning to printing. The travel moves left excessive strings/zits of filament on both exterior and interior walls.

A video showing the issue:

IMG_5680

The results when the extruder does this many, many times:

What I discovered is fascinating. The gcode file on the printer was corrupted.

On the left is the *valid* gcode. On the right... is what came off the printer.

Note that we're around Y75 or so here, but suddenly on the right we're near Y137.

If I search for the exact line `G1 X109.062 Y137.057 E.07456` it occurs exactly once on the left (valid) file, on line 6006. But it occurs *twice* in the right file: once here on line 6470, and once earlier on line 6005. (There were other errors before that, which explains the slight line number differences).

What happened is that a block of gcode from line 6006 was *duplicated* later on, overwriting the lines that should have been there.

What's interesting is that this "duplicated" block is exactly 192 bytes long. Many (but not all) of the diffs also are exactly 192 bytes. That suggests that what's happening is that an earlier 192-byte block is either being written *instead* of the correct block, or is *overwriting* the correct block sometime later. I'm not familiar with the file transfer pipeline PrusaLink uses so I'm not sure which it might be.

I've attached copies of valid and corrupted gcode files for further analysis as well.

gcode-samples

What I have *not* yet determined is exactly when this corruption happened. I've been using Ethernet to upload the files via PrusaLink (local).

I'll do some further testing and update here. In the meantime, now is a good time to mention that it would probably be a very good idea for PrusaLink to validate the files it transfers. The fact that it apparently does not do this is a bit concerning.

Veröffentlicht : 14/08/2023 10:29 pm
Altruego gefällt das
jstm88
(@jstm88)
Active Member
Themenstarter answered:
RE: MK4 - Corrupted gcode using PrusaLink

I've also found other references to the same problem:

So there's absolutely no doubt that this is a firmware issue and it appears to be a bug in the way the MK4 writes the file to the USB drive.

Veröffentlicht : 14/08/2023 11:56 pm
Antimix
(@antimix)
Reputable Member
RE: MK4 - Corrupted gcode using PrusaLink

Are you using the IS 5.0.0 RC ?

Veröffentlicht : 15/08/2023 10:37 am
jstm88
(@jstm88)
Active Member
Themenstarter answered:
RE: MK4 - Corrupted gcode using PrusaLink

No, 4.7.1.

I'm continuing the thread over on https://github.com/prusa3d/Prusa-Firmware-Buddy/issues/3156 as right now I think it's the best place for it. I'll leave this forum post so it can serve as a redirect in case anyone has a similar issue. This is especially true since the symptom can be so unpredictable and there's no real warning.

I wonder how many people have the same problem and don't even realize it's happening, instead blaming it on generic stringing or bad filament...

Veröffentlicht : 15/08/2023 8:23 pm
ronguest gefällt das
koil
 koil
(@koil)
Mitglied
RE: MK4 - Corrupted gcode using PrusaLink
Posted by: @jstm88

No, 4.7.1.

I'm continuing the thread over on https://github.com/prusa3d/Prusa-Firmware-Buddy/issues/3156 as right now I think it's the best place for it. I'll leave this forum post so it can serve as a redirect in case anyone has a similar issue. This is especially true since the symptom can be so unpredictable and there's no real warning.

I wonder how many people have the same problem and don't even realize it's happening, instead blaming it on generic stringing or bad filament...

I bet the issue is more widespread than we think, and I'm pretty sure it's rooted in the terrible network to USB file transfer code.

Veröffentlicht : 16/08/2023 8:41 am
Altruego und gefällt das
Crafty Sven
(@crafty-sven)
Active Member
RE: MK4 - Corrupted gcode using PrusaLink

It's definitely an issue how it saves it to the USB. It prints the file okay and then it rewrites it ? I don't quite know but I have these terrible random things happening to the gcode after (this is opened in the gcode viewer after a spotted something wrong) 

Veröffentlicht : 30/03/2024 6:01 pm
Antimix
(@antimix)
Reputable Member
RE: MK4 - Corrupted gcode using PrusaLink

- Are you using the original PRUSA USB dongle ?

Veröffentlicht : 31/03/2024 3:16 pm
Crafty Sven
(@crafty-sven)
Active Member
RE: MK4 - Corrupted gcode using PrusaLink

I transferred it via prusa connect and I have the original A-Data usb.

So I don't think it's the usb, I think its the network transfer somehow

Veröffentlicht : 31/03/2024 3:33 pm
jstm88
(@jstm88)
Active Member
Themenstarter answered:
RE: MK4 - Corrupted gcode using PrusaLink

I just had it happen again to me after months of no issues. This happened on the latest firmware with binary ‘bgcode’ files.

Deleting some files fixed it (for now) so it looks like it might be linked somehow to how full the drive is.

I’ll post the some more details on the GitHub issue thread when I get the chance.

Veröffentlicht : 31/03/2024 8:45 pm
jstm88
(@jstm88)
Active Member
Themenstarter answered:
RE:

It’s worth repeating as well that we really need a way to validate files. Over on the GitHub thread I wrote a script that does this. But it really should be built in.

I’d like to see a way for PrusaSlicer to embed a checksum into .bgcode files, and then to have the printer check the file before printing. One quick way to do this would be to put a SHA256 checksum at the beginning of the file. That would be compared against the hash of all the following bytes. It would also be possible to include this information in a separate file, but it would be nice to keep it self-contained.

This would also have the benefit of detecting corruption on the drive even if it happens after the transfer. That’s unlikely but why not check if we can?

Diese r Beitrag wurde geändert Vor 6 months 3 mal von jstm88
Veröffentlicht : 31/03/2024 8:50 pm
Teilen: