BM-SDK-nRF54L15-IRQ

nRF54L15 DK Board

BM-SDK-V1.0

Hi:

I have debugged the IRQ according to the nrfx demo, but now there is an unresolvable error that requires assistance.

This is an error printed by RTT:

00> [00:00:04.744,266] <err> os: Unhandled IRQn: 219
00> [00:00:04.744,285] <err> os: >>> ZEPHYR FATAL ERROR 1: Unhandled interrupt on CPU 0
00> [00:00:04.807,684] <err> os: Halting system

This is my test code. When I use nRF54 DK press button 0 or 1, an error pops up:

/*
 * Copyright (c) 2025 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

#include <zephyr/kernel.h> /* k_busy_wait() */
#include <zephyr/sys_clock.h> /* USEC_PER_MSEC */
#include <zephyr/logging/log.h>
#include <zephyr/logging/log_ctrl.h>

#include <nrfx_gpiote.h>
#include <hal/nrf_gpio.h>


LOG_MODULE_REGISTER(app, CONFIG_APP_LEDS_LOG_LEVEL);

//---------------------------------------------------------------------------------------------
// GPIOTE
#define BUTTON_0                        NRF_PIN_PORT_TO_PIN_NUMBER(13, 1)
#define BUTTON_1                        NRF_PIN_PORT_TO_PIN_NUMBER(9, 1)
#define BUTTON_2                        NRF_PIN_PORT_TO_PIN_NUMBER(8, 1)
#define BUTTON_3                        NRF_PIN_PORT_TO_PIN_NUMBER(4, 0)

#define GPIOTE_INST                     NRF_GPIOTE20
#define CONFIG_APP_GPIOTE_IRQ_PRIO      0

/* GPIOTE30 ʵ�� */
static nrfx_gpiote_t gpiote_inst = NRFX_GPIOTE_INSTANCE(GPIOTE_INST);

/* PORT �¼��ص���������Ź���ͬһ handler */
static void port_event_handler(nrfx_gpiote_pin_t pin,
                                nrfx_gpiote_trigger_t trigger,
                                void *context)
{
    /* nrfx �����ڲ����Զ�����¼� */
    if (pin == BUTTON_0) {
        LOG_INF("BUTTON_0");
        /* ���� BUTTON_0 �¼� */
    } else if (pin == BUTTON_1) {
        LOG_INF("BUTTON_1");
        /* ���� BUTTON_1 �¼� */
    }
}

ISR_DIRECT_DECLARE(gpiote_30_direct_isr)
{
	//nrfx_gpiote_irq_handler(&gpiote_inst);
	 nrfx_gpiote_irq_handler(&gpiote_inst);  /* ��ʹ�� NRFX_GPIOTE_INST_HANDLER_GET(20) */
	return 0;
}

void Key_Init(void)
{
    int err;

    /* ��ʼ�� GPIOTE20 */
    IRQ_DIRECT_CONNECT(NRFX_IRQ_NUMBER_GET(GPIOTE_INST),
			   CONFIG_APP_GPIOTE_IRQ_PRIO,
			   gpiote_20_direct_isr, 0);

	irq_enable(NRFX_IRQ_NUMBER_GET(GPIOTE_INST));
    
    err = nrfx_gpiote_init(&gpiote_inst, CONFIG_APP_GPIOTE_IRQ_PRIO);
    if (err) {
        LOG_ERR("nrfx_gpiote_init error: 0x%08X", err);
        return;
    }

    /* ʹ�� PORT �¼�������������ͨ����p_in_channel = NULL�� */
    nrf_gpio_pin_pull_t pull_config = NRF_GPIO_PIN_PULLUP;

    /* PORT �¼��������ã�p_in_channel ��Ϊ NULL ��ʾʹ�� PORT �¼��� */
    nrfx_gpiote_trigger_config_t trigger_config = {
        .trigger      = NRFX_GPIOTE_TRIGGER_HITOLO,
        .p_in_channel = NULL,  /* NULL = ʹ�� PORT �¼�����ռ�ö���ͨ�� */
    };

    nrfx_gpiote_handler_config_t handler_config = {
        .handler   = port_event_handler,
        .p_context = NULL,
    };

    nrfx_gpiote_input_pin_config_t input_config = {
        .p_pull_config    = &pull_config,
        .p_trigger_config = &trigger_config,
        .p_handler_config = &handler_config,
    };

    /* ���� BUTTON_0 */
    err = nrfx_gpiote_input_configure(&gpiote_inst, BUTTON_0, &input_config);
    if (err) {
        LOG_ERR("BUTTON_0 configure error: 0x%08X", err);
        return;
    }
    nrfx_gpiote_trigger_enable(&gpiote_inst, BUTTON_0, true);

    /* ���� BUTTON_1������ͬһ handler�� */
    err = nrfx_gpiote_input_configure(&gpiote_inst, BUTTON_1, &input_config);
    if (err) {
        LOG_ERR("BUTTON_1 configure error: 0x%08X", err);
        return;
    }
    nrfx_gpiote_trigger_enable(&gpiote_inst, BUTTON_1, true);
}

int main(void)
{
	LOG_INF("LEDs sample started");

	/* Initialize the LED */
	
    Key_Init();
	while (true) {
		while (LOG_PROCESS()) {
		}

		/* Turn the LED on *

		/* Turn the LED off */


	}

	return 0;
}
5241.prj.conf

Parents
  • Hi Iiu, 

    In your ISR_DIRECT_DECLARE, you define gpiote_30_direct_isr, but in IRQ_DIRECT_CONNECT you reference gpiote_20_direct_isr, which doesn't exist. This means the IRQ vector is not properly connected, leading to the "Unhandled IRQn: 219" fatal error when the GPIOTE20 interrupt fires. Additionally, you are using GPIOTE_INST = NRF_GPIOTE20, but named your ISR gpiote_30_direct_isr.

    Please also check out the example in the NCS BM v1.0.0 Release Notes for Interrupts

    Regards,
    Amanda H. 

  • /*
     * Copyright (c) 2025 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
     */
    
    #include <zephyr/kernel.h> /* k_busy_wait() */
    #include <zephyr/sys_clock.h> /* USEC_PER_MSEC */
    #include <zephyr/logging/log.h>
    #include <zephyr/logging/log_ctrl.h>
    
    #include <nrfx_gpiote.h>
    #include <hal/nrf_gpio.h>
    
    
    LOG_MODULE_REGISTER(app, CONFIG_APP_LEDS_LOG_LEVEL);
    
    //---------------------------------------------------------------------------------------------
    // GPIOTE
    #define BUTTON_0                        NRF_PIN_PORT_TO_PIN_NUMBER(13, 1)
    #define BUTTON_1                        NRF_PIN_PORT_TO_PIN_NUMBER(9, 1)
    #define BUTTON_2                        NRF_PIN_PORT_TO_PIN_NUMBER(8, 1)
    #define BUTTON_3                        NRF_PIN_PORT_TO_PIN_NUMBER(4, 0)
    
    #define GPIOTE_INST                     NRF_GPIOTE20
    #define CONFIG_APP_GPIOTE_IRQ_PRIO      0
    
    
    static nrfx_gpiote_t gpiote_inst = NRFX_GPIOTE_INSTANCE(GPIOTE_INST);
    
    
    static void port_event_handler(nrfx_gpiote_pin_t pin,
                                    nrfx_gpiote_trigger_t trigger,
                                    void *context)
    {
        if (pin == BUTTON_0) {
            LOG_INF("BUTTON_0");
        } else if (pin == BUTTON_1) {
            LOG_INF("BUTTON_1");
    
        }
    }
    
    ISR_DIRECT_DECLARE(gpiote_20_direct_isr)
    {
    	 nrfx_gpiote_irq_handler(&gpiote_inst);  
    	return 0;
    }
    
    void Key_Init(void)
    {
        int err;
    
        IRQ_DIRECT_CONNECT(NRFX_IRQ_NUMBER_GET(GPIOTE_INST),
    			   CONFIG_APP_GPIOTE_IRQ_PRIO,
    			   gpiote_20_direct_isr, 0);
    
    	irq_enable(NRFX_IRQ_NUMBER_GET(GPIOTE_INST));
        
        err = nrfx_gpiote_init(&gpiote_inst, CONFIG_APP_GPIOTE_IRQ_PRIO);
        if (err) {
            LOG_ERR("nrfx_gpiote_init error: 0x%08X", err);
            return;
        }
    
        nrf_gpio_pin_pull_t pull_config = NRF_GPIO_PIN_PULLUP;
    
        nrfx_gpiote_trigger_config_t trigger_config = {
            .trigger      = NRFX_GPIOTE_TRIGGER_HITOLO,
            .p_in_channel = NULL,  
        };
    
        nrfx_gpiote_handler_config_t handler_config = {
            .handler   = port_event_handler,
            .p_context = NULL,
        };
    
        nrfx_gpiote_input_pin_config_t input_config = {
            .p_pull_config    = &pull_config,
            .p_trigger_config = &trigger_config,
            .p_handler_config = &handler_config,
        };
    
        err = nrfx_gpiote_input_configure(&gpiote_inst, BUTTON_0, &input_config);
        if (err) {
            LOG_ERR("BUTTON_0 configure error: 0x%08X", err);
            return;
        }
        nrfx_gpiote_trigger_enable(&gpiote_inst, BUTTON_0, true);
    
        err = nrfx_gpiote_input_configure(&gpiote_inst, BUTTON_1, &input_config);
        if (err) {
            LOG_ERR("BUTTON_1 configure error: 0x%08X", err);
            return;
        }
        nrfx_gpiote_trigger_enable(&gpiote_inst, BUTTON_1, true);
    }
    
    int main(void)
    {
    	LOG_INF("LEDs sample started");
    
    	/* Initialize the KEY */
    	
        Key_Init();
    	while (true) {
    		while (LOG_PROCESS()) {
    		}
    	}
    	return 0;
    }
    

    Hello,

    Sorry, gpiote_30 is to confirm if the error is related to the IO port, from the results it doesn't seem to have anything to do with it. RTT still shows the same error. The above is the modified code. Initialization and instances are modified according to the reference documentation. Can you help me understand why this error is displayed? Are there any things to keep in mind when using the BM SDK?

    Thank you

Reply
  • /*
     * Copyright (c) 2025 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
     */
    
    #include <zephyr/kernel.h> /* k_busy_wait() */
    #include <zephyr/sys_clock.h> /* USEC_PER_MSEC */
    #include <zephyr/logging/log.h>
    #include <zephyr/logging/log_ctrl.h>
    
    #include <nrfx_gpiote.h>
    #include <hal/nrf_gpio.h>
    
    
    LOG_MODULE_REGISTER(app, CONFIG_APP_LEDS_LOG_LEVEL);
    
    //---------------------------------------------------------------------------------------------
    // GPIOTE
    #define BUTTON_0                        NRF_PIN_PORT_TO_PIN_NUMBER(13, 1)
    #define BUTTON_1                        NRF_PIN_PORT_TO_PIN_NUMBER(9, 1)
    #define BUTTON_2                        NRF_PIN_PORT_TO_PIN_NUMBER(8, 1)
    #define BUTTON_3                        NRF_PIN_PORT_TO_PIN_NUMBER(4, 0)
    
    #define GPIOTE_INST                     NRF_GPIOTE20
    #define CONFIG_APP_GPIOTE_IRQ_PRIO      0
    
    
    static nrfx_gpiote_t gpiote_inst = NRFX_GPIOTE_INSTANCE(GPIOTE_INST);
    
    
    static void port_event_handler(nrfx_gpiote_pin_t pin,
                                    nrfx_gpiote_trigger_t trigger,
                                    void *context)
    {
        if (pin == BUTTON_0) {
            LOG_INF("BUTTON_0");
        } else if (pin == BUTTON_1) {
            LOG_INF("BUTTON_1");
    
        }
    }
    
    ISR_DIRECT_DECLARE(gpiote_20_direct_isr)
    {
    	 nrfx_gpiote_irq_handler(&gpiote_inst);  
    	return 0;
    }
    
    void Key_Init(void)
    {
        int err;
    
        IRQ_DIRECT_CONNECT(NRFX_IRQ_NUMBER_GET(GPIOTE_INST),
    			   CONFIG_APP_GPIOTE_IRQ_PRIO,
    			   gpiote_20_direct_isr, 0);
    
    	irq_enable(NRFX_IRQ_NUMBER_GET(GPIOTE_INST));
        
        err = nrfx_gpiote_init(&gpiote_inst, CONFIG_APP_GPIOTE_IRQ_PRIO);
        if (err) {
            LOG_ERR("nrfx_gpiote_init error: 0x%08X", err);
            return;
        }
    
        nrf_gpio_pin_pull_t pull_config = NRF_GPIO_PIN_PULLUP;
    
        nrfx_gpiote_trigger_config_t trigger_config = {
            .trigger      = NRFX_GPIOTE_TRIGGER_HITOLO,
            .p_in_channel = NULL,  
        };
    
        nrfx_gpiote_handler_config_t handler_config = {
            .handler   = port_event_handler,
            .p_context = NULL,
        };
    
        nrfx_gpiote_input_pin_config_t input_config = {
            .p_pull_config    = &pull_config,
            .p_trigger_config = &trigger_config,
            .p_handler_config = &handler_config,
        };
    
        err = nrfx_gpiote_input_configure(&gpiote_inst, BUTTON_0, &input_config);
        if (err) {
            LOG_ERR("BUTTON_0 configure error: 0x%08X", err);
            return;
        }
        nrfx_gpiote_trigger_enable(&gpiote_inst, BUTTON_0, true);
    
        err = nrfx_gpiote_input_configure(&gpiote_inst, BUTTON_1, &input_config);
        if (err) {
            LOG_ERR("BUTTON_1 configure error: 0x%08X", err);
            return;
        }
        nrfx_gpiote_trigger_enable(&gpiote_inst, BUTTON_1, true);
    }
    
    int main(void)
    {
    	LOG_INF("LEDs sample started");
    
    	/* Initialize the KEY */
    	
        Key_Init();
    	while (true) {
    		while (LOG_PROCESS()) {
    		}
    	}
    	return 0;
    }
    

    Hello,

    Sorry, gpiote_30 is to confirm if the error is related to the IO port, from the results it doesn't seem to have anything to do with it. RTT still shows the same error. The above is the modified code. Initialization and instances are modified according to the reference documentation. Can you help me understand why this error is displayed? Are there any things to keep in mind when using the BM SDK?

    Thank you

Children
No Data
Related