nrf9160 & NCS: reset reason CTRLAP

Hi,

While developing my application for my company on a nRF9160 on a custom board, I came to use the nrfx_reset_reason.h to get my reset cause.

RESETREAS looks as follows:

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf9160%2Fpower.html&anchor=register.RESETREAS

Inside nrfx_reset_reason.h, you can get the reset cause with nrfx_reset_reason_get() and then you are supposed to compare the flags with nrfx_reset_reason_mask_t.

nrfx_reset_reason_mask_t does not have an entry for CTRLAP-reset though in case of the nRF9160, even though, according to the documentation it should be available in the RESETREAS register..

I wanted to ask if there is a reason for this, or if I overlooked something. (or if that one just slipped through).

  • Hello, 

    the DevZone team and Nordic Semiconductor are currently in a summer vacation period, some delays in answers must be expected due to lower staffing during this period. We apologize for the inconvenience. 


    What version of nRF Connect SDK are you working on?

    In modules\hal\nordic\nrfx\helpers\nrfx_reset_reason.h there is:

        NRFX_RESET_REASON_CTRLAP_MASK    = RESET_RESETREAS_CTRLAP_Msk,
        /**< Reset from application CTRL-AP detected. */

    Kind regards,
    Øyvind

  • I'm on NCS 1.8.0, but the enum is the same in 1.9.1.

    Well, this isn't available because of the #if !NRF_POWER_HAS_RESETREAS above.

    When the RESETREAS register is available, the enum entries get mapped to the POWER_RESETREAS_XXX_Msk defines.

    But somehow the CtrlAp reset isn't in this enum.
    As a workaround, I am directly checking against the define POWER_RESETREAS_CTRLAP_Msk, which should work in my application, but I still think that CTRLAP should also get an entry in the enum.
  • I've got some feedback from our developers.

    The this value is indeed missing. The flag is not available in other SoCs that have the RESETREAS register (nRF9160 seems to be the only one that has this flag there), that's why probably it was not added there yet. We need to add:

    #if defined(RESET_RESETREAS_CTRLAP_Msk)
        NRFX_RESET_REASON_CTRLAP_MASK    = RESET_RESETREAS_CTRLAP_Msk,
    #endif

    after the else on the top the screenshot you provided. 

    Let me know how that works compared to the workaround you have. 

    Kind regards,
    Øyvind

  • Probably a typo, but I believe the define to be checked and assigned should be POWER_RESETREAS_CTRLAP_Msk, as that is actually bit 18. RESET_RESETREAS_CTRLAP_Msk would be bit 2 and that define would not be available anyways.

    but other than that, it would work, yes. 

    Thank you very much!

  • Yes, you are right! Thanks for pointing out. Happy to hear that it works. 

    Kind regards,
    Øyvind

Related