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

Flash Prusa MK3S firmware with custom method #309

Open
Vortex-TH opened this issue Apr 18, 2022 · 3 comments
Open

Flash Prusa MK3S firmware with custom method #309

Vortex-TH opened this issue Apr 18, 2022 · 3 comments

Comments

@Vortex-TH
Copy link

I also have the problem that other languages than English are not flashed to my Prusa MK3S #253

As mentioned in #139, a second flash command is necessary that could potentially be done through a 'custom' flash method.

Has this been implemented? I'm not sure where I should enter custom commands. What is the recommended way?

Not sure if I should append it somehow to this customize command line setting:
{avrdude} -v -q -p {mcu} -c {programmer} -P {port} -D -C {conffile} -b {baudrate} {disableverify} -U flash:w:{firmware}:i

It didn't work so far..

@benlye
Copy link
Collaborator

benlye commented Apr 19, 2022

I never got around to implementing the custom command method. I'll see what I can come up with - I'm thinking maybe just a checkbox for Prusa MK3S which would tell the plugin to run both commands.

@arekm
Copy link
Contributor

arekm commented Jul 27, 2022

Or autodetect, octoprint fires event when it finds firmware information early (in response to M115 command)

   eventManager().fire(
                        Events.FIRMWARE_DATA, {"name": firmware_name, "data": data}
                    )

and uses such condition for autodetection of prusa:

 elif "prusa-firmware" in firmware_name.lower():

For reference, commands used by current prusaslicer (on windows) when upgrading firmware:

avrdude-slic3r -v -p atmega2560 -c wiring -P COM5 -b 115200 -D \
   -U flash:w:0:C:\prusa3d_fw_MK3S_MK3S+_3_11_1-RC1_4987.hex:i

avrdude-slic3r -v -p atmega2560 -c arduino -P COM5 -b 115200 -D \
   -u -U flash:w:1:C:\prusa3d_fw_MK3S_MK3S+_3_11_1-RC1_4987.hex:i

Maybe even MK3 could detected based on 'MACHINE_TYPE:'

Send: M115
Recv: FIRMWARE_NAME:Prusa-Firmware 3.11.1-RC1 based on Marlin FIRMWARE_URL:https://github.com/prusa3d/Prusa-Firmware PROTOCOL_VERSION:1.0 MACHINE_TYPE:Prusa i3 MK3S EXTRUDER_COUNT:1 UUID:00000000-0000-0000-0000-000000000000

That 0 or 1 number in `-U flash:w:0:...``` is a section number in .hex file with prusa firmware. They have patched avrdude to accept such format.

Sections are separated by ':00000001FF'. These are basically two firmwares put into one hex file. One firmware is for internal Einsy flash (using wiring method) and second is for Einsy external flash (programmed using arduino method). That second part of file is only for MK3.

% strings Firmware-intl.hex |grep :00000001FF
:00000001FF
:00000001FF

so what we also need to do is to copy firmware contents between first and second marker into temporary file and just call

avrdude -v -p atmega2560 -c arduino -P COM5 -b 115200 -D -u -U flash:w:temp_file.hex:i'

Special avrdude is needed

@arekm
Copy link
Contributor

arekm commented Aug 17, 2022

Implemented as #325

Unfortunately stock avrdude is not being able to flash languages part of firmware. Modified variant is needed.

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

It uses special serial command to init external flash mode on MK3 hardware and also has workarounds
for broken Prusa USB to serial converters.

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

No branches or pull requests

3 participants