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

HFCLKSTATE do not update to 0x10001

Hi, Everyone,

I am Using S130 and sdk 11.0.0.2-alpha with nRF51422 chip. I have two crystal in my custom pcb, one is 32 Khz crystal for LFCLK between XL1 and XL2 (pin 45,46 ) and other is 16Mhz HFCLK between XC1 and XC2(pin 37, 38)

Inside ble_stack_init()

I use either following only for 32Khz external osciilator initialization SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_250_PPM, NULL);

OR following only when using internal RC osc SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_16000MS_CALIBRATION, NULL);

/****/

when I switch LFCLK to internal RC then HFCLK gets updated to 0x10001 -which is external 16Mhz crystal. All perfect , no problem

But when I use 32 Khz external crystal as LFCLK, HFCLK stays to 0x10000 - which says internal RC instead of external oscillator

According to the specs, Radio should not work without external crystal HF clock source, But I can see Advertised data in Master control panel, with accurate information even when i use external 32 khz crystal for LFCLK and HFLCK stays to 0x10000

Can anybody make me clear here ???

Parents
  • Hi

    The selection of the 16MHz clock source should be reflected in the HFCLKSTAT register, while the selection of 32kHz clock source should be reflected in the LFCLKSTAT register. When you enable the 32kHz crystal, that should not have any effect on the HFCLKSTAT register, but should set the first bit in the LFCLKSTAT register instead.

    I see this happen correctly on my nRF51422 IC. What might be happening is that you set a breakpoint immediately after setting the XTAL to see the register value. It may take some time for the CLOCK module to set crystal as the clock source. In my case if I stop at the breakpoint and then step once, the LFCLKSTAT will update to have XTAL selected.

    image description

    image description

Reply
  • Hi

    The selection of the 16MHz clock source should be reflected in the HFCLKSTAT register, while the selection of 32kHz clock source should be reflected in the LFCLKSTAT register. When you enable the 32kHz crystal, that should not have any effect on the HFCLKSTAT register, but should set the first bit in the LFCLKSTAT register instead.

    I see this happen correctly on my nRF51422 IC. What might be happening is that you set a breakpoint immediately after setting the XTAL to see the register value. It may take some time for the CLOCK module to set crystal as the clock source. In my case if I stop at the breakpoint and then step once, the LFCLKSTAT will update to have XTAL selected.

    image description

    image description

Children
No Data
Related