nrf5340_cpuapp or nrf5340_cpuapp_ns?

Hi,

I am developing an application with the nRF5340 microcontroller.

I need to use the I2C module, but if I insert the CONFIG_I2C=y configuration in my prj.conf file, the application doesn't work.

The firmware has been compiled, but when running it gives me the following error:

00> [00:00:00.254,638] <err> os: ***** BUS FAULT *****
00> [00:00:00.254,638] <err> os:   Precise data bus error
00> [00:00:00.254,638] <err> os:   BFAR Address: 0x0
00> [00:00:00.254,669] <err> os: r0/a1:  0x000258f0  r1/a2:  0x000258f8  r2/a3:  0x00000000
00> [00:00:00.254,669] <err> os: r3/a4:  0x0000000c r12/ip:  0x00000001 r14/lr:  0x00021e39
00> [00:00:00.254,669] <err> os:  xpsr:  0x81000000
00> [00:00:00.254,699] <err> os: Faulting instruction address (r15/pc): 0x00017a28
00> [00:00:00.254,730] <err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0
00> [00:00:00.254,730] <err> os: Current thread: 0x2000a740 (unknown)
00> [00:00:00.525,024] <err> fatal_error: Resetting system

So I understand that I need to change my board from nrf5340dk_nrf5340_cpuapp_ns to nrf5340dk_nrf5340_cpuapp.

In this mode, the application works without errors.

However, I would like to understand more about these boards because now I see a yellow triangle with the following suggestion:

"You are going to build without Cortex-M Security Extensions. Consider selecting the nrf5340dk_nrf5340_cpuapp_ns board target to better protect sensitive assets and code. In the _ns version of the board target, TF-M is automatically built as the secure firmware image."

So can you help me understand what is the difference between nrf5340_cpuapp and nrf5340_cpuapp_ns?

Why can't I use nrf5340_cpuapp_ns and I2C module together?

At this point is it better to use nrf5340_cpuapp instead of nrf5340_cpuapp_ns? Does "ns" stand for not sure?

Thank you.

  • Hi

    There is the TF-M(TrustZone) by ARM that is being used with the nRF5340. It allows to split the MCU into secure and non-secure partitions. When using the nRF5340_cpuapp, which is the secure application core configuration, this setup runs the code with complete access to all resources and can also manage security-sensitive tasks and data.

    When using the nRF5340_cpuapp_ns, which is the non-secure application core configuration, this is mainly used to run codes that don't need security sensitive tasks or data directly. Here, secure tasks are handled separately by a secure firmware usually implemented by TF-M.

    Often the non-secure application might not have permissions to directly access peripherals like I2C and hence you might have seen the error when using "ns" as this access might be blocked. If you are using the ns, then you would need to make sure that the TF-M that is used is properly configured t allow access to the peripheral. But better would be to use the secure application configuration.

    Regards,

    Priyanka

Related