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

nRF51822 static void lfclk_config(void) function problem

I have test RTC example on both different hardware revision nRF51822 chip. 1)N51822 QFAAC0 1309AF 2)N51822 QFAAC0 1308AE

1309AF revision chip is function properly with the RTC example. However, 1308AE revision chip unable to function properly. Both chip had programmed with S110 SDK v5.2 hex file.

From debug mode, i have found that 1308AE LF clock unable to start. The program stuck in the while loop of lfclk_config(void) function. 1309AF LF clock able to start and trigger EVENTS_LFCLKSTARTED and go to next steps. All register's address are same for both chip.

static void lfclk_config(void) { NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos); NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; NRF_CLOCK->TASKS_LFCLKSTART = 1; [b] while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) { }[/b] NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; }

However, 1308AE chip able to function properly if remove the while loop in lfclk_config() function. What is the cause of this problem?

Parents
  • Thank for reply.:)

    The nRF51822 chip (1308AE mark) which has problem was tested on custom board. I had bought 4 custom boards from a company and the circuit same as nRF51822 Dev Kit with 16M crystal.

    There is no shorts on crystals based on visual inspection . How to determine crystal is loaded correctly? I did not tried with other RTC example yet as it was working fine at Dev Kit.

    Besides that, the program is the based on Gazell ack example and add on timer function based on RTC example. Gazell layer was function properly without any problem. RTC is based on LF 32K crystal and RTC0.

  • The formula for calculating the capacitors are: C = 2*Cl - Cpin - Cpcb Cpin is 4 pF on the nRF51822. Cl is the load capacitance of the crystal that they use. Cpcb is the capacitance in their PCB traces (normally 2-3 pF).

    Example If the load capacitance for your crystal is 11 pF: 2 * 11 - 4 -3 = 15 pF.

    You can use an oscilloscope to check if the crystal is actually swinging by probing both lines. You should not have 0.3 sec jitter, even if you are running on the RC 32K.

Reply
  • The formula for calculating the capacitors are: C = 2*Cl - Cpin - Cpcb Cpin is 4 pF on the nRF51822. Cl is the load capacitance of the crystal that they use. Cpcb is the capacitance in their PCB traces (normally 2-3 pF).

    Example If the load capacitance for your crystal is 11 pF: 2 * 11 - 4 -3 = 15 pF.

    You can use an oscilloscope to check if the crystal is actually swinging by probing both lines. You should not have 0.3 sec jitter, even if you are running on the RC 32K.

Children
No Data
Related