Raspberry Pi Pico PIO - Ep. 6 - VGA Video and C/C++

  Переглядів 17,429

Life with David

Life with David

День тому

Join David as he investigates VGA video on a Raspberry Pi Pico (RP2040). What more will we need to know before we can write our own VGA programs?
00:00 - Introduction
00:48 - MicroPython vs. C/C++
01:35 - VGA introduction and Pico Hardware Interface
03:55 - Setting up to Compile C/C++ Code
04:58 - Getting and Compiling the Video Demos
06:44 - Downloading files into the Pico
07:29 - Video Demonstrations
08:53 - How does it work?
10:42 - Closing
Links:
VGA Video Interface Design:
datasheets.raspberrypi.org/rp...
C/C++ Application installation on Windows Computer:
datasheets.raspberrypi.org/pi...
Raspberry Pi Video files:
github.com/raspberrypi/pico-p...
github.com/raspberrypi/pico-e...
Music:
(Pinnacle 19.5 royalty-free music):
Pulsing Dance
House Fever
Reaction Time
City Night Groove

КОМЕНТАРІ: 53
@grantpeterson2524
@grantpeterson2524 2 роки тому
David, your tutorials are so wonderful. Love how you are explaining these concepts for us laymen. I was finally able to get a driver written for my HUB75 LED matrix, driven at 50MHz! This wouldn’t have been possible without an FPGA for me otherwise. Keep it up!
@LifewithDavid1
@LifewithDavid1 2 роки тому
Thanks for your kind words!
@alwatt8011
@alwatt8011 Рік тому
A very good video. I liked the Hollerith cards and Fortran, as I have been there and done that too ;-)
@LifewithDavid1
@LifewithDavid1 Рік тому
Cool, thanks.
@bialasiczek
@bialasiczek 2 роки тому
Thank you David! Wonderful series.
@LifewithDavid1
@LifewithDavid1 2 роки тому
Thanks for watching!
@ranhaber1
@ranhaber1 Рік тому
Enjoying all the series
@LifewithDavid1
@LifewithDavid1 Рік тому
That's great! Thanks for watching.
@yourdailyfails1
@yourdailyfails1 2 роки тому
amazing content really enjoyed vga output on pico.
@LifewithDavid1
@LifewithDavid1 2 роки тому
Thank you, and thanks for watching!
@gary7203
@gary7203 Рік тому
I've really enjoyed your Pico videos. I picked one up a month ago, and used your videos to get me started on the right foot. I decided to use the Arduino IDE, which simplifies the build process. I built an AWG using PDM, and it worked ok, but required a lot of ram for the dma. I changed it to an 8 but DAC (resistor ladder) saving a ton of ram. My only issue was the added cycles every once in a while to perform the chaining and a few cycles in the dac state machine. Then it struck me... create a second state machine that provides the timing for the dac machine. The dac waits for an irq set, clears the irq and writes the data. That works like a champ, with no jitter on my output.
@LifewithDavid1
@LifewithDavid1 Рік тому
Thanks! You've probably seen my AWG videos and the journey toward reducing the jitter. Sounds like you found your solution. Thanks for watching!
@TheDarkelvenangel
@TheDarkelvenangel 2 роки тому
Thanks for this deep dive into PIO I have been trying to workout how to modify the VGA scanline code myself.
@LifewithDavid1
@LifewithDavid1 2 роки тому
You're welcome! Thanks for watching; I hope to get even farther.
@danman32
@danman32 3 місяці тому
Pi Pico SDK environment using Visual Studio Code has improved quite a bit since when this video was created 2 years ago and I highly recommend installing the SDK environment using the Pico SDK installer. As long as you launch VSC using the shortcut the SDK install creates, and you have your CMAKE instructions set up correctly, the VSC will dynamically help you with coding mistakes even before you build/compile your code. It will even provide you the means of finding where a reference, such as a function or variable, is declared, defined or used rather than having to use plain Find all the time. I often make stupid syntax mistakes or misuse of data types, and in the past, such as in Arduino IDE, I would not find out about them until I ran a build. But with the VSC and CMAKE plugin, I find these out while I am writing, lowering the time to fix mistakes.
@LifewithDavid1
@LifewithDavid1 3 місяці тому
Thanks for the tip. I'll have to try Visual Studio the next time I use C/C++. I've looked at it a couple times before; and the learning curve seemed pretty steep at the time. Recently, I've moved to bare metal assembly so I'm not using the SDK at all. But I'll give it a go next time. Thanks for watching!
@megri3441
@megri3441 Рік тому
4:45 you can define it as a persistent variable. System Properties > Environment Variables > New
@LifewithDavid1
@LifewithDavid1 Рік тому
Thank you. I'll try that next time; it should make my life a little easier! :-)
@megri3441
@megri3441 Рік тому
@@LifewithDavid1 dont forget to use absolute full path. The sample is relative path is in the video
@miragj
@miragj 2 роки тому
I love this series on Pico's PIO. It's really helping me wrap my head around it. Are you planning on doing more videos about video generation once you've figured it out? Or will you be moving on to other things with the PIO? I'd love to see more about video generation since as you noted the provided code is a bit complicated.
@LifewithDavid1
@LifewithDavid1 2 роки тому
Thank you. That's a great question. My next steps are to understand video generation more. To do that I need to learn C/C++, the SDK PIO assembler, DMA and two core operation. I'm going to do videos about the journey; with the goal of writing or modifying video code to do something fun or useful with the Pico. After I understand video, I think other PIO functions like audio will be a piece of cake. In this case it's more about the journey since I already have a handful of RPi Zeros that can run rings around the Pico video wise. I'm getting started; however; I can see it's going to take some time to wrap my thick skull around all I need to know. Thanks for the feedback; we'll see where it goes!
@skf957
@skf957 2 роки тому
Thanks for the video. It shows some of the extreme lengths the folks at R-pi went to in order to make the RP2040 the success it is. I have a Pico or four, and I went down the C/C++ route almost from the off. I had major issues installing the toolchain onto W.10, but got there in the end thanks to UKposts, ending up with a viable VSC environment. Much easier (if only because there is a runnable script) was when I did the same thing on a R-pi 3b+ When I went back to the W.10 setup, I found it to be broken. Probably something I’d done, but I won’t be fixing it, instead staying on Linux for this type of thing (and everything else as soon as I can). It just feels “right”. I experimented (cut ‘n’ paste) with PIO and struggled to get my head around it. Not so much the “assembler”, but the C++ helper programs and how they all interact with one another. Beyond my capabilities, but I just know that the RP2040, with a relatively high clock speed (for a MCU), dual cores and 8 state machines - must be capable of some pretty stunning stuff in the right hands. Not mine though. I too worked on System 370 - on DOS/VS then MVS, getting pretty familiar with JCL, EXEC, EXEC2, REXX, VSAM and a lot of the utilities that were in use at that time. Happy days until the bean-counters arrived to spoil the fun. When I retired in 2016, it had become a dire existence. I still miss my early days though, and mucking around with the Pico and the R-pi kind of brings back those memories.
@LifewithDavid1
@LifewithDavid1 2 роки тому
Thanks for watching. I agree that RPi has gone above and beyond and I know they will dominate the microcontroller industry the future. I was thinking I should get a RPi 4 and move toward compiling C/C++ in Linux, W10 seems a little fragile. As you see can see from my videos, I'm enjoy reliving the days of "little" computing. Hopefully these little systems will keep both of our brains sharp during retirement. My issue with JCL was when I was developing a Fortran Finite Element program for class at 3:00 AM, there wasn't any support at the computer center; so I had to figure it out on my own. Nothing like a deadline and trying to learn a new "language".
@skf957
@skf957 2 роки тому
@@LifewithDavid1 Totally agree with respect to keeping our brains sharp - I view these little systems as a more fulfilling alternative to crosswords and other such puzzles.
@miragj
@miragj 2 роки тому
@@LifewithDavid1 WSL (Windows Subsystem For Linux) is a pretty good way to run Linux stuff in W10, so you could probably use that to get the Pi Pico's C/C++ toolchain up and running in linux on W10, without needing a separate computer for linux.
@LifewithDavid1
@LifewithDavid1 2 роки тому
@@miragj Thanks for the tip. I'll have to look into that. Today I really dug into the W10 toolchain and I did make some progress.
@paulspark7287
@paulspark7287 Рік тому
These videos are great. I just wish I could mute the background music.
@LifewithDavid1
@LifewithDavid1 Рік тому
I've toned down the background music on recent videos.
@jorgeferreira6727
@jorgeferreira6727 2 роки тому
Nice video, learned a lot about my new toy. The problem of the exact values for the resistors can be circumvented using an R-2R ladder for the DACs. A bit more bulky but as all the resistors are the same, the exact value is less critical.
@LifewithDavid1
@LifewithDavid1 2 роки тому
Thanks for the info! I'm actually working on a video for an AWG that uses an R-2R DAC
@cbmeeks
@cbmeeks 6 місяців тому
I really enjoy your videos! However, there is one correction. 15bit color is not 225 colors but 32,768 colors. 🙂
@LifewithDavid1
@LifewithDavid1 6 місяців тому
You would certainly think so. I'm not sure why I would have said that unless I saw it in some of the RasPi documentation. I see there have been a lot of corrections to the VGA text recently. Nice catch!
@sapiosuicide1552
@sapiosuicide1552 Місяць тому
Sick
@LifewithDavid1
@LifewithDavid1 Місяць тому
I agree, Graham Sanderson has done a great job! Thanks for watching.
@adambeedle
@adambeedle 2 роки тому
👍👍👍
@LifewithDavid1
@LifewithDavid1 2 роки тому
Thanks for watching!
@Marc_Wolfe
@Marc_Wolfe Рік тому
May I suggest I2S DACs for color signals to cut down on IO pin usage... Might be some with DC blocking, but I'm sure some don't.
@LifewithDavid1
@LifewithDavid1 Рік тому
Thanks, I'll have to look at those. I'm not sure of their max speed. We have to output a new value every 40 nanoseconds. EDIT: I looked into the max speed of the I2S protocol and unfortunately it is about 100 times too slow. Video, even VGA is pretty demanding. Thanks for the suggestion, though. I might have to look into it for sound generation. I'm looking at MIDI now; maybe a tiny synthesizer?
@Marc_Wolfe
@Marc_Wolfe Рік тому
@@LifewithDavid1 Yeah, I tried to come back and edit that comment to say the same; but for some reason it wasn't displaying. Maybe grey scale and some "digital potentiometers"; full speed brightness and some optional color stuff. Wonder how hi res you can go at 60 FPS with just black and white, not grey scale, just full black and full white. Nothing flashy, just information data display stuff. I definitely want to look into that with a Teensy 4.0; found out it has features I want, like USB host and device mode ports simultaneously. Really audio friendly devices; make a graphic equalizer and VU meter or something, along with audio ADC and DAC, plug in an ordinary keyboard and use it as MIDI and to interface with sketch settings adjustments... just throw the kitchen sink at it. Apparently people have done VGA on them already.... Went on a tangent there.
@LifewithDavid1
@LifewithDavid1 Рік тому
@@Marc_Wolfe No problem. For more info on what it takes for video display, please see my PIO episode 12 ( ukposts.info/have/v-deo/knVzn4NsfYdpl4U.html ). That gives the math needed for "low res" VGA at 30 FPS. Grey scale just means you only need one DAC instead of three, but for the same resolution you still need the same speed. For black and white you don't need a DAC at all, just on or off. That should be pretty easy to do. Good luck!
@elektron2kim666
@elektron2kim666 Рік тому
A little control task is quite simple for me to do with it. The rest is quite complicated. At least I like to learn a thing or two more in that world at my own pace.
@LifewithDavid1
@LifewithDavid1 Рік тому
You're right, these micro-controllers are so flexible that they can be used for really simple control or turned into little computers that would rival mainframes of 60 years ago. Something for everyone. Thanks for watching!
@Foryourenjoyment
@Foryourenjoyment Рік тому
How would I do this with a 400 pin breadboard want to make it sleek
@LifewithDavid1
@LifewithDavid1 Рік тому
Maybe put the resistor network on a separate board? Kinda like a hat? Sounds interesting. Good luck!
@Foryourenjoyment
@Foryourenjoyment Рік тому
@@LifewithDavid1 was able to do it thank you I even was able to do hdmi with the help of the rp community thanks a lot!
@LifewithDavid1
@LifewithDavid1 Рік тому
@@Foryourenjoyment Fantastic! It sound pretty cool! Thanks for watching!
@zhouyu9971
@zhouyu9971 Рік тому
Does any chip generate excessive heat which requires a heat sink?
@SpeccyMan
@SpeccyMan Рік тому
The best way to answer that question is with experimenting with overclocking and your finger.
@LifewithDavid1
@LifewithDavid1 Рік тому
In my experience, the Pico running at 125 mHz runs nice and cool for what I used it for. I think a hard overclocking would cook things to the point that a heat sink would be needed; but I don't think so for normal use.
@PeetHobby
@PeetHobby 10 місяців тому
They probably use something like "racing the beam" rendering, without the need for video ram or a framebuffer.
@LifewithDavid1
@LifewithDavid1 10 місяців тому
Yes they do. Each line is calculated just before it it displayed. However, the Mario tiles do sit in some "video RAM".
Raspberry Pi Pico - PIO explained
50:01
Slador
Переглядів 24 тис.
КАК ГЛОТАЮТ ШПАГУ?😳
00:33
Masomka
Переглядів 2,1 млн
The World's Fastest Cleaners
00:35
MrBeast
Переглядів 100 млн
Спектакль для окупантів та ждунів 🤯
00:47
Радіо Байрактар
Переглядів 550 тис.
C64 Pico project - I made a tiny Commodore 64 with a Raspberry Pi Pico!
43:54
silvestron's bits and bytes
Переглядів 22 тис.
Raspberry Pi Pico
16:16
ExplainingComputers
Переглядів 300 тис.
Raspberry Pi Pico LCD Projects
17:25
ExplainingComputers
Переглядів 97 тис.
The world's worst video card?
32:47
Ben Eater
Переглядів 6 млн
Raspberry Pi Pico PIO - Ep. 8 - Introduction to DMA
18:21
Life with David
Переглядів 17 тис.
Write Your Own Emulator for Your Own CPU - Using a Raspberry Pi Pico
32:17
RP2040 hot air reflow solder example
24:07
John Lund
Переглядів 10 тис.
Embedded Programming with Raspberry Pi Pico
1:25:21
Utah Cpp Programmers
Переглядів 4,9 тис.
Vortex Cannon vs Drone
20:44
Mark Rober
Переглядів 13 млн
Как установить Windows 10/11?
0:56
Construct PC
Переглядів 1,5 млн