What is PIO | Programmable I/O on Raspberry Pi Pico

Поделиться
HTML-код
  • Опубликовано: 8 мар 2021
  • Microcontroller chips, like our own RP2040 on Raspberry Pi Pico, offer hardware support for protocols such as SPI and I2C. This allows them to send and receive data to and from supported peripherals.
    But what happens when you want to use unsupported tech or multiple SPI devices? That’s where Programmable I/O, or PIO, comes in. PIO was developed just for RP2040 and is unique to the chip.
    Learn more: rptl.io/rp2040-get-started
    Subscribe to our channel: rptl.io/youtube
    Looking for kid-friendly projects, educator-led seminars, and information about our non-profit work? Check out the Raspberry Pi Foundation RUclips channel: rptl.io/rpfyt
    BUY A RASPBERRY PI
    --------------
    Raspberry Pi Pico: rptl.io/pico
    Raspberry Pi 4: rptl.io/raspberrypi4
    Raspberry Pi 400: rptl.io/400
    All Raspberry Pi products: rptl.io/products
    Raspberry Pi Store, Cambridge: rptl.io/cambridge
    READ OUR BOOKS & MAGAZINES
    --------------
    The MagPi magazine: rptl.io/themagpi
    HackSpace magazine: rptl.io/hackspace
    Wireframe magazine: rptl.io/wireframe
    Custom PC: rptl.io/custompc
    Raspberry Pi Press online store: rptl.io/raspberrypipress
    GET HELP WITH YOUR RASPBERRY PI
    --------------
    Getting started with your Raspberry Pi: rptl.io/gettingstarted
    Raspberry Pi Help Guides: rptl.io/help
    Raspberry Pi Forums: rptl.io/forums
    Technical documentation: rptl.io/techdocs
    FOLLOW US
    --------------
    Twitter: rptl.io/twitter
    Instagram: rptl.io/instagram
    Facebook: rptl.io/facebook
    Raspberry Pi blog: rptl.io/blog
    SUPPORT RASPBERRY PI FOUNDATION
    --------------
    Free coding projects: rptl.io/rpfprojects
    Digital Making at Home: rptl.io/dmah
    Free online courses: rptl.io/rpfcourses
    Raspberry Pi Foundation: rptl.io/rpf
    Donate: rptl.io/donate
    #RaspberryPi
  • НаукаНаука

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

  • @McTroyd
    @McTroyd 2 года назад +20

    You guys really nailed it with the PIO on the RP2040. This is cool on so many levels, from introducing the basics of Assembler to a Python user, to solving the timing problems you mention in this video. Looking forward to seeing what comes next!

  • @AndrewTubbiolo
    @AndrewTubbiolo 3 года назад +40

    My grandpappy told me that PIO stands for Pilot Induced Oscillation.

    • @hand-somepaws9285
      @hand-somepaws9285 2 года назад +3

      He ain't wrong

    • @packratswhatif.3990
      @packratswhatif.3990 2 года назад +2

      I thought it meant : Pigs In Outer-Space .

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

      Parallel Input Output

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

      @@packratswhatif.3990 Not quite, since outer space isn't hyphenated. Try "Pigs In Orbit" instead.

  • @BrownianMotionPicture
    @BrownianMotionPicture 2 года назад +3

    PIO is a great gift to the world. Thank you RPTL.

  • @rondamon4408
    @rondamon4408 3 года назад +10

    Very interesting! I'm really enjoying my pico

  • @NextLevelCode
    @NextLevelCode 3 года назад +9

    I hope you guys make a version with WiFi /Bluetooth. Would be amazing. Like an ESP32 + Pico baby.

  • @joeblow6088
    @joeblow6088 3 года назад +4

    Cool video, and great explanation! I've had issues with checking for button input while executing other code. It's probably mostly due to the fact that I'm not very good at coding, but it will be helpful to learn to use State Machines for things like that. NeoPixels are also a great example, because it's something I add to most of my projects. Looking forward to your future videos!

    • @jyvben1520
      @jyvben1520 3 года назад

      do you use an irq handler, that works fine for button,
      use pull=Pin.PULL_DOWN (the button delivers 3.3v when pressed)
      use pull=Pin.PULL_UP ( the button connects to ground when pressed )
      import machijne # or from machine import Pin, disable_irq, enable_irq
      buttonX=machine.Pin(2, machine.Pin.In, pull=machine.Pin.PULL_DOWN)
      buttonX.irq(trigger=machine.Pin.IRQ_RISING, handler=pin_irq)
      buttonXwaspressed = False # variable you can check in your main loop, reset it when your code has acted on it.
      def pin_irq(pin):
      state = machine.disable_irq() # no interrupt while handling this one
      # change a variable or act on another pin, if using a variable then
      global buttonXwaspressed # essential to use the global already existing variable
      buttonXwaspressed = True # let your main loop react to this
      machine.Pin(25).value(1) # example, act on hardware, onboard led is turned on.
      #end handler with
      machine.enable_irq(state) # all irq handlers will act as expected
      # you can have the irq handler react to which pinname is given in the parameter,
      butn1.irq(trigger=machine.Pin.IRQ_RISING, handler=pin_irq)
      butn2.irq(trigger=machine.Pin.IRQ_RISING, handler=pin_irq)
      in "def pin_irq(pin)" function
      if pin == butn1:
      # change or set ... e.g. ON/1/True
      elif pin == butn2:
      # change or set ... e.g. OFF/0/False or increment (e.g. += 1024)

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

    I made a matrix of 37 x 8 pixels from a single 300 RGB LED strip and used a pi pico to drive it. I mapped the PETSCII font so it can scroll a text that looks like the C64 including all the graphics characters. The micropython program used PIO to push the data to the LEDs with exact timings. I admit I did not write that code myself but it's also pointless trying to re-invent the wheel so I just copied that code. But I can say out of experience that the RP2040 is pretty darn powerful for its price and size. And now you can emulate a C64 with it including a 320x240 display! It uses PIO to exactly time the VGA output signal which is generated on the fly because the Pico does not have enough RAM for a frame buffer.

  • @modm8843
    @modm8843 3 года назад

    Great video

  • @mafhper
    @mafhper 3 года назад +1

    My pico is on the way :)

  • @kavorka8855
    @kavorka8855 3 года назад

    AMAZING!

  • @user-tl7zy4hc7n
    @user-tl7zy4hc7n 2 года назад

    thanks~

  • @siriokds
    @siriokds 2 года назад +1

    It can be useful to make a 5V tolerant gpio Pi Pico.

  • @gulotts
    @gulotts 3 года назад +7

    The morse code was SOS?!! Oh no

    • @neils132
      @neils132 3 года назад +6

      it was “RASPBERRY PI” sent backwards i p y r r e b p s a r

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

    I have to say I see how PIO is useful but as a beginner I thinks it makes thinks like writing a byte to a port much more complicated than it needs to be. Maybe there is a library that can do this but if so haven’t found it yet. Happy to receive advice if anyone has more knowledge that’s. Best regards Chris

  • @randomuser2468
    @randomuser2468 3 года назад +1

    Woohoo!

  • @JosSSMr
    @JosSSMr 3 года назад +7

    Hi, PIO is present in other Raspberry devices or only in Pico? Thanks in advance

    • @2231puppy
      @2231puppy 3 года назад +7

      PIO is only for the RP2040 chips. The other RPis use Broadcomm chips, so they do not have PIO

  • @markharrisllb
    @markharrisllb 2 года назад +1

    Don't ESP32s have PIO? Or is my naivety showing?

  • @duncanx99
    @duncanx99 3 года назад +5

    The link to more information just results in a 'This Page Can't Be Reached' error...

    • @raspberrypi
      @raspberrypi  3 года назад +6

      Eeek. How about now?

    • @duncanx99
      @duncanx99 3 года назад +4

      @@raspberrypi That now leads to a valid webpage but I can't see anything specifically related to using the PIO - that only seems to be mentioned once, in relation to dithered pixels.
      Maybe I misunderstood what was said in the video...

    • @jyvben1520
      @jyvben1520 3 года назад +1

      a day later, no problemo, results in "www.raspberrypi.org/documentation/rp2040/getting-started/"

  • @AgainPsychoX
    @AgainPsychoX 3 года назад +8

    I wonder, can I make USB port out of those PIO???

    • @gamertron0882
      @gamertron0882 3 года назад +3

      Well... yes but why, why would you do that, there is already a micro usb on the pico

    • @AgainPsychoX
      @AgainPsychoX 3 года назад +5

      @@gamertron0882 My use case is to intercept mouse movement and keys, and make it detect patterns and do stuff - programmable macros for mouse. There are some mouses on the market with functionality like this, but I could use just Pico instead of 50$ mouse + license on their scripting software...
      Other people could use it also for hardware keyloggers, or maybe some fancy USB hubs.

    • @Mr.Leeroy
      @Mr.Leeroy 3 года назад +3

      Just look into USB signal integrity, USB eye test and abandon the idea.. Even if Pico has enough frequency for USB 1.1 Low speed, which is probably not the case.
      You could though poll mouse buttons with your additional MCU like Atmega32u4 and send your macros along the second USB cable or via USB hub IC.

    • @julianbinder2371
      @julianbinder2371 2 года назад +1

      its probably easier to use something like autohotkey or just some python libraries to do that on your computer itself, which is free

  • @TimothyChapman
    @TimothyChapman 3 года назад +2

    What about using this as a USB joystick?

    • @julianbinder2371
      @julianbinder2371 2 года назад +1

      you could just use the on-board usb-connection for that, reading out a USB-joystick should be pretty easy even without PIO

    • @Henry-sv3wv
      @Henry-sv3wv 2 года назад +1

      @@julianbinder2371 someone made usb interface with the PIO for the LULZ

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

    Programmed I/O is not new. Many generations of Parallel ATA / IDE harddisks used PIO for data handling. The disk's label would state the type of interface and the mode of operation (PIO mode x)

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

    No sound at all??

  • @BharatMohanty
    @BharatMohanty 3 года назад +9

    Bought my first ever single board computer (pi zero w)

    • @bg31337
      @bg31337 3 года назад +1

      But keep in mind that an RPi Pico is not a SBC anymore. It's a microcontroller

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

    Morse Code is NOT a series of dots and dashes. It is a series of dits and dahs!

  • @rohitjg
    @rohitjg 3 года назад +6

    When is support for arduino ide coming?

  • @hellterminator
    @hellterminator 3 года назад +9

    It's pronounced "I squared C," not "I two C." It's actually supposed to be stylized I²C as well, but since that wasn't easily doable in the 80s, I2C was accepted.

    • @jamesbrown99991
      @jamesbrown99991 2 года назад +2

      Are you sure it's not pronounced "eye eye see"?

    • @Henry-sv3wv
      @Henry-sv3wv 2 года назад +1

      on avr it's called: TWI - two wire interface

    • @AlexejSvirid
      @AlexejSvirid 6 месяцев назад

      Actually, I²C is Inter-IntegratedCircuit, or Inter-IC protocol. That's why I is squared.

  • @will9twl
    @will9twl 3 года назад

    can anyone identify another MCU that has a PIO too?

  • @RogerTannous
    @RogerTannous 2 года назад +3

    Why do you always try to advertize for MicroPython in your videos while C++ is also possible with RP2040

  • @jaskaranbindra9939
    @jaskaranbindra9939 2 года назад +2

    Is this Mark Zuckerberg's voice?

  • @victorschlim4644
    @victorschlim4644 3 года назад +1

    If my understanding is correct, this is the same as DMAs in other microcontrollers.

    • @wuschelmohr
      @wuschelmohr 3 года назад +3

      No

    • @chinoto1
      @chinoto1 3 года назад +2

      DMA is for streaming a chunk of memory to another controller on the board, such as SPI, PWM, and possibly PIO. You could implement SPI or PWM by using PIO if you wanted. Supposedly you can use PIO to generate signals for VGA.
      I plan to use PIO for my ws2812 lights so I can construct just the GRB array and have PIO handle generating the signal instead of passing a 16x larger signal array to the SPI controller.

    • @massimookissed1023
      @massimookissed1023 2 года назад +1

      DMA is a way of moving data between memory and other devices, without it going through and occupying the core processor.
      Like instructing an intern to move a stack of papers from the filing cabinet to the broom cupboard without having to supervise and micromanage them doing that task.

  • @TyronStDenis
    @TyronStDenis 3 года назад +1

    It’s the only Internet that you always will be Connected to Wi-Fi and Data with this PIO Thing.