How do I get the reset cause with nRF Connect SDK?

Hi,

I am using an nRF9160/nRFConnect SDK 1.8.0/VSCode and my application uses MCUBoot and SPM. It is a "non secure" application.

I am trying to get a reset cause. 

hwinfo_get_reset_cause() just leads to a weak function that always returns -ENOSYS (= -1).
In my prj.conf I have enabled CONFIG_HWINFO=y, for this purpose. 
CONFIG_HWINFO_NRF=y outputs this warning: HWINFO_NRF (defined at drivers/hwinfo/Kconfig:31) was assigned the value 'y' but got the
value 'n'. Check these unsatisfied dependencies: (!TRUSTED_EXECUTION_NONSECURE).
 
I am kind of new to this whole secure/non-secure thing, so I am probably missing something fundamentally in this regard, so help to get the reset cause would be appreciated.
Thanks!
Parents Reply
  • Thank you.

    This is already much better, than just reading out the register.
    I am sorry, that I'm not explaining myself very well. 
    When I say Zephyr-ish approach, I mean, that I want to be as Hardware-agnostic in my code as possible. With nrf_power_resetreas_get(NRF_POWER_NS) and espeacially with just reading from the register, I am dependent on the Hardware. So far I have managed to only use very high level functions with my code and was hoping to also be able to do this for the reset cause. That's why I was hoping to make hwinfo_get_reset_cause() work, since it is not nrf specific and would only use the underlying nrf driver. 
    I have noticed, that there is hwinfo_nrf stuff (hwinfo_nrf.c), but I cannot figure out, how to get the hwinfo wrapper to use that driver in my constellation.

Children
Related