WirelessPrinting icon indicating copy to clipboard operation
WirelessPrinting copied to clipboard

Upload to printer SD card

Open probonopd opened this issue 5 years ago • 19 comments

We could try to upload to printer SD card, although it is reported to be very slow.

probonopd avatar Jul 21 '19 12:07 probonopd

  • http://marlinfw.org/docs/gcode/M020.html M20 - List SD Card
  • http://marlinfw.org/docs/gcode/M021.html M21 - Init SD card
  • http://marlinfw.org/docs/gcode/M022.html M22 - Release SD card
  • http://marlinfw.org/docs/gcode/M023.html M23 - Select SD file
  • http://marlinfw.org/docs/gcode/M028.html M28 - Start SD write
  • http://marlinfw.org/docs/gcode/M029.html M29 - Stop SD write
  • http://marlinfw.org/docs/gcode/M024.html M24 - Start or Resume SD print

probonopd avatar Jul 21 '19 12:07 probonopd

Most interestingly, we could use

  • http://marlinfw.org/docs/gcode/M928.html M928 - Start SD Logging

Use this command to start logging all console and host input to an SD file while still operating the machine.

The way I understand it, we could print at normal speed and after a complete print would find the printed GCODE on the printer's SD card, from where it could be re-printed at any time.

Might also come in handy for debugging purposes.

Try this by adding to a GCODE file as the first line:

M22 ; Release SD card
M21 ; Init SD card
M928 log.gcode ; Start logging to SD card

(replace log.txt with the name of the GCODE file being uploaded), and as the last line:

M29 ; Stop logging to SD card

We should probably save the file as ERROR-name-of-the.gcode and rename it to name-of-the.gcode only after the print has succeeded. This way we won't accidentally print half-complete GCODE.

probonopd avatar Jul 21 '19 12:07 probonopd

It seems promising...

GMagician avatar Jul 21 '19 12:07 GMagician

Trying it manually as we speak.

probonopd avatar Jul 21 '19 12:07 probonopd

Perhaps I think printer still print sent code

GMagician avatar Jul 21 '19 12:07 GMagician

I don't see the GCODE being saved, do you?

M22 ; Release SD card
M21 ; Init SD card
M23 log.gcode ; Select SD file
M928 log.gcode ; Start logging to SD card
; TEST
M29 ; Stop logging to SD card

telnet says:

>M21 
<echo:SD card ok#wait more#
<ok#ok#
>M928 log.gcode 
<echo:Now fresh file: log.gcode #wait more#
<open failed, File: log.gcode .#wait more#
<ok#ok#
>M29 
<ok#ok#
>M117 Complete

Perhaps we need M23.

probonopd avatar Jul 21 '19 12:07 probonopd

I can't test...long print... but

<open failed, File: log.gcode .#wait more#

is not a good sign..

Loocking into marlin code M928 opens a file and set some flags, nothing more should be needed

GMagician avatar Jul 21 '19 12:07 GMagician

With it, getting

>M21 
<echo:SD card ok#wait more#
<ok#ok#
>M23 log.gcode 
<echo:Now fresh file: log.gcode#wait more#
<open failed, File: log.gcode.#wait more#
<ok#ok#
>M928 log.gcode 
<echo:Now fresh file: log.gcode #wait more#
<open failed, File: log.gcode .#wait more#
<ok#ok#
>M29 
<ok#ok#
>M117 Complete
<ok#ok#

probonopd avatar Jul 21 '19 12:07 probonopd

I am stuck here. Running stock Marlin bugfix-1.1.x firmware from https://github.com/probonopd/marlin-for-ender-2.

probonopd avatar Jul 21 '19 12:07 probonopd

open in marlin calls:

if (!file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC))

and fail to this will send such error message. I'm looking at marlin 2.0 source.

I don't like both O_CREAT and O_APPEND but I need to wait 4h before checking something

GMagician avatar Jul 21 '19 12:07 GMagician

Tried with 2 SD cards, and also with LOG.GCO as the filename.

probonopd avatar Jul 21 '19 12:07 probonopd

Prusa i3 MK2S says:

>M22 
<ok#ok#
>M21 
<echo:SD card ok#wait more#
<ok#ok#
>M23 LOG.GCO 
<ok#ok#
>M928 LOG.GCO 
<ok#ok#
>M29 
<ok#ok#
>M117 Complete
<ok#ok#
>M105

but I don't see the file on the printer's SD card either.

probonopd avatar Jul 21 '19 13:07 probonopd

1h left then I'll have printer to test it

GMagician avatar Jul 21 '19 18:07 GMagician

Having a transparent serial bridge #132 would come in neat to test things like this.

probonopd avatar Jul 21 '19 19:07 probonopd

Tested now.. use file format 8.3

GMagician avatar Jul 21 '19 20:07 GMagician

but as I said before, it execute commands while it save them into file

GMagician avatar Jul 21 '19 20:07 GMagician

Yes, it would be good if it would print as usual and save a copy of what is being printed to the printer's SD, so that it could be re-printed later from the printer's LCD. I could not make it work, though...

probonopd avatar Jul 21 '19 20:07 probonopd

I just sent: M928 test.gco G28 G0 x0 y0 M29

GMagician avatar Jul 21 '19 20:07 GMagician

That's may be a new approach, but only available on Marlin2 and must be enabled on firmware https://github.com/MarlinFirmware/Marlin/pull/14817

GMagician avatar Aug 03 '19 08:08 GMagician