Custom arduino SAMD21 based PCΒ- Oscillator wont start [solved]

Hi all,

Just received my new PCB from the China manufacturer but after soldering the MCU and the bare minimum components (decoup caps, power, reset etc), my scope says that the on chip oscillator wont start.

Reading various thread on line as well the chips datasheet, indicates that this chip is somewhat sensitive to the choice of crystal and the crystal load caps.
I have already tried 3 different 32.768kHz crystals : a small smd one, a through hole axial version and finally the MS1V-T1K ( 32.768KHZ +-20PPM 12.5PF) with different capacitors 12pf,15pf and 22pf , all with no success. The oscillator simply refuses to start.

Needless to say that i have verified correct 3.3v voltage on all supply pins as well as the 1.2V on VddCore pin.
Is there something else am missing? For example does a brand new chip need to be programmed to start an external oscillator?
In my experience with AVR chips with 16MHz crystals, I never experienced anything like this. It was like solder-and-play!

Schematics and PCB layabout below:

You must start the external oscillator via software. I used this on my Arduino Zero clone

	start external crystal XOSC32K, must disable first

The clocking mechanism on the SAMD21 (and pretty much all ARM Cortex MCUs) are a tad more complicated than your AVR chips

Thanks for the info.
I havent seen this on the chip's datasheet!
I was planning to burn the bootloader using another arduino and this :

but how do you upload the code you posted?

The relevant info on the SAMD21 reference manual

Clocks after Reset
On any reset the synchronous clocks start to their initial state:
• OSC8M is enabled and divided by 8
• Generic Generator 0 uses OSC8M as source and generates GCLK_MAIN
• CPU and BUS clocks are undivided
On a Power Reset, the GCLK module starts to its initial state:
• All Generic Clock Generators are disabled except
– Generator 0 is using OSC8M as source without division and generates GCLK_MAIN
– Generator 2 uses OSCULP32K as source without division
• All Generic Clocks are disabled except:
– WDT Generic Clock uses the Generator 2 as source
On a User Reset the GCLK module starts to its initial state, except for:
• Generic Clocks that are write-locked , i.e., the according WRTLOCK is set to 1 prior to Reset or WDT Generic
Clock if the WDT Always-On at power on bit set in the NVM User Row
• Generic Clock is dedicated to the RTC if the RTC Generic Clock is enabled
On any reset the clock sources are reset to their initial state except the 32KHz clock sources which are reset only by
a power reset

As you can see, the XOSC32K clock is not enabled by default, only the internal oscillators.

You need a proper SWD programmer to burn a bootloader into a SAMD21 as it does not come with a bootloader from the factory. I use a JLINK programmer (EDU version)

Thanks again for the info. I guess I missed that one!

Success: Apparently burning an Arduino (Zero in my case) bootloader with Adafruiτ's DAP library from an SD card sets the XOSC32K clock as well!
I can now get a clean 32.768 KHZ wave on my scope and I can also upload sketches via the native usb port.

My first attempts failed because the library had different default host pins for programming !

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.