Can't enable 'HAS_PM' to support power management notification

Hello,

I'm trying to enable the Power management for nRF9161 over nRF-Connect SDK2.5

the prj.conf has an entry of 'CONFIG_PM=y'

but it not accepted because we do not satisty the condition "HAS_PM=y"

the condition 'CONFIG_SYS_CLOCK_EXISTS=y' is found inside the ".config" generated file so it is enabled.

however the second condition "HAS_PM=y" is not satisfied...

I couldn't find "where" to configure and "what" to configure, in order to have this feature "CONFIG_PM=y" enabled...

FYI, we also enabled:

CONFIG_PM_DEVICE=y
CONFIG_PM_DEVICE_RUNTIME=y
Parents Reply
  • Hi,

    that doesn't help much

    what I realy need is to be notified going into IDLE and out of IDLE by the operating system.

    we turn ON and OFF the main UART for the terminal

    otherwise it is not possible to have the main clock closed (UART has baud rate 115200)

    void power_state_enter_cb(enum pm_state state);
    void power_state_exit_cb(enum pm_state state);
    static struct pm_notifier power_state_notifier = {.state_entry = &power_state_enter_cb, .state_exit = &power_state_exit_cb};
     
    main()
    {
    ...
      pm_notifier_register(&power_state_notifier);
    ...
Children
  • If you are using idle hooks to power the UARTE on and off, you will need to prevent the CPU from entering idle mode while the UART is receiving data. This approach does not seem very power-efficient.

  • Hi

    Well, the firmware wakes up every 1 minute so we can postpone cpu idle while UART TX needs to finish (we can poll the register). In practice there is no much UART going on and typically no one looking at it. This firmware get a total of 2uA in the dev kit. Without this, it’s about 20uA more when I don’t stop the UARTE (I do stop the RX side based on an RTS signal)

     

    So what is the chance to get the binaries of the PM back? If I add “select CONFIG_PM” it does compile but is missing some object files…)

  • I still don't understand why the UART can't just be suspended with the PM_DEVICE action after the transaction is complete. You could also have used the UART ASYNC API with the low power mode enabled (CONFIG_UART_0_NRF_ASYNC_LOW_POWER). There's also the Low power UART driver. It does not work with standard flow control signals, however.

    Ohad Gal said:
    So what is the chance to get the binaries of the PM back? If I add “select CONFIG_PM” it does compile but is missing some object files…)

    You need to revert the changes introduced by the commit I linked to in my initial reply.

  • Hello,

    I managed to revert the Git Commit and have the PM hooks back.
    the file power.c is back and there is an implementation for pm_notifier_register()

    static struct pm_notifier power_state_notifier = {.state_entry = &power_state_enter_cb, .state_exit = &power_state_exit_cb};
    
    void power_state_enter_cb(enum pm_state state)
    { // As currently implemented the entry callback is invoked when transitioning from PM_STATE_ACTIVE to another state
      add_CPU24H_accumulator(toc(&user_cpu_timestamp));
      
      // disable the UART
      if (!GET_RTS_HIGH()) // if the UART-RX is enabled, then we need to keep the UART active during sleep/idle as well
      {
        NRF_UARTE0_NS->ENABLE = 0;
        __NOP();
        NRF_UARTE0_NS->ENABLE = 0;
      }
    
      k_cpu_idle();
    }
    
    void power_state_exit_cb(enum pm_state state)
    { // As currently implemented the exit callback is invoked when transitioning from a non-active state to PM_STATE_ACTIVE.
      tic(&user_cpu_timestamp);
    
      // enable the UART
      NRF_UARTE0_NS->ENABLE = 8;
      __NOP();
      NRF_UARTE0_NS->ENABLE = 8;
    }
    
    void main()
    {
        pm_notifier_register(&power_state_notifier);
        ...
        while (1)
        {
            // NOTE: the sleep period here MAY NOT exceed 1 second
            //       otherwise it MAY cause the correlation to start AFTER the REF time
            k_sleep(K_SECONDS(1));
            k_cpu_idle();
        }
    }

    in the prj.conf I have

    CONFIG_SYS_CLOCK_EXISTS=y
    CONFIG_PM=y
    CONFIG_PM_DEVICE=y
    CONFIG_PM_DEVICE_RUNTIME=y
    CONFIG_TICKLESS_KERNEL=y
     
    I am runinig on SDK2.5.0, nrf9161
    my problem is that the hooks are never called (I've put a break point on them in debug)
    any idea what I am doing wrong?

    thanks
    Ohad

  • The nRF SOCs do not implement any CPU power states in the devicetree, assume that is why the PM state transitions are not being registered. An alternative may be to use the idle hooks as in this library: https://github.com/nrfconnect/sdk-nrf/blob/43e521ecb2c6366df2c6f94bec39f36d8d38b89e/subsys/debug/etb_trace/Kconfig#L20  

Related