Custom SAMD21 PCB Crystal not working.

I would appreciate suggestions as to what I may be doing wrong. I have a custom board based on the Zero. The crystal circuit and the SWD programming port are copied from the original Zero board design. Test loading both the bootloader (which I do not need for SWD programming) and actually programming the board with "Blink" both seem to work OK ( I get a "verified" message at the end of programming). I can program from both the Arduino IDE and Atmel 7 with the same results. Unfortunately the board does not work.

I have tried programming with both the Arduino Zero boards file and the Sparkfun SAMD21 Dev. board file making the required changes to the pins.

I have swapped out the crystal, the MCU and the 6.8pF crystal caps. with no change in the symptoms.

Power to all MCU power pins is tested and correct.

Testing shows the crystal oscillator is not working. Do I need to perform some clock setup routine that is not included with the boards file? Any other ideas please?

Thanks for helping.

6.8pF seems really low. I use 22pF.

The capacitor size depends on the crystal's capacitance and the specs in the electrical section of the SAMD21's datasheet for the clock pins also come into play. These limit how low you can go for crystal capacitance and thus the size of the capacitors you use.

This is the crystal I use:
ABS07-32.768KHZ-T

It has a 12.5pF capacitance. If you use 22pF caps the capacitance of the crystal should be the same as mine. I looked into using a lower capacitance crystal which would allow lower capacitance caps, but I was told it was probably not a good idea because stray capacitance in the PCB could potentially overwhelm the much smaller capacitors required to drive it.

Are you sure you have the correct crystal? I haven't been able to figure out the exact crystal Arduino is using on the Zero. It's possible there's a mismatch between the crystal you're using and the capacitors.

SCSWIFT
The crystal on my custom board is an "ABS25-32.768KHZ-6-T" which is what the PCB designer used to allow true SMT mounting. This requires a book capacitance of 6pF. I was concerned about such a low capacitance because I thought there might be trace capacitance problems but the board designer did allow pretty generous clearance around the traces.

DLABUN
As I said above we changed the crystal so that we would have 4 point SMT mount. The closest visually similar crystal I can find on Digikey is from Citizen Fine Device which I gather is a branch of the Citizen Watch company. It looks like their CMJ206T series.

If nobody is going to tell me that I need certain software to set the clock operation then I will start experimenting with other crystals patched in place to see if I can find something that works. An old board I built uses a pretty reliable 32+K clock so that would be my first test.

Thanks for your comments. I am still open to "Doh, you forgot to do this stupid". :slight_smile:

I don't think you have the correct capacitors.... Two 6.8pF in parallel with a crystal is only 3.4pF. Try testing two 12pF capacitors and see if there is any improvement.

dlabun,

I could have been more clear, the 6.8pF caps are either side of the crystal as per the original schematic, not in parallel.

There is a post on clocks including the external crystal here.

http://asf.atmel.com/docs/3.17.0/samd21/html/group__asfdoc__sam0__system__clock__group.html

This article is a bit techie for me, does anyone else understand this?

It seems to say that the SAMD21 boots on its internal clock but then needs firmware to transfer control to the external oscillator. Does anyone know whether this firmware is in the IDE boards file or the bootloader? Could the so called fuses have any influence here? The bootloader seems to load correctly but when I check using Atmel 7 the fuse contents have not changed even though the SAMD21 supposedly had no bootloader pre-installed.

.

diabun is a little confusing. He meant to say two 6.8pF capacitors in series equals 3.4pF.

The standard crystal oscillator circuit used with microcontrollers involves two 22pF capacitors and a 1MHz - 24 MHz crystal.

Crystals are specified by the "load capacitance" typically 16pF e.g. two 22pF with 5pF stray capacitance.
If you have a crystal that needs a 9pF "load", e.g. two 12pF plus 3pF stray.

You are always going to have some stray capacitance. The smaller your physical components and careful layout can mean 2pF or so.

You can design things from first principles if you want.
Personally, I would take the "engineering" route. i.e. copy a proven pcb.
This means copy the part numbers for the crystals too.

David.

I blame sleep deprivation for that one...

Nothing to report in the way of progress but since "dlabun" asked in an earlier post I have found that the original Zero crystal is an MS1V-T1K by Micro Crystal Switzerland. Available from Allied Electronics and Newark.

.

OK guys, excuse me if I am boring you but in my quest for a crystal I have found some questions that I can't find an answer for on the Internet.

Why do manufacturers make crystals in a range of load capacitances? Why do they not settle on a single value such as 12pF?

In any particular application why would you choose a low load capacitance pF value instead of a higher value?

To clarify, this is not a question about why we use capacitors or how you calculate their value, simply, why are crystals made with a choice of load capacitor values.

Thanks,
Brian

.

Read the SAMD21 datasheet, see what capacitance it is expecting with the crystal.
Atmega328 for example looks for 12-22pF to work with the onboard crystal excitation circuit:

"Pins XTAL1 and XTAL2 are input and output, respectively, of an inverting amplifier which can be configured for
use as an On-chip Oscillator, as shown in Figure 9-2 on page 29. Either a quartz crystal or a ceramic resonator
may be used.
This Crystal Oscillator is a full swing oscillator, with rail-to-rail swing on the XTAL2 output. This is useful for
driving other clock inputs and in noisy environments. The current consumption is higher than the ”Low Power
Crystal Oscillator” on page 29. Note that the Full Swing Crystal Oscillator will only operate for VCC = 2.7 - 5.5
volts.
C1 and C2 should always be equal for both crystals and resonators. The optimal value of the capacitors
depends on the crystal or resonator in use, the amount of stray capacitance, and the electromagnetic noise of
the environment. Some initial guidelines for choosing capacitors for use with crystals are given in Table 9-6 on
page 31. For ceramic resonators, the capacitor values given by the manufacturer should be used."

And I think recall that the full swing option was being discontinued for 328P - here's an article on it:

It's probably due to the variety of timing circuits out there... Some want lowest possible power consumption while others go for accuracy. If you're selling crystals you certainly would want to sell as many as possible so you try to cater to different designs.

dlabun.
The power consumption is the only reason I could think of to justify the different load capacitor options. Perhaps the crystals that use the smaller capacitors use less power than the larger units. From the point of view of the manufacturer it would obviously be more profitable to sell one version of the crystal only and save a bunch of production costs.

Here is the pricing on the MS1V-T1K crystals from Newark.
7pF option $1.30 375 in stock
10pF option $1.23 267 in stock
12.5pF option $1.23 15,618 in stock.

OK, price difference is negligible but there must be a reason for vast difference for quantity in stock and there must be a good reason for having three options. Let's face it, 5.5pF between the largest and smallest is hardly a big value change.

Since my board is mains powered I think I will try the 12.5pF version and see what happens. This is mainly on the basis that for a fixed stray capacitance this stray capacitance has a proportionately smaller effect on detuning the bigger parallel capacitors.

.

Changed to original MS1V-T1K crystal and clock now working. I chose the 12.5Pf version and the osc. works with 15pF capacitors. I think these may be a little too high in value but the crystal output on Pin 2 of the micro as viewed on a 'scope is stable.

How did you get the crystal output to work? I couldn't get it configured correctly in my code and gave up on trying to view the crystal output.

dlabun,

The crystal output can be seen on pin 2 of the SAMD with a decent scope. I understand that a scope that puts a high load on the circuit could kill the operation.

Frankly, since I was bought up in the logic/VHD world rather than the MCU world I do not really know what I am doing. I simply replaced the original components and reloaded the bootloader and it ran. The output looks stable on the scope so I assume the PLL is being stabilized correctly. I did not do anything in code at all. I am going to swap capacitors to see what range of values the oscillator will work with because I am beginning to think the permissible range is smaller than I would have expected.

I loaded the bootloader and program using an Atmel ICE and the arduino IDE. The clock started working but I still can't run the "blink" program. It indicates it is loading correctly and the build routine says "Verified" but it does not run. Fortunately I have an experienced friend who is investigating the problem.

My custom project is very close to a Zero since it just uses 3 more I/Os than the Zero supplies. I thought that if I ignored those I/Os and treated the board like a Zero being programmed through SWD the board should work but it doesn't.