Title: nrF9160 NS: Enabling any TWIM (I2C) peripheral causes SecureFault at boot — SFAR=0x20000418 (TF-M secure SRAM), SFSR INVEP+AUVIOL
Environment:
- NCS v3.2.2
- Board: custom nRF9160 NS (TrustZone non-secure image with TF-M)
CONFIG_TFM_LOG_LEVEL_SILENCE=y(disables TF-M secure UART, frees Serial-Box 1)- Zephyr I2C driver:
i2c_nrfx_twim
Symptoms: Adding &i2c3 { status = "okay"; } (or any TWIMx) to the device tree overlay causes a crash immediately at boot, before reaching main(). The fault is caught by tfm_ns_fault_handler_callback in nrf/modules/trusted-firmware-m/fault.c.
Fault registers:
SFSR = 0x49 (bits: INVEP=1, AUVIOL=1, SFARVALID=1)
SFAR = 0x20000418 (inside TF-M secure SRAM: 0x20000000–0x20015FFF)
CFSR = 0
INVEP means NS code attempted to branch to a secure address that is not a valid NSC veneer. AUVIOL means attribution unit violation. The address 0x20000418 is in TF-M's secure SRAM region — not in NS flash, not in a veneer.
What was verified:
- TWIM3 (Serial-Box 3) is correctly set to NS by TF-M SPU (
NRF_SPIM3_S_BASEis in thespu_peripheral_config_non_securelist intarget_cfg_53_91.c) - TWIM1 (Serial-Box 1) is also NS when
SECURE_UART1=OFF(which happens whenCONFIG_TFM_LOG_LEVEL_SILENCE=ysetsCONFIG_TFM_SECURE_UART=n) - SAU is disabled (
SAU_CTRL_ALLNSset) — SPU is the sole gatekeeper - NS VTOR is correct (0x10000)
- Crash happens with any TWIMx, with or without child devices (no ADS1115 driver loaded)
- Crash happens during Zephyr
POST_KERNELI2C driverSYS_INIT, beforemain() - Without
&i2cX { status = "okay"; }the application boots and runs correctly
Suspected cause: Something in the i2c_nrfx_twim driver SYS_INIT path (i2c_nrfx_twim_common_init → nrfx_twim_init → nrfx_prs_acquire / IRQ_CONNECT / pre_init) results in a branch to 0x20000418 in secure SRAM. This could be a function pointer in the NS interrupt vector that was not initialized correctly, or a linker issue placing a symbol at a secure address.
Question: Is there a known issue with i2c_nrfx_twim on nRF9160 NS in NCS 3.2.2? Is there a required board-level DTS property (e.g. memory-regions, zephyr,concat-buf-size) needed for TWIM to initialize correctly from NS context?