Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Prusa MK3 firmware language pack #325

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

arekm
Copy link
Contributor

@arekm arekm commented Aug 17, 2022

Adds support for flashing not only firmware but also firmware language
pack on Prusa MK3 (and newer printer variants).

Needs special avrdude: https://github.com/arekm/avrdude-prusa-mk3

There is a question how to deal with incompatible avrdude and MK3 firmware being used.
Use separate "AVR Programmer Type" ? Try to detect that somehow (just check avrdude path?)

2022-08-17 11:24:00,393 - octoprint.plugins.firmwareupdater - INFO - Firmware update profile index: 0
2022-08-17 11:24:00,405 - octoprint.plugins.firmwareupdater - INFO - Firmware update profile name: Default
2022-08-17 11:24:00,406 - octoprint.plugins.firmwareupdater - INFO - Printer port: /dev/ttyACM0
2022-08-17 11:24:00,420 - octoprint.plugins.firmwareupdater - INFO - Flash method: avrdude
2022-08-17 11:24:00,464 - octoprint.plugins.firmwareupdater - INFO - Firmware update started
2022-08-17 11:24:00,563 - octoprint.plugins.firmwareupdater - INFO - Found Prusa MK3 device: /dev/ttyACM0. Checking firmware file.
2022-08-17 11:24:00,609 - octoprint.plugins.firmwareupdater - INFO - Looks to be Prusa MK3 firmware file.
2022-08-17 11:24:00,668 - octoprint.plugins.firmwareupdater - INFO - Running '/usr/bin/avrdude-prusa -v -q -p m2560 -c wiring -P /dev/ttyACM0 -D -U flash:w:/tmp/tmpo35tb1v7:i' in /usr/bin
2022-08-17 11:24:02,305 - octoprint.plugins.firmwareupdater - INFO - Writing memory...
2022-08-17 11:24:45,243 - octoprint.plugins.firmwareupdater - INFO - Verifying memory...
2022-08-17 11:25:16,485 - octoprint.plugins.firmwareupdater - INFO - Running '/usr/bin/avrdude-prusa -v -q -p m2560 -c arduino -P /dev/ttyACM0 -D -U flash:w:/tmp/tmp5ipknjf_:i -u' in /usr/bin
2022-08-17 11:25:19,076 - octoprint.plugins.firmwareupdater - INFO - Writing memory...
2022-08-17 11:25:37,460 - octoprint.plugins.firmwareupdater - INFO - Verifying memory...
2022-08-17 11:25:52,713 - octoprint.plugins.firmwareupdater - INFO - Flashing successful.
2022-08-17 11:25:52,742 - octoprint.plugins.firmwareupdater - INFO - No postflash gcode or postflash is disabled, setting run_postflash_gcode to false

plugin log

2022-08-17 11:24:00,669 
2022-08-17 11:24:00,671 /usr/bin/avrdude-prusa -v -q -p m2560 -c wiring -P /dev/ttyACM0 -D -U flash:w:/tmp/tmpo35tb1v7:i
2022-08-17 11:24:02,280 > 
2022-08-17 11:24:02,281 > avrdude-prusa: Version 6.3-20171130
2022-08-17 11:24:02,281 >                Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
2022-08-17 11:24:02,282 >                Copyright (c) 2007-2014 Joerg Wunsch
2022-08-17 11:24:02,283 > 
2022-08-17 11:24:02,283 >                System wide configuration file is "/etc/avrdude.conf"
2022-08-17 11:24:02,283 >                User configuration file is "/home/pi/.avrduderc"
2022-08-17 11:24:02,284 >                User configuration file does not exist or is not a regular file, skipping
2022-08-17 11:24:02,284 > 
2022-08-17 11:24:02,285 >                Using Port                    : /dev/ttyACM0
2022-08-17 11:24:02,286 >                Using Programmer              : wiring
2022-08-17 11:24:02,286 >                AVR Part                      : ATmega2560
2022-08-17 11:24:02,287 >                Chip Erase delay              : 9000 us
2022-08-17 11:24:02,287 >                PAGEL                         : PD7
2022-08-17 11:24:02,287 >                BS2                           : PA0
2022-08-17 11:24:02,288 >                RESET disposition             : dedicated
2022-08-17 11:24:02,288 >                RETRY pulse                   : SCK
2022-08-17 11:24:02,289 >                serial program mode           : yes
2022-08-17 11:24:02,289 >                parallel program mode         : yes
2022-08-17 11:24:02,289 >                Timeout                       : 200
2022-08-17 11:24:02,290 >                StabDelay                     : 100
2022-08-17 11:24:02,290 >                CmdexeDelay                   : 25
2022-08-17 11:24:02,291 >                SyncLoops                     : 32
2022-08-17 11:24:02,291 >                ByteDelay                     : 0
2022-08-17 11:24:02,291 >                PollIndex                     : 3
2022-08-17 11:24:02,292 >                PollValue                     : 0x53
2022-08-17 11:24:02,292 >                Memory Detail                 :
2022-08-17 11:24:02,293 > 
2022-08-17 11:24:02,293 >                                         Block Poll               Page                       Polled
2022-08-17 11:24:02,293 >                  Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
2022-08-17 11:24:02,294 >                  ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
2022-08-17 11:24:02,294 >                  eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
2022-08-17 11:24:02,295 >                  flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
2022-08-17 11:24:02,295 >                  lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
2022-08-17 11:24:02,296 >                  hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
2022-08-17 11:24:02,296 >                  efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
2022-08-17 11:24:02,296 >                  lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
2022-08-17 11:24:02,297 >                  calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
2022-08-17 11:24:02,297 >                  signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
2022-08-17 11:24:02,297 > 
2022-08-17 11:24:02,298 >                Programmer Type : Wiring
2022-08-17 11:24:02,298 >                Description     : Wiring
2022-08-17 11:24:02,299 >                Programmer Model: AVRISP
2022-08-17 11:24:02,299 >                Hardware Version: 15
2022-08-17 11:24:02,300 >                Firmware Version Master : 2.10
2022-08-17 11:24:02,300 >                Vtarget         : 0.0 V
2022-08-17 11:24:02,300 >                SCK period      : 0.1 us
2022-08-17 11:24:02,301 > 
2022-08-17 11:24:02,301 > avrdude-prusa: AVR device initialized and ready to accept instructions
2022-08-17 11:24:02,302 > avrdude-prusa: Device signature = 0x1e9801 (probably m2560)
2022-08-17 11:24:02,302 > avrdude-prusa: safemode: lfuse reads as FF
2022-08-17 11:24:02,302 > avrdude-prusa: safemode: hfuse reads as D0
2022-08-17 11:24:02,303 > avrdude-prusa: safemode: efuse reads as FD
2022-08-17 11:24:02,303 > avrdude-prusa: reading input file "/tmp/tmpo35tb1v7"
2022-08-17 11:24:02,304 > avrdude-prusa: writing flash (243244 bytes):
2022-08-17 11:24:02,304 > 
2022-08-17 11:24:45,234 > avrdude-prusa: 243244 bytes of flash written
2022-08-17 11:24:45,236 > avrdude-prusa: verifying flash memory against /tmp/tmpo35tb1v7:
2022-08-17 11:24:45,237 > avrdude-prusa: load data flash data from input file /tmp/tmpo35tb1v7:
2022-08-17 11:24:45,239 > avrdude-prusa: input file /tmp/tmpo35tb1v7 contains 243244 bytes
2022-08-17 11:24:45,240 > avrdude-prusa: reading on-chip flash data:
2022-08-17 11:24:45,241 > 
2022-08-17 11:25:16,471 > avrdude-prusa: verifying ...
2022-08-17 11:25:16,473 > avrdude-prusa: 243244 bytes of flash verified
2022-08-17 11:25:16,474 > 
2022-08-17 11:25:16,475 > avrdude-prusa: safemode: lfuse reads as FF
2022-08-17 11:25:16,476 > avrdude-prusa: safemode: hfuse reads as D0
2022-08-17 11:25:16,477 > avrdude-prusa: safemode: efuse reads as FD
2022-08-17 11:25:16,478 > avrdude-prusa: safemode: Fuses OK (E:FD, H:D0, L:FF)
2022-08-17 11:25:16,479 > 
2022-08-17 11:25:16,480 > avrdude-prusa done.  Thank you.
2022-08-17 11:25:16,481 > 
2022-08-17 11:25:16,482 > 
2022-08-17 11:25:16,486 
2022-08-17 11:25:16,492 /usr/bin/avrdude-prusa -v -q -p m2560 -c arduino -P /dev/ttyACM0 -D -U flash:w:/tmp/tmp5ipknjf_:i -u
2022-08-17 11:25:17,147 > 
2022-08-17 11:25:17,149 > avrdude-prusa: Version 6.3-20171130
2022-08-17 11:25:17,149 >                Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
2022-08-17 11:25:17,150 >                Copyright (c) 2007-2014 Joerg Wunsch
2022-08-17 11:25:17,151 > 
2022-08-17 11:25:17,151 >                System wide configuration file is "/etc/avrdude.conf"
2022-08-17 11:25:17,152 >                User configuration file is "/home/pi/.avrduderc"
2022-08-17 11:25:17,153 >                User configuration file does not exist or is not a regular file, skipping
2022-08-17 11:25:17,153 > 
2022-08-17 11:25:17,154 >                Using Port                    : /dev/ttyACM0
2022-08-17 11:25:17,155 >                Using Programmer              : arduino
2022-08-17 11:25:17,155 > 
2022-08-17 11:25:19,053 >                AVR Part                      : ATmega2560
2022-08-17 11:25:19,054 >                Chip Erase delay              : 9000 us
2022-08-17 11:25:19,055 >                PAGEL                         : PD7
2022-08-17 11:25:19,055 >                BS2                           : PA0
2022-08-17 11:25:19,056 >                RESET disposition             : dedicated
2022-08-17 11:25:19,057 >                RETRY pulse                   : SCK
2022-08-17 11:25:19,057 >                serial program mode           : yes
2022-08-17 11:25:19,058 >                parallel program mode         : yes
2022-08-17 11:25:19,058 >                Timeout                       : 200
2022-08-17 11:25:19,059 >                StabDelay                     : 100
2022-08-17 11:25:19,060 >                CmdexeDelay                   : 25
2022-08-17 11:25:19,060 >                SyncLoops                     : 32
2022-08-17 11:25:19,061 >                ByteDelay                     : 0
2022-08-17 11:25:19,061 >                PollIndex                     : 3
2022-08-17 11:25:19,062 >                PollValue                     : 0x53
2022-08-17 11:25:19,062 >                Memory Detail                 :
2022-08-17 11:25:19,063 > 
2022-08-17 11:25:19,063 >                                         Block Poll               Page                       Polled
2022-08-17 11:25:19,064 >                  Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
2022-08-17 11:25:19,064 >                  ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
2022-08-17 11:25:19,065 >                  eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
2022-08-17 11:25:19,065 >                  flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
2022-08-17 11:25:19,066 >                  lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
2022-08-17 11:25:19,066 >                  hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
2022-08-17 11:25:19,067 >                  efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
2022-08-17 11:25:19,067 >                  lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
2022-08-17 11:25:19,068 >                  calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
2022-08-17 11:25:19,068 >                  signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
2022-08-17 11:25:19,069 > 
2022-08-17 11:25:19,069 >                Programmer Type : Arduino
2022-08-17 11:25:19,070 >                Description     : Arduino
2022-08-17 11:25:19,070 >                Hardware Version: 3
2022-08-17 11:25:19,071 >                Firmware Version: 6.2
2022-08-17 11:25:19,071 >                Vtarget         : 0.3 V
2022-08-17 11:25:19,072 >                Varef           : 0.3 V
2022-08-17 11:25:19,072 >                Oscillator      : 28.800 kHz
2022-08-17 11:25:19,072 >                SCK period      : 3.3 us
2022-08-17 11:25:19,073 > 
2022-08-17 11:25:19,073 > avrdude-prusa: AVR device initialized and ready to accept instructions
2022-08-17 11:25:19,074 > avrdude-prusa: Device signature = 0x1e9801 (probably m2560)
2022-08-17 11:25:19,074 > avrdude-prusa: reading input file "/tmp/tmp5ipknjf_"
2022-08-17 11:25:19,075 > avrdude-prusa: writing flash (127764 bytes):
2022-08-17 11:25:19,075 > 
2022-08-17 11:25:37,452 > avrdude-prusa: 127764 bytes of flash written
2022-08-17 11:25:37,453 > avrdude-prusa: verifying flash memory against /tmp/tmp5ipknjf_:
2022-08-17 11:25:37,455 > avrdude-prusa: load data flash data from input file /tmp/tmp5ipknjf_:
2022-08-17 11:25:37,456 > avrdude-prusa: input file /tmp/tmp5ipknjf_ contains 127764 bytes
2022-08-17 11:25:37,458 > avrdude-prusa: reading on-chip flash data:
2022-08-17 11:25:37,459 > 
2022-08-17 11:25:52,679 > avrdude-prusa: verifying ...
2022-08-17 11:25:52,681 > avrdude-prusa: 127764 bytes of flash verified
2022-08-17 11:25:52,682 > 
2022-08-17 11:25:52,683 > avrdude-prusa done.  Thank you.
2022-08-17 11:25:52,684 > 
2022-08-17 11:25:52,685 > 
2022-08-17 11:25:52,714 Flashing successful.

Adds support for flashing not only firmware but also firmware language
pack on Prusa MK3 (and newer variants) printer.
@benlye
Copy link
Collaborator

benlye commented Nov 11, 2022

@arekm can you change the target of the PR to the devel branch? Can you also include documentation updates to explain what is needed to use this (the special version of avrdude)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants