Welcome! Log In Create A New Profile

Advanced

Updated Marlin customized for Mendel90

Posted by neildarlow 
Updated Marlin customized for Mendel90
March 07, 2014 06:55AM
Hi,

I have recently been doing some work on updating Marlin for the Mendel90 and have published the results at this GitHub repository. The branch to use is Marlin_v1_Mendel90 which is the default.
This repository is the culmination of two projects with specific goals:

1) A Marlin firmware with support for newer features than provided by nophead's RC version.
This firmware now provides opportunities for users to explore features like Heated Bed PID Temperature Control and Automatic Heated Bed Levelling which the original firmware does not support.

This project involved determining the changes nophead made to Marlin for distribution with the Mendel90 Dibond kit. I took the source before and after nophead's changes and isolated each change. These changes were then merged into the latest Marlin source (many had already been taken into account but in a different form and these had to be individually verified for correctness).
The Home Position definitions had changed substantially and, in order to avoid potential confusion, I have created a new definition, Z_HEIGHT_MM, to set the Z Height calibration value. This setting resides at the top of Configuration.h along with E_STEPS_PER_MM.


2) Simpler integration of the Panelolu2 LCD controller.

There have been a number of implementations for using the Panelolu2 on the Mendel90 documented on this forum with differing degrees of difficulty to implement. This project provided the changes necessary to provide Marlin with out-of-the-box support for the Panelolu2.

The issues addressed by this project are:
a) Elimination of firmware hangs when Panelolu2 support is compiled into Marlin but a Panelolu2 is not connected. This required some changes to both Marlin and the LiquidTWI2 library which have been pushed upstream.
b) Resolution of a missing analogInputToDigitalPin definition which caused compilation failures for some users. This required changes to the Melzi folder structure which I based in the latest Sanguino project source release.
c) Accommodation of the bipolar X and Y coordinate system used by the Mendel90 Dibond kit firmware. This involves use of ftostr31 to display X and Y with sign and 0.1mm resolution.
d) A cosmetic fix where the LCD status line retains previous content when newer content is shorter. Status line updates are now padded with spaces to ensure all messages are displayed clearly.


The consequences of these changes, which users should be aware of before using it, are:

1) Arduino >= 1.0.1 is required to build this firmware.
2) Enabling Panelolu2 support increases the resulting binary size considerably and, as a result, an ATmega644p-based Melzi cannot be supported.
3) Adopting a signed display of X and Y with 0.1mm resolution dictates that the X, Y and Z labels are removed from the coordinate display line. It now appears as follows:
Sxxx.x Syyy.y zzz.zz
where S represents a +/- character. This uses the full 20-character line width but, I think, the display fits well with the existing layout.
The signed X, Y coordinate display is controlled by the BED_CENTER_AT_0_0 definition. The existing display format can be retained by not enabling this definition.
4) Users may choose whether to use a bipolar X, Y coordinate system or unipolar. This is controlled by the BED_CENTER_AT_0_0 define.
5) Users may choose whether to explicitly set the X, Y and Z home positions or have them calculated from the X, Y and Z MAX_LENGTH definitions. This is controlled by the MANUAL_HOME_POSITIONS and MANUAL_{X,Y,Z}_HOME_POS definitions. To maintain consistency between manually set Home positions and calculated ones, this firmware sets the post-homing positions to -100, -100 and 200 for X, Y and Z respectively.

The default settings are BED_CENTER_AT_0_0 defined and MANUAL_HOME_POSITIONS undefined. EEPROM settings saving and Panelolu2 are enabled.


To download and build this firmware the following procedure should be used:
1) Download the Marlin_v1_Mendel90 branch as a ZIP file from here.
2) Unzip the downloaded Marlin-Marlin_v1_Mendel90.zip file to a convenient location (I suggest you extract it to your Downloads folder).
3) Copy the Marlin-Marlin_v1_Mendel90/Marlin folder to your Documents/Arduino folder (Windows) or sketchbook folder (Linux).
4) Copy the Marlin-Marlin_v1_Mendel90/ArduinoAddons/Ardiuno_1.x.x/hardware/Melzi folder to your Documents/Arduino/hardware folder (Windows) or sketchbook/hardware folder (Linux).
5) Copy the Marlin-Marlin_v1_Mendel90/ArduinoAddons/Arduino_1.x.x/libraries/LiquidTWI2 folder to your Documents/Arduino/libraries folder (Windows) or sketchbook/libraries folder (Linux).
6) Start Arduino and select File|Sketchbook|Marlin to load the Marlin firmware project.
7) Select the Tools|Board|Melzi W/ ATmega1284p 16MHz device item.
8) Choose your USB port from Tools|Serial Port.
9) Switch to the Configuration.h file tab and modify the Z_HEIGHT_MM and E_STEPS_PER_MM settings to your calibration values and save the file.
10) Ensure the USB Reset jumper is connected on the Mendel90 and power the Mendel90 on.
11) Click the Upload icon to compile and upload Marlin to the Mendel90. Depending on how long the Mendel90 has been powered-on this may fail. Repeat the upload and it should be successful.
12) Your printer is now ready.

If you experience any problems in building, or using, this firmware I will be happy to help. Linux users should note that it is possible to build a non-functional Marlin by using a distribution packaging of Arduino and the AVR-GCC tools. It appears that newer AVR-GCC versions are incompatible with either Arduino or Marlin. I always use the official Arduino tarball package for Linux to build my Marlin firmware (although another project I have planned is to investigate why these failures occur).

I would like to thank Tony Lock (T3P3) for testing my Panelolu2 changes on RAMPS and Sanguinololu hardware. I tested myself with nophead's Melzi hardware.

Regards,
Neil Darlow

Edited 2 time(s). Last edit at 03/07/2014 06:58AM by neildarlow.


I try to write with consideration for all nationalities. Please let me know if something is unclear.
Printing with Mendel90 from fedora 25 using Cura, FreeCAD, MeshLab, OpenSCAD, Skeinforge and Slic3r tools.
Re: Updated Marlin customized for Mendel90
March 07, 2014 07:53AM
Great initiative, i'll try this out later today. As far as i can see its pretty similar to my own brew of updated Marlin & Nop's changes, so it should be an easy transistion
Re: Updated Marlin customized for Mendel90
March 07, 2014 10:15AM
Great work Neil! I've been meaning to do this on my own fork since last year but things have gotten in the way. Your branch appears to have incorporated most of my changes so I guess now I can shelve that for good and just take yours! grinning smiley

I have a few extra options in my Panelolu menu too that make things like filament changes much quicker. Happy to share if anybody is interested.
Re: Updated Marlin customized for Mendel90
March 07, 2014 02:23PM
Quote
neildarlow
3) Adopting a signed display of X and Y with 0.1mm resolution dictates that the X, Y and Z labels are removed from the coordinate display line. It now appears as follows:
Sxxx.x Syyy.y zzz.zz
where S represents a +/- character. This uses the full 20-character line width but, I think, the display fits well with the existing layout.
The signed X, Y coordinate display is controlled by the BED_CENTER_AT_0_0 definition. The existing display format can be retained by not enabling this definition.
Just tossing out an idea.... If you are using the standard 200x200mm bed you should be able to include the labels. The only time where 3 digits left of the decimal would be needed for the X and Y axis would be at the extents, which wouldn't have a decimal as 100 is the soft limit. When you'd need a decimal place, you'd be bewteen -99.9 and 99.9 You'd need to remove at least once space, or drop the 2nd decimal digit for the z-axis.

12345678901234567890
SXXX.X SYYY.Y ZZZ.ZZ
X-100 Y-100  Z123.45
X-99.9Y-99.9 Z123.45

I'm anxious to give this firmware a try. Seeing what it would take to implement the auto z-leveling has been on my too do list but now I can scratch that off and add giving this a try.
Re: Updated Marlin customized for Mendel90
March 07, 2014 02:33PM
@cdru: That certainly is an option but I would have to consider the availability of larger Heated Beds in case anyone wanted to use this firmware with a larger build area. I am trying to keep things generic.

Regards,
Neil Darlow


I try to write with consideration for all nationalities. Please let me know if something is unclear.
Printing with Mendel90 from fedora 25 using Cura, FreeCAD, MeshLab, OpenSCAD, Skeinforge and Slic3r tools.
Re: Updated Marlin customized for Mendel90
March 07, 2014 04:04PM
Just finished my first print with this firmware, works like expected. All i changed was the Z_HEIGHT_MM.
I like the changes to the LCD info,
Re: Updated Marlin customized for Mendel90
March 07, 2014 05:56PM
Thanks for sharing! I save a lot of work, but the encoder from panelolu2 isnĀ“t run out-of-the-box, because the adapter board for melzi need two solder jumpers smiling bouncing smiley

For all other dau (incl. myself): [blog.think3dprint3d.com] ... add solder jumpers for "encoder directly connected"-mode.
Re: Updated Marlin customized for Mendel90
March 07, 2014 09:23PM
K, new question smiling smiley

Is there a way to download (save) the firmware currently installed on the arduino?
I'd like to give this a go, but I'd like to save my current firmware 'just in case' I'd like to revert back.

Thanks!

(After a new computer build, I lost my old firmware file)


--------------------------------------------------------
Custom all metal CoreXY
- Duet 2 Wifi w/ PanelDue 7i
- 330mm x 360mm x 500mm
- 750w Silicon heater

Custom Mendel90
(Backup printer - Old reliable!) - Sold
Re: Updated Marlin customized for Mendel90
March 07, 2014 09:44PM
Quote
Mogal
Is there a way to download (save) the firmware currently installed on the arduino?
I'd like to give this a go, but I'd like to save my current firmware 'just in case' I'd like to revert back.

Not really. If you have a proper AVR programmer, it may be possible to retrieve the compiled binary off of the Arduino, but it probably wouldn't be easy to do.


Help improve the RepRap wiki!
Just click "Edit" in the top-right corner of the page and start typing.
Anyone can edit the wiki!
Re: Updated Marlin customized for Mendel90
March 08, 2014 03:00AM
@Mogal: I would suggest trying to replicate your existing firmware before updating.

@floville: I purchased my Panelolu2 from Think3dPrint3d recently and the encoder was configured for direct connection. There was no need to make any solder pad adjustment.

Regards,
Neil Darlow

Edited 1 time(s). Last edit at 03/08/2014 03:03AM by neildarlow.


I try to write with consideration for all nationalities. Please let me know if something is unclear.
Printing with Mendel90 from fedora 25 using Cura, FreeCAD, MeshLab, OpenSCAD, Skeinforge and Slic3r tools.
Re: Updated Marlin customized for Mendel90
March 08, 2014 04:48AM
@neildarlow: i have the same panelolu2. Perhaps a mistake?
Re: Updated Marlin customized for Mendel90
March 08, 2014 06:21AM
Quote
Mogal
K, new question smiling smiley

Is there a way to download (save) the firmware currently installed on the arduino?
I'd like to give this a go, but I'd like to save my current firmware 'just in case' I'd like to revert back.

Thanks!

(After a new computer build, I lost my old firmware file)

You can read the firmware with AVRdude, but it will be the compiled version in binary format, so you won't be able to make changes or read it (easily), but you can flash it back to restore the current state.
More info here: [forum.arduino.cc]
Re: Updated Marlin customized for Mendel90
March 10, 2014 09:10PM
Thank you for doing this! Any chance you have included the volumetric extrusion and firmware retraction changes that whosa whatsis recently added?
Re: Updated Marlin customized for Mendel90
March 11, 2014 03:51AM
@ashleywebster: Yes. It is my intention to keep this firmware current.

Regards,
Neil Darlow


I try to write with consideration for all nationalities. Please let me know if something is unclear.
Printing with Mendel90 from fedora 25 using Cura, FreeCAD, MeshLab, OpenSCAD, Skeinforge and Slic3r tools.
Re: Updated Marlin customized for Mendel90
March 11, 2014 07:22PM
Very cool. Thank you Neil.
New feature: Enhanced SD card handling
March 14, 2014 06:38PM
Hi All,

I have added a new feature to this firmware. Currently it is enabled for MELZI and Panelolu2 only but instructions are given later for those with other hardware who are willing to test.

This feature provides enhanced SD card handling as follows:

1) If SD Card support is enabled and an LCD panel is connected then the SD Card may be placed in either SD Card slot.
2) If SD Card support is enabled but the LCD panel is not connected then the controller SD Card slot may be used.

The LCD panel SD card slot is checked before the controller board SD card slot. In the event that both SD card slots contain a card then the LCD panel SD card slot will take precedence.

Customizing for other hardware:

Marlin provides a #define named SDSS which specifies the SD card select pin.
Each controller board definition in pins.h sets this #define but the LCD panel definition may assign a different value to SDSS.
I have introduced another #define named MB_SDSS which should be set to the value of SDSS normally assigned by the controller board definition.

An example:

The SDSS definition for MELZI is 31
The Panelolu2 definition redefines SDSS to 30
MB_SDSS should be defined as 31

The logic that tests MB_SDSS checks that it differs from SDSS before attempting to access the SD card slot controlled by MB_SDSS. This means that configurations where MB_SDSS is undefined, or the SDSS pin is shared by both SD card slots, will not be affected by this change.

Regards,
Neil Darlow


I try to write with consideration for all nationalities. Please let me know if something is unclear.
Printing with Mendel90 from fedora 25 using Cura, FreeCAD, MeshLab, OpenSCAD, Skeinforge and Slic3r tools.
Re: Updated Marlin customized for Mendel90
March 16, 2014 07:36AM
Hi neildarlow, first I would like to thank you for your work. Before flashing that firmware I have some questions:

1. In your branch you have:
#define Z_HEIGHT_MM 203.0

In nophead's one it is:
#define Z_HOME_POS (203.680)
#define Z_MAX_POS (Z_HOME_POS - 0.1)

Is the 0.1mm heat inducted expension of the hotend considered? Do I have to put 203.680 or 203.580 in my Z_HEIGHT_MM definition?

2. About the auto bed Leveling: have you (or anybody else) found how to add a servo to the melzi board? I looked all over the forum but only found information about how to modfiy the carriage or about the use with a RAMPS board.

Regards

Christoph
Re: Updated Marlin customized for Mendel90
March 16, 2014 10:37AM
Quote
sguzzel
Hi neildarlow, first I would like to thank you for your work. Before flashing that firmware I have some questions:

1. In your branch you have:
#define Z_HEIGHT_MM 203.0

In nophead's one it is:
#define Z_HOME_POS (203.680)
#define Z_MAX_POS (Z_HOME_POS - 0.1)

Is the 0.1mm heat inducted expension of the hotend considered? Do I have to put 203.680 or 203.580 in my Z_HEIGHT_MM definition?
You should put in 203.68, the 0.1 mm smaller z_max is a software limit, there to prevent the endstop getting hit during any movement not related to homing.
Re: Updated Marlin customized for Mendel90
March 16, 2014 05:32PM
@sguzzel: The 203mm was the original Z_HOME_POS setting in Nophead's Marlin. The Z_MAX_POS was calculated as (Z_HOME_POS - 0.1).

In my firmware the Z_HEIGHT_MM is used to set MANUAL_Z_HOME_POS when MANUAL_HOME_POSITIONS is defined or Z_HOME_POS when MANUAL_HOME_POSITIONS is not defined.

In either case, Z_MAX_POS is set to 200 and will be consistent for all printers (Nophead's would vary the Z_MAX_POS depending on the calibrated Z_HOME_POS of the printer).

I have Z_HEIGHT_MM at 203.0 simply as a place-holder. You should replace this value with your calibrated Z Height value as described in the Build Manual.

Regards,
Neil Darlow

Edited 1 time(s). Last edit at 03/16/2014 05:33PM by neildarlow.


I try to write with consideration for all nationalities. Please let me know if something is unclear.
Printing with Mendel90 from fedora 25 using Cura, FreeCAD, MeshLab, OpenSCAD, Skeinforge and Slic3r tools.
Re: Updated Marlin customized for Mendel90
March 19, 2014 06:02AM
Thx 4 your help.

How about the auto bed leveling with the melzi? Is there a tutorial one can stick to?
Re: Updated Marlin customized for Mendel90
May 03, 2014 07:33AM
Hi Neil,

I ordered a STB RepRap Graphic LCD Controller with Fan Output to enhance my Mendel90. Yesterday I printed the housing for the pcb and today I take care about the Marlin firmware.

I found out, that STB uses the same pins for the SD card slot as melzi does. So I can use both. Not at the same time, sure. Right?

Now I try to merge this with your Marlin firmware. I'll keep you informed about my progress.


MfG / Regards

Stefan

Blog / Gallery / Wiki / Mendel90 kit since Sep 2013 from Nophead / Original Prusa I3 MK3 since Feb 2018 /
OpenScad Workshop: Kursdateien
Octoprint Patron since April 2016
Re: Updated Marlin customized for Mendel90
May 03, 2014 08:40AM
Quote
bastard
I ordered a STB RepRap Graphic LCD Controller with Fan Output to enhance my Mendel90. Yesterday I printed the housing for the pcb and today I take care about the Marlin firmware.

Very nice. That should look good.

Quote
bastard
I found out, that STB uses the same pins for the SD card slot as melzi does. So I can use both. Not at the same time, sure. Right?

If it uses the same physical pin as the Melzi then you will not need my card sharing patches at all. Quite rightly, you should not insert a card in both slots under these conditions.

Quote
bastard
Now I try to merge this with your Marlin firmware. I'll keep you informed about my progress.

Be careful following my modifications. Earlier posts mentioned MB_SDSS which was for a motherboard-centric solution. I later changed this to be LCD-centric and now use LCD_SDSS.

EDIT: Actually, if you define LCD_SDSS and SDSS to the same value the patches are intelligent enough to do nothing so all should be OK.

Good luck!

Regards,
Neil Darlow

Edited 1 time(s). Last edit at 05/03/2014 08:44AM by neildarlow.


I try to write with consideration for all nationalities. Please let me know if something is unclear.
Printing with Mendel90 from fedora 25 using Cura, FreeCAD, MeshLab, OpenSCAD, Skeinforge and Slic3r tools.
Re: Updated Marlin customized for Mendel90
May 03, 2014 09:09AM
Hi Neil,

too bad ... "Binary sketch size: 130,666 bytes (of a 129,024 byte maximum)" ...

So I'm looking for something to save memory ...


MfG / Regards

Stefan

Blog / Gallery / Wiki / Mendel90 kit since Sep 2013 from Nophead / Original Prusa I3 MK3 since Feb 2018 /
OpenScad Workshop: Kursdateien
Octoprint Patron since April 2016
Re: Updated Marlin customized for Mendel90
May 03, 2014 12:45PM
Obviously the LCD code takes quite a lot of space. Are there any features for the graphic display that you could disable?

If you do not need EEPROM storage you could disable that and possibly gain the space you need. Another one would be PID bed temperature control if you have it enabled.

Regards,
Neil Darlow


I try to write with consideration for all nationalities. Please let me know if something is unclear.
Printing with Mendel90 from fedora 25 using Cura, FreeCAD, MeshLab, OpenSCAD, Skeinforge and Slic3r tools.
Re: Updated Marlin customized for Mendel90
May 04, 2014 06:18AM
Hi Neil,

disabling the EEPROM did the trick! "Binary sketch size: 127,902 bytes (of a 129,024 byte maximum)" - I did not use the EEPROM so far, so I'm sure I won't miss anything.

I just changed to German language what gives me "Binary sketch size: 128,006 bytes (of a 129,024 byte maximum)". I'm very satisfied with this setting.

Next: Wait until the display arrives ...

Thx Neil!


MfG / Regards

Stefan

Blog / Gallery / Wiki / Mendel90 kit since Sep 2013 from Nophead / Original Prusa I3 MK3 since Feb 2018 /
OpenScad Workshop: Kursdateien
Octoprint Patron since April 2016
Re: Updated Marlin customized for Mendel90
May 12, 2014 07:59AM
Installed a couple of days ago and it's working well, thanks....

Can I suggest you structure the zip so you just unzip it into the arduino folder.

Now I might have no excuse but to work on a auto bed leveling device.... preferably one with no extra servos....
Re: Updated Marlin customized for Mendel90
May 12, 2014 11:59AM
I have no control over how GitHub constructs the zipfile. The folder layout itself is determined by the upstream Marlin_V1 repository with the addition of the LiquidTWI2 library.

Regards,
Neil Darlow


I try to write with consideration for all nationalities. Please let me know if something is unclear.
Printing with Mendel90 from fedora 25 using Cura, FreeCAD, MeshLab, OpenSCAD, Skeinforge and Slic3r tools.
Re: Updated Marlin customized for Mendel90
May 19, 2014 07:36AM
Hi Neil,
Great work and a big thank you! I updated my firmware for the first time (I bought my Mendel90 March last year) by following the instructions you provided and it worked straight away. Now I should read about auto-leveling and implement it.

Thanks again,
Demetris
Re: Updated Marlin customized for Mendel90
May 26, 2014 09:03AM
Hi,

since yesterday my LCD works. Thank you very much!



I had a few problems with the German umlauts. It seems that the used font has special charakters at the position where umlauts are used to be. So "bianchifan" did a few changes on dogm_lcd_implementation.h, ultralcd.cpp and language.h - see the (only German) thread here.

Neil - is it possible to merge his changes into yours?




MfG / Regards

Stefan

Blog / Gallery / Wiki / Mendel90 kit since Sep 2013 from Nophead / Original Prusa I3 MK3 since Feb 2018 /
OpenScad Workshop: Kursdateien
Octoprint Patron since April 2016
Re: Updated Marlin customized for Mendel90
May 26, 2014 01:53PM
I have taken a quick look at those changes and it appears his Marlin tree is not current and the files provided have changes other than purely textual presentation ones e.g. encoder deadband and steps per click values. There also appear to have been some other language changes recently (Russian) which his language.h does not implement.

With a bit of work I could isolate the textual and character support changes but I could not be sure I have done it correctly. Could you contact the originator of this work and request two things:

1) He produces .diff files of only the changes required to support German language display correctly.
2) He creates a pull request to the official Marlin repository to ensure that these changes are adopted universally by all forks.

If this can be done then I see no reason why the changes cannot go into my fork.

Regards,
Neil Darlow


I try to write with consideration for all nationalities. Please let me know if something is unclear.
Printing with Mendel90 from fedora 25 using Cura, FreeCAD, MeshLab, OpenSCAD, Skeinforge and Slic3r tools.
Sorry, only registered users may post in this forum.

Click here to login