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

Any way to control wether ext. 32k XTAL works properly?

Hello all,

Our product based on nRF51 is on preproduction stage. We use both 16MHz and 32kHz external crystals. The question is: Is there any way to check programatically if 32kHz crystal soldered/soldered properly/works fine?

We noticed that on SD110 v8.0.0 device works even without external 32k crystal with software defined as

if (NRF_SUCCESS !=(err_code=sd_softdevice_enable((uint32_t)NRF_CLOCK_LFCLKSRC_XTAL_75_PPM, softdevice_assert_callback)))...

However, in that case the current consumption increased significantly. And it could cause problems in post production testing.

Best regards,

Parents
  • If you call sd_softdevice_enable() with LFCLKSRC_XTAL and there is no external crystal, the code will be stuck waiting for the crystal to start.

    You can start a watchdog timer (WDT) before initializing the stack. This will reset the chip if a reload register is not set before a certain amount of time. In NRF_POWER->RESETREAS you can check what caused a reset. Remember that the NRF_POWER->RESETREAS register is cumulative, which means that the register is not cleared if the reset source is not power-on-reset or brown out reset. You can clear a field in the register by writing a "1" to it.

    This code will setup a watchdog:

    NRF_WDT->CRV = 32768*10;   //ten seconds
    NRF_WDT->RREN = (WDT_RREN_RR0_Enabled << WDT_RREN_RR0_Pos);
    NRF_WDT->TASKS_START = 1;
    

    You have to reload it regulary to avoid resetting:

    NRF_WDT->RR[0] = 0x6E524635;
    

    Check the reset reason like this (does not clear the register value):

    if(NRF_POWER->RESETREAS & (POWER_RESETREAS_DOG_Detected <<    POWER_RESETREAS_DOG_Pos))
    {
        printf("Chip was reset by watchdog!\n");
    }
    
Reply
  • If you call sd_softdevice_enable() with LFCLKSRC_XTAL and there is no external crystal, the code will be stuck waiting for the crystal to start.

    You can start a watchdog timer (WDT) before initializing the stack. This will reset the chip if a reload register is not set before a certain amount of time. In NRF_POWER->RESETREAS you can check what caused a reset. Remember that the NRF_POWER->RESETREAS register is cumulative, which means that the register is not cleared if the reset source is not power-on-reset or brown out reset. You can clear a field in the register by writing a "1" to it.

    This code will setup a watchdog:

    NRF_WDT->CRV = 32768*10;   //ten seconds
    NRF_WDT->RREN = (WDT_RREN_RR0_Enabled << WDT_RREN_RR0_Pos);
    NRF_WDT->TASKS_START = 1;
    

    You have to reload it regulary to avoid resetting:

    NRF_WDT->RR[0] = 0x6E524635;
    

    Check the reset reason like this (does not clear the register value):

    if(NRF_POWER->RESETREAS & (POWER_RESETREAS_DOG_Detected <<    POWER_RESETREAS_DOG_Pos))
    {
        printf("Chip was reset by watchdog!\n");
    }
    
Children
No Data
Related