 Oh, hi, folks. If you, can you hear me? Oh, there we go. Make sure I get a black screen. If you're watching this after the fact, make sure you check the description below for time codes. It's tend to be really long stream, so the time codes are a great way to get around into different parts of the stream that you're interested in. Or just turn it on while you're doing something else and hang out and check out all the deep dives that we're going to cover. So we're going to take a few minutes like people join us, and I'll say hello's while we're doing that. So hello Oats and Honey, hello Chi, hello Dexter, hello G3 Holiday, hello to Jack Burton, the first comment on YouTube. Hi, David and hi, Bruce. Thanks to David for taking notes as always. Hi, Ardar Sanad, hello Beata. Hi, I love the factory. Aren't you in Colorado usually? Love the factory? Or are you usually in Florida? And I'm just blanking. I'm hoping everything works. I need to have a disclaimer. My computer has not been too pleased with me, not been cooperating. So if I disappear or USB doesn't work, then yeah. Not to be completely unexpected. Hi, Johnny. Hi, Brian from London. Hi. Yes, usually Colorado. I'm right. Hi, 560, love the work you're doing on bare metal pie stuff. Thank you. Hi, Charles. Hi, Anthony. Did I sound all right? Everything good? Johnny's in Hawaii? Awesome. Yeah, yesterday was not very fun. I spent most of the day trying to debug my computer. Not good. The computer bootups, it was USB problems. And I pushed USB a lot. So that's like ideally right now I have like four HD streams or two HD streams and a normal stream, video stream. Hello, Mark. Hi, Xmicron. Hi, Cheatstaffer. Hello, Neurocom Dre. Hi, Michael on LinkedIn. Welcome, everybody. Hey, PT. And by state of the fruit, yeah, my stream is during an internal meeting. So I always miss the meeting. And fill in the more, I have to run it. Awesome. Thank you, Luke. Luke says, everything sounds and looks top-notch. Hi, Affiniter and WebBSK. What we're working on, we're going to talk about the Raspberry Pi 2W and getting Circuit Python running on it without an OS. So just bare metal. Hi, Andrew R. Hi, Sydney from Brazil. Hi, David Buchanan. Hi, Brian. I never trust laptops. Always going to have a few spares. Yeah, this is my desktop, unfortunately. But I ordered a second motherboard for it that will come tomorrow. And that will tell me whether it is actually the motherboard that's causing me heartache. It's like, I've done a ton of USB. And so what I'm getting in, like if we look at the desktop, move this down, push that down. If you just look at my dMessage, what happens is I'm getting, oh, it's not too bad. So there's UVC problems. But I'm getting these, like, device 3.2 is, like, not able to enumerate. But if I unplug everything except, like, a keyboard, I still get that, which means that it's like, means it's something that's on the board itself. Oh, nice. Bruce S. got a 0.2, or yeah, 0.2W and a Raspberry Pi 400. Apple for scale, thank you. Hi, Minnesota Mentat. Got a Chromebook. Mark says, time to get an M1 Max. No, I'm like currently, I mean, the M1s look really cool. But you can get so much more for your money with a desktop. And it doesn't have to worry about thermals anywhere near as much as you do if you have a laptop. So I'm happy having a desktop. Like, I could buy, like, three of these computers for the cost of a MacBook. MacBook Pro, which is what I used to do when I still have one on my desk, so I still use that. But all right, let's do housekeeping. An idea, keep a Pi 400 sparesync with your main one, big USB stick. They break seriously. They break. Oh, interesting. How does it break? I actually did buy a second one because I'm about to play around with it. Hello, unexpected maker. Yeah, I'm just complaining about how my computer has been failing me in the last couple of days. Oh, awesome. Pi 4 with 4 gigs of RAM, but missed a 0.2W. Yeah, the work that I want to do today should mean that we should be able to bring CircuitPython to basically the whole Pi line in the end. New desktop in the pipeline. Beata points out you can't use a desktop on transit. Well, I've worked from home for the last five years. So once I stopped working down on the couch, it was like I really don't need a computer anywhere else. Hey, Mark. Grink, huh? OK, let me switch back to the, let me do the intro slash housekeeping. Whoa, I haven't gotten my windows as big as they can be. So hello, everyone. If you don't know, my name is Scott, and I go by tan newt online. I work on CircuitPython for Adafruit. Adafruit is an open source hardware and software company based out of New York City. I work remotely for them, though. So I live and work in Seattle, work in my house. Yeah, so open source hardware, open source software. CircuitPython is open source software. It brings Python to microcontrollers and soon to be Raspberry Pis as well. So microcontrollers are really inexpensive computers. Raspberry Pis fit that bill too. So it's an all-in-one, all-encompassing experience. So yeah, if you want to support me, you can support me indirectly by supporting Adafruit, who pays me to do these streams, by going to adafruit.com. You can chat with me and a lot of others on the Adafruit Discord server by going to the URL, adafru.it slash discord. That's what the middle box here is. This is a deep dive. It happens almost every week. I'm going to take the week of Thanksgiving off in a couple weeks, but for now, next week will be on Friday as well. It's normally at 2 PM Pacific, which is when this stream started. So that's the typical time. Occasionally I'll switch to Thursday if I want to do it, but I've been going really consistently. So I've been like, OK, we're taking a week off as well. Typically it goes for two hours or more, depending on if I'm stuck into something. If you have any questions, as folks know, I like to take tangents and talk about stuff. So this is a chance for you to ask me anything about circuit Python, Python programming, microcontrollers, all that sorts of stuff. I'm happy to take questions. And yeah, as I said, next week is on Friday. I usually have a note about the cat, catcam up here that is Spook, and he's usually in there. OK, so oh, and one last thing. I'm going to be, Tom's Hardware, I think it's Tom's Hardware, has a pie cast stream. And they asked me to talk about this spare metal circuit Python on the Raspberry Pi work. So I will be on that next week. It's Tuesday at 11 30 AM Pacific time, which is 2 30 PM Eastern time. So I'm going to take a look at that, or I'm going to be on there. And it's funny because I actually mentioned the idea last time I was on the pie cast, and they wrote a whole article about how that was something I wanted to do eventually. So it's kind of a nice circle into like, oh, I'm actually working on this stuff now. And I've proven it out. So cool. Let me say, how do some folks that showed up later can get caught up on the chat. Mark Olson is laying on the couch, loving my office. Decent i7 laptop with external monitor, next to it is a Pentium 4. Oh, duplicate of the other. Interesting. Can't wait to see what the circuit Python team comes up with for the Pi, the 0 2W. Mark says, hi, Mark. Mark Tomlin, that is. Hi, Hams Labs. Hope things are going great with you. It's been a frustrating couple of days. Yes, starting yesterday, I got up yesterday. Hi, Chi. Got up yesterday, tried to type my password into my computer, and it didn't work. Over and over and over. And I was like, I'm pretty sure this is right. And pull everything out. I knew that sometimes USB stuff can interfere if something's misbehaving. So I reduced it down to my keyboard, and then my network didn't work. So it's just been a huge pain. And then on top of that, yeah. Hi, Oats and Henny. So mostly what I've been doing besides fighting my computer this week has been working on SD card support. And I actually tweeted out a thing yesterday saying, caps lock. I don't even know how to do caps lock. It could have been that. But I ended up getting a different keyboard. I also use Colmax. It wasn't clear to me whether I had accidentally reverted to QWERTY. I wonder if there's a setting to be able to see the password. I'm in my house. I don't need super secure passwords or anything. And I work on all open source code. So really not critically important that I have good computer access policies. Yeah, so I tweeted out a thing about wanting an SD card library. Oh, Beepo myself, which is an adaptation of Dvorak for French. Interesting. I really like Colmax. I'm glad I did switch. Dylan asks, did you have to get rid of your custom keyboard? I didn't end up doing it. Onscreen keyboard. Oh, I could do that. Part of the problem is that I also get my passwords and muscle memory, like the ones I type all the time. So I don't necessarily remember what it actually is. That's the other problem. I figured it out. I'm happy the stream seems to be working OK. OK, so SD card work is ongoing. I have, let's see if the overhead is working. Oh, it looks like it is. So what I ended up doing here is I ended up getting a, I think I talked about this last week. I ended up getting a USB sniffer from SparkFun, and it works. OK, so all these wires here, they go over to a Salier, which is a logic analyzer. And I use this this week to confirm that I was actually talking to the card. The problem with this is that as you add more wire and trace lengths and stuff, the slower kind of the card needs to go in order to work correctly. And the bootloader actually wasn't starting up Circuit Python if I was trying to start from the card itself. I got a USB sniffer. Sorry, it's an SD card sniffer. USB is on my mind, obviously. Might need to get you a System76 launch keyboard. How do you feel about medicinal switches? I have not used those switches, but I don't need another keyboard. I've got plenty. Thank you, though. Like I use a, right now I use a keyboard EO, and it's like a split keyboard. Basically, I really like split keyboards. I wouldn't go back. I should also mention, for those of you who are watching on YouTube, I do have it set to normal latency again so that we can do the text to speech or speech to text automatically. So if you do find that you're behind the stream, you might want to switch over to Twitch. It's important to me that the stream is accessible, but for those of you who are able to hear the stream and may want it to be a little quicker, you can go over to Twitch. Hopefully, that's using SD card sniffer. Yeah, everybody corrected me. 4 by 4 trellis for important passwords. It's an interesting idea. Yeah, signal integrity problems. Yeah, so I wasn't. So what I ended up doing, you'll see here that I now have an ethernet plugged into this. And so TAC had told me, oh, he got netboot going, and netboots a way to have the pie for boot from another computer that's running TFTP. And it worked pretty well a couple days ago, but I was trying it today, and it's just super, unreliable, and it's very slow. Like, it's slower than me switching the SD card back and forth, which is a little bit of manual work, but it's like, at least it's reliable and it's quick, which is frustrating. So I'm kind of like sick of working on that. So I was thinking I would move to the 2W today, because I think people want to see the 2W kind of going. So I thought that would be fun to do that. And that won't use the netboot stuff. Daniel says, what would you recommend for recording data from a 9DOF IMU sensor? Maybe a Pi Zero, or Pico, or Arduino Nano, or Uno Nano better for this. I think this is an interesting case for a Pi Zero, with CircuitPython actually, because the nice thing about CircuitPython bare metal on Pi's is that you'll have SD card storage automatically, and you can record to that. The Pico can do it as well. I would not do the either Arduino's. The Nano might be okay, but I don't remember what microcontroller it is. The Uno I would definitely not do, because it's 8-bit. It depends a lot on kind of like how frequently you want to pull the data to, Daniel. It's not pixie, it's just TFTP. So I found a Python implementation of a TFTP server from Facebook, and I've been using that. But it's like super unreliable. Like today it's just when like, I can see that it's pulling files off of it, but it's still not booting. It's just extra frustrating on top of my USB problems. Generally for my passwords I use last pass, it's just like a few that I type in manually. Anthony says, thank you for understanding they're disabled users, glad you are accessible. Yeah, that's what like folks who wanna be more up on the stream can always go to Twitch. But I really do like the auto captions, as somebody like, I'm perfectly able, but I still like to watch TV shows and stuff with captions, especially if they're British. So this was helpful. So thanks to SparkFun for making and stocking this. So once I got the net booting working, I could then isolate the SD card traffic that was due to what I was doing in Circuit Python. So that was really great. And I was able to confirm that I was talking to it. And I got far enough to the point where I needed to follow all those SD card specs. I mean, yeah, I also tried using TFT PDHPA and it had more trouble, not less trouble than the Python version. I don't get it. I don't get why. Like the Raspberry Pi has the IP address burned into it and they're just on the switch next to each other. It just like, maybe I could try it and just see, we can see whether it's, let's do that. I could show, see if it's working. So let's go to the desktop. Porky likes captions too. Stop typing ends. I really need to update my, I have this thing that detects when my hand is on my trackball and makes my right hand on my keyboard mouse triggers. But it's using a proximity sensor right now and it's not very reliable. So if I don't, if I'm not in the proximity range, I type ends instead of mouse clicking, which is if you've ever chatted with me and see me type ends, that's what's happening. TFTP is supposed to be pretty dumb. It should just work. I know, I don't get why it's so slow, why it's so unreliable. Do you have any recommendations for making string formatting a bit faster in Circuit Python code? I don't. I bet it's a lot quicker on things with floating point for some reason too. I bet it's like the RP2040 just so you're feeling that Cortex M0. I do a lot with TFTP. Okay. Make sure your server is a static IP. I didn't actually do that. So I had to update it today because I had network troubles on top of my USB troubles. Quarky says F strings. So F strings internally in Circuit Python just get translated into this format format, the dot format equivalent. Similar string format performance on an M4 actually maybe 10% faster. Yeah. Here, I'll show you. Let's at least try this. I might need to get more USB cables because I for some reason used them for other things. So we have the silicon labs and here's my, the cool thing about this. Oh yeah, don't hit me. I'm running it as root to get the port. I don't know how to change the port number. So if I just turn it off, I just heard the sound of a delivery. I did order this really cool PCIe card that has four USB host chips on it. So the card, the PCIe card has four high speed USB ports and they're all independent, which I am, it's not cheap, but I'm very excited about. So here it did work pretty well, which is cool. It did boot up nicely. So that's awesome. Oh, that might have been the card that just got delivered. I actually kind of want to push my luck and see if I can't get the salier sniffing because this should be fixed. Anyway, I shouldn't get distracted with this. I should do the zero two stuff. Seeing circuit by phone written in Rust at some point would be fun. Getting it running in a Raspberry Pi would also be fun. Calling it RPi would be a full circle in many levels. I'm pretty sure there is a Rust Python already. I think I found that, yeah, there's Rust Python. People have already written a version of Python that's written in Rust, which is neat. I don't know how it compares with size or anything. Hello, Christine. She says there's a show password button hidden. But if you can solve a different thing, you can get a show password button at the login screen. That would be amazing for USB chips. Yeah, it's not cheap, but it's, I got a smaller version of it recommended by Paul from Teensy. I'm just in my Amazon here checking it out. High point technologies. So they have USB, USB HBAs. So these are, this is what I got, I got one of these. And they talk about the shared architecture where there's four ports, but there's only two controllers. And it's a PCIe three times four. I splurged and got the PCIe three times eight. And it's four separate, four separate USBs. Not this one, not the USB 3.2, but this one. It's like $250. But I do so much with USB, and it's so nice to have isolated USBs. It's eight lanes of PCIe three. It's ridiculous, but I'm excited about it. It just got dropped off, but obviously I can't stream while I upgrade my computer. I'll have to check that out. Okay, so let's, I'm glad this worked, but I kinda wanna switch gears because I wanna show off the zero two stuff. So I have a zero two here, and sorry for the lighting. I know that. So this is a zero two W. It's awesome. I haven't actually used it yet, but it's gonna be awesome for a circuit python. It's 15 bucks. Oh, it's HDMI mini, which I forgot to grab a cable for, but that's okay. So let's just go to the overhead and we'll get this set up. I just, I would like to, the main challenge with this is that it's an older chip and the older chip has an older interrupt controller. So most of the work that we've gotta do to get it working is to get the interrupt controller working. And then hopefully USB will work. Okay, so I'm gonna disassemble some of this. I will get back to this next week. One thing I should note, you remember I had this IO carrier board that had the broken micro SD card? I actually swapped to use the broken one because I'm using this like weird, not quite an SD card thing on it. So I was like, oh perfect, like I can't break it more. And if I do, it's fine because it's already broken. So I did that, so I'm just disconnecting the salier. The reason that the zeros are so great for a circuit python on this is because they're designed to have micro B connections, which means that it will be much more obvious that you can just plug it in and treat it like a drive. And sorry, I don't have, this is the HDMI thing I was using last week that is in the shop at Adafruit that I got from there. I don't have it set up today. So we won't actually be seeing output, but I didn't wanna push my USB like that much. Okay, so I'm gonna pop this off because it should just work on the zero two. I was thinking maybe I should label that. So here's the zero two. It's a lot smaller. And I'll have to remember that the SD card is here. So what we're gonna do is we're gonna try to build the bare metal circuit python for it. And unfortunately I realized I don't have a power switch, so I'm actually gonna have to pull it like, unplug and plug in the power, which is gonna be annoying. But I have this debug header that I made, or a debug hat, if you will. Should be pretty handy here. And also my limit for the debugger as well. CM4 with 10 USB ports. Ah, but how many host controllers is that? I think people get, I would love to know how many host controllers something has and what ports are on what host controller. It's not the plugs that matter because the problem that I have is a misbehaving USB device can like, basically DOS the rest of the devices on the host controller. So yeah, I'm all about, oh, and I'm upside down. I'm all about getting as many host, separate host controllers as I can. Because then the USB devices, it's three hubs? Because hubs are different than host controllers as well. I'm all about, I want my USB devices completely isolated, which is why I'm excited for this card. Okay, so I don't know why the SD card stuff's not working, but I don't want to debug that right now. So I do have a reader here, a micro SD card reader, so I'm just popping it between that and that. And I also do, I had a power supply already, so this micro B cable is just a power supply for it. So actually, why don't we just check the boot loader? And power is the outer one. So let's just see if we get anything here on our terminal output. Hopefully it doesn't go poof. It shouldn't do anything. Doesn't look like it. And I don't have the HDMI setup, so I can't see. Hide you through holiday. Didn't manage to get one. That's all right. I do want to support the original zero as well. It just like, that has a different CPU architecture. So like, I wanted to start with Pi 4 and like work my way back, but it's only really like four different chips, right? Like there's not, and the peripherals are almost identical across all of them, especially the first three. So it's really like, knock on wood. Sorry, not gonna be that hard, hopefully, to go from one chip to the other once we have it going. Are you a student under Adafruit? I am not a student. Thank you for asking though. I work for Adafruit. I'm 35, so I'm not a student. Although, I guess people could be students at 35, but no, I'm not. I work for Adafruit. If I want to play along at home with a first gen Pi zero work, all right for tinkering with the dev branch builds, assuming pushing changes to a branch. I am pushing to the branch, but you'll have to do some work that I will talk about today to get it going because you'll have to change the compiler. So I'm starting with 64 bit builds and then like, you'll need to switch the compiler for 32 bits. And then there's maybe like a little bit of assembly that you'll have to switch out to. And yeah, this is a custom PCB I did. It's available on Oshpark. I still haven't tested iSquared C, but if you do want to pick it up, I can, I have shared the link before and I'm happy to share it again. It's meant to be like hand-buildable. I'm like relatively experienced with soldering stuff, but I'm happy to give instruction if people need it. So yeah, this is a custom PCB to be able to do this. Like this is a serial converter, USB to serial converter, and it's like the pin out here is designed to just plug into those because I think it's pretty standard. And then this is SWD, which is really, it's an SWD connector, but it's JTAG over it. And then I haven't actually tested the JTAG yet. So yeah, so what I wanted to talk about today is like I was really focused on proving out my, the concepts with the Pi 4, but now that I've made a lot of progress on that this has come out, I really wanted to like tweak all my build processes so that we could actually support more things. Michael says, I love how fast the Pi 0 2 is. I'm planning on making a Pi portable project once I have time. Awesome. Yeah, I think that the main challenge with supporting Pi boards is actually having the USB broken out so that you can like plug it in and have it show up as a drive. So the like the zero, the original zero is actually more interesting than say like a Pi 2 or a Pi 3 because I think both of those, like they don't break out the, they don't break out the USB device directly. They use it for like the host. Like so many pies are designed so that you plug a keyboard in. They're not designed to be devices themselves. Okay, so what we're going to want to do is let's take a look at some code. Oh, our Dawson had found the project. Thank you. So there's a couple of things that I have to do. Let's do desktop with over. Now, overhead's not interesting. Oh, I don't even have my text editor open. So the normal way in circuit Python that you would build a new board is you would say make and then you can say board equals such and such. And so this is relatively new from last time but I wanted to do like, actually what did I call it? So these are all based on the folders in the directory. Right, so if I do the make again and I do zero to W make and I'll clean it first. Let's see if it compiles. That's where we start. One thing we're going to have to account for is that the memory addresses of things have changed. So we're going to need to think about this. This I don't think we'll boot, but we can see. Actually, I don't think it will. If the zero is supported would the Raspberry Pi model be supported since they use the same sock? Yeah, probably, right. Again, the challenge is the USB being broken out. We support it but you wouldn't have a good way of editing the files on it. But yeah, since it's the same sock like it's really not too hard to support. It's more about how the USB is connected on the board itself. So like the original Raspberry Pi is probably interesting from the like VGA video output. If people want that, oh, I just splashed water on my desk. G3 Holiday, if you need KeyCAD source files for that, I'm not sure I link to them but I'm happy to show them as well. So if anybody wants KeyCAD files for the hat, let me know. I'm happy to do that afterwards. Okay, so we did successfully build but I have a feeling that it's not gonna work. And the main thing, the reason it's not gonna work is I think the address for all of the peripherals is different. I believe it's 7E or something. So we could just see what happens. We should be able to J tag it still. So yeah, let's just see where we're at here. So we're in the wrong build directory and I should delete that one. That's the old name. But we can go under this Raspberry Pi Zero 2W. We have a kernel image and we can just copy that over. Copy here, over right, sync. Yeah, and let's just pop it in and see if we get anything. We'll probably crash. Oh, and it's not spring loaded. Okay, so I'm amazed you haven't created a script to automate the file in sync. I know it's partly because it also does the mount automatically if it was just a copy I would have done it already, but we have a light. Oh, you know what? I don't know if my, this open OCD thing might not actually work because it's configured for a Pi 4 open OCD but we can figure it out because of these configs. I don't like open OCD because I have to manage config files like this but I bet there's a Pi 3 version. It would be nice to get this going. All right, tend to Google open OCD Pi Zero 2W. I'm actually on the mailing list for this. That's for the V1. I've seen you doing that over and over on stream and I can't imagine how many times you've done it off stream. I know it's true but after yesterday or this morning where I was having trouble just with the network boot and even when the network boot was working, it was slower. So it was unreliable and slower for me. So it was just like, I can do it. It's fine. It's probably better if we just find the Pi 3. It might come with it. What browser is that? This is Firefox with the tabs tab tree or something. Okay, here's a... So the Pi 3 is Cortex A53s. Should have thought about those. Ah, here we go. SD card set up. Custom Linux kernel for debugging. Don't need to do that. Enable JTAG debugging. I do that. Here's the pinout and I'm lazy. I don't like doing this. So I made my own. And I guess I'll download this. I don't need to open it. We can just save it. I really like it. I like the tree tab style that downloads. I don't know why I can't auto-complete. There's a dash. That was so close. Address already in use. This is a... I'm trying to remember why that was. Yeah, look at all these USB errors. It's been quiet so far, which is good. Maybe the config has me. Why does the Raspberry Pi 4 one start on a different port? Kill the previous open OCD attempt. Oh, there's a telnet port command. Ah, I don't have it. Oh yeah, it's OBS. I don't even use the telnet port. Ah, OCD. Boom. Listening, awesome. This one, circuit Python ports. This is one of those things where it's like, kind of annoying to have to do, but also really nice to have set up once you are doing it. Source USB, there we go. So it looks like it got... Oh, the tick timer is not working. Okay, so this makes total sense. So there's a system timer that counts up from startup. It's great. The problem is that on the Pi 3, all of the addresses changed. So what we need to do is maybe we'll hack this for now, but I think we talked about the SVD files. So SVD is for a system view description. And there is a specific thing for... There is a specific thing for Cortex-M usually, but I'm bringing that to the Cortex-A world. So I have this here. So I was gonna do it as a 2837. So basically we need to generate a separate header that has all of the different addresses for the peripherals that we're gonna access. Maybe we could do a deep dive just into applying SVD files to new processors. Yeah, so that's kind of what I'm doing right now. I've built this Jinja system on top of that, and we can go into that. So Jinja is a Python templating library. And so what it does is it takes these things and does code-like things, or if it's two curly braces, then it's like a substitution of a value. So what I've got is I've got it kind of split out where I have these peripheral imports that I'm doing. So what it ends up being is one giant XML file, but I'm using Jinja to glom together the pieces. So there's a peripheral kind of subtree of the XML. And so what I do that is I'm using Jinja to put those peripheral pieces together so that I can do exactly what I'm gonna do today, which is generate one SVD file for the 2837, one for the 36, one for the 2711, and all of the four chips that are on all these Raspberry Pis, because they have a lot in common, all the register layouts for the peripherals are the same. It's just like you can see here that there's a peripheral base value that's being passed in when it's being generated, and that is one thing that is changing that changes with the different devices. So I'm just gonna update this to, and then let's find our generator file. What was all this? So in peripherals here, so this is the Broadcom peripherals library, and there's this Jin SVD. So this is doing all the pinmuxing, and the pinmuxing is, I think, pretty much the same, except for the earlier chips, earlier than the Pi 4, earlier than the 2711 have a lot fewer things. So what I wanna do here is I just wanna, I'm gonna duplicate this, and we're gonna generate a 37, that's right, right? And the base address is gonna change, the local base is probably gonna change. We'll just pass the same alt functions in right now, because they're basically the same, and the internet apps are basically the same too. So we should be able to get a lot further if we just update. I think the peripheral base address is 7E. Where we can find that out is one place is, so I think they'll, maybe I'll just Google it, 2837 base address. That second one was actually, so this is a good reference, and this looks like a really good reference too. Oh, it's 3F, but it's mapped to 7E. So we will have to update our memory map as well. Well, we can see what works for us. Is there a write up describing the process and step support to a new platform? Ooh, what ARM chip is it? I think doing a different Cortex-A would be really cool, but there's a lot of work that I don't know. So I think let's try, it's an FPGA. Expand all button on that page, yeah, right. The ARKLARM local is probably also 3F. So that should change, that should change what we generate and actually generate something. So let's try it. So here's the full command that I'm running. It's generating the SVD files and then taking them and converting them to headers, which I guess I should update here as well. It looked like. So what we get in the end is under SVD gen, you end up with these two files and they're giant like 42,000 lines of XML. And then you can see here that like the VC mailbox peripheral. The hard processor core is ARM dual core Cortex-A9. Is it too small, Chi? You want me to make the font bigger? Does it have any other hard peripherals? The XML file is big, yes it is. It's just a little bit bigger. Yes, it's giant. And then what the second stage does is it generates a bunch of headers. So they go in broadcom gen and then you get another giant file that has all of these like structs for all the bits, all of these pound defines for all the bit positions and masks and type stuff too. So it allows you somewhere in here. So it has all of the bases of all the peripherals and there's no yards two through five on this chip. So that's a problem. But then what it does provide you is, you can say like GPIO and it gets substituted for this thing that takes the address and casts it to the type. So it makes it really clean I think to like reference and C code. Hi Dave. So that should be enough to get us further. We could actually test this. So in GDB, I have the SVD extension loaded. So I can do SVD load peripherals. Where am I? Directory I'm in. I'm in broadcom SVD or source. Maybe this will auto complete peripherals. Yeah, SVD gen 837. And I can switch this to SVD load. And I always do that. Okay, so now I can do SVD. And let's, we can verify. Some of these peripherals have identifying registers and I have those encoded here. So if I do SVD, you are one. Oh, hi robot meister. Open OCD, Pi 3, reconnects. So we can actually read the memory. And that like kind of looks okay. I'd like to drive HMI or DisplayPort from the FPGA fabric. This part I'm pretty good at. I run circuit Python from the HPS. I'm happy to chat more offline with you about this. A9s, Cortex A9s are 32 bit Cortex A's. I mean, if you can get them going, the other thing to think about is USB. So getting USB going is really handy too. I'd love to support FPGA stuff with circuit Python. It's just tricky. Let's try a different one. I think, well, so the GIC doesn't exist. We've got stuff on here that doesn't exist. And I didn't fill out the registers for the interrupt controller. That's unfortunate. At least we're able to read these registers. Which ones of these do I have? Sys timer? That doesn't necessarily seem right. FPGA and circuit Python. Yeah, I kind of settled that I really wanted a STEM at FPGA. Using a mock XO2. That was kind of what my plan was for that. So this doesn't look like it's right. It doesn't look like these are the right address. So I wonder if we could just find another reference. So what, like what is the, I want maybe it's 7E, PCM. These docs are not very good. I just redownload all these things. Oh, here's the memory address. GPU peripherals are at 3E. Local peripherals are at four. Arm timer, IRQs and mailboxes are at 4,000. Hi, Paul. Oh, that reminds me. Paul says that they're an hour late because of changing from summer to winter time. The US changes time this weekend. So next week it will be a different time if you're outside the US. So heads up with that. What's the equivalent SVG for CPU info? SVD related interrupts, interrupt controller. Ooh, this is the interrupt controller registers. Nice. Okay. I'm gonna have to... Can this be the year we just collectively decide to get rid of daylight savings time? Thanks for the reminder, Paul. I appreciate that. It's annoying. We're gonna need this. We're gonna have to update the interrupt controller if we want USB to work. 64 bit timer. Let's see what. Let's open 2835. Let's open 2836. Is that the same thing? Yeah. This is why I think it's gonna be relatively easy to support, because they always just say like, it's basically the same thing. We just updated the CPUs. I think people who, morning people like daylight savings because I'm a night owl, so I'm the opposite. I think that is funny though, how that works. Address map. Let's look at the address map here and see what it says. So these are these video core CPU buses, armed physical addresses, and we're talking about physical addresses. This puts them at 2000 address. This shouldn't be so hard. This is why I, yeah, good docs. Good docs are well worth it. Raspberry Pi 3 tutorial uses arm system registers, uses the system timer, and the system timer is at what address? MMIO base, plus 3000. MMIO base is 3F. So this should be correct. I know that there's like, it's for the GIC, which we don't have. I just go around, yeah, I did. Oh, I added all these valid registers on the one thing that I can't check. Okay, so let's just see if it works now. Although we're gonna need to do something so that we import the right thing. We need to make sure we import the right header file. So let's do a, BaconPress just got my zero 2W today, love the packaging. Glad you like it. Let's make a new file. Is that a good name? Outside gen, cause I'm not gonna generate it. And then I'm gonna say pragma once. And if.com equals 2837. I include gen, bcn, 2837.h equals if bcnversion equals 2711. Okay, so now we can say, maybe it should just be defines. What's a good name for this? I don't know, I don't know. So now we have to find, we need to provide bcnversion. So in our make file, I think I have a, bcnversion equals 2711. Am I not using sublime text for? 4121, I assume that means it's sublime text for. I like sublime texts. I never used all the fancy features for other stuff. Okay, so that looks good. And then we have to find any includes that we did. So bcn2711, lpah. So in all these places, we've got to update this to include the defines instead. Maybe it should be like platform, I don't know. An SD card, doesn't actually work yet. Then in peripheral, there's a UART one, let's do the UART. We could get UART out, but we'd be well on our way. Okay, so it looks like the rest of them are in peripherals itself. Maybe it should be called like hardware. This is gonna have to change too. I just, I've tried VS code because I know a lot of people like it and I just couldn't do it. It was always popping a window up and that really bothers me. Am I using this? Well here you go, there's the base address there. I don't think I'm using this file anymore. This has got to change. But I don't. Maybe I'll just do it temporarily. Set peripherals to register access. One thing at a time. I don't, we'll have to look and see if the system timer thing happens after the RAM is initialized. And the glare is making it hard to look. We've got to generate the headers again. I like that all the generated files are in gen folders. Yeah, if we do make again. I just stubbed these out. Where did I put them? I agree the pop-ups are easily the worst part of VS code. Icebreaker, Bitsy, FPGA, and the teensy form factor is in pre-launch. The FPGA folks are doing a lot of good work making it simpler to do. But it's still pretty complicated. It's empty. Okay, so now we've got, now we got a new build. So let's just give it a shot. So unplug, pull the card up. Yep. Maybe it just feels faster because I'm actively engaged instead of just waiting for it. The license is nasty. Hmm, all right, let's see how far we get. I mean, this looks weird to me that we were able, but like the, that the counter is zero. That seems not right. And we're not getting any UART outputs. We're not getting that far. Let's open OCD it again. It's possible that our view into the world is different here than it is from ARM. Yeah, so we're still, it's still zero. We're in main 183. Now does this happen when the MMU is on or off? Is one question. It might be, we're in it, wait for a safe mode reset. Okay, so it is happening later. Yep, the counter should be incrementing. SVB, like all the compare channels are identical. They were identical last time as well. I'm actually a little surprised it's not memory faulting. 3F, 3F is in that first range though, isn't it? So if we think about our memory map, it's cached. Where's the GPU memory in that case? Right? 3F is before this. So what does it say about GPU memory? Like this is the video core and the video core has less than, this is not right. Can GDV do a direct read from the counter without using SVD or maybe have SVD print the address it's trying to read. Yeah, you can do it directly. It's just like way simpler. Like you can do PX, Uint 32, T star of the address. So 3F003000, right? Did I guess that right? And that prints the address. But then if we dereference it is zero. Unexpected maker has an unrelated question that says, in circuit python and micro python, when you use a defined const function, object keyword args with one seven keyword args, how do I determine which were actually set? I want to update members of a struct, but only the ones that were passed in. I have it working, but it stomps with all the default const of that keyword arg was not passed. Yeah, you'll basically need to have a sentinel value that your keyword args are set to by default. Basically internally you say, if it's the default, then don't change it. Like that is the right address, right? It's possible it's going through the MMU. Oh, it's 3004, still zero. Get the current counter frequency, that's RMCPU. Hmm, how does one ask the MMU what physical address it is reading? So there's an ARM instruction that you can provide an address for it, it returns. It gives you back the, there's an ARM instruction that will give you a physical address from a virtual one. One thing we can do, so three F is within this first gig of range. So what we could try doing is just saying, well, for one, we don't need this second table. I can't, I just, I don't want to delete all this. But for testing's sake, let's just basically, market all is not cashable. In fact, we could just have the, we could just turn it off. Let's just see what that does. It is very weird. It could be like a debug bus thing. Like it depends, like it's possible the memory view is different for the debug stuff. It's possible there's unexpected caching. Cause even if, even if you say it's volatile in the compiler, that the CPU may cash still, like there's no signal from the compiler's notion of what's volatile to what the CPU is, like it's a separate, separate system. And this is what I just built, right? Just now, yeah, you get me a switch. If I don't have a switch already. USB to power switch. I don't really like this camera connector hangs off the end, just a smidge. And it makes me worry that I'm going to knock it off. Can you access the LED debug print to the LED? That's a good point. Oh, look, we got some, maybe the clocks are different. Yeah, that's your output. It's possible that that was just a fluke. Oh, something's happening. The J-Link shows up as orange to connect to it. Well, we changed something and we got the garbage output again. It makes me think that could be circuit Python output, but maybe are not getting really, need to change all those words. So it's the wrong speed. That's why it's carbled. So if we just go to UART and we compute it, here is what, 500, but maybe the Pi three has different UART speed. How does it do that? Oh, interesting, it does a mailbox call to set a clock to four megahertz. I wonder what the default is. Yeah, Charles, your spot on. Logic analyzer or scope might tell you what VOD rate it is. Yeah, that's true. Hi, Mr. Who 30 and hello, Johnny. Did I, I don't know if I said hi to Johnny, sorry. Prismax man says, are you programming the Wi-Fi in C? Yes, I'm using C to program the Raspberry Pi. It's a circuit Python is written in C. What do we think the VOD rate is? What's your guess? We could actually query it. That's probably wiser. Or we could actually set the root. We could copy what it's doing. What are the odds that it is for? There's other docs that say, see, so they're like setting the clock rate for the UART clock. I don't know what it defaults to. Raspberry Pi OS. This is also for the Pi three, I think. But there's not just, maybe it is just four. Core frequency. It's the VOD rate based on the core clock. It is vacant. It is based on the core clock. You can see right here, it says, since the UART one spy and I squared C derive their clocks from the core clock, the serial clocks can also dynamically change. Which is why there's a second UART. Oh, we can just set it to 250. Maybe let's do that. So here let's do 250 megahertz. It's right there. Since we're not running Linux, it's probably best to not run it where it's gonna get too hot. One thing I haven't added support for yet is actually reading the temperature. That would be cool. I'm kind of surprised that it's getting into a state where we can't get into it. Oh, maybe that's, well, it's 250. Of course, it's not clear to me how much the, it's not even clear to me how much the boot loader actually does. And what, it's just like a patch that gets passed in the Linux. That's the problem with a closed source boot loader is that you can't see what it's doing. You just have to guess. You either have to guess or you have to rely on good docs. And this stuff does not have good docs. The RP2040 docs are amazing, but the regular Raspberry Pi docs are lacking, at least for the hardware itself. Did we already get a blip? No! We got non-gibberish. Okay, so it's stuck in the SD card stuff, which is good. But it's not surprising that that doesn't work. So let's just skip it. And by skip it, I mean we go into boards, board a net and comment it out. It's save. If you had the HDMI cable connected up would there have been messages there? The boot loader would have had messages, but not necessarily, not necessarily circuit Python. Yeah, maybe, yeah, maybe. Because circuit Python, it seems like the output was actually working. We could try it. I think I have a cable. I just have to dig around. Yeah, the NDAs with Broadcom are the reason, I think. Happy to see that there are other chip, the RP2040s, but are documented. Let's just make sure that we can get all the way to the REPL here. And then we could test pins too. Random comment on GitHub suggests that the default your zero clock rate is 48 megahertz. I think this is your one that we're dealing with. Your one is the weird one. I really should figure out how to do this all. Okay. So we should be able to get all the way to the REPL. Although, no, it's the same USB. So the USB should be okay. That will be our next step. So we've got the frame buffer messages, but we did not get further. So we're stuck somewhere else, but the open OCD looks like it's working. Let's take a look where we're at. Hard fault handler. So we need to source peripherals, GDP. Let's try it again. Ha ha, look at that. Oh yeah, how much memory do we have? This should be fine. Allocate memory. That length is suspiciously long, although that's like 32 megabytes. Yeah, the arm stubs have been helpful too. I have looked at those. Locate remaining memory. Data abort from same level. Is that because we're not marking it as normal memory? It could also be. Like that should be okay. They had trouble with Broadcom. They do hire people away, so I could see that. Check how the memory is set up in the MMU. Uh, agreed. It's a data abort. We could tweak. Now that we know that that MMU bit is a problem, we can change it. We can fix it. We can do a better fix. And I think a reasonable fix is just a, I'm wondering if we should, maybe we should just hard code it for now. Let's just hard code it. If PCM, what did I call it? Version? Is that what I called it? It's in defines. Yep. So we'll do this. If it's PCM version. Let's just do this. Ah, we don't need this second table at all. Not up there, three, seven. We can make it smaller later. I don't usually have this much trouble with this. Hi Patrick. So we're gonna wanna set peripherals to register access, but they're not in a separate table. Yeah, we got further on the zero two, which is awesome. I like didn't even know what to expect, how far we get. This is the thing that sets it, so let's do, kind of like it in order. The amount of memory is smaller than the pi four. Yep. That's true Charles. So it's two, we have a gig. It's two megabytes apiece. My hex just doesn't scale this much. So the first two megabytes, how much is two megabytes? What is that in hex? Okay, it's like, let's see. Two megabytes is two times 1024 times 1024. So it's 200,000, two zero and four zeros. And then we set it as device. So what is 3F, 3F zero zero. Wait, am I wrong? 504. So peripherals are 504 to 512 and there's no, I know that it's smaller, but Raspberry Pi SD card work will make SD wire look more interesting, is it a different product? What is that? SD card reader and a mux. I was thinking something like this would be cool and to be able to like have a micro that's acting like an SD card and we'll tell you when you've done it wrong, when the process is wrong. So we know it's 512 megabytes, which means that it's 256 minus eight. If it's a total gig, we start in the middle. So that's the GPU. I don't know if you can hear the teenagers going by or not. They're having a good time. Okay, there we go. So I think this is right. So this is the code segment. This is all RAM, which is actually the same. It's just fine. We have the last 16 megabytes of 512 megabytes of RAM are shared with the GPU and then we have peripheral register access from 3F to 4O. So let's give that a shot. Let's make sure it works. And the device read only, ha ha ha, oops. At least in C the compiler will tell you to add a semicolon. All right, let's do the SD card dance. It keeps me active. It's had a good excuse. Hey-o, look at that. We have Ripple over had crashed, tried to hit enter and now it's unhappy. Well, we're making progress here. Let's do dance again. Doesn't look like we crashed. Like stopped outputting. It's definitely running still. I don't know how to get, I see this output from time to time but I don't know how to actually request it. Like Beata says, yay. So I don't know why it stopped working cause it looks like it's still running. I wish I could get this output for the core I actually care about. It's just showing 1, 2 cores 1, 2 and 3 and I'm running on zero. Like I don't know how to trigger this. It just happens from time to time. I wish I could do it all the time. So we're in main C 470. You don't have a file system that's certified then is reading it, right? Correct. Haven't gotten that working. I was just running it from boot in it or board in it to try and test it. Let's see what line 470 is. It would be nice if it worked. It seems like, oh, it could be all the interrupt stuff. All the interrupt stuff is wrong. Let's see. Dave wants to know what unexpected makers that it took me over a year to stop putting semicolons in my Python code. Now I keep forgetting to put semicolons in my C code. And Dave was asking what Cion's first who is unexpected maker what his first programming language was. Yeah, my guess is this is all interrupt problems. That's likely my guess because it's gonna do all the GIC stuff which is probably not, well, certainly not right because there is no GIC. As far as I know, maybe there is and they just don't use it. So yeah, I think we've got four minutes. Are there any other questions folks have? I have a couple of things. So my next steps are to do the register layout for the legacy interrupt controller. And that is done. That will be done in this SVD peripherals directory. There's, I have this legacy interrupt thing. You can see I haven't added any of the fields yet. So I need to do that. The captions are ahead of the audio in my stream. Oops. Is there a non interrupt driven UART driver? So the UART is not interrupt driven. So I'm not exactly sure why that's a problem but the USB machinery should be going. So if there's anything triggering like a if there's anything triggering an interrupt it's not gonna be handled correctly. And it should show me if I'm in an interrupt and it's not, but it's like, I know it's something that I've gotta get working. So I think this is as good as we're gonna get on the stream today. So one thing I'm gonna do is I'm gonna, I'm gonna get all this set up and then I'll, I'll write an equivalent of in peripherals we have, that in Brog.com we have interrupts and we have this handle IRQ which is referencing this GIC CPU thing. And so basically we need a different implementation of this function for the 2837. So that'll be my next step. And then hopefully it'll be working but I might go, I'm gonna go grab that package and maybe actually open up my computer and set that up, I don't know. Either way I'm gonna push this code. So if you do wanna follow along you can check it out on my GitHub which is github.com slash tan newt slash circuitbython. You can check it out there. There's a, if you click branches you can see the most recently updated ones. There's a RPI one, RPI one that has all the changes for this stuff in it. So that's the place to follow along. I think we've made reasonably good progress getting all the MMU stuff set up. It is nice the A53 is like RMV8 and stuff. The older we go it's like, it's three and four, PI three and fours can be RMV8. Previous ones before that are RMV7 and then the original PI is like previous to like that naming. Fallow says, great progress today. Thank you, it is progress. And it's important to recognize that. Oh, and thank you for the link to the repo. So I'll make sure and get this everything that I've done checked in just because given all my computer trouble I wanna make sure that all the code that I'm working on is pushed publicly or as a backup. So I'll do that. Unexpected makers first programming language was basic on the Commodore 64 and the model, micro B, model B and then assembler on the Commodore 64. Dave says it was basic on the ZX80. The ZX80 as a home computer stuff didn't really take off in Australia was definitely somewhere around but mostly Commodore and then Apple dominated but all of our schools had micro B's. Ah, you all are the perfect audience for me trying to make Raspberry Pi's into something in homage of Commodore 64 and ZX80's then. So that could be cool. Patrick says, thanks Scott. Now I can go back and watch it from the beginning and I didn't watch last week yet but that thumbnail is awesome. Qi had a spectrum when they were a kid. Yeah, it's cool. I think we're, we definitely wanna do that. So one of the major things is doing USB hosts but once we have SD cards working we should be able to get it done. Fellow had visual basic. Oh, several people are typing. I think we're hearing people's first languages here. Programming languages. Andrew R had basic and assembler on the Acorn Atom. Charles, Charles's was basic and assembler on the Altair 8800. Cool, I hope you all agree with my desire to make Circuit Python into something equivalent. Dylan learned with some C++ Arduino precursor that ran on Lego Mindstorms. Our Dorsenod was on an Apple II and had an R Atari 1040 STE next. Jesus, I'd love to type a game in from a magazine and press run and it does not work. Linux 203, basic on the C64 here too. Mr. Who30 says, how about an Amiga and Atari during those times? Patrick says, the Magnavox Odyssey II for PC, no ability to say type in a program and don't turn it off. Unexpected Maker went from C64 to Amiga. My dad went Apple Ice, 2C maybe, 1CE to XT clone. Paul did assembly on pre-Apple II in ITT 2020. Beata, Apple basic then Q basic on the PC then Borland, Pascal and C. Bruce S. says my first real language was Pascal so I was mostly a mainframe person in Punch Guards. Linux 203 says my daughter started with Python 39. I started with PHP. Greg says, does logo count? Sure, that's one thing that Phil LaLore actually kind of excited because we have a turtle library. So doing turtle in Circuit Python would be awesome on a TV. So I think there's definitely a jive for that. Unexpected Maker says Apple IIe. Shiny Squirrel Club says TRS80, Model 3, Timex Z80, Sinclair 1000 and Atari 130XE. Is this why you all are watching this stream because you just want to harken back to those days with this Circuit Python bare metal stuff? It's definitely true. Like I think there's something to be said for the simplicity of it. At least I hope so. It's a new branch. We want to understand pointers still. Yeah, that's interesting. So Python doesn't have pointers. That's what I was wondering, you are all hardcore. I mean, so I should say I'm maybe a little younger. I probably the first programming language I did was PHP because I went from the web world. So I learned HTML and then I wanted to make it dynamic and JavaScript really wasn't super a thing. So I did PHP as a way to like change the HTML. I was generating. Mr. Who says I still have my logo bucks from a long time ago. I'd love to update that. We could update those for Circuit Python. R. Darcy Knott says I definitely started with that at school on a Thompson MO5 or TO7. Shiny Squirrel Club, 42 years, 30 plus languages. I don't remember all of them. Yeah, all of them. Thanks Google. I know I use Google a lot too. All right, let me do housekeeping and we'll wrap up. So thank you everybody again for, oh, let me switch for hanging out. It's been a pleasure. Glad we could make some progress, but you know, there's always more work to do. Always, always, always more work to do. So it's never just a walk in the park. Yeah, so this interrupt stuff. I might continue on that a little bit more. We'll see. And yeah, so this has been a deep dive. Deep dive with Scott happens normally Fridays at 2 p.m. Pacific, which is right about now. Reminder and thanks to Paul for reminding me of this. The US changes times this weekend. So next week will be at a different time if you're outside the US. So heads up for that. If you wanna support me, you can do that by supporting Adafruit by going to adafruit.com purchasing some hardware there. We've had some Raspberry Pi stuff but it's been selling really quickly. So sign up with emails if you wanna get notified. That's how I snagged my 2W is I got an email, got out of the shower and like immediately went to my desk to order it. If you wanna chat with me and a lot of other people ask more questions, collaborate the Discord servers where that happens. It's a chat program. You can go to the URL adafru.it slash discord that will get you into our server in Discord. And I think that's it. Thank you again to David for taking time codes and thank you to Patrick for collecting all those time codes in the repository. That's a great way to kind of search around in all of the previous episodes of deep dives which are quite a few now. So there's a lot there. They're all like two hours long. So thank you again to Patrick and David for that. And oh, and lastly, PiCast on Tuesday, I'll be on there and we'll be talking about all of this work. So if you've been watching these deep dives you'll probably be up to date on my thinking about that but it should be cool anyway. And with that, I will switch to the cat cam and pet the cat after I unhook myself. Have a great weekend, you too, Paul. I'm excited, I'm gonna see my fam. Have a great weekend, everyone.