I am trying to configure rp2040 function gpio_set_irq_enabled_with_callback on Pico using Arduino IDE with installed Arduino mbed OS because i need some libraries. When called interrupt happens but then Pico freezes and must be restarted. Input is from button in rotary encoder. Printing is set only to see if it's alive. Is the function badly implemented or is it possibble that it doesn't work in Arduino IDE?
I have tried moving the function to void setup() and all possibble events in function.
Here is link to C/C++ SDK page 121

#define inputSW 18

void button_callback(uint gpio, uint32_t events){
  Serial.println("Interrupt occured");  

void setup() {

void loop() {
  gpio_set_irq_enabled_with_callback(inputSW, 0x04, 1, &button_callback);

1 Answer 1


Problem resolved. Problem seems to be in official Arduino mbed OS RP2040 version 3.0.1.
Works with Raspberry Pi Pico/RP2040 by Earle F./Philhower, version 1.13.2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.