#372

  Переглядів 168,753

Andreas Spiess

Andreas Spiess

День тому

The new Pi Pico has two cores. How can we use both? And: If you want to play with the Pico, this video can save you a lot of time because we will discover the main differences between programming an Arduino and a Pi Pico. After this video, you will know more than 99% of all Pi Pico users. And you know how to avoid some quirks.
I am a proud Patreon of @GreatScott!, @ElectroBOOM , @Electronoobs , @EEVblog , and others
No Docker, No Microsoft Teams, Zoom
Links:
Pi Pico: amzn.to/2ZyCwao or amzn.to/3k2PNSd
Book: hackspace.raspberrypi.org/boo...
The links above usually are affiliate links that support the channel (no additional cost for you).
Supporting Material and Blog Page: www.sensorsiot.org
Github: www.github.com/sensorsiot
My Patreon Page: / andreasspiess
Discord: / discord
If you want to support the channel, please use the links below to start your shopping. No additional charges for you, but I get a commission of your purchases to buy new stuff for the channel
My Amazon.com shop: www.amazon.com/shop/andreassp...
For Banggood bit.ly/2jAQEf4
For AliExpress: bit.ly/2B0yTLL
For Amazon.de: amzn.to/2r0ZCYI
For Amazon UK: amzn.to/2mxBaJf
For ebay.com: ebay.to/2DuYXBp
profile.php?...
/ spiessa
www.instructables.com/member/...
Please do not try to email me. This communication channel is reserved for my primary job
As an Amazon Associate, I earn from qualifying purchases
#no#midroll#ads

КОМЕНТАРІ: 842
@RocketManRC-Electronics
@RocketManRC-Electronics 3 роки тому
A great video as always Andreas! I happened to have the C++ dev environment setup on the bench using a Raspberry Pi 4 and therefore was able to quickly measure the interrupt response time with my oscilloscope. This turned out to be 1.1us when built for debug and 1.0us for release. The release version seems to have some jitter of around 0.1us whereas the debug version doesn't which seems a bit unusual.
@RocketManRC-Electronics
@RocketManRC-Electronics 3 роки тому
To add a bit more to my last comment, I did a some more investigation and it appears that the minimum execution time of a GPIO interrupt handler is 5 us (i.e. even if it does nothing) which seems like an awful lot of overhead. I searched the data sheet for the processor and the SDK documentation and source code but could find no explanation for this behaviour. Probably someone more familiar with the ARM processor architecture will know. Cheers!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you for testing it. This seems to be ok. Of the 1.3 us of the STM32, about half was to set the pin (Arduino is not very fast in this discipline)
@nukular2008
@nukular2008 3 роки тому
@@RocketManRC-Electronics How did you measure the execution time of the isr?
@rianderous8761
@rianderous8761 3 роки тому
Micropython seems to have a "hard = true" option when assigning an IRQ to a pin. Maybe this would also make it a bit faster. Maybe I might try this someday.... docs.micropython.org/en/latest/library/machine.Pin.html
@TheEmbeddedHobbyist
@TheEmbeddedHobbyist 3 роки тому
@@rianderous8761 python will always be slower as it needs an interpreter to run.
@lluisllimargas2637
@lluisllimargas2637 3 роки тому
The cat says: "no more interrupts".
@AndreasSpiess
@AndreasSpiess 3 роки тому
:-))
@VakesanM
@VakesanM 3 роки тому
Nothing like your weekly dosage of your guy with the swiss accent. :)
@AndreasSpiess
@AndreasSpiess 3 роки тому
:-)
@rnbpl
@rnbpl 3 роки тому
shorting the pico's RUN pin to ground causes a hardware reset, it's a pity that there isn't a built in reset button, but adding one isn't too hard
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are right. I still think it should not be the task of the buyer...
@sssxxxttt
@sssxxxttt 3 роки тому
@@AndreasSpiess Reset buttons are also a danger. I've pressed them inadvertently too many times. You could pull the other end of the usb cable to spare the soldered on connector. (Great content and presentation by the way! And that's a cool cat :))
@EvileDik
@EvileDik 3 роки тому
I got so annoyed with having to do this when working on MCU breakout boards, I made a small PCB pass-through board with a gang switch on it to break all USB connections. A small but very nice quality of life improvement.
@richards7909
@richards7909 3 роки тому
I’m not entirely sure, but BenHeck I believe did some magic with the onboard button and a single wire to act as a reset.
@AndersJackson
@AndersJackson 3 роки тому
You don't even need a button. Just connect a Wire from ground to the RUN pin, and you reser the device. I think you need to add that, so we Will stop this nonsens with pulling the USB-cable to reset the device. Just ground RUN pin on the device!
@rjordans
@rjordans 3 роки тому
If you're afraid of wearing out the connector you can always try unplugging the other end of the cable ;-)
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are right. Theoretically. I used a Raspberry pi with an SSD Ethernet, HDMI, and a mouse. Not really convenient to unplug it there...
@VisDeux
@VisDeux 3 роки тому
@@AndreasSpiess I would use one of those usb cord with an inline power switch in that case.
@DinoFancellu
@DinoFancellu 3 роки тому
​@@VisDeuxMany of those are power only, not data, Finding a data cable with a switch is hard​
@marvintpandroid2213
@marvintpandroid2213 3 роки тому
@@DinoFancellu make your own?
@beware_the_moose
@beware_the_moose 3 роки тому
The easy answer is to use a simple usb extension and pull it there
@christianvohwinkel7272
@christianvohwinkel7272 3 роки тому
you can reset the pico by connecting the "run" pin to ground.
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are right. This is what I do now.
@carltone
@carltone 3 роки тому
Andreas, thanks for this very comprehensive introductory tutorial. Your subject / explanation style is excellent.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad you enjoyed it!
@sunwukong6268
@sunwukong6268 2 роки тому
I really like the quality of your explanations. Great visualization and you show the examples very detailed. Thanks for enlightening me so often. I am still pretty new to the topic, but I had lots of fun so far.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Glad it was helpful! And welcome aboard the channel!
@jerrychan1471
@jerrychan1471 3 роки тому
Fastastic and practical info on the fundamentals of utilizing multiple cores! Your explanations are so clear and concise, thank you!
@AndreasSpiess
@AndreasSpiess 3 роки тому
You're very welcome!
@tdtrecordsmusic
@tdtrecordsmusic 3 роки тому
freeRTOS !! Yea, I just started reading the official docs last week. Half way through mastering freeRTOS already. Cool stuff in there. These topics will advance/enhance our lives 4 sure
@AndreasSpiess
@AndreasSpiess 3 роки тому
True! But we have to change our programming styles a little...
@AndersJackson
@AndersJackson 3 роки тому
@@AndreasSpiess and changing programming style from Arduino are just fine, and Good.
@cookinsteve9281
@cookinsteve9281 Рік тому
When you made this video, I was miles away from securing a job in engineering. No degree, no money, self-study. A year later, Mr. Spiess set me on a journey with the pico that allowed me to secure a job as an RF Technician (en route to engineering position) for municipal districts and emergency service radios. Thank you for all the immensely valuable information and education and it is not for granted!
@AndreasSpiess
@AndreasSpiess Рік тому
Congratulations! I am always happy if I can be of help for somebody.
@DraganPanjkov
@DraganPanjkov 3 роки тому
Great tip with the baton, I don't remember reading about it in the book. Thank you Andreas! I also had some issues with threading: it simply did not work when I used VS Code and rshell - but it started to work when I installed Thonny.
@AndreasSpiess
@AndreasSpiess 3 роки тому
I do not think that locks are covered in the book.
@DraganPanjkov
@DraganPanjkov 3 роки тому
@@AndreasSpiess you are correct, they are not covered in the book
@mrdrbernd
@mrdrbernd 3 роки тому
Quality content as always. - And not a mix-up of examples from the book, another unboxing, introduction etc. - He sets the bar high for other UKpostsrs. Thank you!
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are welcome!
@PATRIK67KALLBACK
@PATRIK67KALLBACK 3 роки тому
Grear and informative video, thank you! I have just got my r-pico so I will reproduce the interrupt test you showed in both C++ and python :)
@AndreasSpiess
@AndreasSpiess 3 роки тому
Check the pinned comment about the C++ reaction time...
@Arrowtake
@Arrowtake 3 роки тому
Thanks for digging up all this info. Good prep video while waiting my first picos to arrive any day.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad the content is useful for you!
@HariWiguna
@HariWiguna 3 роки тому
Hi Andreas! I learned a lot from you. Thank you for elevating us to the top 1%!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Welcome in the club ;-)
@jstro-hobbytech
@jstro-hobbytech Рік тому
I love your deep dives Andreas. I'm glad you exist to do them. I had a chuckle at the arduino c++ designation. Another great video.
@AndreasSpiess
@AndreasSpiess Рік тому
Thank you. Glad you like the content.
@glennpoirier8000
@glennpoirier8000 3 роки тому
Thanks Andreas, very timely and very useful tutorial. Another reason to look forward to the weekend!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad you liked the video!
@johnhschuster
@johnhschuster 3 роки тому
As usual a great video with excellent resource links. The Getting started book is worth five pounds, whatever that is in dollars. Threads and interrupts were explained so that mere mortals can grasp it. Keep broadcasting!!
@AndreasSpiess
@AndreasSpiess 3 роки тому
I agree. The foundation does a good job documenting their products.
@dgrantstocker6148
@dgrantstocker6148 Рік тому
Just received some picos yesterday and was interested in using both cores. Perfect timing discovering #372. Thank you!
@AndreasSpiess
@AndreasSpiess Рік тому
Enjoy!
@ncoide
@ncoide 3 роки тому
Awesome video!!! I put a button between ground and PIN run in pico. Now I can connect and disconnect using it
@AndreasSpiess
@AndreasSpiess 3 роки тому
I know and I did it. But on a beginners board in 2021?
@JeremyChone
@JeremyChone Рік тому
Such a nice, informative, and well-produced video. Thanks a lot.
@AndreasSpiess
@AndreasSpiess Рік тому
Glad you liked it!
@tonygoodhew9536
@tonygoodhew9536 3 роки тому
Brilliant, just what I wanted to know but could not work out from the documentation or the Forum. Thank you.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad it helped
@avejst
@avejst 3 роки тому
Great job with the video as always 👍 Thanks for sharing your knowledge to all of us 👍😊
@AndreasSpiess
@AndreasSpiess 3 роки тому
My pleasure!
@wjn777
@wjn777 3 роки тому
Thanks, very useful video. I especially like the footage of your sleepy lab assistant at the end
@AndreasSpiess
@AndreasSpiess 3 роки тому
I will tell her ;-)
@vadik1001
@vadik1001 3 роки тому
greets from ukraine! u have very good english, easily understandable even for non english-speaken guys like me. doing electronics as hobby for 20 years, but still can get some new knowledge from any of your videos. so what we can say about newbies. its a heaven for them. keep it up, man
@AndreasSpiess
@AndreasSpiess 3 роки тому
Cool, thanks!
@klif_n
@klif_n 3 роки тому
Thanks for this, it's exactly what I happened to be looking for. I was trying to find something to do with the 5 Pico's I impulse purchased. Now with some Hall effect sensors and this new found task and interrupt info I think I'm off to the races. Cheers! Oh and the cat snoring at the end is just... awww.. :)
@AndreasSpiess
@AndreasSpiess 3 роки тому
Enjoy your project and the new "feeling" of programming MicroPython...
@_a_x_s_
@_a_x_s_ 3 роки тому
Great! I have just got an LPC55S69 which also has two cores. I am planning to make a quadcopter flight controller with the feature. Your video makes my idea clearer and more valid.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Good luck with your project!
@_a_x_s_
@_a_x_s_ 3 роки тому
@@AndreasSpiess Thank you!
@adilsongoliveira
@adilsongoliveira 3 роки тому
Great video as always Andreas, you made this look quite simple! May I ask you to raise the volume of the audio a bit? Thanks!
@AndreasSpiess
@AndreasSpiess 3 роки тому
I always use the standard for podcasting. But I do not know what UKposts does with it.
@pcost
@pcost 3 роки тому
Andreas!!! Lovely video as *ALWAYS!!* After this video you TRIGGERED me to wish that you eventually make a C++ video for Raspberry Pico, please!!!!!!! Thank you for all your hard work.
@AndreasSpiess
@AndreasSpiess 3 роки тому
I wait till it is supported by the Arduino IDE.
@ethzero
@ethzero 2 роки тому
Excellent! Regarding the RP "reset", I grabbed an old powered USB hub with a switch and inserted it between the Pico and computer.
@AndreasSpiess
@AndreasSpiess 2 роки тому
A good idea! As another possibility, in another video I just added a small button switch...
@anokhautomation4453
@anokhautomation4453 2 роки тому
We respect you Sir a lot. 👍expecting more experimental tutorials from your side 🙏
@AndreasSpiess
@AndreasSpiess 2 роки тому
What are "experimental tutorials"?
@Gabonidaz
@Gabonidaz 3 роки тому
i'm a subscriber of your channel for long time ago and i want you know: your content is always the best, regards from brazil
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you for your nice words!
@shadow7037932
@shadow7037932 3 роки тому
Totally agree with you on the reset button lol. Ran in to that exact same issue when playing around with the cores.
@AndreasSpiess
@AndreasSpiess 3 роки тому
I added now one myself ;-)
@olivierhubertolituks
@olivierhubertolituks 3 роки тому
I like the remark about the 5 cents :) By the way, it's always a plaisure to learn something new with your videos.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thanks! 😃
@umutk5614
@umutk5614 3 роки тому
There are few things that warms my heart like a peacefully snoring sleeping cat 💕
@AndreasSpiess
@AndreasSpiess 3 роки тому
:-)
@sv3glx
@sv3glx 3 роки тому
Amazing as always! Thank you. Kisses to your cat from my cat!
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are welcome. I will tell her...
@psikogeek
@psikogeek 3 роки тому
We all know who is the star of the show.
@javier8246
@javier8246 3 роки тому
Como siempre, señor Andreas, un vídeo muy bueno y muy buena su explicación. Aún no he podido conseguir la placa Pico pero después de ver este vídeo, tengo aún más ganas!
@AndreasSpiess
@AndreasSpiess 3 роки тому
¡Estoy seguro de que recibirás uno pronto!
@antonionava7274
@antonionava7274 3 роки тому
Hey Andreas I love your videos, always with interesting information, and thanks for add spanish subtitles, It allows me to share your videos with my studends. Greetings from México
@AndreasSpiess
@AndreasSpiess 3 роки тому
I do not add the Spanish CCs. It is Luciana, an Argentinean student. I only provide the small fee ;-)
@sameerk12982
@sameerk12982 2 роки тому
Hello from India Andreas... Thank you very much for all the interesting and easy to understand videos... Please make more videos using Pi-Pico and Python.
@AndreasSpiess
@AndreasSpiess 2 роки тому
So far my viewers are not very much interested in the Pico as well as in MicroPython :-(
@haves_
@haves_ 3 роки тому
waiting for your RTOS videos!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Coming soon!
@stephensmith1470
@stephensmith1470 3 роки тому
Great! You've answered 2 of my main pressing questions which are the use of 2 cores and interrupt response time. Disappointed with Micropython slow interrupt response time. I think I'll will wait for the official Arduino IDE support. Hopefully the existing libraries will work as well. Planning to port my application to Pi Pico for more processing power. Currently running on Arduino Uno.
@AndreasSpiess
@AndreasSpiess 3 роки тому
I doubt that all libraries will work from day one on. It took quite a while to get them ready for the ESP8266 or ESP32.
@Bensinn86
@Bensinn86 3 роки тому
Thank you for sharing this global variable 'trick'. That "local variable referenced before assignment" error almost drove me crazy :D
@AndreasSpiess
@AndreasSpiess 3 роки тому
Me too ;-)
@maximus6884
@maximus6884 2 роки тому
This is a great video. You make it sound so simple but I believe you did a lot of hard work to get it done to this level. On a side note, I think that its best we call release() function after accuire() just to release the batton. Just an idea.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Glad it was helpful! Indeed, most of my videos need some research!
@MrMilarepa108
@MrMilarepa108 4 місяці тому
Ok that's the most adorable snoring cat on the internet. I will become a Patreon now just so you can give her more treats.
@AndreasSpiess
@AndreasSpiess 3 місяці тому
Thank you! Indeed, she is very good in snoring!
@janseiffert7799
@janseiffert7799 3 роки тому
Thanks for your video! I'm also very interested in the PIO speed, but have no Pico to measure myself. I guess you could build a simple pin-> pin latency test the following way: - Set up a DMA channel to copy the same byte into the IO-space to change the pin (there are different bit manipulation functions at offsets, like set, reset, toggle) - use the PIO to kick the DMA - Maybe you need a second DMA channel or DMA channel chaining to keep the whole engine running
@AndreasSpiess
@AndreasSpiess 3 роки тому
I wait for the results of the challenge. If this PIO is simple to use I expected many contestants. So far I got none :-(
@jbilander8886
@jbilander8886 3 роки тому
Jan, if you use PIO for example to drive GPIO pins to just generate a square wave the max frequency would be clk_sys/2 (62.5 MHz) since it would take 2 cycles to complete the code below: .wrap_target set pins 1 set pins 0 .wrap
@kroojohn
@kroojohn 3 роки тому
Another Great Video :) thank you. There are definitely a lot to learn from this short video :)
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad it was helpful!
@kroojohn
@kroojohn 3 роки тому
@@AndreasSpiess by the way, have you had any luck yet in using Pico with ESP-01 Module?
@AndreasSpiess
@AndreasSpiess 3 роки тому
I did not try. But it should work if you load the "AT firmware" on the ESP-01
@kroojohn
@kroojohn 3 роки тому
@@AndreasSpiess Just tried it last night, works well.. but definitely need "AT " firmware as you said. Luckily that is standard factory firmware on esp01s .. :)
@ftfarias15
@ftfarias15 2 роки тому
Excellent video and loved to see you cat in the end!
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you very much!
@nerdwerx2292
@nerdwerx2292 3 роки тому
Great stuff!That cat is giving me a good idea though, sleeping sounds great!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Definitively we all can learn that from her ;-)
@tonysfun
@tonysfun 3 роки тому
Just fantastic again Andreas! Thank you!
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are welcome!
@davidweeks1997
@davidweeks1997 3 роки тому
Andreas, have you ever applied this tech to sailing? Seems to be a natural use, where the sailing community can set up spontaneous networks at anchor and perhaps even at sea.
@frankn5216
@frankn5216 3 роки тому
Loved your video, keep it coming!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you! Will do!
@eFeXuy
@eFeXuy 3 роки тому
The reset pin is the pin 30, is labeled "run", pull it down for reset.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thanks for the tip. I already have my reset pin. But a beginner?
@eFeXuy
@eFeXuy 3 роки тому
@@AndreasSpiess It is counter intuitive. It also works for accesing the mass storage mode without disconnecting the USB, assert RUN low, hold the button, release RUN. I don't feel like a lot of people know this, would you put a short video about it?
@AndreasSpiess
@AndreasSpiess 3 роки тому
Did you try with two cores?
@eFeXuy
@eFeXuy 3 роки тому
@@AndreasSpiess I did now, the whole thing resets. Edit: according to RP2040's datasheet: "The chip-level reset subsystem resets the whole chip, placing it in a default state. This happens at initial power-on, during a power supply brown-out event or when the chip’s RUN pin is taken low. "
@AndreasSpiess
@AndreasSpiess 3 роки тому
I tried it too now. I did not see a difference if I pressed the reset together with the boot button or not. It always resets.
@josemartinzamorafernandez5264
@josemartinzamorafernandez5264 Рік тому
Excellent, very well explained. You have another subscriber.
@AndreasSpiess
@AndreasSpiess Рік тому
Welcome aboard the channel!
@marklewus5468
@marklewus5468 3 роки тому
Two comments. After I got my pico last month I did a lot of testing with multicore in Python. Globals do get updated across cores. But it’s non-blocking and (other than @ entry) takes about 1 ms so you should use a blocking mechanism if you’re counting on a variable getting updated. Locks, otoh, can be counted on to be updated in real time on both sides. They are probably using an interrupt to do this so you may take a small performance hit when using locks. About the connector: usb-micro connectors are rated for a minimum of 10,000 careful insertion cycles. Detach from the pico side, not from the computer side. It’s way easier to replace a $4 pico than a USB port on your laptop :) I really enjoy your videos, thanks!
@AndreasSpiess
@AndreasSpiess 3 роки тому
I assume the firmware does the blocking. It has all information to do it. I did not measure how long the locks take. Concerning the USB: On those boards the weak point is never the connector. Always the soldering or even the PCB. Another viewer complained that he lost already a few of these boards because of this fact. I added a reset button ;-)
@MCChubbyUnicorn
@MCChubbyUnicorn 2 роки тому
This is super helpful. I might use C++ instead for my project if the SNES clock/latch pin is too fast for my project. I hope so, because then i might be able to get away with using 0 shift registers instead of 2 per emulated controller
@AndreasSpiess
@AndreasSpiess 2 роки тому
Glad you found the content useful!
@y2ksw1
@y2ksw1 3 роки тому
The weekend I was looking into C++ programming of the Pico and found your example interesting for quick testing a project. C++ is a total overkill for 99% of most projects. But industrial applications may be time critical.
@AndreasSpiess
@AndreasSpiess 3 роки тому
I think, MicroPython is great for prototyping. Creating teh two core synchronization example in C++ is much harder, for example.
@BensWorkshop
@BensWorkshop 3 роки тому
Thank you for alerting me to the Pi Pico. What a useful device for mains powered motor control. I can have one core monitor the mains and set some variables whilst the other one manages the amount of chop the motor gets. Also £4 for an MCU on a board is really cheap.
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are welcome!
@overflow7276
@overflow7276 3 роки тому
Dear Mr. Spiess, I really like your videos and I wondered since you review so many different boards, if you have ever come accross the M5 Stick C. This ESP32 powered board costs 10 Dollars and comed with so many things installed it's amazing. Battery, LCD Display, Gyroscope, Microphone, 3 Buttons, a grove board and a few GPIO pins. I would love if you could tell me what you think of this board. Greetings from Austria!
@LloydSMITH
@LloydSMITH 3 роки тому
Nice tutorial thanks 😉
@AndreasSpiess
@AndreasSpiess 3 роки тому
You're welcome!
@simoncollins6650
@simoncollins6650 3 роки тому
Great video and you get a nice cat mindful moment as well😀
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you for watching till the end ;-)
@CogGrinder
@CogGrinder 3 роки тому
Great video and extra adorable snoozing Dishka!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you for staying till the end ;-)
@dieSpinnt
@dieSpinnt 3 роки тому
Thanks for the video, Andreas:) PIN30 RUN -> RUN is the RP2040 enable pin, and has an internal (on-chip) pull-up resistor to 3.3V of about ~50K Ohms. To reset RP2040, short this pin low. 2021, Raspberry Pi Pico Datasheet, page 7,8. ... RTFD!;)
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are right. See my newest video
@theworldisbetternow
@theworldisbetternow 3 роки тому
Twist: now that we have watched the video as all pico users do, we are no more in the 99% club. Because Andreas educated *all* pico users. The 99% already know about interrupts, two cores etc 😎 Hurry up if you want to be in the 1%-range (for a second).
@AndreasSpiess
@AndreasSpiess 3 роки тому
Interesting point of view. Maybe a topic for a PhD work for a a budding epidemiologist ;-)
@MatheusFP104
@MatheusFP104 3 роки тому
Nice video! Waiting for someone talks about PIO!
@AndreasSpiess
@AndreasSpiess 3 роки тому
You find alredy people demonstrating some example from the Pi foundation. For the moment I have no example where I could use it.
@user-ud3nm5st3z
@user-ud3nm5st3z 2 роки тому
Thanks! a lot has now become clear.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Great to hear!
@mrksaccount123
@mrksaccount123 3 роки тому
Thank you sir! You have now helped me reach the 1%
@AndreasSpiess
@AndreasSpiess 3 роки тому
Excellent!
@iot_cdp
@iot_cdp 3 роки тому
Thank you Andreas for this (and for them all)!! FYI, pulling down the RUN pin resets the board. How do we know which core is used at what time?
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are right with the run pin. And I do not know how to check the core. I am sure there is a command.
@cheaterman49
@cheaterman49 3 роки тому
I am not quite sure with mpy (I don't have a board at hand) but if it's anything like CPython, _thread.current_thread() should tell you that?
@AndreasSpiess
@AndreasSpiess 3 роки тому
Unfortunately this command does not work :-(
@cheaterman49
@cheaterman49 3 роки тому
@@AndreasSpiess Ah, I just checked! In both mpy and CPython, the lower-level primitive is "_thread.get_ident()" ! :-) mpython.readthedocs.io/en/latest/library/micropython/_thread.html#_thread.get_ident (and in CPython for reference: python.readthedocs.io/fr/hack-in-language/library/_thread.html#_thread.get_ident ) My bad :-) I should have RTFD hahaha! EDIT: Being a lower-level primitive, one needs to be careful: this function returns an integer that can be recycled once a thread exits!
@wayne6220
@wayne6220 3 роки тому
Good video as usual. Thank you so much.
@AndreasSpiess
@AndreasSpiess 3 роки тому
My pleasure!
@arnauddurand127
@arnauddurand127 3 роки тому
A video about uasyncio/asyncio for (single core) multitasking would also be useful to many users in my opinion.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Is it available on Micropython?
@arnauddurand127
@arnauddurand127 3 роки тому
@@AndreasSpiess Yes. :-D Have a look at the uasyncio module.
@mahtin
@mahtin 3 роки тому
@@AndreasSpiess yes, I’ve got code working cleanly using uasyncio on the Pico. I’m now, after watching this video, very interested in adding in _threads and seeing how they all work together. Fun times! (PS: great video).
@AndreasSpiess
@AndreasSpiess 3 роки тому
I will have a look at it.
@mysomervda
@mysomervda 3 роки тому
Fantastic video again. You are a few steps ahead of me, I will get to the 1% soon :). I am testing using the PI Pico as a robotics motor controller with motor encoder monitoring. I could get it to track encoder pulses from an irq up to around 16KHz but was measuring encoder pulses per x amount of time (Using the Timer function in micropython so don't need to calculate time since last pulse), so the code I had in the irq callback was simpler, just a increment of count. Because I want to track two motors for a robotic platform the threading will be useful, hopefully I can run the irq callbacks on separate threads without them impacting the IRQ responsiveness.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Did you check your results with an oscilloscope? 1/50us is 20kHz. So your ISR probably takes most of the processing power... IC++ it is much faster, BTW.
@LupinCorp01
@LupinCorp01 3 роки тому
@@AndreasSpiess - I used a function generator to generate the irq for the test. FYI: Video of the test is here ukposts.info/have/v-deo/jIeKfKyuZ3-mtoU.html 10:53 in. The plan if the Pico can't keep up with two motors is to switch over to an ESP32 or Blackpill , worst case I will have to code in C (but am trying to avoid it)
@AndreasSpiess
@AndreasSpiess 3 роки тому
This is probably a little faster than my method. You still can use the second core for that task and use the first core for calculations...
@AdaptivePhenix
@AdaptivePhenix Рік тому
A fine example of why someone needs to break this chicken/egg scenario regarding the Parallax P2. 16KHz is miserable 😁 The best way to use interrupts is _not_ to use them. Apart from the P2's eight parallel processors, its 64 identical "smart-pins" can be pretty much anything one might need. Any pair of pins can decocde/count a quadrature encoder.....even with all eight processors idling. How about a frequency of sysclock/2 ? I am not aware of any dedicated quadrature-counting device that can come close to this. Program in C, BASIC, SPIN, ASM or combine any/all of those languages. If nobody knows about the P2's existence then naturally, nobody will be using it. 😉
@AllAmericanBeaner68
@AllAmericanBeaner68 2 роки тому
Great video and adorable kitty! I wonder if it's possible to program these in C++ or even assembly if you wanted to optimize speed from the dual cores. I have a DSP project I'm working on with 40kHz acoustic detections and these were beginning to look pretty appealing to use for this until you compared the interrupts with ESP and STM uCs. Still very cool though!
@AndreasSpiess
@AndreasSpiess 2 роки тому
You can program the Pico in C++ with the Arduino IDE for example. I do not know if dual core is supported. Maybe you look at my new video about ESP32 and audio?
@AllAmericanBeaner68
@AllAmericanBeaner68 2 роки тому
@@AndreasSpiess Thank you for the suggestion! I just watched your ESP32 video on audio and the Pmod audio card you suggested looks to have the sampling rate we would need (108kHz).
@charly2181
@charly2181 3 роки тому
Great video sir!. Waiting the freeRTOS video!!!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Coming soon!
@rickhunt3183
@rickhunt3183 3 роки тому
This is a great presentation. Lots of good information to use when I can get my hands on a supply of these boards. The only ones currently available in the US are from scalpers charging 3 times or more than companies taking back orders. Perhaps I'll just have to suck it up and wait until March 17 when legitimate orders are fulfilled at a reasonable price. I think there will be a version at some point with WIFI and Blue Tooth to compete with the Esp-32 if the price is comparable. I hope you have a great day.
@AndreasSpiess
@AndreasSpiess 3 роки тому
We will see if they are able to add WiFi. This seems not so easy...
@rickhunt3183
@rickhunt3183 3 роки тому
@@AndreasSpiess I would settle for LoRa over wifi. It would be nice to read sensor data over a distance. In fact I think LoRa would be more useful anyway.
@kosmasraptis8374
@kosmasraptis8374 Рік тому
Well, a WiFi version just came out 2 days ago, not sure if they will make a Bluetooth one too
@rickhunt3183
@rickhunt3183 Рік тому
@@kosmasraptis8374 I saw that it was available, unfortunately they will only let you buy 1 and I want 10. I guess I can suck it up and buy just one. I just hate to pay huge shipping charges on something that cost 6 dollars..I already have a project in mind so I might as well buy the one before they are all gone. The device is technically bluetooth ready but it's not currently activated.
@kosmasraptis8374
@kosmasraptis8374 Рік тому
@@rickhunt3183 Perhaps you can get a Bluetooth shield for that
@PhG1961
@PhG1961 3 роки тому
Excellent comparison. I guess I ordered my Pico's a little too soon. The reset button new release is defenately the next step ! Thnxs for this entertaining sunday morning !
@AndreasSpiess
@AndreasSpiess 3 роки тому
I added a small one myself...
@PhG1961
@PhG1961 3 роки тому
@@AndreasSpiess Indeed a valueble alternative!
@MartinBgelund
@MartinBgelund 3 роки тому
Thank you Andreas, I have been looking for these topics on the Pi Pico and now you provided them in a excellent manner. This is great stuff! Now I only have to find out how to use the Pi Pico as an I2C slave device. I can easily find info on how to use it as master, but nothing on how to use it as a slave. Could you be persuaded to look into this, I think it will be highly appreciated by many people using the Pi Pico:-)
@AndreasSpiess
@AndreasSpiess 3 роки тому
I2C slave is not easy and it tool a while till I found it out for the ATTiny back in the day. In addition, here we need it for Micropython...
@MartinBgelund
@MartinBgelund 3 роки тому
Your video on the ATTiny85 controlled array of ultrasonic sensors communicating over I2C was excellent, and I learned a great deal from it. And you made it look relatively easy, so I began to think that I was missing something since I couldn't find anything on the Pi Pico as an I2C slave device. Is it really that different from the usage as a master? From my perspective the main diffrence is that slave devices have to have an address assigned, the rest is "just" sending and receiving - but I've never made an I2C library, so of course I wouldn't know the gory details.
@AndreasSpiess
@AndreasSpiess 3 роки тому
I do not know if it was difficult. Maybe somebody with the knowledge should create it.
@electronic7979
@electronic7979 3 роки тому
Helpful information
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you!
@brianmoore5454
@brianmoore5454 3 роки тому
Andeas...loving your videos on the Pi Pico. One question please, what is the best way of powering the Pico so that it can operate independently from a USB power source... such as a weather station??
@AndreasSpiess
@AndreasSpiess 3 роки тому
As said in my last video. You can power it in a wide range of voltages.
@trungnguyennguyen336
@trungnguyennguyen336 3 роки тому
Great video. Thank you so much. I can resolve my problem
@AndreasSpiess
@AndreasSpiess 3 роки тому
Happy to help
@XerotoLabs
@XerotoLabs 3 роки тому
Thanks great info as ever.
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are welcome! Is it still cold in Canada?
@jjdawg9918
@jjdawg9918 3 роки тому
Great as always Andreas. I do have to say I really dislike the use of interpreted languages(python) on embedded systems since it is such a waste of processing power compared to compiled languages(C/C++). It does however open up the world to people that would otherwise not be able use these products at all. I have worked with RTOSs for over 30 years and remember people getting fired for using blocking functions such as delay loops, sleep, pause, etc instead of interrupts/message queues. Nice to see you re-introducing this concept to the next generation.
@AndreasSpiess
@AndreasSpiess 3 роки тому
We had this discussion in my video about MicroPython. I predict that high level languages will take over in the next few years for prototype projects where programmer's time is much more expensive than processing time. RTOS are still a very good thing and for me also a "higher level" language where the programmer does not control everything. And you are right: They allow a very different programming style.
@user-jz4wn5qr9c
@user-jz4wn5qr9c 7 місяців тому
Also, it's good for many hobbyists who just create fun trash stuff like me. In such projects, speed often doesn't matter, but the fun and convenient process of development does. I used to program Arduino a lot, but RP Pico is a lot more fun for me.
@Bleibruk
@Bleibruk 3 роки тому
Oh thanks! I want this board and work with c++. Have a lot of potential!
@AndreasSpiess
@AndreasSpiess 3 роки тому
You can do that already now.
@Bleibruk
@Bleibruk 3 роки тому
@@AndreasSpiess of course! I just need to buy it 🤣 I'm from Colombia
@turbotoblast4
@turbotoblast4 2 роки тому
Wow, this video is great, I'll check out your other ones.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Glad you liked it!
@Average_Geo
@Average_Geo 3 роки тому
Now, to get a Pi Pico so I can officially be in the 99% group by experimenting with the information from this video. I am shocked I haven't picked up 5-10 of them already! Great video, well documented and explained. I will reference it when the Pi Pico arrives.
@AndreasSpiess
@AndreasSpiess 3 роки тому
I hope it will help to get a quick start. Especially the variable thing took me quite some time to discover.
@marsa74
@marsa74 3 роки тому
Thanks Andreas! Working with multiple (mutex) semaphores is a pain in the ass when the program becomes larger and especially across libraries. My knowledge of Python is almost zero but it seems to adopt a somewhat more modern monitor concept (notify(), wait_for() etc.) as well. Do you know if this has been ported to the Pico Python dialect as well?
@AndreasSpiess
@AndreasSpiess 3 роки тому
MycroPython does not support the full thread library, just the basic _therad. So you do not have all comfort (for the moment)
@marsa74
@marsa74 3 роки тому
@@AndreasSpiess Thanks for the response.
@qcsupport2594
@qcsupport2594 3 роки тому
Good stuff as always! I prefer coding embedded projects using interrupts and an event loop, and maybe setting low power modes for battery life. Add threading and it quickly gets complicated. I fiind the absolute need to design with finite state machines to clarify the complexity and prevent mistakes. And so far: no embedded programming environment is giving me a satisfying way to code with FSMs. ARGH. (So I design them in documenation only, better than nothing. FSMs conserve sanity.) I'm looking forward to the freeRTOS episode. Having Andreas try things first is also a good way to conserve sanity ;)
@AndreasSpiess
@AndreasSpiess 3 роки тому
I llike state machines but I only use case statements to program them. Tasks open a new way to programing. More like object oriented. You have to pay way more attention because everything can run in parallel...
@sausagehider
@sausagehider 3 роки тому
Another great informative video. I'm a bit torn whether to bother with the Pico or not. There seems to be so much hype over it at the moment with what seems like every man and his dog, (or cat) going over it. All great stuff of course. The Arduino has served us well for years now and with Expressive’s ESP8266 & ESP32 I cannot really see any advantages to using a Pico. I suppose as time goes by there will be something to lift it above the rest. The cost sounds great, in the UK at £3.60, but no one seems to include the shipping during their rave about the Pico, here in the UK the shipping is £2.99, which brings the total to £6.59, that is way over the top I believe. I just paid less than half that for an ESP32 including (now the new tax) and delivery which took just 12 days. It would have been great if they had included built-in WiFi on the chip that surely would have made it more competitive. Although I am probably at the bottom end of the maker pile, it doesn’t appeal to me other than maybe to get one just to play with, same as I did the Seeeduino XIAO. I just hope that all the great makers that post how-to’s don’t abandon the Arduino’s and ESP’s. Dishka is such a great companion to have with you in your workshop!
@AndreasSpiess
@AndreasSpiess 3 роки тому
You do not need a Pico as we saw in my last video...
@markj7572
@markj7572 3 роки тому
Agreed, a reset button is important on any board that will go through many development cycles. It's not just about resetting when it locks up, but also about watching what happens when it is powered up. Yes, there are ways of doing it by button, but 5p extra for a reset button is something I'd happily pay. That said, leave the button off but put pads on the board for me to add it.
@AndreasSpiess
@AndreasSpiess 3 роки тому
I agree. Pads would have been a good alternative. I solved the problem differently (in another video)
@nickhubbard3671
@nickhubbard3671 3 роки тому
Very detailed and a lot covered - thanks Now... designers that don't believe in a reset button do need to have a serious head examination. I designed a PC modem in the 1990s - used a DSP single chip with a controller 8048. The DSP worked great - until it "fell over" - There was no "begin again" control line. The short term solution - power cycle. The fix - scrap the design and go with another DSP design. (One that did have a reset line.) Thanks for the video!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you. In my age I do not forget a reset pin because, as I said, I am a mere mortal ;-)
@nickhubbard3671
@nickhubbard3671 3 роки тому
@@AndreasSpiess ... and a few flashing LEDs!
@McTroyd
@McTroyd 3 роки тому
Come now... we can have a reset "button" by soldering a small jumper to one of the castellated grounds, and just tap the Reset pin. Bonus: If things get too boring, Dishka can start bopping the wire around. 😁 Thanks for the video! Glad to see uPython supports threads on the Pico, even if only in a limited fashion.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Of course I have my reset button now. But does a beginner has to solder in 2021?
@McTroyd
@McTroyd 3 роки тому
@@AndreasSpiess Perhaps not, but they could short the pins... 🤷‍♂️
@user-um3ui1gu9t
@user-um3ui1gu9t Рік тому
Where in the documentation did you found that multithreading is implemented using multicore ? The MicroPython documentation regarding threads is quite minimalist and point to the CPython page, which does not speak about cores... Beside MicroPython also run on single core platform... Thanks
@AndreasSpiess
@AndreasSpiess Рік тому
I do not remember where I read about it :-(
@mrtnsnp
@mrtnsnp 3 роки тому
You can add your own reset button on the 'run' pin (pin #30 on the Pico). If that pin is connected to ground the Pico will reset. This will be even more needed once you start with C/C++ on the Pico, as updating the code will require a mount/upload/unmount cycle.
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are right. I solved the issue with a tiny button. I still think it should not be the task of the buyer...
@mrtnsnp
@mrtnsnp 3 роки тому
@@AndreasSpiess Agreed, but a at least we have a workaround.
@DaveRepairs
@DaveRepairs 3 роки тому
nice presentation !
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you!
@StevenKroeger
@StevenKroeger 2 роки тому
Nice ...you have the Rasta colors on your lights :)
@AndreasSpiess
@AndreasSpiess 2 роки тому
:-)
@zuimelanieforno4654
@zuimelanieforno4654 3 роки тому
Grüezi. Greetings from Hamburg. Thank You for this nice Video. I will try this two Cores thingy... May I ask about setting a defined Frequency (48kHz)? How would it create/generate this Frequency in MicroPython? I assume it would be then C++. I already tried to "grab" analog (Stereo) Signals, thru ADC0 and ADC1 also Headphone´s Ground on ADCGND. It seems to work, but maybe only the positive Amplitude (DC). Thank You in advance, and have a nice Day. c.u. Zui
@AndreasSpiess
@AndreasSpiess 3 роки тому
I think you need a low-level library to drive your ADC. MycroPython is probably not fast enough. And you need a capacitor and a voltage divider to get your average voltage t around 1.5 volts.
@zuimelanieforno4654
@zuimelanieforno4654 3 роки тому
@@AndreasSpiess Danke Herr Spiess. I will try my very Best. Breadboard? Check. Resistance? Check. Capacitor? Check. OK, gonna do some Low-Level Formatting of my Harddrive... lol Can I also cut the Wire to divide the Voltage? Hmmm... I am equipped with some Books. Vogel Fachbuch - Elektrotechnische Grundlagen Franzis verlag - Grundwissen Elektronik Franzis verlag - Aufgaben mit Lösungen Elektrotechnik ...and alot of Willpower, two RPi-Pico´s and a couple of Arduino Uno´s. If I am correct I messed up the Conversion of the Poweroutput... 3 x Books² + Zui = 3000 Watt of Something and no remaining of Chocolate. c.u. Zui and very warm greetings from Hamburg, Germany
@luisinistrosa4399
@luisinistrosa4399 2 роки тому
Excelente video muchas gracias sobre todo por los subtítulos en inglés y español
@AndreasSpiess
@AndreasSpiess 2 роки тому
The Spanish subtitles are made by Luciana, an Argentinean woman
@stanhuang689
@stanhuang689 2 роки тому
That's very useful, thanks.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Glad you think so!
@mrezahoseiny9861
@mrezahoseiny9861 3 роки тому
Many thanks for professional tutorial! Could you please share some idea how one can connect two or more Pico devices (the idea is to distribute a heavy processes to several Pico devices), Again am more interested on how to physically connect and then how to network among them? Thanks for considering my request. Regards
@AndreasSpiess
@AndreasSpiess 3 роки тому
I would use a stronger MCU for more load. But you have the usual suspects like I2C or Serial. Or if you want, you could build your own high-speed connection using PIO.
@WacKEDmaN
@WacKEDmaN 3 роки тому
interesting..thanks Andreas, you always have the timely info for us plebs! :) i might have to get one and try an 8bit amstrad cpc emulator...esp32 is a tiny bit slow... do you know if there is a RGB/VGA out and PS2 keyboard/mouse in for Pi Pico yet? :P idea for pico reset... ..inline switch on the usb power.. i usually power my rpi from a step up/down psu set at around 6v (to overcome losses in usb cable and onboard voltage regulators... its powered by 12v 1a brick.. so it has pleanty of power for my ESP32 and PIs with peripherals
@AndreasSpiess
@AndreasSpiess 3 роки тому
1. I left VGA behind me. So I do not know if somebody did it. 2. I already added a small button. Still, I think it is not my task...
@nicksharp7680
@nicksharp7680 3 роки тому
You can setup VGA out using 5 pins and a few resistors. I've seen the Pi emulating the BBC Micro .
@malch2843
@malch2843 3 роки тому
@@nicksharp7680 I believe I have seen it somewhere on UKposts emulating a Sinclair Spectrum too.
@nicksharp7680
@nicksharp7680 3 роки тому
@@malch2843 I'll have to look for that one 👍🏻
@MilenHristov
@MilenHristov 3 роки тому
Did you try ctrl+d to do a software reset? I use that for micropython on esp32/8266.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Yes. And it usually works. But not if you play with both cores. A problem for sure solved in a future release. But we hope we can program this board also using C++. And there you have no ctrl-c or ctrl-d ;-)
Use the very attractive new ATTINY chips for your projects
14:34
Andreas Spiess
Переглядів 187 тис.
Конгрес голосує за допомогу Україні. Спецефір Голосу Америки
5:43:13
Голос Америки Українською
Переглядів 443 тис.
Ages 1 - 100 Decide Who Wins $250,000
40:02
MrBeast
Переглядів 88 млн
You’ve Never Seen A Race Like This 🚀
00:21
Red Bull
Переглядів 27 млн
In-depth: Raspberry Pi Pico's PIO - programmable I/O!
17:19
stacksmashing
Переглядів 126 тис.
Rutgers University Confirmed: Meshtastic and LoRa are dangerous
13:27
Andreas Spiess
Переглядів 703 тис.
Building a Raspberry Pi Pico Powered ZX Spectrum | #PiPico #zxspectrum
12:43
Raspberry Pi Pico PIO - Ep. 1 - Overview with Pull, Out, and Parallel Port
13:23
What is VGA and How to Use it With a Raspberry Pi Pico
18:28
Gary Explains
Переглядів 48 тис.
Radar Sensors from $3 to over $100: Which one is Best?
14:31
Andreas Spiess
Переглядів 145 тис.
Game Boy games that did the impossible.
15:33
Modern Vintage Gamer
Переглядів 156 тис.
How does NB-IOT and CAT-M1 / LTE-M compare to LoRaWAN (Tutorial)?
21:58
Andreas Spiess
Переглядів 54 тис.
Arduino vs Pico - Which is the Best Microcontroller For You?
20:38
Gary Explains
Переглядів 276 тис.
Это БЕСИТ ВСЕХ пользователей iPhone!!! 😡
28:07
Яблочный Маньяк
Переглядів 24 тис.
The PA042 SAMSUNG S24 Ultra phone cage turns your phone into a pro camera!
0:24
Result of the portable iPhone electrical machine #hacks
1:01
KevKevKiwi
Переглядів 2,1 млн