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

Number of PWR MGMT handlers

Is there a limit to the number of handlers that can be registered using NRF_PWR_MGMT_HANDLER_REGISTER? I can't seem to get any more than 3 to be called, changing NRF_PWR_MGMT_CONFIG_HANDLER_PRIORITY_COUNT doesnt seem to help either

I'm using sdk 16,0 on an NRF52840

Parents
  • ok I made some dumb logic errors prevent this from working properly. It's fixed now but I noticed a couple of things while investigating:

    my watch dog is waking my system up after  NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF. This doesn't seem like desired behaviour

    Another issue i found is that i can call nrf_pwr_mgmt_shutdown( NRF_PWR_MGMT_SHUTDOWN_CONTINUE) without issues, even if a shutdown hasnt been started with one of the other members of nrf_pwr_mgmt_shutdown_t

  • Hi,

    goldwake said:
    my watch dog is waking my system up after  NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF. This doesn't seem like desired behaviour

    Have you reset the chip after programming, to make sure it does not enter emulated System OFF mode? If the chip successfully enters System OFF mode, it should not be waken up by the Watchdog.

    goldwake said:
    Another issue i found is that i can call nrf_pwr_mgmt_shutdown( NRF_PWR_MGMT_SHUTDOWN_CONTINUE) without issues, even if a shutdown hasnt been started with one of the other members of nrf_pwr_mgmt_shutdown_t

    It looks like this is the intended behavior, the function checks if the procedure is started first:

    // Check if shutdown procedure is not started.
    if (!nrf_mtx_trylock(&m_sysoff_mtx))
    {
        return;
    }

    The function does not have a return code, so it will not be able to report an error. You should make sure that the logic in your application does not depend on this function unless the shutdown procedure is started.

    Best regards,
    Jørgen

Reply
  • Hi,

    goldwake said:
    my watch dog is waking my system up after  NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF. This doesn't seem like desired behaviour

    Have you reset the chip after programming, to make sure it does not enter emulated System OFF mode? If the chip successfully enters System OFF mode, it should not be waken up by the Watchdog.

    goldwake said:
    Another issue i found is that i can call nrf_pwr_mgmt_shutdown( NRF_PWR_MGMT_SHUTDOWN_CONTINUE) without issues, even if a shutdown hasnt been started with one of the other members of nrf_pwr_mgmt_shutdown_t

    It looks like this is the intended behavior, the function checks if the procedure is started first:

    // Check if shutdown procedure is not started.
    if (!nrf_mtx_trylock(&m_sysoff_mtx))
    {
        return;
    }

    The function does not have a return code, so it will not be able to report an error. You should make sure that the logic in your application does not depend on this function unless the shutdown procedure is started.

    Best regards,
    Jørgen

Children
No Data
Related