TAMPC on the nRF54L15-DK

Is it possible to use at least one channel of the TAMPC in a Zephyr application on the nRF54L15-DK? It appears that the channel 0 pins (p1.4 and p1.5) are used by the UART on the DK. According to the tables on the back of the DK board, p1.11 and p1.12 aren't connected to anything. Can those be used for channel 3 of the TAMPC? If so, how do I go about using them to test the PRBS tamper detection? I can compile this code for channel 0, but if I change the reference to channel 3 it doesn't compile.

int tampc_active_shield_init(tampc_callback_t callback)
{
    user_callback = callback;

    /* Clear any pending events */
    nrf_tampc_event_clear(NRF_TAMPC, NRF_TAMPC_EVENT_TAMPER);
#if NRF_TAMPC_HAS_EVENT_WRITE_ERROR
    nrf_tampc_event_clear(NRF_TAMPC, NRF_TAMPC_EVENT_WRITE_ERROR);
#endif

    /* Enable active shield channel 3 */
#if NRF_TAMPC_HAS_ACTIVE_SHIELD_CHANNELS
    nrf_tampc_activeshield_channel_enable(NRF_TAMPC, NRF_TAMPC_ACTIVESHIELD_CHANNEL_3_MASK);
    printk("Active shield channel 3 enabled\n");
#else
    printk("Active shield channels not available on this device\n");
    return -ENOTSUP;
#endif

    /* Enable TAMPER interrupt */
    nrf_tampc_int_enable(NRF_TAMPC, NRF_TAMPC_INT_TAMPER_MASK);

    /* Connect and enable IRQ - TAMPC_IRQn is 220 on nRF54L15 */
    IRQ_CONNECT(TAMPC_IRQn, 1, tampc_irq_handler, NULL, 0);
    irq_enable(TAMPC_IRQn);

    printk("TAMPC initialized, IRQn=%d\n", TAMPC_IRQn);
    printk("INTENSET=0x%08x\n", nrf_tampc_int_enable_check(NRF_TAMPC, NRF_TAMPC_ALL_INTS_MASK));

    return 0;
}

Overlay for configuring p1.11 and p1.12:
/&peripheral_domain {
    tamper0: tampc@5003a000 {
        compatible = "nordic,nrf54l15-tampc";
        reg = <0x5003A000 0x1000>;
        channel-count = <4>;

        /* ASO3 = P1.11, ASI3 = P1.12 */
        aso-pins = <&gpio1 11 GPIO_ACTIVE_HIGH>;
        asi-pins = <&gpio1 12 GPIO_ACTIVE_HIGH>;
    };
};

Parents
  • Hi, 

    What NCS version are you using?

    I can compile this code for channel 0, but if I change the reference to channel 3 it doesn't compile.

    How does it not compile? Could you elaborate further or provide the log?

    Regards,
    Amanda H.

  • Hi Amanda. I'm building using the nRF extensions in VS Code. NCS version 3.2.1.
    Build log attached.

    Executing task: nRF Connect: Build [incremental]: beacon1/build/beacon1 
    
    Building beacon1
    west build --build-dir c:/Users/12162/beacon1/build --domain beacon1
    
    -- west build: building domain(s): beacon1
    [0/1] Re-running CMake...
    Loading Zephyr default modules (Zephyr base (cached)).
    -- Application: C:/Users/12162/beacon1
    -- CMake version: 3.21.0
    -- Cache files will be written to: C:/ncs/v3.2.1/zephyr/.cache
    -- Zephyr version: 4.2.99 (C:/ncs/v3.2.1/zephyr)
    -- Found west (found suitable version "1.4.0", minimum required is "0.14.0")
    -- Board: nrf54l15dk, qualifiers: nrf54l15/cpuapp
    -- Found host-tools: zephyr 0.17.0 (C:/ncs/toolchains/66cdf9b75e/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.17.0 (C:/ncs/toolchains/66cdf9b75e/opt/zephyr-sdk)
    -- Found BOARD.dts: C:/ncs/v3.2.1/zephyr/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts
    -- Generated zephyr.dts: C:/Users/12162/beacon1/build/beacon1/zephyr/zephyr.dts
    -- Generated pickled edt: C:/Users/12162/beacon1/build/beacon1/zephyr/edt.pickle
    -- Generated devicetree_generated.h: C:/Users/12162/beacon1/build/beacon1/zephyr/include/generated/zephyr/devicetree_generated.h
    Parsing C:/ncs/v3.2.1/zephyr/Kconfig
    Loaded configuration 'C:/Users/12162/beacon1/build/beacon1/zephyr/.config'
    Merged configuration 'C:/Users/12162/beacon1/build/beacon1/zephyr/.config.sysbuild'
    No change to configuration in 'C:/Users/12162/beacon1/build/beacon1/zephyr/.config'
    No change to Kconfig header in 'C:/Users/12162/beacon1/build/beacon1/zephyr/include/generated/zephyr/autoconf.h'
    -- Found gen_kobject_list: C:/ncs/v3.2.1/zephyr/scripts/build/gen_kobject_list.py
    CMake Warning at C:/ncs/v3.2.1/zephyr/CMakeLists.txt:2321 (message):
      __ASSERT() statements are globally ENABLED
    
    
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Users/12162/beacon1/build/beacon1
    [1/249] Building C object modules/hal_nordic/modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/ncs/v3.2.1/modules/hal/no[3/249] Building C object CMakeFiles/app.dir/src/main.c.obj
    FAILED: CMakeFiles/app.dir/src/main.c.obj
    C:\ncs\toolchains\66cdf9b75e\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_PSA_CRYPTO_CONFIG_FILE=\"nrf-
    psa-crypto-config.h\" -DMBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE=\"nrf-psa-crypto-user-config.h\" -DNRF54L15_XXAA -DNRF_APPLICATION -DNRF_CONFIG_CPU_FREQ_MHZ=128 -DPICOLIBC_LONG_LONG_PRINTF_SCANF -DUSE_PAR
    TITION_MANAGER=1 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -IC:/ncs/v3.2.1/nrf/drivers/mpsl/clock_control -IC:/Users/12162/beacon1/build/beacon1/zephyr/include/generated/zephyr -IC
    :/ncs/v3.2.1/zephyr/include -IC:/Users/12162/beacon1/build/beacon1/zephyr/include/generated -IC:/ncs/v3.2.1/zephyr/soc/nordic -IC:/ncs/v3.2.1/zephyr/soc/nordic/nrf54l/. -IC:/ncs/v3.2.1/zephyr/soc/nord
    ic/common/. -IC:/ncs/v3.2.1/zephyr/subsys/bluetooth -IC:/ncs/v3.2.1/nrf/include -IC:/ncs/v3.2.1/nrf/lib/multithreading_lock/. -IC:/ncs/v3.2.1/nrf/subsys/bluetooth/controller/. -IC:/ncs/v3.2.1/nrf/test
    s/include -IC:/ncs/v3.2.1/modules/hal/cmsis_6/CMSIS/Core/Include -IC:/ncs/v3.2.1/zephyr/modules/cmsis_6/. -IC:/ncs/v3.2.1/nrf/modules/hal_nordic/. -IC:/ncs/v3.2.1/modules/hal/nordic/nrfx -IC:/ncs/v3.2
    .1/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v3.2.1/modules/hal/nordic/nrfx/bsp/stable -IC:/ncs/v3.2.1/modules/hal/nordic/nrfx/bsp/stable/templates -IC:/ncs/v3.2.1/zephyr/modules/hal_nordic/nrf
    x/. -IC:/ncs/v3.2.1/nrfxlib/softdevice_controller/include -IC:/ncs/v3.2.1/nrfxlib/mpsl/fem/common/include -IC:/ncs/v3.2.1/nrfxlib/mpsl/fem/nrf21540_gpio/include -IC:/ncs/v3.2.1/nrfxlib/mpsl/fem/nrf215
    40_gpio_spi/include -IC:/ncs/v3.2.1/nrfxlib/mpsl/fem/nrf2220/include -IC:/ncs/v3.2.1/nrfxlib/mpsl/fem/nrf2240/include -IC:/ncs/v3.2.1/nrfxlib/mpsl/fem/nrf22xx/include -IC:/ncs/v3.2.1/nrfxlib/mpsl/fem/
    simple_gpio/include -IC:/ncs/v3.2.1/nrfxlib/mpsl/fem/include -IC:/ncs/v3.2.1/nrfxlib/mpsl/fem/include/protocol -IC:/ncs/v3.2.1/nrfxlib/mpsl/include -IC:/ncs/v3.2.1/nrfxlib/mpsl/include/protocol -IC:/U
    sers/12162/beacon1/build/beacon1/generated/library_nrf_security_psa -IC:/ncs/v3.2.1/nrf/subsys/nrf_security/include -IC:/ncs/v3.2.1/modules/crypto/oberon-psa-crypto/oberon/drivers -IC:/ncs/v3.2.1/nrf/
    subsys/nrf_security/src/threading/include -IC:/ncs/v3.2.1/nrf/subsys/nrf_security/src/utils -IC:/ncs/v3.2.1/nrf/subsys/nrf_security/src/drivers/cracen/common/include -IC:/ncs/v3.2.1/nrf/subsys/nrf_sec
    urity/src/drivers/cracen/sxsymcrypt/include -IC:/ncs/v3.2.1/nrf/subsys/nrf_security/src/drivers/cracen/silexpk/target/baremetal_ba414e_with_ik -IC:/ncs/v3.2.1/nrf/subsys/nrf_security/src/drivers/crace
    n/silexpk/include -IC:/ncs/v3.2.1/nrf/subsys/nrf_security/src/drivers/cracen/cracenpsa/include -IC:/ncs/v3.2.1/modules/crypto/oberon-psa-crypto/include -IC:/ncs/v3.2.1/modules/crypto/oberon-psa-crypto
    /library -IC:/ncs/v3.2.1/modules/crypto/mbedtls/library -IC:/ncs/v3.2.1/modules/crypto/mbedtls/include -IC:/ncs/v3.2.1/modules/crypto/mbedtls/include/library -IC:/ncs/v3.2.1/nrfxlib/crypto/nrf_oberon/
    include -IC:/ncs/v3.2.1/nrfxlib/crypto/nrf_oberon/include/mbedtls -isystem C:/ncs/v3.2.1/zephyr/lib/libc/common/include -fno-strict-aliasing -Og -imacros C:/Users/12162/beacon1/build/beacon1/zephyr/in
    clude/generated/zephyr/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft --sysroot=C:/ncs/toolch
    ains/66cdf9b75e/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/v3.2.1/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-
    promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reord
    er-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=C:/Users/12162/beacon1=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v3.2.1/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v3.2.1=WEST_
    TOPDIR -ffunction-sections -fdata-sections -specs=picolibc.specs -std=c99 -MD -MT CMakeFiles/app.dir/src/main.c.obj -MF CMakeFiles\app.dir\src\main.c.obj.d -o CMakeFiles/app.dir/src/main.c.obj -c C:/U
    sers/12162/beacon1/src/main.c
    C:/Users/12162/beacon1/src/main.c: In function 'tampc_active_shield_init':
    C:/Users/12162/beacon1/src/main.c:138:54: error: 'NRF_TAMPC_ACTIVESHIELD_CHANNEL_3_MASK' undeclared (first use in this function); did you mean 'NRF_TAMPC_ACTIVESHIELD_CHANNEL_1_MASK'?
      138 |     nrf_tampc_activeshield_channel_enable(NRF_TAMPC, NRF_TAMPC_ACTIVESHIELD_CHANNEL_3_MASK);
          |                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          |                                                      NRF_TAMPC_ACTIVESHIELD_CHANNEL_1_MASK
    C:/Users/12162/beacon1/src/main.c:138:54: note: each undeclared identifier is reported only once for each function it appears in
    C:/Users/12162/beacon1/src/main.c: In function 'tampc_disable':
    C:/Users/12162/beacon1/src/main.c:163:55: error: 'NRF_TAMPC_ACTIVESHIELD_CHANNEL_3_MASK' undeclared (first use in this function); did you mean 'NRF_TAMPC_ACTIVESHIELD_CHANNEL_1_MASK'?
      163 |     nrf_tampc_activeshield_channel_disable(NRF_TAMPC, NRF_TAMPC_ACTIVESHIELD_CHANNEL_3_MASK);
          |                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          |                                                       NRF_TAMPC_ACTIVESHIELD_CHANNEL_1_MASK
    [15/249] Building C object modules/hal_nordic/modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/ncs/v3.2.1/modules/hal/n[16/249] Building C object modules/hal_nordic/modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/ncs/v3.2.1/modules/hal/nordic/nrfx/drivers/src/nrfx_gpiote.c.obj
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\66cdf9b75e\opt\bin\cmake.EXE' --build C:/Users/12162/beacon1/build/beacon1

  • Try this way: 
    In the Welcome View: the Run west update action under  Manage SDKs > Manage West Workspace.

  • After that update completed, I get build errors if either one of these symbols are in the prj.conf file:

    CONFIG_TAMPC=y
    CONFIG_NRFX_TAMPC=y
  • Executing task: nRF Connect: Build [pristine]: beacon1/build 
    
    Building beacon1
    west build --build-dir c:/Users/12162/beacon1/build c:/Users/12162/beacon1 --pristine --board nrf54l15dk/nrf54l15/cpuapp -- -DDEBUG_THREAD_INFO=On -DCONFIG_DEBUG_THREAD_INFO=y -Dbeacon1_DEBUG_THREAD_INFO=On
    
    -- west build: generating a build system
    Loading Zephyr module(s) (Zephyr base): sysbuild_default
    -- Found Python3: C:/ncs/toolchains/66cdf9b75e/opt/bin/python.exe (found suitable version "3.12.4", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: C:/ncs/v3.2.1/zephyr/.cache
    -- Found west (found suitable version "1.4.0", minimum required is "0.14.0")
    -- Board: nrf54l15dk, qualifiers: nrf54l15/cpuapp
    Parsing C:/ncs/v3.2.1/zephyr/share/sysbuild/Kconfig
    Loaded configuration 'C:/Users/12162/beacon1/build/_sysbuild/empty.conf'
    Merged configuration 'C:/Users/12162/beacon1/build/_sysbuild/empty.conf'
    Configuration saved to 'C:/Users/12162/beacon1/build/zephyr/.config'
    Kconfig header saved to 'C:/Users/12162/beacon1/build/_sysbuild/autoconf.h'
    --
       *****************************
       * Running CMake for beacon1 *
       *****************************
    
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/Users/12162/beacon1
    -- CMake version: 3.21.0
    -- Found Python3: C:/ncs/toolchains/66cdf9b75e/opt/bin/python.exe (found suitable version "3.12.4", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: C:/ncs/v3.2.1/zephyr/.cache
    -- Zephyr version: 4.2.99 (C:/ncs/v3.2.1/zephyr)
    -- Found west (found suitable version "1.4.0", minimum required is "0.14.0")
    -- Board: nrf54l15dk, qualifiers: nrf54l15/cpuapp
    -- Found host-tools: zephyr 0.17.0 (C:/ncs/toolchains/66cdf9b75e/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.17.0 (C:/ncs/toolchains/66cdf9b75e/opt/zephyr-sdk)
    -- Found Dtc: C:/ncs/toolchains/66cdf9b75e/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/ncs/v3.2.1/zephyr/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts
    -- Found devicetree overlay: C:/Users/12162/beacon1/boards/nrf54l15dk_nrf54l15_cpuapp.overlay
    -- Generated zephyr.dts: C:/Users/12162/beacon1/build/beacon1/zephyr/zephyr.dts
    -- Generated pickled edt: C:/Users/12162/beacon1/build/beacon1/zephyr/edt.pickle
    -- Generated devicetree_generated.h: C:/Users/12162/beacon1/build/beacon1/zephyr/include/generated/zephyr/devicetree_generated.h
    
    warning: The choice symbol MBEDTLS_BUILTIN (defined at
    C:/ncs/v3.2.1/zephyr/modules/mbedtls/Kconfig:30, modules\mbedtls\Kconfig:30) was selected (set =y),
    but no symbol ended up as the choice selection. See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_MBEDTLS_BUILTIN and/or look up
    MBEDTLS_BUILTIN in the menuconfig/guiconfig interface. The Application Development Primer, Setting
    Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
    too.
    
    
    Parsing C:/ncs/v3.2.1/zephyr/Kconfig
    C:/Users/12162/beacon1/prj.conf:63: warning: attempt to assign the value 'y' to the undefined symbol TAMPCLoaded configuration 'C:/ncs/v3.2.1/zephyr/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp
    _defconfig'
    Merged configuration 'C:/Users/12162/beacon1/prj.conf'
    Merged configuration 'C:/Users/12162/beacon1/build/beacon1/zephyr/misc/generated/extra_kconfig_options.conf'
    
    Merged configuration 'C:/Users/12162/beacon1/build/beacon1/zephyr/.config.sysbuild'
    
    error: Aborting due to Kconfig warnings
    
    CMake Error at C:/ncs/v3.2.1/zephyr/cmake/modules/kconfig.cmake:387 (message):
      command failed with return code: 1
    Call Stack (most recent call first):
      C:/ncs/v3.2.1/nrf/cmake/modules/kconfig.cmake:112 (include)
      C:/ncs/v3.2.1/zephyr/cmake/modules/zephyr_default.cmake:131 (include)
      C:/ncs/v3.2.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/ncs/v3.2.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:4 (find_package)
    
    -- Configuring incomplete, errors occurred!
    
    CMake Error at cmake/modules/sysbuild_extensions.cmake:530 (message):
      CMake configure failed for Zephyr project: beacon1
    
      Location: C:/Users/12162/beacon1
    Call Stack (most recent call first):
      cmake/modules/sysbuild_images.cmake:43 (ExternalZephyrProject_Cmake)
      cmake/modules/sysbuild_default.cmake:21 (include)
      C:/ncs/v3.2.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:75 (include)
      C:/ncs/v3.2.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      C:/ncs/v3.2.1/zephyr/share/sysbuild-package/cmake/SysbuildConfig.cmake:8 (include)
      template/CMakeLists.txt:10 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    See also "C:/Users/12162/beacon1/build/CMakeFiles/CMakeOutput.log".
    ?[91mFATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\66cdf9b75e\opt\bin\cmake.EXE' -DWEST_PYTHON=C:/ncs/toolchains/66cdf9b75e/opt/bin/python.exe '-Bc:\Users\12162\beacon1\build' -GNinja
    -DBOARD=nrf54l15dk/nrf54l15/cpuapp -DDEBUG_THREAD_INFO=On -DCONFIG_DEBUG_THREAD_INFO=y -Dbeacon1_DEBUG_THREAD_INFO=On '-SC:\ncs\v3.2.1\zephyr\share\sysbuild' '-DAPP_DIR:PATH=c:\Users\12162\beacon1
    

  • Sorry for the late reply.  

    Currently, using DTS or Kconfig in this way is not supported for TAMPC, so it must be done through direct register writes and by working with the MDK.

    We found an issue where Channel 3 is not resolved correctly in nrf_tampc.h. Specifically, NRF_TAMPC_ACTIVESHIELD_CHANNEL_COUNT is not being resolved as expected. This is caused by incorrect symbols being used in the following conditional statements:

    Following symbols defined by MDK in nrf54l15_types.h should be used instead:

    • TAMPC_ACTIVESHIELD_CHEN_CH3_Msk

    • TAMPC_ACTIVESHIELD_CHEN_CH2_Msk

    • TAMPC_ACTIVESHIELD_CHEN_CH1_Msk

    As a temporary software workaround, you can either:

    1. Manually correct the definition in nrf_tampc.h, or

    2. Avoid using the nrf_tampc_activeshield_mask_t enumerators and instead use the MDK symbols directly (e.g., TAMPC_ACTIVESHIELD_CHEN_CHxxx_Msk).

Reply Children
No Data
Related