Это видео недоступно.
Сожалеем об этом.

Raspberry Pi Pico PIO - PIO Interrupts using C - Ep. 19

Поделиться
HTML-код
  • Опубликовано: 18 авг 2024
  • Join David as he explores PIO interrupts on the RP2040. After diving into interrupt theory, we examine how to use the C/C++ SDK to identify and clear multiple state machine interrupts using both callback functions and interrupt polling, identifying which state machine triggered an interrupt, and how to synchronize state machines using interrupts. Differences between NVIC and State Machine Interrupts are addressed.
    Program files for Episode 19: github.com/Lif...
    Raspberry Pi Pico APIs:
    raspberrypi.gi...
    RP2040 Datasheet:
    datasheets.ras...
    Raspberry Pi Pico C/C++ SDK: datasheets.ras...
    Getting Started with the Raspberry Pi Pico: datasheets.ras...
    PIO Episode 7 - C/C++ SDK:
    • Raspberry Pi Pico PIO ...
    PIO Episode 6 - VGA Video and C/C++:
    • Raspberry Pi Pico PIO ...
    To build you will need to install some extra tools. • Arm GNU Toolchain (you need the filename ending with -arm-none-eabi.exe) • CMake • Build Tools for Visual Studio 2022 • Python 3.10 • Git---See "Getting Started with the Raspberry Pi Pico" above.
    00:00 - Introduction
    01:18 - RP204 Interrupt Overview
    02:15 - PIO Interrupt Details
    05:50 - C/C++ SDK CMake process review
    07:34 - Identify and clear multiple PIO interrupts using callback
    19:08 - Identify and clear multiple PIO interrupts using polling
    21:13 - Which state machine triggering an interrupt?
    22:48 - Synchronizing multiple state machines
    24:21 - Additional callback considerations
    25:43 - Closing
    Music:
    (Pinnacle 25 royalty-free music):
    Pulsing Dance
    House Fever
    Reaction Time
    City Night Groove
    Movie clip - "The Blues Brothers"; Universal Pictures, 1980

Комментарии • 43

  • @MordecaiV
    @MordecaiV Год назад +16

    I know you'll probably have more popular videos with micropython, but I really really appreciate the c level videos.

    • @LifewithDavid1
      @LifewithDavid1  Год назад +4

      I like C so much better. Yeah, it's a little more complicated; but you have much better control with C. You'll see how much better C is with interrupts than MicroPython. Thanks for watching!

  • @davidmiddleton2927
    @davidmiddleton2927 Год назад +4

    I am very impressed and grateful for your efforts

  • @Steven-jf4cs
    @Steven-jf4cs 6 месяцев назад

    I've seen many interrupt introductions and this was by far the best! Top drawer!

  • @goowatch
    @goowatch Год назад +2

    Thank you! I learned a lot. Your explanations are the best

  • @kamals4905
    @kamals4905 Год назад +1

    Best tutorial I've ever watched about pio
    As i understand with this example, here is second scenario,
    Drive addressable led (neopixel or ws2812)with any other mcu,
    Decode that signal with pio instance ,by doing that
    I think it will be easy to understand more clearly
    Thanks👍

    • @LifewithDavid1
      @LifewithDavid1  Год назад

      Glad you liked it. I'll have to look at neopixel. I see there are exercises in the SDKs. Thanks for watching!

  • @danman32
    @danman32 8 месяцев назад

    I encountered kernel panics too when i used interrupt callback in ESP32 to indicate when an ADC sample was ready to calculate RMS voltage to current routine.
    Solution there was to use RTOS built into the ESP32 framework.
    In the case of the Pico, the so-called crash may be the watchdog timer, which was the issue with the ESP32. Interrupt callbacks on ESP32 would hold up all other background housekeeping, including clearing the watchdog timer in a timely manner.

    • @LifewithDavid1
      @LifewithDavid1  8 месяцев назад

      I expect you are correct. I've done interrupts using bare metal with no watchdog tmer and they are rock solid. Thanks for the comment!

  • @honorbean2973
    @honorbean2973 7 месяцев назад

    Wow this is impressive. Nice work!

  • @sapiosuicide1552
    @sapiosuicide1552 5 месяцев назад

    This video saved my life

    • @LifewithDavid1
      @LifewithDavid1  5 месяцев назад

      Wow, that's a lot of pressure! Thanks for watching (and living). :-)

  • @28add11
    @28add11 Год назад

    Thanks! Very helpful to learn about all the C interrupts.

  • @jimm7001
    @jimm7001 Год назад +1

    David, you "compiled" a lot of information into this video! Nice presentation. But, a tangential question: We appear to be at around 100 videos. Do you know what the rating is for the service life of the Vid-Shirt?
    Thanks.

    • @LifewithDavid1
      @LifewithDavid1  Год назад +1

      Thank you. We handle it with museum curator gloves and wash it periodically. LOL.

  • @markday3145
    @markday3145 Год назад

    "All modern processors use interrupts." It warmed my heart to see a 6502 among the modern processors. Interrupts were simpler back then...

    • @LifewithDavid1
      @LifewithDavid1  Год назад +1

      Yea, I purposely threw that in. As you can see from some of my previous videos, I really like the 6502. It was cutting edge when I started designing my computer. In fact I have a 3rd quarter 1975 version in a ceramic and gold DIP. You are right; interrupts were much simpler. Thanks for watching!

  • @davidkender4660
    @davidkender4660 9 месяцев назад

    David,
    Can all your assiduous effort be translated into an equivalent Pico library routine (using the Arduino IDE) of mimicking the Arduino's Interruption Service Routine along with attachInterrupt?
    It would stupendous if the Pico hardware interrupt worked on multiple GPIO pins with Modes RISING, FALLING, CHANGE; but I would be ecstatic with only one Pico GPIO pin and any of the modes.
    Thank you for all of your diligent work and brilliant video tutorials.
    Dave K

    • @LifewithDavid1
      @LifewithDavid1  9 месяцев назад

      Thank you for the comment and suggestion. I will have to look into that. Unfortunately, I'm not very familiar with the Arduino Interrupt Service routine; so it will take a bit of study before I can figure out what to do. In my last video, I did use interrupts; but not for GPIO. Thanks for watching!

  • @martinbonfiore7871
    @martinbonfiore7871 2 месяца назад

    Great series! I am trying to understand a program that I found that uses IO_IRQ_BANK0 and I am not understanding. It seems to different and maybe powerful but why someone would use it is not clear. Any help or pointers to info would be greatly appreciated.

    • @LifewithDavid1
      @LifewithDavid1  2 месяца назад

      Bank 0 is the GPIO. IO_IRQ_BANK0 refers to NVIC interrupt #13 (table 80 of the RP2040 datasheet). Check out section 2.19.5.2. "Enable a GPIO interrupt" of the RP2040 datasheet to help understand how to use GPIO Interrupts. You would use GPIO interrupts so you don't always have to check the status of the GPIO. Instead, let the interrupt start an interrupt service routine when the GPIO changes state. Then the core can do something productive, like comprehending its navel, while waiting for a GPIO to fire. It does take a bit of head scratching to understand how to set up these interrupts. Good luck!

    • @martinbonfiore7871
      @martinbonfiore7871 2 месяца назад

      @@LifewithDavid1 Thanks!

  • @deanbell5164
    @deanbell5164 Год назад

    Have you thought about linear power control of AC with triac(s) bye using the PIO?

    • @LifewithDavid1
      @LifewithDavid1  Год назад

      That would take a little thought. An easy way to determine 0 crossing time would be to use the RP2040's built in ADC. PIO doesn't access the ADC directly, however, you might be able to do something with DMA; I'm not sure. The other way would be to build a 0 crossing detector circuit and feed that into the PIO. Interesting.

    • @deanbell5164
      @deanbell5164 Год назад

      @@LifewithDavid1 I use a H11AA1 for the zero crossing detection and DMA for the PIO plumbing with interrupts for the triggers. I thought this may a good topic for one of your PIO videos.

    • @LifewithDavid1
      @LifewithDavid1  Год назад +1

      That would be cool. Thanks for the suggestion. There is so many things that little board can do; I hope to do so many projects.

    • @deanbell5164
      @deanbell5164 Год назад

      By the way I have a 1000 steps for the power to (half) phase table, this is for accurate solar power diversion into a 4Kw load. 230V @ 50Hz here in NZL.

  • @fabiovsroque
    @fabiovsroque Год назад

    Hi David, is it true that Pi Pico has only one pin interrupt, or GPIO interrupt per core? I can't beleave, I am devastated...

    • @LifewithDavid1
      @LifewithDavid1  Год назад +1

      If you mean IO_IRQ_BANK0 of the NVIC, then you are right However, since it is part of the NVIC; it is very powerful. I haven't experimented with it much, but I believe you can set it up such that any and/or all GPIO pads can throw an IObank interrupt; it's up to the callback routine to figure out which one. That makes sense because you wouldn't want multiple NVIC interrupts hitting at once for "simultaneous" signals; there would be more racing going on than at the Indy 500. Like I said, I haven't experimented with this; maybe look into the NVIC part of the ARM Cortex M0+ architecture for more information. Thanks for watching!

    • @fabiovsroque
      @fabiovsroque Год назад +1

      @@LifewithDavid1 Thank you very much for the hints!

  • @wktodd
    @wktodd Год назад +1

    Interesting Dave. But ... A Muppet?

  • @robminderman7213
    @robminderman7213 Год назад +2

    Thumbs up for puppets

    • @LifewithDavid1
      @LifewithDavid1  Год назад

      Always wondered what Captain Pico would sound like!

  • @jyvben1520
    @jyvben1520 Год назад

    wow, too much for me, intro ok which suggests we could chain pio statemachines using the register, so when limited by one pio "program" we end with setting a register which then lets the next statemachine do ... (could be wrong but i'll never find out)

    • @LifewithDavid1
      @LifewithDavid1  Год назад

      Maybe MicroPython will be a little less overwhelming. Thanks for watching!