Got GPIO Interrupt even pin state doesn't change

We have two products which are very much similar and have both an external RTC. So processor (nRF5340) and external RTC are identical. On one product, let's call it WP, everything works fine. On the other product, I call it nWP, we get always interrupts on that GPIO pin that is used for the interrupt output of the external RTC.

According my understanding even the configuration and device tree are identical, with the following exceptions:

  • WP uses a Uart (uart 1), nWP uses I2Cm (i2c1)
  • The pin assignment is different.
    • RTC interrupt on WP: P0.27, on nWP P0.4
    • On nWP there is "around the interrupt pin": P0.0 <=> LED, P0.1 <=> SPI MISO, P0.2 <=> currently not usedGPIO interrupt, P0.3 <=> LED, P0.4 <=> the RTC interrupt with the problem, P0.5 <=> some reset output of another device
    • Other pins are also different

On both products we have the same source code, we only select a different board file.

I checked with an oscilloscope that the RTC interrupt pin is not changing its state. But right from the beginning the ISR is triggered very often.

The pin is configured with (of course in both cases as the same file is taken)

    #define RTC_IRQ_NODE DT_NODELABEL(irq_rtc_pin)
    static const struct gpio_dt_spec rtcIrq = GPIO_DT_SPEC_GET_OR(RTC_IRQ_NODE, gpios, {1});
    static struct gpio_callback rtc_cb;

    void rtc_int(const struct device *dev, struct gpio_callback *cb,
		    uint32_t pins)
    {
	    LOG_INF("rtc interrupt");
    }
    
    gpio_pin_configure_dt(&rtcIrq, GPIO_INPUT | GPIO_PULL_UP);
    gpio_pin_interrupt_configure_dt(&rtcIrq, GPIO_INT_EDGE_FALLING);
    gpio_init_callback(&rtc_cb, rtc_int, BIT(rtcIrqPin));
    gpio_add_callback(rtcIrq.port, &rtc_cb);

Can it be that in the nWP case P0.4 is used somehow internally from another processor module which would then trigger the interrupt?

Another for me not understandable observation is:

When I insert a breakbpoint before the definition of the interrupt (in OZONE debugger) I tried to change the pin state (the RTC output is open drain, so I can change it on my processor) through the register window of the debugger. Under GPIO/P0_S/PIN_CNF[4] I can configure pullup and pulldown resistors. Doing this I see the change on the oscilloscope. But when I change DIR of pin 4 to putput and change the OUT register, I see no change on the oscilloscope. I tried even several DRIVE settings in IN_CNF[4].
When I configure the pin as output I should see changes also, right?

As I'm asking already some questions another "funny" observation I have no explanation for. When Ozone programmed the new image but hasn't startet it yet, the green LED on the non working product (nWP) blinks with about 1 Hz. Doing the same on the working product, no LED gets high. Of course for WP P0.3 is not connected to an LED, there it's SPI_MOSI.
But this blinking starts already before the first assembler instruction of my code is executed. And only when I connect the jlink debugger. Again maybe something that points to some internal usage (but for debugging?).

I'm really out of ideas what to do to get this second product working.

Erwin

Parents
  • Hi,

    Can it be that in the nWP case P0.4 is used somehow internally from another processor module which would then trigger the interrupt?

    That could be. Could you check the compiled devicetree, and see if pin 4 is used for something else?

    In VS Code:

    Alternatively, check the file your_build_folder\zephyr\ zephyr.dts

  • I veryfied again that pin 4 of port 0 is just used for our RTC interrupt. There is just another 0x4 for the internal RTCs. But that's different, right?

    rtc0: rtc@14000 {
                    compatible = "nordic,nrf-rtc";
                    reg = < 0x14000 0x1000 >;
                    cc-num = < 0x4 >;
                    interrupts = < 0x14 0x1 >;
                    status = "okay";
                    clock-frequency = < 0x8000 >;
                    prescaler = < 0x1 >;
                    label = "RTC_0";
                };
                rtc1: rtc@15000 {
                    compatible = "nordic,nrf-rtc";
                    reg = < 0x15000 0x1000 >;
                    cc-num = < 0x4 >;
                    interrupts = < 0x15 0x1 >;
                    status = "okay";
                    clock-frequency = < 0x8000 >;
                    prescaler = < 0x1 >;
                    label = "RTC_1";
                };
Reply
  • I veryfied again that pin 4 of port 0 is just used for our RTC interrupt. There is just another 0x4 for the internal RTCs. But that's different, right?

    rtc0: rtc@14000 {
                    compatible = "nordic,nrf-rtc";
                    reg = < 0x14000 0x1000 >;
                    cc-num = < 0x4 >;
                    interrupts = < 0x14 0x1 >;
                    status = "okay";
                    clock-frequency = < 0x8000 >;
                    prescaler = < 0x1 >;
                    label = "RTC_0";
                };
                rtc1: rtc@15000 {
                    compatible = "nordic,nrf-rtc";
                    reg = < 0x15000 0x1000 >;
                    cc-num = < 0x4 >;
                    interrupts = < 0x15 0x1 >;
                    status = "okay";
                    clock-frequency = < 0x8000 >;
                    prescaler = < 0x1 >;
                    label = "RTC_1";
                };
Children
Related