Welcome! Log In Create A New Profile


How to add a debug message to marlin?

Posted by Tryit 
How to add a debug message to marlin?
May 18, 2018 05:23AM
How can I add a simple bit of code to "see" what marlin is doing?

I'd like to know if I can send to LCD screen as well as via serial to a connected PC running repetier.

I imagine a serial println command??

I want to check the values of some config variables and #define values.

Re: How to add a debug message to marlin?
May 20, 2018 12:19PM
It is difficult to write lines on the LCD Screen... There are a lot of issues involved to doing that as a debug tool.

But SERIAL_ECHO() macros are very very easy to use. I use them all the time to print debug information.

Also... I use a Max7219 8x8 LED Matrix to display check point information... and bar charts and such. You can buy them on eBay for under $2.00 including shipping.
And there is a setting in Configuration_adv.h to turn on support so you can write values to it. It is very easy to use.

Edited 1 time(s). Last edit at 05/20/2018 12:31PM by Roxy.
Re: How to add a debug message to marlin?
June 22, 2018 04:35AM

With little knowledge of Marlin and Roxy's help I found a way to get debug messages:

Add "print" statements something like this:


Not really sure where best to put these - depends what you are trying to see but I inserted these in the gcode M115 (show Marlin version etc.) instruction interpreter.

This is in Marlin_main.cpp file
in the section beginning "inline void gcode_M115() {"
I inserted immediately before the final closing "}" of this section.

Connect PC to printer board via USB cable.
Use arduino IDE to compile / upload

Start serial monitor (under tools in arduino IDE) I had to change options at bottom of window to "both NL and CR" and set baud rate to 250000.
Send "M115" whenever you want to see the debug echos (after the info. M115 normally generates).

Hope this helps someone!
Re: How to add a debug message to marlin?
June 22, 2018 12:09PM
Now go on eBay and get a Max7219 8x8 LED Matrix! Here is pre-assembled one for under $2.00 (including shipping)


It is very handy to be able to light up different dots depending on what is going on in the firmware. And if you are not debugging code, the lights will show you how many commands are buffered up waiting to be executed by the printer.
It looks very cool while printing.
Sorry, only registered users may post in this forum.

Click here to login