Disabling KILL_PIN in Marlin 3D printer firmwareon March 1, 2015 at 12:56 pm
In rare situations there is an issue that can cause your 3D printer running Marlin firmware to suddenly stop during a print, leaving you to troubleshoot without knowing for sure if you have fixed the cause. One of the first things I look for is something being wired to use the Kill Pin, such as a GLCD panel. Many LCD panels include a switch to press to emergency stop the printer. Most people don’t use it at all and without a panel many printers do not have any kill switch other than the reset switch on the electronics they use. There is no direct danger by not having a kill switch, in my opinion. If you do have a LCD panel with Marlin, there is a Stop Printing menu item on the main menu that works just fine for me.
However, even if you do not use a kill switch but have one connected, the wire from the switch to the board can pick up electrical noise, and in some rare situations be sensitive to noise spikes that can cause false kill switch events in the firmware, and it may trigger even if the switch was not pressed. The switch is usually a button on something like the GLCD panel, using one of the wires between the GLCD and the KILL_PIN on the RAMBO or RAMPS board. Instead of disconnecting the wire itself or mangling the GLCD connectors, it’s easy to simply disable the KILL_PIN in the Marlin firmware so it’s ignored. When I hear about somebody experiencing unexplained printer stops, the first thing I usually recommend is to disable the KILL_PIN and it seems to solve the problem in most cases.
If you have a host program like Pronterface or Repetier connected via USB, you may see a message like “Error:Printer halted. Kill() called!” when the printer halts. This is direct proof that the kill pin was triggered. If you don’t have anything connected that displays serial output messages, which is common when using a LCD panel instead of a host, you may not see any message and be unsure why the printer stopped. If you have any type of kill switch connected, but didn’t press it, you are likely the victim of a false kill pin event.
Marlin has a set of pin definitions for each type of electronics. In older versions of Marlin all the boards are defined in pins.h, with a section for each board. The RAMBO board is number 301, and there is more than one place KILL_PIN is defined in that section, depending on which options are selected for your electronics, such as which LCD you use. To make things simple, I personally disable the KILL_PIN in all the places for the board I use just to be sure I get the right one and it doesn’t become active by accident in the future if I change options.
Here is an example of how the KILL_PIN is disabled:
#define KILL_PIN -1 //80
Notice the pin is set to -1 and has //80 after it. This is because the original value was 80 for this option, and I just put “-1 //” in front of it, which sets the pin to -1 and reminds me the original value was 80 in case I ever want to enable it again. I do this for every KILL_PIN in the section for my board. Setting the pin to -1 is what disables it and tells Marlin to ignore it completely. It should go without saying that after changing any marlin files like this you need to re-upload Marlin to your board. 🙂
For newer versions of Marlin, the pin definitions are not in the pins.h file any more, each board type has it’s own file. You can look in boards.h to see which file has the pin definitions for your board, and use the same method for setting KILL_PIN to -1 everywhere in your board file. The pins_RAMBO.h file is where the pins for RAMBO are defined for recent versions. If you don’t use endstops and are familiar with disabling endstop pins, it’s the same process to disable the kill pin and avoid any chance of random electrical noise to ruin a print by causing the kill pin to trigger and halt the printer.