How to make the Intermittent application with GRTC and LFXO while asleep.

Hi.

I have been investigating how to use GRTC and LFXO for LFCLK with nRF54L15DK.
In my goal, I would like to make the Intermittent application with sleep and GRTC that works with LFXO even if the MCU stay asleep.

I found the library(nrfx_grtc.h), but I couldn't find the sample named 'GRTC' with the library from ncs 3.0.0.

Do you know how to manipulate the API of GRTC, and properly to write the prj.cof ?


Best regards.

Parents
  • Hello,

    The system clock in Zephyr is already running off the GRTC (or the RTC if you're using a nRF52/53/91 series device). So, let's say you have a single threaded application, you can make it wake up periodically using Zephyr primitives such as k_msleep(). It will be in System ON mode  between the wake ups.

    int main(void)
    {
        while (1) {
            printk("Woke up. Going back to sleep\n);
            k_msleep(1000);  // Sleep for 1000 ms
        }
        
        return 0;
    }

    https://docs.nordicsemi.com/bundle/ncs-3.1.0-preview1/page/nrf/test_and_optimize/optimizing/power_general.html 

    Best regards,

    Vidar

  • HI.
    Thank you for replying, but where did you find GRTC automatically works responding to power state?
    Indeed, I see the k_sleep() go sleep, but I couldn't find that automatic clock source change in your URL document.
    The document seemes to state some techniques for power saving.

    Anyway, I will try obeying your suggested document.
    If I confirm the power consumption become lower, I will report them.

    Best regards.

  • Hi,

    The only change needed to the "system_off" sample should be to add the following to lines to the prj.conf file:

    CONFIG_GRTC_WAKEUP_ENABLE=y
    CONFIG_GPIO_WAKEUP_ENABLE=n

    You can also add CONFIG_LOG=y for addtional logging.

    I tried to run your merged.hex and it failed here as well. The program entered the secure fault exception handler which means you must have built the project for the nrf54l15dk/nrf54l15/cpuapp/ns instead of nrf54l15dk/nrf54l15/cpuapp/The nrf54l15dk/nrf54l15/cpuapp/ns target is currently not supported for this sample.

    shibuta said:
    Is it really effective to enable GRTC?

    GRTC is always enabled when building a Zephyr application for the nRF54L15 

  • Hi,

    Thank you for replying.
    OK, then,

    Unfortunately, I already build with 'nrf54l15dk/nrf54l15/cpuapp/ns'.

    Just now, I added CONFIG_LOG=y, and I found the log from COM port as below,

    nrf54l15dk system off demo
    Reset by debugger.
    Retained data not supported
    *** Booting nRF Connect SDK v3.0.0-3bfc46578e42 ***
    *** Using Zephyr OS v4.0.99-3e0ce7636fa6 ***
    Entering system off; wait 10 seconds to restart
    [00:00:00.011,780] <err> os: ***** BUS FAULT *****
    [00:00:00.011,785] <err> os:   Precise data bus error
    [00:00:00.011,790] <err> os:   BFAR Address: 0x0
    [00:00:00.011,800] <err> os: r0/a1:  0x00000000  r1/a2:  0x00000001  r2/a3:  0x00000000
    [00:00:00.011,808] <err> os: r3/a4:  0x400cf000 r12/ip:  0x00000000 r14/lr:  0x0004f3df
    [00:00:00.011,812] <err> os:  xpsr:  0x41000000
    [00:00:00.011,816] <err> os: Faulting instruction address (r15/pc): 0x0004bbda
    [00:00:00.011,836] <err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0
    [00:00:00.011,850] <err> os: Current thread: 0x20013748 (unknown)
    [00:00:00.085,693] <err> os: Halting system

    Indeed, you say this sample not supported, but
    why did you succeed in building with this sample ?
    It was because your build environment differs from mine, alright ?

    I just would like to confirm the timer library useful or not while deep-sleep for development.

    Best regards.

  • Hi,

    What I mean is that you must build the project for nrf54l15dk/nrf54l15/cpuapp.

  • Hi.
    I built with 'nrf54l15dk/nrf54l15/cpuapp'.

    But, no any message are found.
    Is it correct?

  • Yes, this is the correct build target for your nrf54L15 DK board. 

    no any message are found.

    Which messages are you referring to? Are you missing the log output:

    *** Booting nRF Connect SDK v3.0.0-3bfc46578e42 ***
    *** Using Zephyr OS v4.0.99-3e0ce7636fa6 ***
    
    nrf54l15dk system off demo
    Reset by debugger.
    Retained data not supported
    Entering system off; wait 2 seconds to restart

    ?

Reply Children
Related