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

the clock function is not working in esb_ptx example for nRF52832

Hi, 

as I said before I am working with nRF52832. I can connect with nrf and program it. for example I can make an LED to blink. but when I run the esb_ptx example the program doesn't pass through the clock_initialize() line. I am using the CX2016DB32000D0WZRC1 chip as the crystal. can you help me to find the problem.   

  • Hi,

    but when I run the esb_ptx example the program doesn't pass through the clock_initialize() line.

    There is no function called clock_initialize in the SDK 17 (which I see you are using in another question). There is a clocks_start() in the esb_ptx example, though. Is that the one?

    That is implemented like this:

    void clocks_start( void )
    {
        NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
        NRF_CLOCK->TASKS_HFCLKSTART = 1;
    
        while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);
    }

    So the only thing that could make this not return is if the HFCLKSTARTED event never happens. Can you double check with a debugger if this really is the problem, and the while loop never exits? If so, there is likely a problem with the HF crystal on your HW.

  • you are right, it is clock_start(). when I comment clock_start() the program runs properly and the LED start blinking, but when the clock_start() line is active, it stops there. I checked the crystal an I even changed it but noting happen. the crystal that i am using has all the features that is said in datasheet. 

  • Hi,

    Masoumeh said:
    I checked the crystal an I even changed it but noting happen. the crystal that i am using has all the features that is said in datasheet. 

    It does not necessarily need to be a problem with the crystal itself, butit could be a problem with the circuitry around the crystal. Can you double check the load caps and that the soldering is OK etc? Please check all the solderings of X1, C2 and C1, and thee connections with the IC on the XC1 and XC2 pins (see snippet from reference circuitry for QFAA below)

  • I checked them. the soldering and connections are ok. the caps are 12pf, also I reduce the value of the C1,2 but noting happen. 

  • I see. I do not have any other suggestions, then. Just to double check, did you verify that execution is stuck in the loop waiting for HFCLKSTARTED? And also just to be sure, can you test the code on a DK if you have that around so that we know it works on good HW?

Related