This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf51822, custom board, crystal design

I've been developing some ble code for a custom board. Recently, I just finished creating a new smaller board. When I load my code onto it, I notice that I have trouble discovering my device's services and fail to connect most of the time.

After looking through the forum, I've come to question whether my crystals and capacitors have been chosen appropriately. So I have two questions:

  1. Assuming that my 16MHz crystal and capacitors are appropriately chosen, can I use either the internal RC oscillator or synthasized low frequency clock for ble communication?

  2. Have I chosen the right crystals and capacitors? For the 16MHz, I have chosen a Kyrocera crystal : 16MHz ±10ppm Crystal 8pF 200 Ohm Surrounding it I have two identical 12pF capacitors. For the low frequency crystal reference,I chose a Abracon crystal: 32.768kHz ±20ppm Crystal 9pF 90 kOhm. Surrounding it, I have two identical 12pF capcitors as well.

Seeing that my low frequency clock crystal has a crystal capacitance of 9pF, I expect that I have chosen my capacitors incorrectly for that frequency reference. However,even when I try using either the synthasized 16MHz clock source or the internal RC oscillator, I have poor ble connection.

    1. yes you can use either internal RC (with periodic calibration) or synthesized LF from HF instead of the LF crystal. Last time I asked, the calibrated RC was the recommended one of those.

    2. Capacitors seem right. The formula in the reference sheet is Cl = C1.C2/(C1+C2) where C1 and C2 are C + Cpin and Cpin is 4pF. Rearrange that and you get C = 2.Cl - Cpin. In your case Cl is 8pF and 9pF respectively so that would give you capacitances of 12pF and 14pF, which is just about what you have. Unless you have a lot of stray capacitance from the traces connecting them, you should be in the ballpark. How close to the reference layout did you stay?

    You could test the frequency outputs of your crystals with a scope if you have one (i don't) or by getting a timer running off HF or LF clock to toggle a GPIO pin in a simple 'blinky' type app and use a logic analyser. That should tell you if you are way off.

    How about antenna? Crystals are tricky, antennas are beasts. If this is affecting you on either crystal source, I'd go take a look there too.

  • Thank you. My board design is not too far from the reference designs. I do have a little less ground plane due to having some other sensors on board. I saw that my 16Mhz crystal seemed spot on which is comforting.

    Strangely enough, I was able to resolve this issue by disabling the internal DC/DC converter. One new addition from my last board is the fact that we have a switching regulator on board. Lesson learned, don't enable the dc/dc mode if you are regulating your power.

Related