Opening MKRZERO COM Port doesn't reset SAMD21

With all other Arduinos I've worked with (Nano, Uno) whenever you open the COM port (i.e. the main
USB connected com port) It resets the Arduino board causing the sketch to restart from scratch. This
doesn't seem to be true for the MKRZERO. When I open the com port it appears to have no effect and
the sketch continues to run. This is quite a problem when trying to port my sketches over to the MKRZERO.

Does anybody know a way to programmatically reset the MKRZERO board from the host?

some Arduinos have an USB chip. it can reset the (main) MCU. some Arduino MCUs have native USB port (Leonardo, Micro, Zero, all MKR). they reset when 1200 baud connection is opened

Of course once I posted I'd find the answer. Opening the COM port briefly at 1200bps performs the needed reset.

Interesting that while the bootloader does this the serial monitor port does not. Or is there a way to force the
monitor to do this? I tried setting the baud to 1200 and then back to 115200 but this didn't seem to work.

This doesn't seem to really do what I need. It only puts the board into bootloader mode. Here is what I see:

Open putty (term emulator) and create serial window for COM60 (my MKRZERO port) baud 1200
Close the putty window. At this point I hear the usb de and re enumerate. The orange LED 1 is slowly fading and
the COM port is now 61 (my MKRZERO bootloader port).

Once in this state I have to re-upload the software. Hitting the reset button doesn't help it comes back up in
this same mode.

Is there a way to just get it to reset without going into permanent bootloader mode? Even one that is initially
bootloader but then timesout to runtime is fine.

tozz88:
This doesn't seem to really do what I need. It only puts the board into bootloader mode. Here is what I see:

Open putty (term emulator) and create serial window for COM60 (my MKRZERO port) baud 1200
Close the putty window. At this point I hear the usb de and re enumerate. The orange LED 1 is slowly fading and
the COM port is now 61 (my MKRZERO bootloader port).

Once in this state I have to re-upload the software. Hitting the reset button doesn't help it comes back up in
this same mode.

Is there a way to just get it to reset without going into permanent bootloader mode? Even one that is initially
bootloader but then timesout to runtime is fine.

wait, it will leave the bootloader mode. it takes 10 seconds

Why do you need to do this reset?

Why do you need to do this reset?

I am using MKRZero as test harness for a hardware product and need to be able to force a hardware
reset of all components and guarantee test harness is running in a pristine state. Note this is code that
also works on normal arduinos we are using so looking for a compatible solution that can work across the
board (pun not intended). What I ended up doing is adding this code snipet to loop():

#ifdef ARDUINO_ARCH_SAMD
// Samd21 arduinos don't automatically reset when COM port is opened
// So we set up convention that open@2400 baud is reset
if (Serial.baud() == 2400) {
NVIC_SystemReset();
}
#endif

then we can add this to our test scripts:

stty -F comport -ispeed 2400 -ospeed 2400

which now resets both types of arduinos the same.