This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Does the nRF52840 have an internal error flag to detect defect of external LFCLK source?

Dear Nordic team,

considering our error analysis, does the nRF52840-CKKA-F have an internal error flag that is set when the external LFCLK source is absent or shortcut?

What is the nRF expected to do in case the external LFCLK source fails?

Best gegards,

Konstantin

Parents
  • Hi,

    Normally you would wait for the LFXO event EVENTS_LFCLKSTARTED to be generated after starting the LFCLK with the task TASKS_LFCLKSTART. If the LFCLK event doesn't start then the application will usually just spin in the while loop forever. If you suspect that there is something wrong with the external crystal then you can try to change the LFCLK source to the internal RC oscillator and see if it works then. 

    regards

    Jared 

  • Thank you Jared,

    how does this look like during the runtime?
    Does an error flag exist that signals an error of or missing LFCLK signal after the LFCLKSTART signal had been successfully set (EVENTS_LFCLKSTARTED received). 

    Background: When I shortcut the LFCLK pads to ground, the user feedback (LEDs and buzzer) freezes / the output PWM is running continuous on HIGH or LOW. How could I detect this via firmware?

    Regards,
    Konstantin

  • Hi Konstantin

    Jared is currently on vacation, and I will help you out in the mean time. 

    Konstantin Y said:
    how does this look like during the runtime?

    If you are talking about the application spinning in a loop you could detect this by having a timeout counter in the while loop, and exit the loop once the counter reaches a certain value (this value needs to be set higher than the time it normally takes to start the LF clock obviously). 

    Konstantin Y said:
    Does an error flag exist that signals an error of or missing LFCLK signal after the LFCLKSTART signal had been successfully set (EVENTS_LFCLKSTARTED received). 

    No, there is no such flag unfortunately. 

    You can see an overview of all the LF and HF clock related registers for the nRF52840 here.

    Konstantin Y said:
    Background: When I shortcut the LFCLK pads to ground, the user feedback (LEDs and buzzer) freezes / the output PWM is running continuous on HIGH or LOW. How could I detect this via firmware?

    Normally you would use the watchdog peripheral to detect issues like this, but the problem is that the watchdog is based on the LF clock, and would also stop if the 32k clock source stops working. 

    You might have to implement something similar to a watchdog using a TIMER module (the TIMER modules use the HF clock source rather than the LF clock), and reset this timer repeatedly through an RTC interrupt. Then you can set up an interrupt on the timer which only occurs if the timer is not reset in time by the RTC interrupt. 

    The main drawback of this is that you will not be able to get very low sleep currents (single digit microamps) since you need to keep the HF clock running at all times. 

    Best regards
    Torbjørn

Reply
  • Hi Konstantin

    Jared is currently on vacation, and I will help you out in the mean time. 

    Konstantin Y said:
    how does this look like during the runtime?

    If you are talking about the application spinning in a loop you could detect this by having a timeout counter in the while loop, and exit the loop once the counter reaches a certain value (this value needs to be set higher than the time it normally takes to start the LF clock obviously). 

    Konstantin Y said:
    Does an error flag exist that signals an error of or missing LFCLK signal after the LFCLKSTART signal had been successfully set (EVENTS_LFCLKSTARTED received). 

    No, there is no such flag unfortunately. 

    You can see an overview of all the LF and HF clock related registers for the nRF52840 here.

    Konstantin Y said:
    Background: When I shortcut the LFCLK pads to ground, the user feedback (LEDs and buzzer) freezes / the output PWM is running continuous on HIGH or LOW. How could I detect this via firmware?

    Normally you would use the watchdog peripheral to detect issues like this, but the problem is that the watchdog is based on the LF clock, and would also stop if the 32k clock source stops working. 

    You might have to implement something similar to a watchdog using a TIMER module (the TIMER modules use the HF clock source rather than the LF clock), and reset this timer repeatedly through an RTC interrupt. Then you can set up an interrupt on the timer which only occurs if the timer is not reset in time by the RTC interrupt. 

    The main drawback of this is that you will not be able to get very low sleep currents (single digit microamps) since you need to keep the HF clock running at all times. 

    Best regards
    Torbjørn

Children
No Data
Related