RP2040 PWM Wrap interrupt?

I have an application where I need to attach the PWM Wrap interrupt on an RP2040. Can anyone point me to any examples of how to do this in the Arduino framework, or outline the basic steps for porting a function from the Pico SDK to Arduino? I know this functionality is provided in the Pi Pico SDK, but I don't think it's exposed in the Arduino framework. I'm using a nano Rp2040 connect.

I think that the Arduino Framework "exposes" most of the SDK. It just doesn't "advertise" it. So you can do stuff like:

void myIRQ() {
}

void setup() {
    irq_set_exclusive_handler(PWM_IRQ_WRAP, myIRQ);
}

Thank you. Where should I search to find other such items? This code compiles on my system, but I don't know where to find the source, e.g. where PWM_IRQ_WRAP is defined.

where PWM_IRQ_WRAP is defined.

The rp2040 datasheet...
Screen Shot 2022-10-10 at 11.58.17 PM

What I meant was, where does the Arduino framework have that definition. I can see it when I'm using vscode, it's in intctrl.h. But I don't know how to find the Arduino version.

Followup question: How would I tell it which PWM instance I want to attach to. I have multiple PWMs running, but only need the interrupt from one of them.

The Arduino install includes a pretty complete copy of the SDK include files, even though it omits the source code (in favor of a binary library.) For example, PWM_IRQ_WRAP is in:
cores/arduino/mbed/targets/TARGET_RASPBERRYPI/TARGET_RP2040/pico-sdk/rp2040/hardware_regs/include/hardware/regs/intctrl.h
(sorta looks like a different directory structure, though. Shallower, which is probably a good thing.)

Okay, got it, thanks.

BTW, I use ID Utils - GNU Project - Free Software Foundation (FSF) to examine "foreign" source. It's a bit like the functions provided by a good IDE ("goto definition", "find occurrences"), only without the IDE. It's great!

WWHackintosh<9738> pwd
/Applications/Arduino-1.8.15.app/Contents/Java/portable/packages/arduino/hardware/mbed_rp2040/3.0.1
WWHackintosh<9738> mkid    # Build ID database (do once!)
WWHackintosh<9739> gid PWM_IRQ_WRAP
cores/arduino/mbed/targets/TARGET_RASPBERRYPI/TARGET_RP2040/pico-sdk/rp2040/hardware_regs/include/hardware/regs/intctrl.h:13:#define PWM_IRQ_WRAP 4
WWHackintosh<9740> 

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.