Run BOTH Cores with Threading On The PICO

Поділитися
Вставка
  • Опубліковано 6 вер 2024
  • While the Raspberry PI PICO is fast and powerful, most people never use the other half of its processing devices - Core 1. The RP2040 has two cores and you can use both of them with MicroPython. This video shows you how to use them to "double" your processing speed. Also covered is the details of how to lock data and other resources so that only one core can access certain data at any given time.
    SEE ASSOCIATED VIDEOS:
    Raspberry Pi PICO Setup and Preparation for Programming • Raspberry Pi PICO Setu...
    PICO Machine Library PIN Class
    • PICO Machine Library P...
    VISIT OUR COMPANION WEBSITE
    makingstuffwit...
    DOWNLOAD FILES HERE
    makingstuffwit...

КОМЕНТАРІ • 21

  • @RandomBitzzz
    @RandomBitzzz Рік тому

    Chris wears an Amiga shirt... gets an automatic thumbs up from me.
    But in all seriousness, this is great info and a great video. Very well put together/presented.

    • @MakingStuffwithChrisDeHut
      @MakingStuffwithChrisDeHut  Рік тому +1

      Hi RandomBitzz, thanks for the kind words, very much appreciated!
      Regarding the Amiga, I still have my Amiga 1000 that has a memory expansion, monitor, and external disk drive. I threw away the mouse and keyboard some years back thinking it was some old PC hardware. I wake up every morning now and kick myself in the private parts for doing that!
      Cheers
      Chris

    • @RandomBitzzz
      @RandomBitzzz Рік тому

      @@MakingStuffwithChrisDeHut I kick myself for not picking up a Commodore SX-64 when I had the chance. I was really big into the 64 and 128.
      My younger brother was the Amiga enthusiast in our household, but I helped him install a few hardware upgrades every now and then. I would have picked one up myself but I found all my money going into two other competing interests. One being a 1968 Camaro that I was restoring and the other being all the girls that would ride along in it 🙂

    • @MakingStuffwithChrisDeHut
      @MakingStuffwithChrisDeHut  Рік тому +1

      @@RandomBitzzz LOL!!!! The reason I wear Pontiac T-Shirts is I had a 1968 Firebird that I had a love affair with. I really miss that car AND all the money I spent on it!!!!
      Cheers!
      Chris

  • @waymamma
    @waymamma Рік тому +1

    Nice video, thanks for taking the time to put this together. You used the term Semaphore to refer to the thread synchronization mechanism, really this should be called a Mutex (or Lock, or Resource). Semaphores serve a slightly different purpose. Anyway, good stuff!

  • @lorisrobots
    @lorisrobots Рік тому +2

    Good info and tips. I am working on when would doing a thread be best versus using interrupts. Any thoughts? Thanks for video!

  • @sameads2703
    @sameads2703 6 місяців тому

    I enjoyed this. Connected a few dots for me. Thank you!

  • @tomek3633
    @tomek3633 Рік тому +2

    Some thoughts on "data transfer between the threads". Instead of the lock/wait, a shared array could be used. core1 pushes new entries while main loop checks if array size > 0 and acts accordingly (removing first element from array when done). Also, a shared object would make sense, containing a value element and a "lockstate" element (boolean value indicating if data is beeing changed or not). Did not try that, but it came up to my mind.

    • @MakingStuffwithChrisDeHut
      @MakingStuffwithChrisDeHut  Рік тому +2

      I like that idea too! It would be interesting to try that when I have time. Thanks for sharing that idea Tomek.
      Cheers!
      Chris

  • @SK-bl1lp
    @SK-bl1lp Рік тому +4

    Hey, please tell someone DIY guys that Python works within 1 process which means it cannot utilize 2 cores until you can run 2 apps simultaneously.

  • @ericsmith7988
    @ericsmith7988 Рік тому +1

    I like your videos, but one thing could you zoom in while you are in your code window, it is hard to see it. I have to get really close to my screen to make out what you are describing. Just a thought. I am learning Micro Python right now; it is different than C++ "Arduino IDE". Thank you.

    • @MakingStuffwithChrisDeHut
      @MakingStuffwithChrisDeHut  Рік тому

      Hi Eric,
      Several other viewers have been letting me know the font size is too small as well. I will certainly try to enlarge the font so that it is more readable. Thanks for letting me know about this.
      Cheers!
      Chris

    • @ke7uia
      @ke7uia Рік тому +1

      @@MakingStuffwithChrisDeHut Yea, perhaps make the font larger in Thonny

  • @jyvben1520
    @jyvben1520 Рік тому

    Interesting, another unused part (in my case) is pio and pio memory, wondering if it can be used to exchange data between cores and/or be used as semaphore.

    • @MakingStuffwithChrisDeHut
      @MakingStuffwithChrisDeHut  Рік тому

      Your curiosity matches mine Ben. I have been wanting to spend some time on the PIO side of the PICO, perhaps later this year I can start exploring there.
      Cheers!
      Chris

  • @OmidAtaollahi
    @OmidAtaollahi Рік тому

    much appreciated 🙏

  • @stumpy1495
    @stumpy1495 3 місяці тому

    Or perhaps learn C and get the equivalent of 10s of cores in processing power....