Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8609

General • Spurious GPIO8 interrupts triggered starting sleep mode - INTF forced interrupt issue

$
0
0
Hello everyone,

I'm experiencing a puzzling issue with spurious GPIO interrupts when using sleep functions on RP2040. I've created a minimal test project to isolate the problem and would appreciate any insights.

Project Architecture
My minimal test setup includes:

* Dual-core application: Core0 handles main logic and timer interrupts, Core1 runs a simple polling loop
* Repeating timer: 1kHz timer interrupt for LED management using add_repeating_timer_us()
* GPIO interrupts: 3 GPIO pins configured for edge detection (pins 2, 6, and 8)
* Sleep functionality: Using sleep_goto_sleep_until() for power management

The Problem

When I call sleep_goto_sleep_until(&ts, &sleep_callback), GPIO8 starts generating continuous spurious interrupts, even though:

1. No physical signal changes occur on GPIO8
2. GPIO8 interrupt was properly disabled before sleep
3. All GPIO interrupt registers were cleared before sleep
4. The pin function was reset (deinit/reinit cycle)

Debug Observations

Using a debugger with breakpoints in gpio_default_irq_handler(), I discovered:

* The spurious interrupts are triggered by irq_ctrl_base->intf[1] = 0x2
* This indicates a forced interrupt on GPIO8 (register 1, bit 1 = GPIO8)
* The interrupt appears immediately after sleep_goto_sleep_until() is called
* The interrupts occur continuously until the system is reset

See picture with intf[1] value : https://github.com/Phelix2003/minimal_t ... d5b578.png

Code Structure : https://github.com/Phelix2003/minimal_test

Questions

1. Why does sleep_goto_sleep_until() cause forced interrupts (intf register) on GPIO8?
2. Is this a known issue with sleep functions and GPIO interrupt interaction?
3. Are there specific GPIO pins that should be avoided when using sleep functions?
4. What's the proper way to completely disable GPIO interrupts before sleep to prevent this behavior?

Environment

* Hardware: RP2040-based custom board
* SDK Version: Pico SDK 2.2.0
* Build: CMake with standard pico_sleep library

The issue is reproducible and occurs specifically with GPIO8. I've verified that no hardware is connected to this pin, and the same code works fine without the sleep call.

Any insights would be greatly appreciated!

Regards,

Jonathan

Statistics: Posted by phelixbel — Sun Sep 07, 2025 8:52 am



Viewing all articles
Browse latest Browse all 8609

Trending Articles