G38 Probe Target implementation

I’m trying to get G38.2 to work. I started with the firmware from the firmware page and made a couple of changes to the Configuration.h and Configuration_adv.h files and then flashed the firmware. The commands now trigger an action. However, the axis doesn’t stop when the touch plate is hit. It appears to be a known bug in the 1.1.0-1 firmware (I think that is the version from the firmware page). It has been fixed with firmware after 1.1.0-RC8 .

The way I see it I have four options:

1 . Jump to the latest firmware from the Marlin page and try to change the settings in Configuration.h and _adv.h to match those from the V1 firmware page.

  1. Use the latest firmware from the Allted/Marlin github page and make the probe changes to those configuration.h files

  2. Use 1.1.0 RC8 with a new endstops.cpp file (like is mentioned here https://www.v1engineering.com/forum/topic/touch-plate-with-g38-codes/)

  3. Bag it and move on with my project.

Any advice? I’m leaning towards option 2. Has anyone used G38 since P3DCNC’s post March 2017?


Start with 2 for sure. See what happens. So much has changed since RC8.

1 Like

Ok. I went for option 2, Downloaded MPCNC_MRambo_T8_16T_LCD branch from Allted/Marlin github and made a few changes to configuration.h: defined FIX_MOUNTED_PROBE and setting INVERT_X_DIR, INVERT_Y_DIR, INVERT_Z_DIR to all true (that was easier than flipping the connectors) . In Configuration_adv.h, I defined G38_PROBE_TARGET.

Sadly, same effect G38.2 moves the axis (X, Y or Z), but doesn’t stop when the Z endstop is triggered. Nice splash screen on the v2 firmware though.

If I did something obviously wrong or if I missed a setting, let me know. I’ll continue to work it.

Try M119 to see your end stop status, then manually trigger the connection and try it again. You might have a wiring issue between the z plate and your board or between the bit and your board.

Good advice. G28 Z was working ok, so I figured the wires/connections were good. I’ll look at m119 tonight.

Solved, but it wasn’t pretty and Marlin has a bug here I think. From some research it appears this “bug” has been fixed and then comes back often as the other end stop and bed leveling features evolve.

For future reference: I made the changes as above and then had to edit the endstops.cpp file to change the #if ENABLED(G38_PROBE_TARGET) section of the code to read the Z_MIN instead of the Z_MIN_PROBE and comment rest of the conditional. This is because I don’t think Z_MIN_PROBE is actually getting set when Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN in Configuration.h is set.

1 Like

Hey Mark

i was having the same issue as you and fixed it by editing the endstop.ccp like in your comment.

Thanks for the answer to this problem

You should be able to use newer versions of marlin without issue. I found that manually configuring Z_MIN_PROBE_PINfixed my issues. Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN seems buggy and doesn’t set the appropriate pin to be monitored by G38.

Thread documenting what I tried here: https://www.v1engineering.com/forum/topic/g38-x-support-in-marlin/

My fork of marlin: https://github.com/mzizzi/Marlin/tree/MPCNC_Rambo_T8_16T_LCD_mzizzi

Manually setting Z_MIN_PROBE_PIN: https://github.com/mzizzi/Marlin/blob/MPCNC_Rambo_T8_16T_LCD_mzizzi/Marlin/Configuration.h#L799

With the latest firmware (Ryan updated a couple weeks ago) it is possible to get this working with just Configuration.h and Configuration_adv.h, no changes to any cpp files are necessary.

There does appear to (still) be some weirdness around Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, and as far as I know this must be disabled (even if using the zmin connector on the board).

My configuration (including other stuff specific to my machine) has G38 working and is outlined here: https://www.v1engineering.com/forum/topic/running-ryans-latest/


1 Like