P1.06 of nRF54L15 not working as normal GPIO

Hello Team,

I am using the nrf54l15 custom board for development. I have configured the P1.06 as a normal GPIO as follows:

/ {
	gpio_keys {
		compatible = "gpio-leds";
		ai1: ai1 {
			gpios = <&gpio1 6 (GPIO_ACTIVE_HIGH)>;
			label = "AI1";
		};
	};
};

And using it as follows:

#define AI_NODE                 DT_NODELABEL(ai1)
static struct gpio_dt_spec ai_pin = GPIO_DT_SPEC_GET(AI_NODE, gpios);
ret = gpio_pin_configure_dt(&ai_pin, GPIO_OUTPUT);

uint8_t st;
void main(void)
{
    while(1)
    {
        gpio_pin_set_dt(&ai_pin, 1);
    
    	k_sleep(K_SECONDS(1));
    	st = gpio_pin_get_dt(&ai_pin);
    	printf("TOGGLE,%d\r\n",st);
    
    	gpio_pin_set_dt(&ai_pin, 0);
    
    	k_sleep(K_SECONDS(1));
        st = gpio_pin_get_dt(&ai_pin);
        printf("TOGGLE,%d\r\n",st);
    }
}

The pin status is always read as 0. I have also checked on the oscilloscope, and the pin always stays low.

I have added the following settings to the proj.conf file

CONFIG_BUILD_WITH_TFM=y
CONFIG_TRUSTED_EXECUTION_NONSECURE=y

Am I missing any settings to configure P1.06 as a normal GPIO? Any help would be appreciated.

Thank you,

Payal

  • Hi,

    Since you are building the application as Non-Secure with TF-M enabled, this could be related to SPU (Secure/Non-Secure) ownership of GPIO1. As a first check, could you please try building and flashing the same application without TF-M (remove CONFIG_BUILD_WITH_TFM=y and CONFIG_TRUSTED_EXECUTION_NONSECURE=y, or use a non-TrustZone target if possible) and see if P1.06 starts toggling?

    If it works without TF-M, that would indicate that P1.06 is still attributed to the Secure world and therefore having issues when driven from the Non-Secure application. Also, please confirm the exact board/target used in your build command, especially whether you are building the ns variant.

    Kind Regards,
    Syed Maysum

  • Hi,

    remove CONFIG_BUILD_WITH_TFM=y and CONFIG_TRUSTED_EXECUTION_NONSECURE=y,

    I tried after removing  CONFIG_BUILD_WITH_TFM=y and CONFIG_TRUSTED_EXECUTION_NONSECURE=y, still P1.06 is not toggling.

    use a non-TrustZone target if possible

    After using non-TrustZone, I am getting compilation errors.

    please confirm the exact board/target used in your build command

    board is nrf54l15dk/nrf54l15/cpuapp

  • Hi,

    Thanks for your clarification. The key point here is that P1.06 is used as UART RTS on the nRF54L15, however the documentation states that RTS/CTS pins can be reused as GPIO, when HWFC is disabled on the nRF54L15 SoC.

    So even if you configure P1.06 as a GPIO in your application, GPIO control will not work if any enabled UART still maps P1.06 as RTS (or has HW flow control enabled). In that case, the UART peripheral owns the pin, and GPIO writes will have no effect. So you may try the following steps

    1. Check which UART instance uses P1.06 as RTS on your board in zephyr.dts
    2. Then disable HW flow control on that UART by adding this in your overlay:
      &uartX {
          /delete-property/ hw-flow-control;
      };
    3. Also ensure P1.06 must not appear in any psels group for that UART.

    Once P1.06 is no longer used as RTS by any UART, it should be usable as a normal GPIO output. Please check and confirm if it works.

    Best Regards,
    Syed Maysum

Related