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

[BUG] Stuck at language selection when selecting German #3558

Closed
BeeCave opened this issue Aug 7, 2022 · 13 comments
Closed

[BUG] Stuck at language selection when selecting German #3558

BeeCave opened this issue Aug 7, 2022 · 13 comments
Labels

Comments

@BeeCave
Copy link

BeeCave commented Aug 7, 2022

Printer type - [MK3S+]
Printer firmware version - [3.11.0, 3.11.1-RC1]

USB/Octoprint

Since 3.11.0 and 3.11.1-RC1 stuck at language selection
Hi all,
since Firmware 3.11.0 and 3.11.1-RC1 i'm stuck in the language selection menu when choosing the german language (Deutsch). Selecting the English works. Selecting the German language in 3.10.1 works flawlessly.

I'm using https://plugins.octoprint.org/plugins/firmwareupdater/ to flash new firmware.

Regards
Markus

To Reproduce
Flash 3.11.0 or 3.11.1-RC1 and select "German - Deutsch"

Expected behavior
Selecting German language works and doesn't end in a loop.

@BeeCave BeeCave added the bug label Aug 7, 2022
@arekm
Copy link
Contributor

arekm commented Aug 7, 2022

How do you update with plugin? Two avrdude commands are needed to flash properly on prusa.

That plugin doesn't do that correctly:

OctoPrint/OctoPrint-FirmwareUpdater#309

@leptun
Copy link
Collaborator

leptun commented Aug 7, 2022

You must use PrusaSlicer to update the firmware if you are using languages. The problem with firmwareupdater is that it uses regular avrdude which doesn't upload also the language data. As a result, when you update to 3.11.1-RC1 with firmwareupdater, the language data is still from the old firmware, hence why it doesn't work there, but works once you revert back to 3.11.0

@BeeCave
Copy link
Author

BeeCave commented Aug 7, 2022

Thanks for the hint. I'm flashing with PrusaSLicer next time. Hopefully the plugin will get an update in the future.

@3d-gussner
Copy link
Collaborator

@BeeCave Please consider to close this issue.

@3d-gussner
Copy link
Collaborator

@BeeCave Can you confirm that the flashing with Prusa Slicer solved the issue? If so please close this issue.

@BeeCave
Copy link
Author

BeeCave commented Aug 13, 2022

@3d-gussner Yes, flashing with Prusa Slicer solved the issue.

@BeeCave BeeCave closed this as completed Aug 13, 2022
@arekm
Copy link
Contributor

arekm commented Aug 17, 2022

@leptun Are broken USB to serial converters still used in MK3S+? Tried to use avrdude without workaround for ';' character on my 2 months old mk3s+ and it failed, so looks like it.

Anyway for brave people:
OctoPrint/OctoPrint-FirmwareUpdater#325

@leptun
Copy link
Collaborator

leptun commented Aug 17, 2022

@arekm it is not “broken”. In the prusa 32u2 usb to serial firmware, “;” is used as an escape character for commands addressed to the 32u2 chip. This has been the standard since the MK2 and it hasn’t changed since the release of the MK3 (except some minor command expansion recently). So the “;” workaround is still needed.

What were the arguments that you provided avrdude and what avrdude version did you use?

@arekm
Copy link
Contributor

arekm commented Aug 17, 2022

Comment in code says "infamous ';' bug" so thought it is bug.

My goal was to get stock 'avrdude' working somehow. By intializing mk3 hardware for external flashing (via char entry_magic_receive[] = "w25x20cl_enter\n") first and then calling stock avrdude.

That unfortunately won't work if ";" workaround is needed as stock avrdude doesn't have it.

(stock)avrdude -v -q -p m2560 -c arduino -P /dev/ttyACM0 -D -U flash:w:/tmp/tmp5ipknjf_:i -u

(/tmp/tmp5ipknjf_ contains only second section of firmware, that with languages)

@leptun
Copy link
Collaborator

leptun commented Aug 17, 2022

Try using “wiring” as the programmer type in avrdude (-c wiring). This is what I’m using with stock avrdude and I’ve had no upload issues (somehow)

@arekm
Copy link
Contributor

arekm commented Aug 17, 2022

"-c wiring" for base firmware works well on stock avrdude for me, too but not for languages.

Just tested -c wiring for languages part. So using -c wiring with languages part of hex only (== second firmware section after first :00000001FF marker in hex file).

Patched avrdude to issue w25x20cl_enter command.

72449 read(3, "start\n", 6)             = 6
72449 write(3, "w25x20cl_enter\n", 15)  = 15
72449 pselect6(4, [3], NULL, NULL, {tv_sec=5, tv_nsec=0}, NULL) = 1 (in [3], left {tv_sec=4, tv_nsec=994508772})
72449 read(3, "w25x20cl_cfm\n", 13)     = 13

so printer goes into proper mode

 ~/test/avrdude-6.3-20171130/avrdude -v -p m2560 -c wiring -P /dev/ttyACM0 -b 115200 -D -u -U flash:w:/home/pi/prusa-test.fw:i

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/pi/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

avrdude done.  Thank you.
[...]

but "wiring" mode doesn't work for external flash / languages.

(btw. PrusaSlicer uses "-c arduino" for languages)

I guess there is no way to use stock avrdude for flashing languages.

btw.
Which part of firmware actually handles "w25x20cl_enter" command? Can't find it in prusa-firmware and also in published
on github mk3-32u2-firmware. Some closed bootloader variant in prusas?

@leptun
Copy link
Collaborator

leptun commented Aug 18, 2022

so printer goes into proper mode

It may be in the correct mode, but it most likely will not be after avrdude is called. The problem is that when avrdude is called, the serial port is opened again and that triggers a reset of the printer, rendering your previous w25x20cl_enter attempts useless.

but "wiring" mode doesn't work for external flash / languages.
(btw. PrusaSlicer uses "-c arduino" for languages)

Yeah, I think that's correct. The "arduino" protocol is simpler, so that one was used instead to save on flash.

I guess there is no way to use stock avrdude for flashing languages.

It might be possible to use it, but it probably won't be easy. Just for reference, this is the code in prusaslicer that does this (in the patched avrdude): https://github.com/prusa3d/PrusaSlicer/blob/991f2bdbd18cbc18912147d7886bb1e1e3412742/src/avrdude/arduino.c#L84

Which part of firmware actually handles "w25x20cl_enter" command? Can't find it in prusa-firmware and also in published
on github mk3-32u2-firmware. Some closed bootloader variant in prusas?

For the Prusa-Firmware, it is https://github.com/prusa3d/Prusa-Firmware/blob/MK3/Firmware/optiboot_xflash.cpp. The slicer part was linked above.
The 32u2 that is on github is outdated. There is another repo, but it is not public yet for some reason. The 32u2 firmware has nothing to do with language flashing so you can just ignore it. The 2560 bootloader IS special, but not for flashing (it's only responsible for the language select, and that part is public)

@arekm
Copy link
Contributor

arekm commented Aug 18, 2022

The problem is that when avrdude is called, the serial port is opened again and that triggers a reset of the printer, rendering your previous w25x20cl_enter attempts useless.

In my testing serial was opened only once (by avrdude) because I used

Just for reference, this is the code in prusaslicer that does this (in the patched avrdude): https://github.com/prusa3d/PrusaSlicer/blob/991f2bdbd18cbc18912147d7886bb1e1e3412742/src/avrdude/arduino.c#L84

exactly this approach - patched wiring code for avrdude to do external flash init. To see if wiring would work. But it didn't (log pasted earlier).

Well, we will need to live with a patched avrdude ;(

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

No branches or pull requests

4 participants