# How to enable EMERGENCY_PARSER in Marlin firmware?

In the documentation of some commands of the Marlin firmware (like M112 - Emergency Stop), it says that the EMERGENCY_PARSER should be enabled to execute them instantaneously.

The thing is, I didn't find any information there of how to enable that EMERGENCY_PARSER or how it works.

Any help will be appreciated.

The constant EMERGENCY_PARSER is located in the advanced printer configuration file Marlin/Configuration_adv.h:

// Enable an emergency-command parser to intercept certain commands as they
// enter the serial receive buffer, so they cannot be blocked.
// Currently handles M108, M112, M410
// Does not work on boards using AT90USB (USBCON) processors!
//#define EMERGENCY_PARSER


To enable the EMERGENCY_PARSER, you need to remove the // before #define EMERGENCY_PARSER and recompile the sources.

Normally your printer will execute a command until it is ready to accept a next instruction. Without the EMERGENCY_PARSER set, the printer finishes the instruction that it is executing at the moment, if set, the execution is interrupted and immediately sent and thus not waiting for a clear space in the buffer.

• Is there a way to know if EMERGENCY_PARSER is set without looking at the printer configuration file (for example, sending a command or checking the first responses when you connect via serial port)? Was this feature added on Marlin 1.1.0? Nov 23 '18 at 13:58
• @fsinisi90 I don't know if you could try that out. You do need to somehow inject the M112 in the midst of operation, usually that is done by the code as an emergency response on certain limit checks, I do not know how to insert that manually from outside.
– 0scar
Nov 23 '18 at 14:25
• Well, I've already tried with M190 (wait for bed temperature) and then M108 and it's not working, but my firmware is Marlin 1.0.3 and I guess the EMERGENCY_PARSER was added on 1.1.0, so I don't even have the possibility to enable it. Anyway, I was looking for a way to check it on any printer from my source code (I'm connecting through pyserial), without human intervention. Nov 23 '18 at 14:57