CNCJS Hitting Hard Stop on M6

I’m trying to get up and running with CNCJS, but this issue is driving me crazy. Here’s what I’m doing:

  1. Connect to machine and load gcode
  2. Home the machine
  3. My tool is already loaded and probing is complete (so right now the Z axis is at the top of its stroke because it just homed).
  4. I turn on my router and hit “go”
  5. As soon as CNCJS sees M6, it drives the Z axis up to the limit switch causing it to trigger the hard stop error state. It is also giving “Error:38 Invalid Gcode”

It seems like M6 is causing the machine to operate in relative coordinates and just drive the Z axis up by a certain amount, which makes no sense. If you want to return to the top of the Z-axis and the machine is already homed, there’s no reason to to be in G91.

Luckily the machine is running proximity switches so it’s never actually crashed itself.

An M6 will just cause a pause and prompt for user intervention, like running a macro. What exactly happens when the M6 is reached? Are you intervening at all, or is what you’re seeing all automated? Can you share your gcode? How are you generating it?

First off, I’m using code which is generated in Fusion360 using the Carbide post processor and this code has been successful run many times from Carbide Motion without issue (even after the conversion to proximity sensors).

Is there not some script or something that runs when M6 is commanded in CNCJS? How does the machine know where to go for the tool change operation? Is it in my gcode or is it a parameter in CNCJS?

I can’t tell you exactly what happens when I reach M6 because it all happens so quickly, but everything I’m experiencing is automated. The list I gave above is exactly what I am doing, however I should maybe revise #5 to read:

  1. After hitting “go” the z-axis moves to the very top of it’s stroke, going past the soft limit offset from the hard stop and I am promoted on screen to change the tool. Sometimes the hard limit is tripped here, sometimes not. If not, after clicking the continue button (without touching the CNC at all), the program will start but usually trips the hard stop within the first move, halting the program.

Can you share your gcode?

If I’m not mistaken this used to be a popular problem some time ago. After installing HDZ I’ve experienced it myself. Switching to a different post processor seemed to fix that issue.

Sorry, I forgot to post the gcode4011.nc (545 Bytes)

@BartK I am also running an HDZ, do you know which post processor people were switching to?

It just seems really strange that this issue would occur with one gcode sender and not with another.

You might want to try OpenBulids.cps this works for me. Download it and delete zip extension and give it a go.
OpenbuildsGRBL.cps.zip (17.4 KB)

Its requesting a tool change thinking it needs to be loaded.
ensure proper tool is loaded

Easy fix, wipe that line.
‘T603 M6’

The tool change is not the issue. It is this line:
G28 G91 Z0
That is telling the machine to go to your Z axis G28 position (which I’m guessing you haven’t set).

The Error 38 is because of the tool number, 603, as the default max value for grbl is 255.

Here’s a link to my post processor.
https://a360.co/2PPwJrT
Gives the option to use G28 (default no), and it gives the option to Use Tools (default yes), along with some other User-Defined options.
image

In CNCjs, the M6 will pause the job and wait for you to resume…that’s all. It’s up to you if you want to run a macro at that point or not.

4 Likes

Awesome, thanks! It was my suspicion that line may be an issue, but because it said z0 i was confused.

Alternatively, can’t i just set the G28 position using G28.1?

To solve your current problem, yes.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.