Bug in Arduino Zero Run-time library??

G'day group.
This is my first post here. I've been and electronics hobbyist for over half a century, designed and built my own Z80 based CP/M computer with 8 inch floppy disks way back when and always seem to have a microprocessor project on the boil.

I've made up a PCB to drive the axes of my PCB milling rig (self-designed and built) and to probe the baseplate for levelling and flatness. This uses a Robotdyne SAMD M0 mini (don't dismiss me yet, I become relevant soon) CPU which is touted as being 'compatible' with Arduino Zero.
I'm using the AccelStepper library, from which I modified the 'bounce.ino' example to drive each of the axes individually to check my board out. This new sketch 'NewBounce.ino' is attached. It works just fine and drives every axis, one at a time.

So then I tried out the program I have written to connect the M0mini to Putty on the Windows PC via its USB port. The program is written intending that the cutting head can be moved to establish each of the corners of the rectangular milling surface using keyboard commands (or just diagonally opposite corners - it will figure out the rest) and then execute a probe to establish the surface Z axis measurement at each corner and also the centre.

The full program (rough - only the keyboard command area has been debugged) is attached.

The keyboard command and the program when it runs will only move one axis at a time but at the start of the program, AccelStepper objects are declared for all axes and then the initialisation is completed during setup().
My problem is that although the X and Y axes perform as expected, the Z axis object does not seem to initialise at all. The STEP pin is supposed to default high and pulse low and the DIR pin is supposed to switch between high and low, depending. Both pins start off low and stay that way. It does not matter in which order the axis objects are declared, it's always the Z axis which does not initialise.

I took this problem off to the AccelStepper forum where a responder installed my program onto an Arduino UNO, where all axes worked perfectly. Inspired, I installed my program onto an Arduino Zero I had handy where it misbehaved just as badly (See? I told you I would get relevant).

The only conclusion I can draw from all this is that there is a problem with the run-time library in version 1.8.3 of the Arduino Zero Variant software - ie the run-time library.

Since the problem appears manifest either in the declaration of the axes or during the relatively short setup() function, someone here who has the requisite real-time debugging faciiity should be able to pinpoint it quite quickly - I hope.

Regards, Peter.

NewBounce.ino (2.37 KB)

FlatnessTester.ino (17.1 KB)

for the Robotdyn M0 I would try Arduino M0 board definition

I understand where you got that from but it's wrong. The Arduino IDE won't work for the M0 mini unless you select the Arduino Zero board. Believe me, I read that too and tried it.

Meanwhile, the M0 mini is only mentioned as background info. The issue here is with the Arduino/Genuino Zero.

Peter.

Bump!