M990 Simple Upload - aegean-odyssey/mpmd_marlin_1.1.x GitHub Wiki

M990 Simple Upload Protocol

The SIMPLE UPLOAD protocol transfers a file in blocks with a fixed-length of 512 bytes. The transmitter always sends a 512-byte block to the receiver with the transmitter padding the last block with an end-of-file (EOF) character (i.e. nul, '\0'). At least one EOF (nul) character must be sent. The receiver initiates the transfer by sending the token, "BEGIN\n", and acknowleges each block received with a newline, "\n". The receiver identifies the end of the file transfer by examining the last character of each block. If the last character of the block is an EOF (nul) character, then the block should be the final block from the transmitter. The bytes preceeding the first EOF (nul) character in the block are the remaining data bytes of the file being transmitted. This simple scheme REQUIRES that the EOF (nul) character is NEVER part of the file's actual data -- not generally a problem when transferring text files.

NOTE: Our receiver implementation also sets "card.saving = true" to prevent Marlin from executing any extra or stray commands that the sending program may transmit after our receiving process terminates (such as after an abort or error). The sending program should always transmit an "M29" (close file) M-code command a few seconds after it has sent its final data packet to return Marlin to its normal command process state (i.e. "set card.saving = false").

Host (transmitter)
; transmits the command
M990 S<file_size> /<file_name>
; wait 3s for 'BEGIN'
; loop:
;   send 512 bytes
;   wait 3s for '\n' (linefeed)
;   if "more to send" goto loop
wait 3s
M29
Printer (receiver)
; receives the command
M990 S<file_size> /<file_name>
;  open file_name for write
;  send "BEGIN\n"
;  loop:
;      wait 3s for 512-bytes
;      write packet to disk
;      send '\n' (linefeed)
;      if not last packet, goto loop
;  close file
;  fail if #received bytes < file_size
;  success, otherwise

Implementations

(more belongs here)

m990.py
$ m990.py -h
Simple Upload Protocol, transfer a file through a serial port.
Usage: m990.py -d|--device=port -s|--speed=bps -q|--quiet file
e.g.
$ m990.py -d /dev/ttyACM0 file_to_upload.gcode

(more belongs here)

⚠️ **GitHub.com Fallback** ⚠️