Grbl on RAMBo w/ Dual Endstops!

That was actually very helpful - however, for some reason, any changes to $23 are being ignored. That’s even after a hard reset. The bitmask for $23 seems to be allowed to be anything, but no changes occur. Even if I set $23=31 (11111), so all axes should be inverted, there’s no differences for $23=0. The changes are completely ignored.

Can you post the output of the $$ command? A number of the settings interact, so it may be more helpful if we can see the actual current settings.

So I’m starting to figure it out. My bitmask, with the way I have my steppers plugged in, is like so:

y2, x2, z, y1, x1. My plugs are wired as in Ryan’s picture. All the dupont connectors have their exposed pin part facing inwards towards the board. My home is in the bottom right hand of the machine, and my X axis goes from X- on the left, and X+ on the right. My Y axis is Y- at home (bottom of the machine), and Y+ is at the far end.

The motors themselves are such that X2 is at the bottom of the machine, and X1 at the top. Y2 is at the left, and Y1 is at the right. Here’s a drawing for clarity: https://i.imgur.com/w3c2sQ2.png

Here is my $$ command: https://pastebin.com/ZWNSj5ML

However, something strange seems to be happening. Y2 no longer moves at all during homing. It jogs correctly now, and X homes correctly when I press the homing button in cncjs.

y2 moves when I jog. It does not move when I hit the home button in cncjs. It does move when I do G28 or G28.1 Y0.

Are you aware of the ? command to get current machine status, including enstop condition? What does that command show? When I run it, the triggered endstops are listed at the end of the output line. I don’t think I had to modify $10 to get the enstop status to show up.

Just saw this and had to pop in as it happened to me as well when first flashing Grbl. For me it had to do with some weird eeprom issue and resetting EEPROM after flashing, then going back through and reconfiguring fixed it. The issue drove me crazy and was about ready to give up and just use Marlin lol.

Not sure how or why… but whatever it was did not handle arc commands until resetting eeprom… x and y would twist on arc commands only (i j k in gcode lines). Homing of course would work… cause no arcs. So try an eeprom reset

@kev I tend to clear eeprom regularly and reset it. It doesn’t seem to make a difference.

In the condition where all switches are pressed, it shows XYXYH. In a position where none are pressed, I get: <Idle|WPos:-3.000,131.830,0.000,-3.000,131.830|FS:0,0|Pn:ZYH>

The blue home button still won’t move Y2.

The other pn: zyh should not be there when no end stops are closed.

With all limit switches disconnected and $5=0, I’m getting: <Idle|WPos:0.000,0.000,0.000,0.000,0.000|FS:0,0|Pn:XYYH>

This is with all switches completely disconnected, physically.

Now, let’s try $5=1:

<Alarm|WPos:0.000,0.000,0.000,0.000,0.000|FS:0,0|Pn:ZXH>
ok

Nope. Still doesn’t make any sense. Don’t even know what Pn means.

Pn I think maybe shorthand for PIN number or something… it is a list of limit pins that are closed.

I am wondering what is the H for. Should be xyzxy

Are you using enducross’s repo? There are some places in the code to change axis names. Iirc… some versions use A and B for x2 and y2… never seen H though. They should be xyzxy if using enducross code… which is Not perfect but the closest to directly working on dual ends top mpcnc.

Edit… also seems the five axis are responding properly to $5… except that H.

1 Like

I am, and I found the issue there: my Y stop was wired to Z.

I am pleased to report we are now jogging and homing correctly.

What I am less pleased to report is that grbl says y = -597 when the machine is homed. How do I fix that?

I always thought conventional home was bottom left maybe change the bed. Are you 597 from left side?

It’s kind of in a weird spot and I can’t use conventional home. I’m about 597 (actually 300, but I don’t want to change the value now that another has cited it) from the top of the machine. As I get closer, the number becomes more positive. But from my perspective, Y should be rising. In the visualizer, it is, yet Y reports itself as less negative instead of more positive. Why?

That is standard convention for pro Cnc machines. You have 2 coordinate systems, mpos which represents the machines physical position along the gantry, referenced with origin at the top right. So note that mpos will always be less than zero. Then there is WPOS which represents your workspace… workspace origin can be anywhere you want. Usually when setting up an operation you set wpos zero at bottom left corner of stock so x and y wpos are positive for the operation.

Another way to think of this… when you home you are setting zero for mpos ( seen as a negative number equal to the size of your work area… origins at top right). This is separate from what you do when you hit xyz=0 in your gcode sender, you are setting wpos origin at the current position.

So does this one look about right? https://i.imgur.com/lS0l6Ij.png

That shows wpos origin is set to -297, -3, 0. Is this with your head positioned sort of centered along x, with Y 3mm from hitting the top stop? If so then that is correct. If your gantry is centered along y… the -3 is not right.

This is with the machine homed at the bottom right of the machine. It can only go up and left.

Ah ok… you have your wpos origin set to the right whereas most folks use the left. Then what you have looks correct… For a rig with 300mm workspace.

1 Like

There is also an option in the config file to set your homed position to 0,0. I’m not sure if using a negative number for the bed size works, but you should have the flexibility to set the machine coordinate space however you want from there.

Thanks. I really appreciate it. It’s a 300mm workspace indeed, I just forgot to set the soft limit to 300. I think 600 is default for grbl.

Here’s how I solved this problem for the next guy who comes looking:

  1. There is no particular arrangement for X1, X2, and Y1, Y2. It is possible that your arrangement differs from mine. Likewise, where you have your limit stops is also important. For me, I square mine at the bottom right.

  2. What this means is that the bitmask for $3 applies to sockets on your board, it applies to pins. You should orient all your plugs in one direction, and label your steppers clearly.

  3. Set $3 like so: 00000. You do not know what the order will be, because you do not know your motor arrangement is identical to mine. If you’re using a weird board like we are here, you also don’t know which pins/sockets those address. Flipping the plugs is not necessary, and don’t do it or this will be even more confusing.

After every single run, reset the machine via the hardware reset. $3 doesn’t seem to take otherwise. Take the belts off. Seriously.

Now, run +Y and +X. You will see the motors move. Make a chart for X1, X2 and Y1, Y2.

Now set $3=1. Note down which motor changed. Draw a box for all five bits of your bitmask. Whichever motor changed is assigned to that bit. Suppose it was Y2 that reversed direction, you’d know that Y2 was the lowest bit. That’s equivalent to 00001.

You need both your motors to run the same direction on both axes. And ideally in the direction you like best.

Then, set $3=2. Note which motor changed direction. That’s equivalent to 00010. See how we’re floating that 1 all the way left so we can map out which bit inverts which motor? That’s why you can’t find the “standard” mask when you google. You have to map them out. So the next one will be 00100, or 4, and then 01000, or 8, and so on and so forth. We then make a map of which bit inverts which motor.

  1. Now, set the Y axis up by flipping the bits for Y1 and Y2 until you’re pleased with the results. So if they’re moving in different directions, invert the one that’s moving in the wrong direction. If that hurts your brain, invert one, then the other, till it moves how you want. If they both move in the same direction, but the wrong direction, invert both.

Now write that number in binary. Take that number from binary to decimal and write it down. Call it Y.

Revert Y to 0’s, so nothing is inverted.

  1. Now, set the X axis how you like by flipping the bits for X1 and X2. Once you’re satisfied, call that number X.

To get both axes working the way you want, now take $3=(X+Y), addition in decimal, unless you like doing addition and carrying in binary. Both axes will now work.

  1. Do the same thing for $23 if you want it to home in some weird direction like I did. Go ahead and keep the belts off, then invert one axis at a time. Now it will home how you like.

Thanks to everyone who helped me. I hope this helps the next guy who has a weird machine.

4 Likes