MKRzero custom board - Random oscillator startup

Hello everyone!

I build a custom MKRZero board using SAMD21G18A IC.

The board works flawlessly just after I flash it or read/access fuses from Atmel studio and Atmel-ICE or Segger programmer by SWD.

This is where it gets tricky. When I shut the power down and start it again, the bootloader or the code don't work. I suspect the problem is from the oscillator.

VDDANA, VDDIO, VDDIN are all ok and have proper decoupling capacitors. 3.3V is stable and voltage rise is within specs.

When I use my oscilloscope, I see the oscillator don't start everytime. I tried 7pf oscillator with capacitors from 10 to 22pf and 12,5pf oscillator also from 10 to 22pf capacitors. Same problem... I now bought a 9pf capacitor and waiting for it.

I manage to start the board by doing one very precise manipulation. I power it up, nothing happens. I shut down power for 1/4 of a second and start it again and then the oscillator starts and everything is fine...

Any idea what could be the problem?

Also, every time I use SWD communication with the board (even just reading some address), it starts again properly, bootloader or application depending on what is on it...

Thank you very much!