Custom SAMD Board External Crystal Problem

Hello,

I recently designed and built a custom SAMD board for my college final. The board is based around the SAM D21 and the NINA-W10. With the help of Juraj, I got the module working, however, recently, I have been having a lot of connectivity issues with my board.

When I built my board, I used my Atmel ICE and AS7 in order to bootload my board with the MKRWiFi1010 .hex/.bin bootloader. At first it worked great for over a week. However, now, when I plug my board into my computer, there is never a COM Port.

After mentioning to Juraj that while the MKRWiFi1010 bootloader didn't work, the Nano 33 IOT bootloader always worked. Juraj then mentioned that the issue must be with the crystal because that was the major difference between the two bootloaders.

So, when I replaced the crystal, and then plugged my board into my computer again, the COM Port showed up and I was able to upload code again. However, after about a day, the COM Port didn't appear again despite changing USB cables and double pressing reset. So, I did what I did before, but this time, instead of replacing the crystal, I literally just un-soldered and re-soldered the crystal as well as changed the two capacitors, and it worked.

But, it stopped working just now and I am tired of doing this.

I attached a file of the connections of the crystal to the SAMD, however it is the exact same as on the MKRWiFi1010 schematic.

I am wondering if anyone has any ideas on what might be causing this issue?

I would appreciate any feedback and am open to answer your questions. Thank you!

These cheap low frequency crystals are harder to get to oscillate than one might think. You need to have a look into the datasheet of the crystal and the SAMD21.
It is also a good idea to have a look into a few application notes. This is a common issue and you can find good information from all the MCU manufacturer including Microchip/ATMEL.

The datasheet for the SAMD21 Family states crystal load capacitance MAX for 32kHz oscillator is 12.5pF. So, you should try lower values.

Please also note even when you set this up correctly, the datasheet states it typically takes 28K cycles for startup. That is around 1 second. If you need faster startup time you need to use a faster crystal (compare the table for the normal high speed oscillator) or internal RC.

Hello,

When I designed my board based off the MKRWiFi1010, I purchased the parts from Digi-key because there were links provided on the MKR schematic for the identical parts. Although, in order to eliminate any possible chance I received the wrong components, I just un-soldered the crystal and two capacitors on a MKRWiFi1010 I had laying around. I then soldered them on my board, and for the first couple of hours it worked.

However, soon, the COM Port no longer showed up, which has happened multiple times.

I am no expert, but I doubt the issue has to do with the components because I am using the components from an actual Arduino MKRWiFi1010.

Furthermore, I do have a copper pour around the crystal and there is a ground plane on the layer below it.

Do you think that using a hot air re-flow station would damage the crystal? Are there any other things I should try?

I would really appreciate any feedback.

Thank you.

Can you show us a close up photo of the crystal circuit? You only posted a schematic.

Thank for you responding. I attached a photo of the crystal circuit on my board.

Unfortunately, my iPhone camera is terrible at focusing on close objects.

Thank you.

Also, I used a multi meter to test the connection and can confirm that everything is properly connected.

Does anyone have any ideas of what I should try?

Thank you!

Actually, the photo isn't too bad, thanks:

Did you meter the caps also to make sure they're not shorted?

Did you have a look at a couple of application notes regarding oscillator design? It is a tricky business, the signals a very weak and can be disturb easily. Engineers spend quite some time to select crystals and test their circuit to ensure the board works under different temperatures and voltages if the boards are battery powered. Often, they need to improve the layout during development.

I suspect you do not have the equipment needed to directly analyze your oscillator. Standard oscilloscope probes have too much capacitance to measure the oscillator circuit direct.

The application notes and datasheets can give you some hints on how you can indirectly measure your oscillator frequency. For this you would need to get a sketch running on your board that outputs you a signal that is created based on the oscillator frequency. You could try to reprogram your board using your ATMEL ICE. You can then use a standard oscilloscope or logic analyzer to measure the frequency.

I would try to find out:

  1. Is the oscillator working at all?
  2. If yes, is the frequency within the tolerance needed to use USB?
  3. Which pins are you using in your sketch that are directly around the oscillator circuit and might affect your circuit?

Thank you for your helpful insight.

After reading your replies, the first thing that I tried was to test is the oscillator was working at all. I used my multi-meter in order to test the frequency.

When my ground probe touched the PA00_XIN32 pad of the crystal, my computer immediately made that connection sound, however, when I went into the device manager, the board showed up as an Unknown USB Device, despite my computer having all of the necessary drivers.

I am no expert, do you know what is happening or what I should try next?

Thank you so much!

Also, if I double tab the reset button or unplug the board and then re-plug it in again, the board or (unknown USB Device) disappears until I touch that pad with my ground probe.

kevin_smith_56:
When my ground probe touched the PA00_XIN32 pad of the crystal, my computer immediately made that connection sound, however, when I went into the device manager, the board showed up as an Unknown USB Device, despite my computer having all of the necessary drivers.

Your probe adds an additional capacity and resistor to your oscillator circuit giving it a kick to start running. However the circuit does not seem to run at the right frequency.

During the USB enumeration process your PC is reading information from the Arduino about the device (e.g. manufacturer, endpoints, …) to identify the device and choose the right driver. If the information is not read correctly (that is why you seen unknown USB Device) your PC cannot select the correct driver.

You said you used the Nano 33 IoT bootloader before and it always worked. I would recommend you flash that bootloader. This should allow you to run sketches on your board without the 32kHz crystal. Once this is working you can try to switch the clock sources from within your sketch and do some more experiments. Make sure you write your sketches in a way that you can control when you switch the clock source. e.g. start with a long delay or wait for a input pin to be set to HIGH/LOW.

Wow, that makes so much more sense.

If I were to design a new board, what would I need to change in order for my circuit to work properly? I have seen/read about a ton of other custom SAMD boards that all worked 100% with the external crystal. I still don't understand why this is only happening to my board.

As I previously said, I am using the exact same crystal and capacitors as on the MKR 1010. In addition, there are no software changes, thus the issue must be with the hardware?

Furthermore, when a solder a new crystal on, it works, but it soon stops working.

After doing some research, I found this post. It looks like this person had a similar problem...
https://forum.arduino.cc/index.php?topic=263037.0 What do make of this?

Would this explain why when I un-soldered and re-soldered my crystal it worked again for a short time? How do I check the connection/resistance or something of the crystal connections?

Should I build an entire new board? (could the my current PCB be faulty?)

What would be the best step to take next?

I'm sorry for my long posts. I am only trying to give you a lot of data so that you get a better understanding...

Thank you!

P.S.

I can share my board files if you think that might be the problem instead?

kevin_smith_56:
If I were to design a new board, what would I need to change in order for my circuit to work properly?

This is part design guidelines from the manufacturers and part experimentation.

kevin_smith_56:
I have seen/read about a ton of other custom SAMD boards that all worked 100% with the external crystal.
I still don’t understand why this is only happening to my board.

It does not happen to your board only. These crystals are hard to get working. Otherwise you would not find so many application notes about the subject from all the major MCU manufacturers. The slower the crystal (lower power) the harder it is to get them running.

kevin_smith_56:
As I previously said, I am using the exact same crystal and capacitors as on the MKR 1010. In addition, there are no software changes, thus the issue must be with the hardware?

Your layout, PCB materials and power circuit are different.

kevin_smith_56:
Furthermore, when a solder a new crystal on, it works, but it soon stops working.

Oscillator circuits are very sensitive and use very small signals. On one side you need a little bit of noise to get the oscillation running on the other side you do not want too much noise to interfere with the oscillation. When you heat up the board it expands, moisture gets removed and after a while the situation changes again.

kevin_smith_56:
Should I build an entire new board?

You need to find out whats wrong with your current layout first?

kevin_smith_56:
(could the my current PCB be faulty?)

Of course, heating up the board and your components multiple times can damage them.

kevin_smith_56:
What would be the best step to take next?

If you have a way of measuring the frequency of the board e.g. an oscilloscope or logic analyzer, as said in the last post, I would change the bootloader and do experiments with switching the oscillator in a sketch and do some measurements. Then you can trim the board by exchanging the capacitor values and try again.
If you do not have a way of measuring. Cut your losses and get your board running using the internal oscillators.

kevin_smith_56:
I can share my board files if you think that might be the problem instead?

Did you compare your layout with the layout recommendation from application notes and datasheets?

Thank you for your help Klaus_K.

After you said that constantly heating the board could damage it, I remembered that I had changed parts out many times.

I just created a new board, and so far, everything seems to be working.

Thanks again!