 All right get this show going. If you're watching this after the fact, make sure you check the description below for time codes so that you can skip around. These streams tend to be about two hours long so the time codes are great. Thank you to David in advance for making those so that people can find their way around the video. We'll just take a few minutes here for people to collect and I'll say hello to folks and then we'll be on our way. Oh let me pause these. I have like two tabs that play it back to me and I paused it in a really weird when I make it a weird face. Of course. Yeah and both cats are in the window right now enjoying the sun. Hello Pierre, deep dive into USB. Hello unexpected maker. Hello David. Hello William. Hi Neil. Hello Michael. Hello Biata. And be alone 20. Hello. Oh and I don't have uh my discord's on the wrong thing. This is the third to last stream I'm going to do before I'm off on paternity leave. Hello Thomas. Hello foamy guy. Yeah we'll see if Vin wants to say Vin is the closer of the two cats. She's the one that usually doesn't like it when I'm talking but my uh nobody's in the house besides me so that I'm the only human she can hang out with right now. Hey Dashipu. Hello Mark. All right I guess I don't have to keep waiting. We'll collect some more people. Hey Keithy. So we'll do some housekeeping and then go from there. Thanks Neil. Yeah I'm very excited. We have just over it's a it's a a month and a week until the due date so is that your cats? Yep these are the two kitties. Spook is the one under the plants further away and then Vin is there with just the spot on her head. Hi Ham's Lab. Hello Enic Data. Hello Fokenology. Yep everything's good. My partner's mom is in town so that's been fun. Okay so hello everyone. Let me switch off cats actually before I do that. Hello everyone my name is Scott and I work on Circuit Python for Adafruit. Circuit Python is a a version of Python designed for microcontrollers which are little inexpensive computers that are yeah really expensive not super powerful but they can go in a lot of different places which is really cool and yeah so Adafruit pays me to work on Circuit Python and pays me to stream and Adafruit is an open-source hardware and software company based out in New York City so I work from home here with the kitties at my side there are my co-workers from Seattle here so yeah yeah they're from the same their brother and sister from the same litter so yeah they're definitely definitely related. If you want to support me you can support me by supporting Adafruit by going to Adafruit.com and purchasing hardware there. There's lots of cool stuff coming and lots of cool stuff already out if you're new to the new to the world of hardware and software and embedded stuff. If you'd like to chat with the folks that are in here this middle box this middle box is the Discord server which is a chat server that lasts throughout time not just tied to individual streams so you can go to the URL adafru.it slash discord and that will get you into the Discord server where I hang out we do a bunch of Circuit Python development and a lot of helpful folks there so it's a great place to go I always point people to that so this is a deep dive it happens every week normally on Fridays at 2 p.m Pacific which is basically now four minutes past now and we typically go for about two hours things that are kind of further than that or longer than that are kind of exhausting and folks usually set aside these two hours anyway so because we have so much time we're happy to answer questions which I'll get to in just a sec I know I'm a little behind on the chat but before I do that the last few bits of housekeeping next week will also be on Friday and the week after that I think as well those will be my last two streams before I go on paternity leave the baby's not due until the end of next month but I don't want to like try to plan it and then have the baby come early and be worried about that plus my wife is going to be off work starting next week so it doesn't make sense for me to like carry on being super rigorous while she's not working either so two more after this one and then Fobenguy will continue doing deep dives in this time slot which is awesome so if you do want to find if you do want to like hang out with this crew at this time we're going to have somebody else streaming and foamy guy does great streams and lots of different circuit by that related content so thank you foamy guy for doing that I really appreciate it and I'll read off a bit of an update after that but lastly in in the housekeeping section here David DCD is very kind and takes notes during these streams and that gives you time codes and little blurbs about what we're talking about when so those have been collated by patrick ask patrick w and they're on github at github.com slash ate a fruit slash deep dash dive dash notes so thank you to them both for putting those together okay let me catch up on the chat if folks have questions I'm happy to answer them but generally technical questions are better than personal questions but I I'm a pretty open book as well so neil says congrats thank you third to last unless some happy surprises come early yep these are my cats hello paul and hello pierre yeah I I rearrange the furniture I so the thing against the window is actually like a bassinet stand and I was thinking about putting in here and then kind of decided against it so I switched it up thought that would be fun um hello joe and I already answered unexpected makers questions about the the cats being siblings which they are and I think they had there was another pair from their litter that was also up for adoption but they these two both have smudges on their nose which is uh makes it pretty hard to tell them apart but you have to look at their ears to tell who's who um andy there says congrats thank you uh be alone says uh how old are you I'm in my mid-dirties I'll tell you that much and hello randall thanks for joining so that's the youtube chat um hello I think I said hello to bruce didn't say how do you uh hams lab asked any clues as to what foamy guy is going to do on fridays after you're gone and foamy guy's in the chat and said I will continue on with deep dives on fridays very similar type of content working on circuit python related things but it'll likely we'll spend more time in python land than sea land and maybe some working on projects instead of core slash libraries I've been streaming saturday mornings for a little while now you can check those out on youtube if you want a sneak peek you can check out one of those prior streams and the deep dives will end up being pretty similar and hello bruce again so that's it um thanks again to foamy guy for being uh game to step into this time slot um I don't know what my plans are whether I'll come back to it or whatever I like this is my first kid so I don't I don't know what to expect and I don't know what I'm going to want to do and I don't know where Adafrit's going to be by the time that I'm kind of back into full swing so we'll play it by ear um I'll let you know um but foamy guy does awesome streams too so maybe I'll just uh hop in the chats on those to start um okay any questions before I kind of make stuff up as I go along which is what I do every week and I know there's a lag so I'll just uh delay a little bit any circuit python or hardware questions you want to topics you will want to cover before we get going I don't see any cool well I can I can make stuff up so I think last week I started to talk about that I was looking at USB host um the BLE stuff that I had gotten in um is all checked in now I think so I've like turned that page um I'm realizing as I get closer and closer to this baby coming that I the larger projects are being harder and harder for me to focus on so uh before I get into the USB host stuff I should I think I should actually there's just a couple fixes that could be mildly interesting for me to cover um so let's so Dan and I Dan and I were talking about doing a 7.2 release and Jeff too so we went through all the issues and we categorized them um pure has a related question uh let me finish my thought on 7.2 and I'll go do that do I know anything about phones not a lot not a lot about phones uh embedded electronics are simpler than phones generally um so yeah we're trying to get 7.2 done we had done the milestones earlier in the week and then there was like three or four issues left and so yesterday I was like hey Dan do you want me to pick up a couple of these so let me just briefly go to the desktop and just talk through the couple that I did and it was quite nice to get something simple and and knock it out so Dan updated the frozen libraries after realizing that IR remote was fixed um I switched this thing so that we have we changed the default state of pins on the ESP port and so um there was a Dan had noticed that on the mag tag the speaker was clicking because the speaker is on when it's high and so there is this like yeah this this noise that was caused by us turning on the speaker so I introduced the thing in the ESP port that allows you uh a board individually to override what a pin reset means so on ESP if you can say uh you if you define ESP board reset pin number it'll give you a pin number and then you can check it and if you want to reset it you reset it and then return true and then after that it will um be ignored after that um so that was one of the things I did and then um Neradoc did a fix so thank you Neradoc and then this there is this crash on Espresso when setting RGB brightness to zero and Dolt Dan and I created pull requests like one after another and we decided to go with the way that I had fixed it so uh the fix that I had was the the issue was is that it was trying to transmit over the spy spy device when the spy device wasn't uh initialized because we used to have pre 7.0 the status LED would be active uh throughout like when before user code was run as user code was running and after and there was like this weird handoff logic and in 7.0 we simplified it where the circuit python only uses the status LED before and after user code is run um and so this was a crash due to the fact that um we had this thing here so if you set the status brightness it tried to retransmit the the last color uh with the brightness adjusted uh but that doesn't work because that crashes now because uh the user code when the user code to set the brightness whether it's in code up higher in the REPL like either way the status LED pixel is not on uh so it ends up uh potentially crashing so uh I I re re uh documented it a little bit too to make sure that I was like hey when you set the status RGB brightness it's going to take effect next time that it's actually used uh it's not going to happen immediately so I knocked those two out um is there anything else interesting oh this is going to be interesting an unexpected maker might be interested in this is um Dan fixed this issue with how we handle deep sleep in circuit python when Dan uh when Dan implemented it uh we were concerned he was concerned about the ability to actually like plug in USB and be able to edit the the code um but the problem is is that USB enumeration which is the process and this is kind of dovetailing into USB so maybe we should just go there um once you plug something in there's a process called enumeration which uh is how you get like a device assigned an address and then figure out kind of what kind of device it is and that takes time and so with deep sleep and if you will if we wanted you to be able to plug in a device and have it pop up a circuit pie even when it's deep sleeping we actually had to delay like five seconds before uh to give it time to decide whether we actually wanted to stay a lot stay awake um so that we could do the USB stuff and I thought when we had implemented it that we had talked about a policy um where the very first time circuit python starts up it will do that five minute wait or five second wait not five minutes five second wait um to to give us be a time to turn on but um then if that if it was waking up from a deep sleep we wouldn't do that wait um so this is what Dan implemented so this this will be in seven two so the idea is that if you hit the reset button or you plug it in it'll wait the five seconds to make sure uh before it will wait five seconds before deep sleeping to make sure that you didn't want to connect to circuit pie like it's connected over USB um but then if it if that five seconds goes by and it goes to deep sleep the next time it wakes up it's not going to wait that five seconds it's going to run the code as fast as it can and then go back to sleep and this should be good for anybody who's doing lower power stuff in circuit python is that um a lot of the power that you consume is actually in that period where like circuit python is running so by shortening that to to not five seconds it should actually improve battery life a lot which i'm very excited about so thanks to Dan for for fixing that um so the the moral of the story is power low power stuff should get better that's across i think this is universal it was in main dot pie so any port that does deep sleep should see improvements and but then the caveat is is that if you do want to actually be able to connect to something over usb you actually you'll have to hit reset um deep deep sleep won't give usb enough time to enumerate otherwise um okay i don't think oh uh purples fixed the pressing the any key responding slowly on expressive which was i they saw me struggle with on the stream so it was awesome that they found and fixed that so thank you purples for that is there a way we can hook into that i have vivas sense on my s3 board so i can bypass that is not vivas present um we don't currently have a way but you can totally add it um i would suggest starting from this pr because it will show you exactly where that mechanic is happening so it's 60 60 51 is the pr that changes it so yeah take a look at that um hey charles but yeah we don't currently have a way to hook it to the board to know um and i'm not actually sure you want it on vivas either because it's possible you're using like a usb charge only cable and that's and you well i guess yeah it's not clear to me whether you actually want that or not um if you know if just if if you just know you have vivas um pierce says that's a great improvement what about if i want billy after sleeping sending a message saying this is how cold hot i am over billy so this also takes this also should take into account the billy workflow stuff but the expectation i think is that if you want if you want to wake up every so often to do a billy broadcast for example then you need to um you just wake up and do it and then go back to sleep there is a register you can check to see if the usb is on perhaps other boards too yeah we don't take that into account we're doing it based on enumeration i think we're i think i think it's dependent on tiny usb at the moment um okay i think yeah jeff improves get described and we'll test that because we're about to branch we're brought about to branch 7.2 so we'll have a separate separate branch for 7.2 which will be our next stable release and then jeff's been working on um merging in micro python 118 so that's all ready to go we're just waiting to do the branch and then we'll do the merge into 118 so we'll actually have like a 7.3 alpha with the new micro python stuff in shortly as well which is another reason we kind of liked it like that's kind of sometimes our forcing function for getting a stable releases we want to be able to have the pre-release builds be uh less stable because we have some something that's like bigger that we're going to move in um and speaking of this jeff's in the chat and says the new performance stuff for micro python the fast path and the lookup cache which is one of the major features of micro python 118 gives a 19 performance boost in the most contrived example i could come up with compared to 7.2 alpha 2 it's a loop that just accesses a member of an object more details in my latest comment on the 118 merge pr um correct pierce pierce the new micro python will be in 7.3 yeah that's our plan um if if a micro python merge changes the mpy version that forces us to do a major version but this one does not um the next one will so 119 will probably lead to 8.0 um circuit python 8.0 um i think those are the highlights our merge reanimator has been doing a lot of stm fixes so that's been great um and we do actually have there's a samd deep sleep fix that's almost ready to be merged and as well um and then uh the the merge pr is 60 38 and jeff didn't turn on the program and stuff i was like hey could you just take a little bit i think it's like kind of impressive so a little loop on the rp 2040 became nearly 20 faster so yeah uh subscribe to that pr 60 38 should be coming in shortly and then we won't be able to do a 7.3 release officially until 7.2 is stable but i think 7.2 has generally been pretty good so i my my guess would be that 7.2 will be stable in the next week or two um charles is saying and oh i should say thank you to jeff for doing the merge merges are not always pleasant so thank you for doing that um and thank you of course to all of the micro python contributors for making micro python even better um okay charles says i need usb host so i can build a mini concentrator uh that will allow more than one usb device to be connected through one port yeah so let's talk usb and if folks have questions feel free to ask them in fact i miss one from pier so pier's question about usb host is that says is that mostly a traditional in quotes raspberry pie thing or some micro controllers also support it i know you need hardware for it um jeff says sometimes i like a week where it's almost all code and no hardware i know what you mean i sometimes getting new hardware set up is like a hurdle that i've got to get myself over um so i think yes usb host tends to be more more of a like full computer sort of thing um but at the same time a lot of them do actually support it so um the thing that you want to look for generally is in micro controllers it will be otg so if it's usb otg um otg stands for on the go and it's a way of detecting whether the the usb should be a device which is what circuit python curly is or a host um and i think generally generally if it has native usb it can be both um there's actually not a ton of difference between the two um it's more about like one of the trickier bits is like who provides the power and yeah so randall says what would you think of a port to x86 for retro computing um if somebody wanted to do it it should work like we already have a unix port um i think one of the challenges if you're talking bare metals just like the documentation but i'm sure lots of people understand it i just don't i'm still getting into the cortex a land of stuff well let's see let's see we can just use the nrf 52 840 as an example uh the bigger challenge is like because circuit python kind of has that role as a usb device um and only had and a lot of the boards only have one usb peripheral that's it's not really like where usb host is interesting the reason that this came up was more around the um the the person who did the demo for the raspberry pi uh for the raspberry pi pico the rp 2040 being able to do usb host from a p i o which basically giving you a second usb native usb um that's more interesting so that you could still do circuit pi device but at the same time you could also do usb host which would be neat so let's just see it says usb 2.0 which is not telling us enough but if we keep looking how do i find the data sheet get started development kit uh oh here's the product brief i remember how the x86 had basic built-in would be cool to see the rebel instead so circuit python and micro python are very 32 bit cured still so you'd still want a 32 bit cpu because that's kind of what it assumes and remember you need like 32 k ram or more um where the heck why is it so hard to find the oh i've downloaded find the data sheet so let's see what it says in terms of usb full speed usb controller let's say yeah none of this tells you i think we'll have to find the data sheet slitzer says one will ate a fruit stock more raspberry pi fours and the answer is when they receive more raspberry pi fours from the raspberry pi folks oh here's a documentation button i saw a pio asm demo the other day in micro python was circuit python the origin of pio asm i don't know what demo you're referring to but the the format for pio asm originates from the c um hello kernel panic i like your name um the c version of the pico sdk has a form of pio asm and uh it was my choice to basically write an assembler in circuit python to basically convert that standard syntax that they had documented in the data sheet and stuff and then convert that into the bytes that are the actual assembly whereas um micro pythons approach was different originally like damien used uh lots of python tricks to do python that generates the same stuff so we we we chose to do different approaches for that i'm asking you about nrf 52 some people do ask to make dongles for their fancy wired keyboards make them wireless yeah let's keep digging um product specification i have the older version let's open it and so we're gonna go it's probably not core components peripherals alphabetical so this this explicitly here calls it usb device um so that's telling us that it doesn't do host i think nordic designed this on the usb device themselves so or the usb peripheral so it it's unable to do it um yeah so this is just a thing yeah so it doesn't look like the nrf 52 8 40 can do it i'm a little curious because they now have the 53 40 i know that's like the the next gen so it says usb again let's go to documentation sam d-21 can do it i know that naradox says usb host and bluetooth workflow would have been a good combo so the s3 can do ogg i think i'm not sure if tiny usb does it the usb supports it but um the s3 is probably that bluetooth plus usb host the combo that you're looking for 53 40 products back which we don't we don't actually support this in circuit python yet but i'm curious to see if they added it in the new gen so let's do the same thing let's look for network core peripherals and usb so it's still just usb device in the 53 40 as well michael says tiny usb doesn't support it yet doesn't support usb host on the s3 right but i think that i think that the hardware does i know i have the data sheet around here somewhere technical reference that might actually tell us more preliminary yeah so this says usb on the go so that means that i can do both oh michael confirms both the s3 and s2 can do otg thank you michael that's helpful so yeah so if you want ba lee and usb then the s3 is your first first uh your best option i think so so this is let's see the s3 features usb on the go along with an integrated transceiver it can either operate as a host or a device and supports 12 megabits per second full speed and one and a half megabit second low speed data rates of the usb 1.1 spec the host negotiation protocol and the session request protocol are also supported so that's a way for the two devices on each end to actually negotiate who's the host and who's the device um okay device mode features so today i wanted to talk more about usb host and the reason kind of the i think i showed it last week but the the reason to look into usb host was the really cool as i said earlier the rp2040 demo using pio as usb host so that that gets us to the point where we have two usb's and one chip and that's really ideal for us because we can continue to do the circuit python workflow over circuit pi um but then also doing um also doing usb host at the same time so uh having two is great um there is uh one other option for that um this brings so many potential project ideas so so i was working on the pio stuff in circuit python i got a little bit um in the weeds with that because a lot of it's in circuit it is in tiny usb um and so i've actually tried to hand this off to tac i haven't heard any updates from tac yet about it so tac is the the maintainer of tiny usb um and is creator and maintainer of tiny usb and is actually paid by eta fruit as well to work on tiny usb so if you want to sit you want to sit uh support tac you can you can do that by purchasing from eta fruit as well um so uh yeah tac does a great job um oh there's an esp usb soft host as well that's interesting uh for low speed only yeah so the pio demo is able to do full speed as well which is interesting pierce says my s3s for unexpected maker are traveling right now still no traveling for me teres says the rp 2040 is something i really want to try using one day the rp 2040 and particularly the pio is amazing um they're really inexpensive to try so i would totally take a look at uh take a look at that so gamma game says will there be a helper library to make the dual usb easier to work with so um there's already on on um tiny usb or not in tiny usb the the pio thing is this look at my browser history uh the pico pico pio usb repository so if you want to start and play around with that um you can you can take a look there i'll drop that in the chat and yeah i love tiny usb too it was there is a point where circuit python i i kind of like said like look we're just going to switch to tiny usb for all of our usb stuff because i was fixing bugs in like the atmel provided usb stack and it was like but it has a license that says you can only use it on atmel stuff i was like why am i using this vendor provided stack that has bugs in it where i can see the code and i can fix it but i can't like then have fixed it for all of the places that we need to use usb um so i thought that was kind of silly so uh tac had already written a lot of tiny usb and i kind of took a look at it and and uh i don't like to tightly couple circuit python do a lot of things but that was one case where it was just like i don't need five usb stacks because all of this most of the stuff that it does is all class level which is like usb hid usb mass storage usb midi are all things that are like generic and define kind of outside of individual vendors so it doesn't make any sense to have like multiple implementations of those things so uh it chose to just fight the bullet and switch all of our usb stacks over to tiny usb which i think was basically i think it was basically that like we had done atmel and then we were about to do like nordic i think and it was like instead of having two different like a nordic stack and an atmel stack we would just have tiny usb um paul's also waiting for the s3s so uh yeah so i i got this demo going and i was trying to like start to figure out how to fit it into tiny usb um and i had mentioned it to tac and he sounded very interested in working on it so i originally i initially said no no no i'm working on it and then i went huh what could i do if tac was doing that part and so um my my focus is shifted from that super low level like pio a low level of usb host to the kind of the other end which is once we have usb host um what does it look like in circuit python to actually use it um so that was kind of what i was thinking i'd talk about today is like how i'm thinking about exposing usb host into uh circuit python and i should say that we actually do have uh some boards some microcontrollers that have two usb's on them already uh where we can where i can get it working uh i don't need to wait for the rp20 40 usb hosts stuff to be able to actually add the host apis and things um yeah the python api side so so that's what i'm thinking about and um what i've got is i'll just unplug it um this giant dev board that i've complained about before and i continue to think it's kind of terrible but this this dev board here is the imx 10 60 uh imx rt 10 60 and it's got these two usb plugs right here uh because it has two usb otg peripherals in it um and they can do terraces i'm a python programmer so this is right up my alley awesome yeah um yeah so this is an imx rt 10 60 and it's on the teensy fours so teensy four and the imx 10 50 and 10 60 have um yeah this board is gigantic it's gigantic and the thing that bothers me the most is that there are no labels like there's a ton of labels there's a ton of labels and they're all the like schematic labels so you want to look at these two usb plugs they're not labeled usb one usb two they're labeled like j something right like j nine and ten and the buttons the buttons are labeled switch three and switch two they don't tell you which one's reset or boot or whatever um so yeah not a huge fan of these boards um but then again cheap dev boards uh which have like all this stuff on them are are kind of awesome anyway especially these imx rts i was very excited about these um when they first came out because this this imx rt uh the 10 60 is clocked at like 500 megahertz like it's very quick and has like a megabyte of ram so uh we were planning on getting into these imx rts more um but they've actually been really hard to come by so um i'm not sure they're available yet but at some point they'll be they'll be more available um and in the meantime this is a great way for me to do the usb host stuff um so if you do want to they can have labeled them press and see what happens yeah yeah it's just kind of outrageous so um but yeah i can i can use this to get it working and then um correct this is the evk there's an evk b now which might be better um i don't know what the difference is but i i picked it up pretty early because i was following this chip family a lot um but the teensies are really pretty affordable the teensy fours um they don't have two usb plugs but it's not that hard to just plug it in anyway yeah and terra says i have a teensy with an imx rt 10 62 so you should be able to run circuit python on that it's it's not gotten a lot of love but i think it still works and in fact that's one of my next steps is to get it going on this board again be for better yeah probably um so yeah this is this is my uh evk 10 10 60 uh and um these are cool chips they're super fast and this one has two usb's with embedded fies so fies are the things that actually do the like changing of the signals the physical interfaces i guess is what fies um and they're they're high speed as well so so this these were this was the first chip family we found with high speed usb which is 480 uh megabits per second instead of 12 so these are these are going to be really cool chips when we could actually buy them um yep and todbot points out that teensy already has a usb host library that works on teensies so um you if it doesn't work on circuit python you can always try it on our duino with or teensy duino um and deshipu's pointing out at least the ones of us with the compulsive microcontroller oh we all do deep in our drawers at least the ones of us with compulsive microcontroller acquisition disorder um can i give you is let you in on a secret somebody nerd sniped me so nerd sniping is a term that i use for uh bringing up a topic that is of great interest to somebody even when it's not the thing that they should be paying attention to or working on um i guess you could also think of it as like ooh shiny and like distracting um so i got nerd sniped in the last week i think it was and i finally gave into that so um a few weeks ago lady aida had pinged me and said hey what do you know about FPGAs because she's starting to think about like longer term projects and stuff and with the long lead times for chips she was thinking about whether like some FPGAs were things that she could get so she nerd sniped me on did on FPGA stuff and then kind of i don't think it went anywhere like it was still kind of uncertain what we wanted to do um but but but but um in the last week or two somebody has dropped into discord and said hey um i know that circuit python runs on the cortex a 53 and the a 72 which are the raspberry pies i'd like to get it running on a cortex a nine and this a nine happens to be right next to an FPGA so xylings has these uh chips called the zinx and they're kind of half microprocessor and half FPGA um where they have um they have dual core cortex a nines and then they have um they have dual core cortex a nines with like 512 megabytes of external RAM so they're they're actually designed to run Linux um and then that's all connected into like a an FPGA as well um but it also has hard usb so it has usb oh it has a usb peripheral um let me just pull it up let me just pull it up so the zinc seven thousand and yeah so the seven the regular seven thousand is the thing that i got nerds night with um so here's what you can see it's got like dual a nines it's got a huge cache lovely a 72 says um the rp20 40s native usb can only do slave so no it can do it can do device and host but host uh if we want we want to be able to do both at the same time so you can still have the circuit pi example um web BS case as nerds night yeah nerds night is uh a term i used for being distracted by cool tech i guess and in this case because we're talking hardware it can cost money as well um and woo ha ha woo ha says 11 says um it sounds like mining rig boards on aliexpress true because i think i think FPGAs are used in in mining stuff as well for as an alternative to like GPU stuff um and the ship who says it was nice to know you um yeah so so the thing that got me was if i ignore this bottom part of this thing it's basically just another microcontroller or whatever um ryang says i have a vigilant core s z7 i can help with so um yeah so there's two cores it can talk to the programmable logic um slinky tangles says vivado if you love endless frustration so the other thing i looked into though is that the open tooling has pretty good xiling seven series support so i was looking at um oh github.com uh simby flow project x-ray so simby flow project x-ray is uh documenting the xiling seven series bit stream format so the open tools should actually work with us um and if you look in the database they actually have zink sevens in here um for this the 70 tens and the 70 20s so not all the different variations but the variation that i ended up ordering off digikey two hours ago because i gave in um it's it is supported by the open tools so um that may not mean fully open or fully supported but i did actually find also where did i find it i don't remember where it was but there's also um some like automated testing infrastructure for the open tool chains that they're using the zink series to do um um so yeah so i got nerd sniped by the ability to do fpgas but not needing to worry about the cpu cores assuming that i add support for the cortex a9 which i don't actually expect to be that difficult um the kaiser tamelos 93 says how does the intel adoption of risk 5 affect the fpga progression it's a good question i think more open fpga support would be awesome um i don't know exactly what all that means um i think it's cool that intel's adopting risk 5 and they're definitely trying to pivot intel i think a bit to more like we'll just make chips for everyone which is good too and if you haven't followed it the stuff that myth row is doing tim anzel with google and the free asic design stuff is really cool um if you if you haven't seen this um you can make your own silicon like you can design your own um the open shuttle program so this is e-fabulous is a company that's to some degree the osh park of of an integrated circuitry um but google is sponsoring these programs where you can design a chip and they'll manufacture it for you and send it we always called it geek trapping interesting um so they give you full documentation on the 130 nanometer process and um you have to just post your your designs to github and then you can get it actually manufactured um if it's openly licensed and stuff so that's just it's really cool there's some really cool videos on like they've just got the first one back there because it takes so long they're like starting things as they go along before they even get everything back um but yeah this stuff is really neat and they're working on doing more technologies and stuff so i would hope intel would like make available some of their older technologies um which would be really cool which is another reason that was like oh i think it might be time maybe maybe during my paternity leave what it would be like oh i'm just going to play around with this this fbga stuff lamore doesn't want me doing it lady it doesn't want me she she nixed this but i gave in so the reason i gave in it's an open source supported to uh fpga in this it's um it's dual core a9 so it shouldn't be that hard for me to get it going because i've done i've kind of gotten over a lot of the hump of learning the cortex a series stuff and then what i also saw here is that this has hey rich um there are two hard usb ip blocks and i did some research and they're called um what's the name i forget what the name is but i was just looking in tiny usb doing this host stuff and i was looking at the imx the board that i was showing you before i was talking about how i got distracted and i am x has the same usb peripherals as this zinc does um as the zinc chip does so uh i couldn't help myself it could not help myself um it's in tiny usb or no i was looking in if you look at tiny usb board support imxrt and then family dot make what you'll see is it uses the source from chip idea rich says i'm really interested in fpgs but haven't had time to dive in yet so yeah chip ideas the name of the the the usb core um sorry let me there is five followers spam on twitch that i had to ban somebody for um so chip idea and this is the same usb chipset that is on this zinc with the cortex a9 so i gave it i just ordered it it's probably not it's probably going to just sit in my giant box and at the bottom of my drawer like this ship to the ship who's talking about but i just couldn't help myself i just couldn't help myself because what i'm picturing in my mind is that you can have circuit python running on it and you can say all right put this on the fpga and then interact interface with it like all without having to like restart or worry about any of that so i'm pretty pretty interested in seeing how that how that works yeah i wish pc companies would open up all their older components to allow hardware changes without major hacks and overalls i agree with you that's the beauty of open source hardware like ader fruit does and george points out that um andy's acquisition of xilinx which they completed this week i think may have some effect on fpga's as well yep i think that'll be interesting and wuha linked to uh a zinc board one thing i would caution you if you're if you're interested in this is the unlike the imxrt the zinc does not have the usb 5 on board so it has to have an external one and the from what i was looking at the dev boards for it not all of them support usb device they they usually support usb hosts but they don't always do usb device so i actually bought not the cheapest one because i wanted one that could do otg so it could do both um we all have a lot of dev boards that looked super useful until the next one i yeah and it's kind of my job to have them like i've got basically the whole series of the imxrt's like it is it's handy to have them especially if it's like one day you're like oh i want to add support for this and you don't want to have to wait for shipping and stuff so all right well that was a a huge detour in how scott gets distracted by shiny fpga chips that are also cortex a level stuff but that's not really going to be that shouldn't be my job because i know it's too high cost i think really for for uh did he share what version i bought i can show you what i what i got let's do a quick digikey detour so if we want to find that it's under well we can just like zinc 70 10 it's 200 bucks the cheapest ones i found were uh modules i think it is the evaluation boards let's do series zinc 7 000 in stock pierce says you are one of the few that can actually justify their collection slinky tankle says i worked with the micro zed and the red pitaya there are a lot more other expensive eval kits oh zarland says thanks for the last week's tips i have circuit by the working on the pi zero 2 w and the s3 nice yeah so if you just look here the zybo is what i ended up picking up and in the image if you can see it's labeled usb otg um and i like did my digging and and looked it up if you look at the well sort by price it is still one of the cheaper zinks so there's this pink board which is funny because it's like meant to be python python and the zinc and it's only got usb host i think note that they have hgmi as well which is cool um um and of course they have the arduino the the arduino footprint um but yeah so i picked up this zybo one that i can link to of course i i make no promises that anything ever happens to it so be aware of that i've got one of these on my bin i'm about to dive in digital it has a huge section of selection of p mod adapters yeah and i have a collection of fpga boards like let me be real and i don't use them but for some reason this is interesting to me because i know i can do the hard ip sides of things like the folks that did the there's an eos s3 which is like an open thing and they did like an fpga version or they did a feather format of their their like hybrid microcontroller and fpga but they don't have usb outside of the fpga so if you wanted usb support you would you would fill up the fpga with usb and you wouldn't be able to do much else um so so this is yeah this is what i just picked up i don't have it yet uh this this zybo z10 but yeah it i finally gave in to that and i justified it the money because uh luckily i have a bunch of github sponsors and they give me some extra spending cash for my business so i was like i'll just i'll just consider this like something i use that money for because i know i know lady a dad doesn't want me working on it even though here i am talking about it but the usb side like the usb side i should be able to get tiny usb going on it with hopefully not too much too much trouble oh interesting taris says i bought my first fpga recently a tang nano 4k dev board that has a gaon blah blah blah blah that has a cortex and three embedded haven't worked out the tooling yet hmm let's take a look at that do you think digikey has it you know 4k i don't think the gaon ones are supported by the open open tool chain you know 4k dev kit details it's got a usb connector but there's very clearly an adapter next to it 4 000 or so lots i was thinking wouldn't it be cool and i don't know if this is possible but with the zinc whether we could put a risk 5 core in it and then have it talk to the usb directly so that we could like switch between the two okay so it's got the m3 but i don't see any mention of usb i believe there's a i'd believe it that the open tooling like cost is such a barrier yeah $18 $18 dev board versus the $200 i just spent on that but usb yeah i'm such a usb person um phognology says i'm hoping to i can use the st dual synopsis usb otg with circuit by then host and device um it's also a new dead thing i've been doing it a while until you realize that hgmi yeah large full hgmi forge fpga oh yeah this feels more like like the mock xo2's are really interesting to me um the mock xo's from lattice so there's kind of two ways you can treat fpga's there's one that is like i want to just treat it as like a little bit of extra circuitry next to my main thing as like glue logic or there's the i want to create my own system on a chip virtually on an fpga and those are like two very dramatic different uses for it whereas like one needs a lot of resource and the other one doesn't um yeah so if you want to know what has support for host in tiny usb um if you want to help me with this this would be awesome but if you look in examples and host there is this hig controller and there's this only dot txt which lists the boards that the the example is actually run on so circuit python doesn't have any of this lpc support we do have the imxrt support and we have you'll see this host example actually works on the rp2040 as well um the gowan fpga in the board has a usb fi interesting uh did i close that tab what was the part number welcome to deep dyes where we don't always talk about what i advertise is what we're going to talk about hi ter yeah can we find the oh here's here's but that's like an announcement is there uh oh this is this is a handy reference i think open source tool chains oh yeah here's some like no name boards interesting oh man the pink has a 70 20 on it and otg host that's a weird way to say it this looks looks like a handy reference this is what i picked up but i picked up the cheaper version of the two j tag usb j tag usb sounds different pretty amazing that a one dollar mt you can be a usb host oh digikey knows i'm talking about them because they just shipped my order i tend to my my interests like kind of cycle i get really into some things and then i kind of move away and do something else but i do actually go back to things does adafruit have any interest in making more networking care probably not hardcore networking stuff but we're making more and more devices that are more and more devices that are like network connected but i don't think we'd ever make like a router or anything so yeah so um we should maybe talk about usb usb host so what is usb host so we've talked a lot about usb device so usb device is um you connected to something else and where do i want to start so what you can say is hey i'm a keyboard or hey i'm a mouse like that's the basics of of usb of a usb device and then it can get more complicated you can say and this is what circuit python does is you can say um hey i'm a mouse and i'm a keyboard and that's what's known as like a composite device um i'd like to see a coax to sfp plus uh you could always email support with suggestions but i i doubt that that we're going to do something like that um the usb host the best usb to have around for your party today's foxes in love comic was precisely about this yeah so um so yeah so so usb devices say hey i'm just going to be a keyboard um and uh that's that whereas and the the opposite side of it being a usb host is like i want a keyboard to plug into me or i want some of their usb device to be plugged into me and the job of the usb host is to um manage that that device and any other devices that are connected to it because not only can you have a single device connected to you as a host but you can potentially actually have like uh you can have a hub connected to you and then multiple devices uh connected to you after that so um imagine that you have like a hub and then you plug a usb keyboard and a usb mouse into it um and what the usb host needs to manage is like what devices are there and um who do i need to talk to sort of sort of stuff um so and yeah and and all of the communications on usb are um hosted and initiated so um there's like a starter frame packet that goes out every millisecond for usb 2 usb full speed and low speed and then there there are b packets that say like hey you device here like tell me um like has anything been pressed um i'm not describing that that well let me show you i have is that where i want to start maybe not maybe that's not where i want to start so what i've been thinking about is what will the api be that we present to uh circuit python user code and there's a couple things that i'm considering too because i do want usb to be able to run outside of the vm the usb host to run outside of the vm because i do have this world where a board oh yeah ben eaters video is great yeah let me plug that to you i i actually watched that on friday um let me make sure you don't see my all my youtube stuff or ate it fruits yeah this yeah ben eater did like a whole series christada says i forgot why i was subscribed but this seems quite interesting i'm glad you find it interesting if you have questions i'm happy to wander away if i want to plug in a keyboard would i receive hit events and have to deal with them yeah so let's talk about that and i think um yeah let's talk about what that means so i think i've got so this is the s3 so let's let's just take a look at this host mode features eight channels pipes and control pipe consists of two channels in and out as in and out transactions must be handled separately only control transfer type is supported so there's this idea of in in host terms it's known as as pipes but um in device terms they're end points so um if we're using a keyboard an example which i know pierre is interested in who makes keyboards um you would have like a an endpoint that is uh an an interrupt endpoint that is where your your reports about what keys are pressed go and to call them interrupt is not interrupt is super overloaded for people but the the idea with interrupts on usb is that it gets pulled every so often by the host so the host will say like hey um how fitting h id management yeah um um yeah so so yeah it's everything on usb is actually pulled but interrupts are kind of have a guarantee about how frequently they'll be pulled whereas um other types of end points don't necessarily happen and pierre says message q perhaps uh huh yeah yep you're you're going the right direction so um let's see what in terms of the hardware on the s3 each of the other seven channels is dynamically configurable to be in or out so in is into the host and out is out from the host and then there's uh this has three types but i think control is a fourth type um bulk isochronous and interrupts and so i think that um so bulk is typically used by mass storage so when we're talking about reading and writing bytes on mass storage that's done through a bulk and two bulk endpoints um isochronous is um what is it what it means like consistent in time or something right so it's like uh it's for audio generally and then interrupts transfer types are like your h id stuff it's a common pattern of impersonating a hardware interrupt with pulling a reliable frequency yeah that makes sense terabyte says um would it be smart to implement python classes that represent h id devices at the high level yes so i think that's that's what i'm where my brain is going except for the fact that i do want to be able to do keyboards natively so that i can do it outside of the python vm um so let me see if this works i have the other way i thought about talking about this and maybe i should talk a little bit more about this but i also have the usb 2.0 uh the the 2.0 spec here and it might have some nice diagrams as well so here's bus topology so there's a this root hub and then you can have like multiple tiers of hubs and what they call functions which i've been calling devices um so this is this limits like how many different devices you can have on the whole bus there would be the need for low-level api in a circuit python host libraries yes so that's where i'm thinking um there's only one host in any usb system and there's a lot of devices um here's the electrical signaling mechanical bus protocol robustness so you have to do attachment and detachment stuff control bulk interrupt isochronous are all things that we've talked about too so allocating usb bandwidth so the host has to decide like in a given frame which frames it for low speed and and full speed are a millisecond long and how are you going to talk to all the different devices in that period folk knowledge says are you going to base it on tiny usb abstraction or use mixed usb abstractions underneath so it's it's all going to be on top of tiny usb so i might actually have to change some of the tiny usb stuff we'll see terabyte says one of my projects is to develop a hardware control panel for curvil space program and i want to plug it in via usb and i've been looking at implementing it as generic hid device so no drivers will be needed on the computer end yeah so terabyte that for for pretend for acting is an hid device circuit python does it really well um and you can uh you can do that already you should you should be able to do that already with circuit python so i'd recommend looking into it um yeah so so circuit python has been really really successful because of usb device support already right like we have a lot of people making keyboards my keyboard right now is running circuit python and there's some great tutorials on that in particular if you do learn.aderfruit.com and do custom usb you can see that there's like here's a mechanical keyboard keypad the one that i'm thinking of is this one because this one has other hid device so consumer control advanced topics like custom hid devices and boot and mouse support and i thought there was gamepad too but gamepad might be be somewhere else but i i link a lot of people to this as well hi kevin um is nkey rollover covered here the beneter actually has a nice um tutorial on that so you could do you could do a custom hid device to give you nkey roller over if you wanted oh and this is actually a gamepad example here it's just not titled that so yeah for acting as a usb device we have that really well um and so we're kind of doing and and we already have usb hid usb cdc and usb midi modules in circuit python for the doing those native but that's acting as those things not not receiving them um be honest that's what i miss about firewire having multiple hosts on the same bus oh i didn't know you could do that with firewire one thing i need is sending back data back to the control panel for displaying um we also support circuit python supports uh cdc so i'd probably go that route although um i was looking at the keyboard configurators and they use hid raw so i'd love to do hid raw at some point as well um that would be cool too i'd love to be like there's kind of a semi standard for configuring keyboards over hid raw and so i thought it would be cool to add that support to circuit python so that you could use those tools to customize your your keyboards so many different things to do so many things to do um okay so yeah this is all device stuff and we've been doing it a while and it works pretty well so the question is is like on the flip side how does how does our like usb world view change with host instead of device um yeah that's a good point jp says uh this is not a great tutorial to start with for hid yeah this is more of the advanced stuff um yeah so here's the list of of existing host examples for tiny usb so if you're on a platform like somebody was talking about st um this is the place to start if the platform doesn't support host so what what i'll do is i'm talking i'm thinking about this high level api for usb host in circuit python but it will be connected into the the usb host api is of tiny usb and so for every platform that tiny usb supports we should be able to just turn it on the circuit python have it be the same have it be consistent um and do that so what is the circuit python level api going to be and then can i implement it and build it on top of tiny usb so i did get the i got that hidden controller example running on this board um that's what i did earlier and so now my next step is to build circuit python and get it loaded for this board which i'll probably just do next week but let me i started working out what the api would be but i've that's kind of the brainstorming i've been doing so um are you blowing my mind about firewire it sounds a little bit like pc i pc ii i think can do stuff like that so talking about hubs and then functions compound device appears to the host is a hub with one or more non removable devices but yeah i think function is basically like the equivalent of what i think of as device so they have these like logical communication flows this stuff gets tricky yeah so this is where they start talking about pipes and they say a pipe bundle to an interface and i think there is a way for devices to have multiple interfaces that you switch between but i don't know how common it is in practice um good use cases for usb besides keyboards smart speakers and midi well cdc has its serial has its origins and in modems um i know some people do like network connectivity over usb but you can like a lot of people just want h id which is human interface devices and then like there's this synth crowd that wants midi like it's okay if it's a few use cases if everybody uses those um tera says firewire was basically pc i if i recall they could get access to host memory even which could open some interesting attack routes on old devices yeah i've never looked in the firewire i had it briefly when it was like a thing on video cameras i'm not so i'm my computer age involved some firewire but not a lot so i think that yeah oh this is a good example so this is kind of what i've been thinking so there's a this host side there's client software and there's buffers so i think pierre got to this before earlier is that a lot of what we're going to be doing is just buffering data in and out and then they have these pipes which in my mind like they end up at endpoints but like i think i'll just call them endpoints because we are talking more in a world aware like we're we're in a we want to share the usb world we want to like abstract away the host and device stuff a bit more um yeah so let me try i have the gimp open and i actually have a a tablet the drawing tablet here so let me just go a little crazy and see if i can't i just set it up uh but we can see if i can channel my like i think robert baruch's videos like to do this a lot um so let's see let's do i'm still not used to this but i'm gonna make it a little smaller so at the top level we're talking usb host so that's the first um like the module level thing i actually bought this a few weeks ago and i hadn't set it up so i i plugged it in and it just worked so i was pretty happy so i was thinking about this originally i was just going to do dot devices as like the here's all the devices that are on the port but i don't think i want to do that because thinking more about it i think you you know it's pretty standard in circuit python to have like a constructor um oh i don't know what i did there but i think we want it to take like d plus and d minus which are the two usb pins and then i think there might be you know like we talked about vbus a little bit so maybe we want like keyword args for like other pins so i think we i think we do want like a high level port object and on boards that have it like baked in they can just instantiate this and then you could have like a board word dot usb b i just got this i don't know what it might be confused by my hand usb host for example it's on my lap that maybe that's my problem oh and of course i meant to capitalize that oh i didn't notice david we're we're watching me use my new writing tablet thing okay so i think port would have like a dot devices devices and this would be like a tuple of device and a corollary that i'm thinking of is like the bealy i o dot connections i don't know what i'm doing so that it's doing that like very similar style pen and paper under the top down camera works best yeah that that would make sense too except i only have two more streams after this so i this point i'm like i'm not going to change change my setup at all um yeah i guess it could work but i don't have that i don't have the hover cam set up so that's that's kind of like the corollary that i'm thinking of so the other class that we would have or one other class we would have here is a device am i bumping that there is a button on here that i'm not aware of so these would you wouldn't construct these devices you would get um you would you would get them from the port object and they would automatically create them for you so internally they would know like device number so that is like the internal reference number that's used on the usb port but then you'd also be able to do like d dot vendor id vendor id dot product id and these are like your two super course like um yeah i'll get better at it too usb to do automation stuff oh that is one thing i thought about so if we could do usb host and do mass storage cdc we'd be able to automatically update another circuit python board and verify that it works so i think this could actually be really useful for automated circuit python testing um okay so where am i so other things that we want we definitely want the descriptor and this is the thing that is the like tells you a lot more um a lot more information about what the device can actually do and then there i one one thing i was thinking about is there's a command in usb that is get string descriptor so in the descriptor itself there may be things that say hey i have a string name for this and then you have to look up the id so i'm considering having like a get string descriptor function call where you'd give it like the number of the string descriptor that you care about um but i'm not sure that that is the not sure that's the best approach because generally i like it to be better documented but this is kind of like more of a free form thing kevin says when you said you only have two more streams are you leaving ate a fruit or something i'm not leaving ate a fruit i am going to be on paternity leave because i am going to have a child at some point soon well the the the kids due date is the end of next month so it's not like i'm overdue but yeah i'm going to be taking 18 weeks off total this year for learning how to parent a small child get string descriptor seems very pythonic i generally don't like getters but i think in this case because the one i think at this level of the api one thing i want to avoid is i want to avoid being too device type specific i actually want to be pretty vague yeah import parenting i want it to be um pretty generic at this level so this is the this is the first level that i think you kind of need is a baseline minimum to do usb host and then like pierre was talking about earlier um this is the level that we can build python libraries on top of for for example tiny usb has a a dual shock four which is a usb controller example right like um they have the uh like there's no reason for circuit python to have dual shock four support built in and even just supporting keyboards generically could be really tough kevin's relieved oh yeah thank you yeah we're i'm excited i'm i'm ready for some time off i'm ready to have to uh do some do some parenting some diaper changes um and yeah youtube has machine generated subtitles we do we do have a little bit of a delay but the delays so that the subtitling stuff can can happen um oh yeah and the luna that david points out is actually another fpga product okay so so device and then vendor id product id descriptor get string descriptor i think that's largely what you need to figure out okay what am i connected to and what can it do and then in this descriptor this descriptor here which i don't really want to have native parsing stuff for i want python level parsing um the other thing it's going to tell you is it's going to tell you the end points that it has and and what they can do so i think that maybe we want like a do we want like a a get end point get end point or is it like a is it more like a separate well this would take a number as well and maybe does it have to tell us what about get serial number yeah we could have serial number so that would be up here so the next step to figuring this out is i like to actually write the docs if you've ever looked in circuit pythons um if you've ever looked in circuit pythons code base you'll see there's a shared bindings and shared bindings is where we do the conversion from like python objects and functions into c and that's where we'd like to put the docs in line um so that's i actually like to write those up first and then what i do is i kind of work from there and um and then uh from there i'll implement it kind of all the way down and pierce says would you need get endpoint or get message from q yeah so so what i would do is and maybe let me open a new file which i could just do it so so the other piece of this puzzle is so this is usb usb host well this is a question continued um i'm picturing like an end point um in right so this is the thing that has the buffer of packets in and then there's also end point out and that's generally one or the other buffer outgoing we may not actually need to buffer outgoing but that could be there and then i think the only one that's weird so control can do um is actually bidirectional um so i think i think we want two different ones because um because i want it to be when you're working with the object i want it to be clear so this this would have like a a device and an endpoint number associated with it and this would have a device and an endpoint number associated with it as well i don't i don't know exactly how you would get it from the device i'm not sure you would just construct it like it would make sense hid has both in and out i don't think that's on the same endpoint number though so you would have you would just have two objects you would have one for one direction and one for the other direction you don't need to have both like i think that yeah i don't think they're they're both where was that other one where i work folks are back where that came from i've been playing around the idea of usb devices for sensors and motors that could be used at the either pc or mind stores elesis i think is what tac uses i use beagle i have a beagle 480 now that's pretty handy oh there it is zoneland says where i work we take the usb to handle 128 endpoints at once um i think the main thing is that um like per endpoint you get different buffers rp2040 featherboard with wi-fi for 15 bucks i'm all about unless you need pio on the rp2040 just buy an s3 like or an s2 like the esp is if you want wi-fi use an esp only if you need pio do you need rp2040 like and some people have said they do but generally i i don't really like two controller solutions okay so i think so this is five classes and these are basically going to mimic like these are basically cues so inspiration for what this api is is like q but also like packet buffer from uh b leo is also an inspiration for what that'll be um and in fact we have we want i haven't done it yet but we should be able to do like h id host over b le and like they should be we should be able to swap those in so this is also going to be modeled after q and packet buffer although packet packets out rather than packets in um so i think that that's kind of the that's the lowest level that's the lowest level of it all i was considering and i'm not sure what i want to do but um i was considering doing like endpoint types so usb host um like bulk but i don't think i think we can just split by direction i don't think we need like host uh interrupt like i don't think we need separate um sets of things for these things um oh interesting controlling 32z zc at once which results on a lot of endpoints correct h id host over billy wait my brain hurts you mean connecting a billy keyboard to a circuit python billy board correct correct so that's that's the similar case where it's going to be sending you reports of what keys are pressed and you need to buffer them in um so that you can see like what all the keys were pressed and we don't currently do that there's a bug on the billy library but i haven't actually gotten to it but when we're thinking about this api we should be able to build kind of the same thing on top of the two and we've we've managed to do the h id h id device is pretty interchangeable between usb and billy so we've done a good job there we just need to do it kind of the other direction of reading reading data in so i think the thing that i've been thinking about there and this is i've gotten i haven't talked about keyboards yet but i've also been thinking about keyboards in general so i think and i've been thinking about how i would write keyboard software so like there's there's an existing examples of like q m k and k m k are kind of the classic examples but i have a problem with this code because they they say like they don't show you the loop which is kind of my my beef um and i was thinking more about like what a keyboard is doing it's it's like a while true loop right and the first thing it does is it like um gets all pressed keys and this is a matter of like key number and then you can translate that to um from key number to like usb h id number which is what billy uses as well but the problem is well and that's what you would send over billy or eight billy or usb but there's a third step that you need if you're uh wanting to actually show something like in the terminal you would do uh like usb or like h id to like ascii or what is it like vt100 or utf so this is not only like characters but also like uh cursor control like like deleting characters i'll be curious to see what you all think of my let me scribble and gimp stuff um but i thought this could be i think i feel like i've kind of like struggled a bit showing my process for api design because usually it's like me trying to like formulate sentences to type in comments whereas this night this lets me be a little briefer on screen but also talk about what i'm thinking about um and so this process is interesting right because what we're talking about um for usb host is here right like this is usb host or like usb host is one of the things that can do this same with billy or key scanning can do this too and then if we want to be able to do like this c64 circuit python right where it's all built in like we need to do this whole process natively kind of outside of python because we wanted to run after that um this is the first time i've used this tablet but i'm happy with it so far um wife we got a new couch and she wants to play around with it always get always good stream when i'm texting on camera um okay so yeah so this is kind of what am i in the back of my brain i'm thinking about too not only that when i support usb host in circuit python i also need this this process here to get into basically oh i didn't say this but this is basically like uh the equivalent of like usb serial right like this is the equivalent of what we are getting over the serial link um from circuit python so yeah this is something that if we want to have that experience of just editing and and using a keyboard to input into circuit python this is the stuff that we need to do um and then also um thinking about just mechanical keyboard software there's this this stuff too and and one of the one of the tricky things is in here or in here um and maybe pierre is talking about this too is actually like um what is it key maps key layouts like i don't actually use qwerty q w e r t or col mac so like if i wanted to create a circuit python thing i use col mac so i actually need to do this like extra mapping step in here as well so that i'd be able to actually type on it um so yeah this is um this is my process my brain is thinking about what i want for the usb host interfaces so let's just take a peek at there and if folks have feedback on this let me know but basically what we'll have is we'll have a port class that you give it the pins that you want to use for the port and for most microcontrollers that'll be super limited right because they don't usually connect a lot of different ones to it um but potentially when we do rp 2040 p i o that'll be pretty flexible they'll need to be next to each other but um but besides that like generally that's going to be pretty constrained um and then for device so so on a port you'd be able to see all the devices on it um you'd be able to have a device object with some basic information like serial number vendor id product id and descriptor and then you'd be able to kind of do these like manual get things based on the descriptor that you've understood like we're not going to do descriptor parsing in in the core except for keyboards which will be separate and as part of a separate module so we don't have to have all of it all at once we need to like split it out in the chunks so we have port we have device and then we have end point in and out and in and out can handle all the different types of end points um i don't think we actually need to care like tiny usb really is just transfer transfer and transfer complete callback um but i do want in and out to be separate just so that the apis are different and so we may we might need to expose the control access to we probably do and it's weird because it's bi bi directional on a single end point um i don't think we're going to do this so i could just cross this off and then um because i don't think there's a lot of code that's different between all of them and then the highest level is like thinking about this this keyboard process so what it's usb host will be five classes port device end point in end point out and control um and those will all be built on tiny usb and that'll give you enough information to see what's connected to you oh that's what we need um device needs dot connected because just like in bililand um you could plug a device in start using it in circuit python and then unplug it and you have a problem um and folk knowledge he says async usb host versions so i think that generally this isn't async i o but a lot of it will be asynchronous like we could get these things early and store them or not like maybe we don't actually get the descriptor until you call it and that's blocking but generally the way that we'll do async is through these q like objects rather than proper async i o um a lot like packet buffer where you just say like is there another one um and maybe in the future we integrate that into async i o so that you can actually like sleep while it's happening but that's complicated um so this gives me a sketch of what the api looks like and then my next step i'll i'll i'll sketch it all out and start filling it in and then what i'll do is i'll do examples as well so i'll do example code that is actually useful for um testing so my first example will be usb import usb host usb host here i'm writing it in the air let me just do one last one so like if we're talking like the the most basic example it's going to be import usb host and then p equals usb host port and blah blah blah and then i'm just going to do print uh p dot devices and maybe i'd do that in a loop um so that i could like watch how that changes as i plug in a device and unplug a device and then maybe once that works i do like a four d in p dot devices maybe that's what i do instead and then i could print like d dot vendor id right like that's the first product id like that's my first most basic like that in video game terminology this is like the quote unquote vertical slice right this is the proof of concept that goes from circuit python uh into c into tiny usb to the hardware and back so yeah that's the plan hopefully i didn't bore too many of you i think i lost lost some viewers but all right well i think i will maybe i'll export these and just so that we can dump them in the note stock as well um i'll do that off stream not with this but with the with the mouse instead any final questions we're just about out of time otherwise and i'm hoping to have like this api laid out in a like draft pr um for for feedback as well and it's getting hot in here 77 but yeah that was good i've been thinking about that what's the model of your magic tablet i have a walk home i think the bilie version's only like ten dollars more so this is what that's the front and it's the intuos oh you can it's still kind of small here let's switch this is the back can you read the model number it's um ctl 6100 wl but yeah i just i just set it up like right before the stream and it's been working pretty well so um so far so good based on your writing you should have been a doctor i've got time i'm still young i could be a doctor i'm not yeah i type i don't write that's why i was talking while i was scribbling all right let me pull up my housekeeping so thank you all again uh for joining me for this deep dive happens every week fridays at 2 p.m pacific i'll only be doing it for another two weeks and then i'll be on paternity leave um if you want to support me um please do that by going to eta fruit dot com and purchasing stuff there um if i distracted you and got in got you into digikey ordering digikey is great and they support eta fruit too so don't feel bad about that you can purchase eta fruit stuff from digikey and um that also like benefits eta fruit so don't feel bad for picking up eta fruit stuff from digikey as well um if you want to chat with me and a bunch of others uh we're on the eta fruit discord server which is this middle box here uh you can join it by going to adafru.it slash discord and um that will be where we're hanging out we're talking circuit python uh circuit python dev channel's got updates about like all the stuff that's coming into circuit python so it's the place to be for circuit python development um next week's on friday and probably the week after that too um and yeah uh all notes are available on github thank you to um david and patrick for taking those notes and aggregating them together um that's github.com slash eta fruit slash deep dash dive dash notes and um yeah thanks to those two thank you all for hanging out um welcome to the new folks and we'll see you on discord and we'll see you on the deep dive next week so i will pet both cats which i don't usually do and uh and then get out of here i always end the stream with petting cats if you didn't realize that usually vins them in here so we'll see what she does have a great weekend everyone have a great weekend everyone