How to edit MK3S firmware to accept higher Z axis
Hi,
Yep, me again. I have a (recently) MK3S MMU2, but the Z axis height on my printer is 350mm, not 220mm. For the old MK3 firmware, I edited the code to enable the printer to recognise the new height. I have tried to do that same for the most recent MK3S firmware source code from Github ( https://github.com/prusa3d/Prusa-Firmware/releases/tag/v3.7.0 ) but something has changed in the firmware and the process I used on the MK3 doesn't work on the MK3S.
Specifically, does anyone know why the printer LCD shows the Z axis height as "?" when the code has been altered, and how to make it register as "0.00" like normal?
I had this exact problem with the MK3, and this is how fixed it then:
In Arduino, I have added the 'Configuration_prusa' tab and edited the Z axis height, then in ultralcd.cpp edited the 'break' height.
Only this process no longer works.
Please, does anyone have any suggestions?
Fair farren
Re: How to edit MK3S firmware to accept higher Z axis
Point 1.c here: https://github.com/prusa3d/Prusa-Firmware/tree/v3.7.0
This enables fprintf.
Peter
Please note: I do not have any affiliation with Prusa Research. Any advices given are offered in good faith. It is your responsibility to ensure that by following my advice you do not suffer or cause injury, damage…
Re: How to edit MK3S firmware to accept higher Z axis
Yeah, the bit about -
c. modify platform.txt to enable float printf support:
add "-Wl,-u,vfprintf -lprintf_flt -lm" to "compiler.c.elf.flags=" before existing flag "-Wl,--gc-sections"
example:
"compiler.c.elf.flags=-w -Os -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections"
I've done that.
Fair farren
Re: How to edit MK3S firmware to accept higher Z axis
I've done that.
There are several platform.txt files lurking on your PC. Make sure you edited the right one (or all of them 😉 )
It didn't work for me to start with. But after a few uninstall/installs of the Arduino program and a clean-up of the folders it uses, it started to work. Problem is that I don't know what it was exactly that fixed the problem 🙁
Peter
Please note: I do not have any affiliation with Prusa Research. Any advices given are offered in good faith. It is your responsibility to ensure that by following my advice you do not suffer or cause injury, damage…
Re: How to edit MK3S firmware to accept higher Z axis
There is only one file of three that has complier.c.elf.flags, and that is this one: E:\arduino-1.8.5\hardware\arduino\avr and it has other stuff in the line already: "compiler.c.elf.flags={compiler.warning_flags} -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections"
Where I supposed to insert the print support code, "-Wl,-u,vfprintf -lprintf_flt -lm", without stuffing something up?
I've tried all different variations of this code I think of, and it never makes any difference. Also, the setup in the ultralcd.cpp is different to the MK3, from line 6896 it is now
" switch (axis) {
case 0: axis_length = X_MAX_POS; break;
case 1: axis_length = Y_MAX_POS + 8; break;
default: axis_length = 350; break;
}
"
But I still have Z axis height as ?
Help! I'm going mad!!!
Fair farren
Re: How to edit MK3S firmware to accept higher Z axis
I've found out WHY it doesn't work!
Arduino 1.6.9, what Prusa USED TO USE for the MK3 firmware, has a line of text in the platform.txt file: "compiler.c.elf.flags={compiler.warning_flags} -Wl,--gc-sections", in which can be inserted "-Wl,-u,vfprintf -lprintf_flt -lm" to enable print float support.
Arduino 1.8.5, which to now recommended for MK3S firmware DOES NOT HAVE THIS SAME CODE in the platform.txt file. Instead, it has "compiler.c.elf.flags={compiler.warning_flags} -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections"
MK3S firmware cannot be compiled in Arduino 1.6.9, and Arduino 1.8.5 cannot be edited to enable print float support as instructed.
What do I do now?
Fair farren
Re: How to edit MK3S firmware to accept higher Z axis
I've found out WHY it doesn't work!
Humph. Just checked and yup, I did end up reverting to 1.6.9. And 3.6.0 (Mk3S variant) compiles fine with that for me. I will download and try the latest from Github later today. But firmware 3.7 doesn't work on my printer (filaments will not load).
Peter
Please note: I do not have any affiliation with Prusa Research. Any advices given are offered in good faith. It is your responsibility to ensure that by following my advice you do not suffer or cause injury, damage…
Re: How to edit MK3S firmware to accept higher Z axis
Okay...
Where did you get the working 3.6.0 firmware from?
I found this page in Arduino's forums, http://forum.arduino.cc/index.php?PHPSESSID=d2al6jqqi15fr5tamst1rivea6&topic=311154.0
but it doesn't get rid of the '?' unfortunately.
Fair farren
Re: How to edit MK3S firmware to accept higher Z axis
Firmware 3.0.0 final is here: https://github.com/prusa3d/Prusa-Firmware/tree/v3.6.0
And I have attached my platform.txt file for 1.6.9 which is located here: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Peter
Please note: I do not have any affiliation with Prusa Research. Any advices given are offered in good faith. It is your responsibility to ensure that by following my advice you do not suffer or cause injury, damage…
Re: How to edit MK3S firmware to accept higher Z axis
Using Arduino 1.6.9 with the recommended 3.6.0 firmware and supplied platform.txt throws up a host of errors, all to do with the uart2 tab.
Using Arduino 1.8.5 with the recommended 3.6.0 firmware makes printer LCD display in weird garbled code.
Fair farren
Re: How to edit MK3S firmware to accept higher Z axis
Apologies, it was 3.6.0-RC1 that I was compiling without issue.
I don't think the Final would be much different, but I can download and try if you wish.
Peter
Please note: I do not have any affiliation with Prusa Research. Any advices given are offered in good faith. It is your responsibility to ensure that by following my advice you do not suffer or cause injury, damage…
Re: How to edit MK3S firmware to accept higher Z axis
Hi Peter,
Thanks, I just need 3.6.0 to compile and flash to the printer without leaving a question mark in place of the Z height. In Arduino 1.8.5, firmware 3.6.0 compiles just fine. It's when I flash the printer that I get a ? instead of 0.00
Fair farren
Re: How to edit MK3S firmware to accept higher Z axis
Hi Peter,
Thanks, I just need 3.6.0 to compile and flash to the printer without leaving a question mark in place of the Z height. In Arduino 1.8.5, firmware 3.6.0 compiles just fine. It's when I flash the printer that I get a ? instead of 0.00
Yes, I am aware of that and it's the vfprintf that's required in the platform.txt. It now works for me; I did get the "?" but that is long gone since I sorted that file and used 1.69 to compile. I never got a good compile with 1.8.5.
Peter
Please note: I do not have any affiliation with Prusa Research. Any advices given are offered in good faith. It is your responsibility to ensure that by following my advice you do not suffer or cause injury, damage…
Re: How to edit MK3S firmware to accept higher Z axis
Hi Peter,
I tried using 3.6.0 RC1 compiled in 1.6.9 as suggested. I know m version of 1.6.9 normally works, because I compile firmware for my other Prusa printer using it without hassle.
But using 3.6.0 RC1 gives the following errors (I don't even change anything in uart2!):
Arduino: 1.6.9 (Windows 7), Board: "RAMBo"
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp: In function 'void uart2_init()':
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:16:9: error: 'cli' was not declared in this scope
cli();
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:17:5: error: 'UCSR2A' was not declared in this scope
UCSR2A = (0 << U2X2); // baudrate multiplier
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:17:20: error: 'U2X2' was not declared in this scope
UCSR2A = (0 << U2X2); // baudrate multiplier
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:18:5: error: 'UCSR2B' was not declared in this scope
UCSR2B = (1 << RXEN2) | (1 << TXEN2) | (0 << UCSZ22); // enable receiver and transmitter
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:18:20: error: 'RXEN2' was not declared in this scope
UCSR2B = (1 << RXEN2) | (1 << TXEN2) | (0 << UCSZ22); // enable receiver and transmitter
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:18:35: error: 'TXEN2' was not declared in this scope
UCSR2B = (1 << RXEN2) | (1 << TXEN2) | (0 << UCSZ22); // enable receiver and transmitter
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:18:50: error: 'UCSZ22' was not declared in this scope
UCSR2B = (1 << RXEN2) | (1 << TXEN2) | (0 << UCSZ22); // enable receiver and transmitter
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:19:5: error: 'UCSR2C' was not declared in this scope
UCSR2C = (0 << UMSEL21) | (0 << UMSEL20) | (0 << UPM21) |
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:19:20: error: 'UMSEL21' was not declared in this scope
UCSR2C = (0 << UMSEL21) | (0 << UMSEL20) | (0 << UPM21) |
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:19:37: error: 'UMSEL20' was not declared in this scope
UCSR2C = (0 << UMSEL21) | (0 << UMSEL20) | (0 << UPM21) |
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:19:54: error: 'UPM21' was not declared in this scope
UCSR2C = (0 << UMSEL21) | (0 << UMSEL20) | (0 << UPM21) |
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:20:20: error: 'UPM20' was not declared in this scope
(0 << UPM20) | (1 << USBS2) |(1 << UCSZ21) | (1 << UCSZ20); // Use 8-bit character sizes
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:20:35: error: 'USBS2' was not declared in this scope
(0 << UPM20) | (1 << USBS2) |(1 << UCSZ21) | (1 << UCSZ20); // Use 8-bit character sizes
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:20:49: error: 'UCSZ21' was not declared in this scope
(0 << UPM20) | (1 << USBS2) |(1 << UCSZ21) | (1 << UCSZ20); // Use 8-bit character sizes
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:20:65: error: 'UCSZ20' was not declared in this scope
(0 << UPM20) | (1 << USBS2) |(1 << UCSZ21) | (1 << UCSZ20); // Use 8-bit character sizes
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:22:5: error: 'UBRR2H' was not declared in this scope
UBRR2H = (BAUD_PRESCALE >> 8); // Load upper 8-bits of the baud rate value into the high byte of the UBRR register
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:22:15: error: 'BAUD_PRESCALE' was not declared in this scope
UBRR2H = (BAUD_PRESCALE >> 8); // Load upper 8-bits of the baud rate value into the high byte of the UBRR register
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:23:5: error: 'UBRR2L' was not declared in this scope
UBRR2L = BAUD_PRESCALE; // Load lower 8-bits of the baud rate value into the low byte of the UBRR register
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:25:21: error: 'RXCIE2' was not declared in this scope
UCSR2B |= (1 << RXCIE2); // enable rx interrupt
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:26:9: error: 'sei' was not declared in this scope
sei();
^
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp: At global scope:
E:\arduino-1.6.9-windows\arduino-1.6.9\portable\output\sketch\uart2.cpp:29:4: error: expected constructor, destructor, or type conversion before '(' token
ISR(USART2_RX_vect)
^
exit status 1
Error compiling for board RAMBo.
I don't understand any of that, sorry.
And I'm curious (really am, this is not sarcasm or vindictiveness) how Prusa made the firmware in 1.8.5 in the first place, if 1.8.5 doesn't support fprintf in the first place. How does that work? Also, print float support seems to mean lots of different things, depending on the use to which it is put. What does it actually mean to a Prusa printer to have print float support?
And also, thank you for your assistance in this matter. I do appreciate the time you have put into this thread.
Fair farren
Re: How to edit MK3S firmware to accept higher Z axis
Kryss
Really sorry, but that is well beyond me, sorry. Maybe Waldemar could get you going. Will try to contact him.
Peter
Please note: I do not have any affiliation with Prusa Research. Any advices given are offered in good faith. It is your responsibility to ensure that by following my advice you do not suffer or cause injury, damage…
Re: How to edit MK3S firmware to accept higher Z axis
Did you read the https://github.com/prusa3d/Prusa-Firmware#using-linux-subsystem-under-windows-10-64-bit and https://github.com/prusa3d/Prusa-Firmware#using-git-bash-under-windows-10-64-bit part? The PF-build.sh script will download a known build environment and compile the firmware.
Re: How to edit MK3S firmware to accept higher Z axis
I use the pf-build.sh script to compile Zaribo firmware and these are 220/320/420 high. Checkout https://github.com/Zaribo/Zaribo-Firmware and compare it to Prusa you will find few important changes next to the re branding of the name.
Re: How to edit MK3S firmware to accept higher Z axis
Why does the Zaribo firmware also recommend using Arduino 1.8.5, in fact it uses the exact same instructions regarding the program as Prusa, including editing a line of text that doesn't exist? And how come the instructions say 'using Linux subsystem for Window 10' and the actual linked webpage says 'using Windows 10 subsystem under Linux'?
I'm sorry waldemar.g, that's why I haven't gone with your suggestion before because I'm reluctant to start stuffing around with my computer's operating system.
Does Zaribo account for the new IR sensor? That's the only reason I'm trying to make Prusa's firmware work, because the IR sensor is so new that the other build I use doesn't support it yet.
Fair farren
Re: How to edit MK3S firmware to accept higher Z axis
Why does the Zaribo firmware also recommend using Arduino 1.8.5, in fact it uses the exact same instructions regarding the program as Prusa, including editing a line of text that doesn't exist?
The 1st part of the readme is from Prusa and as Zaribo is a fork it has nearly the same code as the root.
Prusa changed few months ago from Arduino 1.6.9 to 1.8.5 for compiling the MK3 branch.
And how come the instructions say 'using Linux subsystem for Window 10' and the actual linked webpage says 'using Windows 10 subsystem under Linux'?
Sorry for the two different senses, but the "Using Linux subsystem under Windows 10 64 bit" is a guide how to prepare your Windows 10 computer to be able to run the "PF-build.sh" script and compile the firmware from the source code.
It contains
- How-to install Linux subsystem on Windows using the "Windows Subsystem for Linux Installation Guide for Windows 10" guide
- How-to update your subsystem
- How-to add needed functions/programs "zip" by the PF-build.sh script
- How-to modify the linux environment to get rid off "warnings"
- Some Tips for Linux
- How-to finally use "PF-build.sh" to compile your source code
On the other hand "Windows Subsystem for Linux Installation Guide for Windows 10" is just a guide from Microsoft how to install it on Windows.
I'm sorry waldemar.g, that's why I haven't gone with your suggestion before because I'm reluctant to start stuffing around with my computer's operating system.
No problem ...
I wrote the "PF-build.sh" as I saw many people struggling to get a proper "Prusa Firmware build environment", as the readme wasn't clear, and other circumstances could make it difficult. After days of testing I made a Pull Request to the Prusa github and they approved it.
And i build the Windows PF-build-env for users don't want to use the linux subsystem but like more git-bash for windows.
https://github.com/3d-gussner/PF-build-env/releases
You can read Prusa's comments in the Pull Request https://github.com/prusa3d/Prusa-Firmware/pull/1543
Does Zaribo account for the new IR sensor? That's the only reason I'm trying to make Prusa's firmware work, because the IR sensor is so new that the other build I use doesn't support it yet.
As said before Zaribo firmware is based on the Prusa frimware and all changes made by Prusa are implemented to the Zaribo fork. That means the IR sensor code is as well in the Zaribo firmware.
The main difference between these two is that Zaribo has 220/320 and 420 high printers.
It also got some in our opinion critical bug fixes Prusa didn't pulled yet like https://github.com/prusa3d/Prusa-Firmware/pull/1263 .
And other things. You can see them in the comparison i posted earlier.
Re: How to edit MK3S firmware to accept higher Z axis
I found a solution, you can read all about it here:
https://github.com/prusa3d/Prusa-Firmware/issues/1714#issuecomment-485056027
Fair farren