Turning a Raspberry Pi Pico into a GPU!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] welcome back to element for Te presents I'm Clen and corporate needs me to find the difference between this picture and this picture wait they are the same [Music] picture of course there's a clear distinction between a raspberry Pico and this R monstrous GPU but what if we can turn a Raspberry Pi Pico into some sort of GPU in a previous episode I ran Linux on this little ESP 42 board that I designed and it has a spot for an rp240 but I had to remove it because of a design issue this was meant to act as the GPU for this device and it's finally time to make that happen with the short time frame that I have for each project I tend to rather quickly dive into fully fledged PCB designs for each part but sometimes this doesn't just work out right so it's better to prototype that with a rasper pi Pico and some wires and stuff and then when we know everything works we can put that all together into a new iteration of the whole design so this time we're using a Ras pip PCO to prototype the idea and try to make a GPU for my esp32 uh Linux thing and maybe even for other things of course I'm not inventing the Wheel from scratch there is already a great project called PCO DVI out there which basically takes advantage of the Raspberry Pi Pico's Pio programmable input output pins uh to bitbang DVI signals and DVI is kind of like a subset of HDMI so basically the connectors are compatible but they're not exactly the same signal and also there's a licensing thing with HDMI going so this is a DVI signal in theory this could also work on Old DVI monitors but it should also work on HDMI monitors but those can be finicky and they need to accept a DVI signal so we are already on kind of a wonky track so first we learn about how this pvi stuff works and then I try to find a suitable interface to interface that's basically with my main computer or any computer if we are so inclined to do going directly into the weeds I flashed all the appropriate example files onto my raspberry pipe Pico that also means of course I have to install the Pico SDK uh it's fork for Arduino and the pvi library in my Arduino ID I'm still using 8.19 because that gives me bigger compatible with compatibility with third party boards in my experience and I've sold out a breakout for a generic HDMI breakout with a lot of wires to my Pico that is mounted on a breadboard and let's give it a go uh okay we got the first uh trouble here there's no signal coming out um there could be two reasons one I could have hooked it up wrong or I maybe am missing some components let's check that out so great news Jabs turns out my pinout is right uh it connects to the right signals but not in the right way so I'm missing some components in the Pico DVI documentation there we can find the DVI sock which is basically the dedicated board that you directly sold onto a Pico without any headers in between and that is because of pedance matching and there's also uh documented that the designer L uh I think luk ran is the designer of that originally intended to use caps in between the lines then later changed that to resistors so I think these are meant for matching the impedance of all these lines together and I don't have these here so uh I could either experiment with a lot of resistors but that still doesn't tune the length of wire here which is really hard to do if you actually solder them individually it's much easier on a PCB and I think uh we should rule out that sort of error so I'm ordering some pvi socks and sort that directly to a p Pico and we see if that changes anything yeah looks like soldering a DVI sock directly to the Raspberry Pi is the best one to just not mess up the impedance matching it's not perfect because there is already a contact resistance here but it is better than all my uh wiring jobs I also tried to putting header pins on there which initially did not yield a functioning system but it turns out it was just me flashing the device wrong and now uh both versions work hello I'm James from workbench Wednesdays a show about the stuff found on your electronics workbench look for new episodes on well Wednesday days you can connect with me over on the element 14 Community I look forward to seeing you for now it is time to get back to watching this week's project video all right we got a working thing my work is done or well let's just a Pio outputting some stuff that's not a GPU a GPU takes in signals from a main processor and then converts that into usable data for the screen so it has to do with a bit more than just that so A GPU has this PCI header here and that takes in all the data you need and then it puts it out to HDMI ports which this thing doesn't have because it's a accelerator card imagine the ports here so inside the pcie port there are a lot of lanes these are meant so there is a big amount of data throughput into the card then the card does its computational magic and then it puts out the signal in here there's a hidden bus I can't just have pcie on my ESP 32 but I can have some other buses and inside each pcie bus no matter if it's X1 or x16 there is an icec C Port hidden inside it's called the SM bus and it's actually really cool have you ever plugged in a monitor and then just wondered how does your computer know what resolution that monitor had what brand is it how do they know go over just some cable that just transfers video signals well there's not just video signals in here there's also an i Square C port on here ha and that I Square C Port connects to the PCI port and that is what transferred that data so your computer and your monitor are already talking to each other even though you haven't even installed any drivers or so and by the way VGA also has the exact same connection contion inside so you could hijack that asrac connection on an HDMI or DVI port or on a VGA port even to attach ASC devices to your normal everyday computer H let's exploit that each device on an iare cus has to have a unique address this is the reason why there is usually a mode to give an ascc device a secondary address like they have a default address and if you P pull that or that pin low then it switches to a different address this allows you to have more than one of these on a bus and with a microcontroller and the Arduino IDE I can use the wire library to not just talk to ice CR C devices but I can also turn microcontrollers into icec C devices give them a custom address and then they basically turn into these devices so a different microcontroller like another Pico like an es 32 like a computer system a Linux one could address that iare c device on its iare C bus which is hidden inside the pcie connector and then give commands to it like to a graphics card just a bit slower because the bus is limited to 1 MHz okay so if we have the pie on the uh bus is that already a GPU because it's a device that's talking to the computer and then it outputs the data not not not just I'm breaking out the old 8bit computer again to show that so what these have basically is they have a CPU that is also responsible to draw everything that appears on screen but it puts that to an input output chip and that input output chip converts it into Data that can be displayed and then generates a signal for the SC screen that is attached to it so the device I built so far is basically like this input output chip on an old 8bit computer it takes in the data the CPU wants to draw on screen via the ascra cbus in that case it was an 8bit uh parallel bus and then it converts that via the Ada fruit Graphics Library into uh data that appears on screen so this Graphics library is super useful and a lot of people know how to utilize it and love it so why not take advantage of that and basically make a code that runs on my Pico GPU that understands these commands so you can program with the normal Adafruit Graphics library on the high end it gets sent over as s c and it does the same commands on the device so it would be really easy to implement more and more features let's start with a basic text mode and maybe changing the color of the screen and stuff onto the code welcome to my computer and the Arduino IDE we have two pieces of code this time one runs on the host system so whatever the device is sending data over the bus to our homemade GPU it just has to have an icr C port and we can code this in any language we want for the testing and stuff I've just used the second Raspberry Pi Pico and run it in Arduino coat now we're getting into the meat and potatoes this is the coat that runs on the Pico that is the actual Pico GPU or pseudo GPU because it's not really a GPU let's see if all these Shenanigans work seems we have a big chunk of code ready let's flash that onto two P Picos one to take control over the other so one actually runs the GPU code outputs the DVI signals to a little Monitor and the other one is acting over I sare C and just sends commands one after the other and that basically simulates the host system it is awesome seeing something that you write on One controller being sent to the other and then put on screen we have a Hello World we have a weird hello world in a different angle that wraps around the screen which is also a feature I wanted to test that comes from the Y Graphics Library so it knows where the screen ends and then wraps around your text very handy I'm also changing the background image and I'm also trying to draw individual pixels on screen but I don't think they really show up something is wrong there but that's not the best way to draw pixels anyway because that is the way that old 8bit computers did it where they sent pixel by pixel data into video RAM and then that video RAM gets displayed um it's still the CPU that has to do all the tasks this this is not what a GPU actually does so the next iteration of this would be to invent uh some sort of frame buffer for that so we can send full frame image data to it or just give it commands to render stuff but that's a bit down the line let's first do a little design uh on top to make this compatible with a normal PC yes a pcie [Music] card to my total surprise we're back in C head of course I made a design because I'm way too unhinged to not make a PCP for this episode uh so here we have a raspberry piie Pico this is basically one to one the design that is used on the DVI sock so we have the little resistors here and we have some pull-up resistors for the SM bus or ascra C bus that is also connected to the screen which means we could also talk to devices behind that name screens for example and this here is a PCI uh X1 connector yes in reality this thing looks like this so we have the pipo here USB port on this side so you can still plug it in but you can also plug it into a normal PC motherboard here you have your DVI connector and if you check that out in 3D there's the rendering then it looks like this uh excuse me there is no hole here but uh well I couldn't model that in now so but you get the idea so you plug this in uh this is an optional uh ldo for generating the 5 volts uh that are usually present on DVI ports uh but turns out uh that you don't really need that it's not present on the DVI sock by default and the screen did work but maybe that is the issue why I couldn't get some other screens to work so I'm including that here for hopefully bigger compatibility yeah also this is the voltage regulator takes the 12 volts that are present on the PCI bus puts it down to uh 3.3 which uh then turns on the Piko we also disable the piko's internal 33 regulator so it doesn't do double duty and we take in the signals from here from the PCI connector would you plug this into your computer let's find out well I sent this to ISA and just fingers crossed I'm doing this like absolutely last minute maybe we get to see it working in this episode maybe another one I would love to show you now the finished PCI card but sadly there's just air here that is because I basically made this last minute sent the files off to ISA and they have haven't arrived yet and I need to finish this video so follow us on the social medias and on element14.com and I will post uh pictures and stuff once it has arrived so you can see if it actually works and in a future episode we are trying to combine that with a like a full host computer system to see if that actually works on any computer and also of course I want to integrate this with the uh USB 42 Linux board in turn making my own single board computer some things sound really complicated like turning a pipo into a GPU but in the end they are not so complicated just build on the shoulders of giants and now we have basically video signals over iare C so it's basically like a plug andplay video card for microcontrollers isn't that awesome and now it's your turn all the files all the code is open source please join in on the fun expand on it Implement more of the features of the E fruit Graphics Library I've just done the basics but I'm sure a lot of other people are much better at programming and they do a much more efficient job on packing as many features as possible into the little flash memory that the Pico has I got to go there's another project waiting for [Music] me [Music]
Info
Channel: element14 presents
Views: 104,452
Rating: undefined out of 5
Keywords: electronics, hardware, hacking, mods, element14, maker, engineering, element14presents
Id: 8-RuYM-9s3A
Channel Id: undefined
Length: 16min 42sec (1002 seconds)
Published: Fri Mar 01 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.