I was playing with different values of pull-up resistors and removed 10k resistor from

I was playing with different values of pull-up resistors and removed 10k resistor from the RC filter, but still I get false probes reported randomly. I can say it goes a little better, as I was able to catch first 50+ probe points with no problem, but then the problem came again.

I measured the voltage between the probing tool (v-bit connected to GND) and the PCB (connected to Due probe pin D18) during the process. It is 3.3V (HIGH) when probing begins and gets low (so we have ACTIVE_LOW trigger) every time the tool is touching a PCB = it ‘grounds’ the PROBE pin down to 0V. When the tool goes up again moving to the next probe point the PROBE pin immediately goes back to 3.3V.
The faulty probes are starting (and disappearing) unexpectedly, while probe pin remains on VCC (3.3V) and not touching GND in any way at that time.

Does the INPUT_INACTIVE in the code below correspond to D18 PROBE pin at 3.3V (this is when NO switch is opened in my circuit) or 0V? And how is all that related to HIGH or LOW logic state of a PIN vs. ACTIVE_LOW or ACTIVE_HIGH transition?

static stat_t _probing_start()
{
// initial probe state, don’t probe if we’re already contacted!
int8_t probe = gpio_read_input(pb.probe_input);

// INPUT_INACTIVE means switch is OPEN
if ( probe == INPUT_INACTIVE ) {
	cm_straight_feed(pb.target, pb.flags);
    return (_set_pb_func(_probing_backoff));

} else {
    cm.probe_state = PROBE_SUCCEEDED;
    return (_set_pb_func(_probing_finish));
}

}

and here

static stat_t _probing_backoff()
{
// Test if we’ve contacted
int8_t probe = gpio_read_input(pb.probe_input);

// INPUT_INACTIVE means switch is OPEN (at least for now)
if ( probe == INPUT_INACTIVE ) {
    cm.probe_state = PROBE_FAILED;

} else {
    cm.probe_state = PROBE_SUCCEEDED;

    // capture contact position in step space and convert from steps to mm.
    // snapshot was taken by switch interrupt at the time of closure
    float contact_position[AXES];
    kn_forward_kinematics(en_get_encoder_snapshot_vector(), contact_position);

    cm_queue_flush();                               // flush queue & end feedhold
    cm_straight_feed(contact_position, pb.flags);   // NB: feed rate is the same as the probe move
}
return (_set_pb_func(_probing_finish));

}

@Alden_Hart @Riley_Porter_ril3y Do you have any idea(s) what next to check in order to solve this problem?

If you removed the 10K and now have 1K pull up and 100nF, you have increased the bandwidth of the input port (I am referring to your recently posted NO schmatic). A2.7K pullup and 470nF would match the component values used in tinyGV9. That may help, but matching the V9 performance exactly would be difficult with hand made wiring, compared to the PCB layout on the V9. All this assumes that noise is contributing here, not FW logic.
Also, you should clarify for Alden if your measurements are VOM or oscillocope. A VOM is useful to confirm static circuit states, but does not really say much about transient behavior(ms or ns duration events). Your oscilloscope, should you have one, should have at least twice the bandwidth(or more) of the port input LPF.
You might consider experimenting with an additional capacitor (something 100nF or so) between the probe and the workpiece being probed, out at the probe. Might help, might make things worse, that’s the way it is dealing with RF noise.
How are you actually grounding your workpiece? A shielded cable, with shield and the connection wire grounded at the tinyG2 end would be best.
Any chance the probe(a milling bit in your non-rotating spindle, I assume) has a dc or intermittent path to machine ground via the way it is mounted? Probing sort of started when most folks were using plastic case spindle machines that were isolated by their mounts. Perhaps not so if you are using one of the quiet-cut spindles. You could test this by wrapping a layer of tape around the mill bit before chucking into spindle. Bad for actual milling, but could help isolate this issue.
I am intentionally not addressing your FW logic question. I am learning with you in that zone.

Thanks @cmcgrath5035 for all your comments.
I was initially thinking about electrically isolating the v-bit, but I need to unwrap the tape before milling = dismount the bit = ruin my probing, so I did not do it. The way I did the connections is that the v-bit which is mounted in my quiet spindle is wired to GND, while the PCB is wired to Probe.

I am now considering putting an additional 100nF capacitor between the probe wires, on the Arduino side, as close as possible.

Currently my wiring is using a small breadboard and once I have it all working I want to do a small board directly plugged into Due Limit and Probe pins.

I use a touch-plate as a probe. The touch plate metal part is lying down on the PCB (VCC) and the aligator clip is connected to the v-bit (GND). The PCB is electrically isolated from the machine by a 10mm MDF (my waste board) plate placed between the machine metal bed and the PCB.

This ‘touch-plate’ probe is wired with a non-shielded wire (as it arrived from China) but I twisted the wires together. I will probably change to a shielded Belden wire.

The shield of all wired limit switches (shielded cable used all way long) and probe (shielded cable on currently controller box part only and not on the touch-plate) respective wires ends are all conected to the controler box case and/or machine body and to Earth (yellow/green wire). I then additionally connected Earth and GND, as there were some very small potential differences between GND and Earth before.

Still searching…

I sort of get what you have, am frankly a bit confused by you last paragraph, particularly “to the controler box case and/or machine body and to Earth (yellow/green wire).”
It sounds like you may have introduced some ground loops. I don’t believe it is a good idea to connect your machine to ground (here I mean tinyG ground) or to consider your machine to be digital ground. My definition here of digital ground is the negative(-) input to DUE.

I am also wary of connecting what you are calling Earth to digital ground, I am assuming you are talking about the Earth connection on your power brick. That probably should be the same as the green wire in a 3 wire extension cord, which in best case is connected to Power Pole neutral back at your Circuit Breaker box, but in other cases could be just a really long noise antenna.

How exactly do you ground the tool? An alligator clip and wire, connected to where? You can’t rely on the chuck to cleanly ground the milling tool, it’s path to ground is probably thru the bearings internal to the motor, not a solid ground always.

It would appear that we are simultaneously testing G2 probing and a unique, not necessarily ‘wrong’ method of wiring your machine.

I would suggest you test G2 under the cleanest combination of conditions. I would define this as a small copper pcb, connected to digital ground via a shielded ground wire and an isolated tool connected via a second shielded wire to the port pin, port held high by 2.7K and bypassed to ground by .47uF. That is as close as you can get to the Synthetos test bed. Probe directly to the PCB.

If that works as expected, then you know you are debugging machine and not G2.

The cleanest combination is correct, when considering a v-bit being electrically insulated from the machine. But this is not possible with my spindle, as the tool is made of metal and is touching metal parts of the spindle, machine… This is the reason why I ‘reversed’ the probe connection and connected PROBE to the PCB and not the v-bit.

The only way it might work is to insulate the probing tool with tape or paint and use it for probing. Then change the tool in the collet to the milling tool (all metal and not tape-wrapped/painted v-bit or other milling bit), zero-out z-axis at (0,0) directly on the PCB using Touch-Plate widget with 0.00 milimeters plate height and mill. This way it is no more needed to keep the same potential on the tool (which has machine potential = default Earth) and GND, which actually was the only reason I connected GND and Earth together. You are right it is not wise to put Earth on digital ground, but this was done as a one of the steps on the way to final solution.

I never had similar problems when probed using the same machine, the same cables and breadboard with gShield and Arduino Uno, where A5 analog pin is being configured for probing. But I prefer the TinyG workspace and don’t want to roll back to GRBL.

I understand your end-game machine issues. You may be the first to fully explore probing with G2 and the quiet spindle form factor.
I am suggesting the isolated milling bit ‘clean’ test as a Go/No go for G2 FW first. If it runs OK in clean mode, we may need to brainstorm a better way to probe.

The path to ground for a milling bit in a quiet cut spindle is out thru the bearings at each end of the motor armature, a very noisey path. Think about it, anything that is spinning has to be on the inner side of the bearing, or it could not spin.

I believe your alternate probing methodology proposed might work, but would be very error prone for many users, that does not meet ‘Chilipeppr’s’ goal of feature rich and easy to use…

Reversing the “NO probe switch” by connecting the Port to the PCB and clipping a hard(er) ground to the tool during probing might work, but users would need to ensure that the PCB hold-down didn’t accidently ground it.
There could be other issues - a large rectangular copper plate is a fairly good antenna at some frequencies.

I am not familiar with GRBL.
The secret may be in how GRBL uses the Analog Port Pin. If they were to take that input, A/D it and follow that with a very narrow digital (FW) filter. it could substantially clean up the switch transients and be a big help.
Otherwise, I might expect the Analog I/O to perform more poorly, since a moderate amount of threshold clean up (schmitt trigger) is normally included in digital interfaces.

Also keep in mind that Analog and Digital ports on DUE probably have much higher bandwidth capability than those on the UNO, I have not bothered to check the specs.

I’ll guess (I am not a dev) that if necessary, an Analog port on the DUE could be programmed to perform as the Probe switch, with some additional development. You continued testing could provide valuable input to that discussion.