I'm trying to put the nRF9160 into System Off mode and am getting a bus fault error when writing to the REGULATORS module. This is the error output:
***** BUS FAULT ***** Precise data bus error BFAR Address: 0x40004500***** Hardware exception *****Current thread ID = 0x200245f8Faulting instruction address = 0x412daFatal fault in thread 0x200245f8! Aborting.
I first set the modem to power off using ```lte_power_off()```, and then call ```nrf_regulators_system_off(NRF_REGULATORS_NS);```
I'm calling this from a non-secure app. Do I have to add configuration in the bootloader to allow non-secure access to the REGULATORS registers? Are there additional steps to configure before going into System Off mode?
Hey, anyone have a similar issue?
Hi Jack,I am sorry for the delay.
Could you explain what you are using as reference?
I do not recognize this lte_power_off() function, is this a custom function.
It would be helpful if you could share some code, and if anything is sensitive we can make this case private.
Please see how the different thing are enabled in non-secure/secure in the spm.c.
So the call to lte_power_off() is just something I'm doing before trying to go into System Off mode. It's in the LTE Link Control Library found in the NRF Connect SDK. File is found here:
That is unrelated and not the issue. I was just trying to inform you of operations I was doing before actually trying to go into system off mode. The real issue is when I try and write to the REGULATORS register to go into System Off mode. It is documented here:
I'm calling the function nrf_regulators_system_off(NRF_REGULATORS_NS); which is located in the Zephyr project here:
As soon as I write to the REGULATORS register I get a Bus Fault error at that register address. This is what the write operation looks like:
p_reg->SYSTEMOFF = REGULATORS_SYSTEMOFF_SYSTEMOFF_Msk;
Hi Jack,Sorry for my confusion.
Basically we need to set the regulators in non-secure to be able to use it:
To set the Regulators in non-secure we can add this in the spm.c:
PERIPH("NRF_REGULATORS", NRF_REGULATORS_S, CONFIG_SPM_NRF_REGULATORS_NS),
And we need to set it as default non-secure in the Kconfig file:
bool "Regulators is Non-Secure"
From the serial output you can confirm that the Regulators are set in Non-Secure:
Thanks for the response.
So I have been using an older version of the SDK and had no idea that so much had changed. I was still using secure_boot instead of spm. And I have EM Studio v4.14. Just wondering if you guys have a plan to get to a standard bootloader for the nRF9160? Is secure_boot obsolete? Don't they pretty much do the same thing by configuring security around all of the peripherals?
I just downloaded all the latest SDKs and EM Studio v4.16. I'm trying to run the spm sample and am getting build errors for 2 things that are not defined.
DT_FLASH_AREA_IMAGE_0_NONSECURE_OFFSET_0 undeclared. (line 26 in spm.c)
NRF_P0 undeclared (line 317 in spm.c)
Am I missing any configs for these?
Another issue I'm having:
I'm noticing in the board directory in Zephyr for the nrf9160 there is an inconsistency. The nRF Connect documentations says to use the branch "nrf91", however this branch does not have definitions for "nrf9160_pca10090ns". Master does have the definitions, however, when I try to open the "spm" sample with the master branch of Zephyr I get "Project load failed".
CMake Error at C:/Users/jpanetta/Documents/Dignity/nrf91-2/Zephyr/cmake/kconfig.cmake:194 (message): command failed with return code: 1Call Stack (most recent call first): C:/Users/jpanetta/Documents/Dignity/nrf91-2/Zephyr/cmake/app/boilerplate.cmake:500 (include) CMakeLists.txt:3 (include)
-- Configuring incomplete, errors occurred!Project load failedReported error: solution load command failed (1)