Embedded - 396: Untangle the Mess

Episode Date: December 17, 2021

Uri Shaked shows us Wokwi, his board and processor simulator. We checked out Arduino code in GDB and then looked at his simulator for the Cortex-M0 Raspberry Pi Pico.  First, you should totally  loo...k at Wokwi.com. As Christopher noted, signing up for an account shows you many other things. Then you can go look at the processors written in TypeScript in Uri’s Github repos: github.com/urish. Find Wokwi on Twitter (@WokwiMakes, Uri is @UriShaked). You can also find Wokwi on Facebook. Uri live-coded development of the Pico’s RP2040, it is on Wokwi’s YouTube channel. You can find out more about the RP2040 or the AVR core in the ATMega family by taking his free courses on Hackaday: hackaday.io/urishaked  (Scroll down for courses.) Uri’s homepage is urish.org. You can find The Salsa Beat Machine there as well as some of his other projects. He has a blog there as well as at Wokwi. Susie Hansen - La Salsa Nunca Se Acaba

Transcript
Discussion (0)
Starting point is 00:00:00 Welcome to Embedded. I am Elysia White alongside Christopher White. This week we'll be talking about simulating processors and boards with Uri Shakad. Hi Uri. Welcome. Hello. Thank you. Could you tell us about yourself as if we met at an embedded systems conference? Oh, well, so for that, we would need to actually go on an embedded system conference. Let me just imagine the situation.
Starting point is 00:00:39 So you are standing next to a booth where they show some kind of future technology. And then we are both looking at this technology and starting to talk about it. And if you have some idea what it would be, then tell me. And you ask me, hey, I'm Uri. And I love learning about technology and seeing how I can do creative things with it, taking it to the limits. And I think that's it. I will probably ask you about yourself at that point and let you continue asking questions to figure out what part of my personality or interests you are most interested in. Well, that's going to work out well, because now we want to do lightning round where we ask you short questions and we want short answers. And if we are behaving ourselves, we won't ask, are you sure and why and how are you ready?
Starting point is 00:01:51 Yes. Favorite food. What was that? Favorite food. Favorite food. Good food. If it's tasty, it's favorite. Okay.
Starting point is 00:02:04 Favorite processor. Favorite processor. Favorite processor. I think might be ESP32. Emulator, simulator, or other thing that ends in "-ater"? Terminator. Complete one project or start a dozen. More a thousand samba or salsa salsa of course
Starting point is 00:02:31 favorite fictional robot uh well he comes to mind he's cute do you like to listen to music when you're working yes um yes What do you like to listen to? I know that would come. So it really depends. Sometimes it's upbeat merengue music, which if I need to really get into the zone and if I need to sort of just enjoy what I'm listening to so that would probably be some type of
Starting point is 00:03:10 jazz salsa like Sofrito from Mongo Santa Maria that's one I listen to a lot nowadays I would talk about Latin music on this podcast exclusively we could just do that because it's one of the most difficult things
Starting point is 00:03:27 I've ever had to deal with on drums. And I still can't figure it out. It's just so complicated and hard, but it's so amazing. But anyway, this is not what the podcast is about. We should actually get back to that because he has something related. Okay, one more lightning round question. Do you have a tip everyone should know? Yeah, actually something pretty useful I figured out lately,
Starting point is 00:03:47 and then I shared it in one of the courses that I did, and everyone was wow. So maybe it will be useful for the other engineers listening here. If you go to any repository on the GitHub site and you press the dot button, the period button on your keyboard. It's the best. Go on, I'm sorry. So you already know.
Starting point is 00:04:11 It's still a great tip. Tell people the tip. It's awesome. It's suddenly the screen, the static page with the GitHub file list suddenly replaces with a full screen code editor where you can see everything, jump between files, search, syntax highlighting, do anything you would do in an editor.
Starting point is 00:04:32 And it happens in just an instant. Yes, yes, I love that. Okay, but we have asked you here to talk about WalkWe. Is that how you say it? You pronounce it right. Yeah. First, where does the name come from? So I get asked that all the time.
Starting point is 00:04:55 The story behind it is that there is no story. I was looking for a short name that would be easy to pronounce and wasn't used by anything else in the world yet. So one night I just, there is a website where you can enter a set of constraints. So I went there and said, I want a name for five or six letters long with two vowels. And then it looks for available domain names and shows you a list of all the, like you have many pages of possibilities. And then I just went through like 50 pages of possibilities. And eventually I shortlisted a few and Walkway was the one that sounded,
Starting point is 00:05:50 I guess, the least strange out of that list. Okay, so I have been teaching a course about embedded systems and I recently asked students to write a flash simulator for testing and they kind of hated me for that. But I've been thinking a lot about simulators, and that's what Walkway is. Could you tell me about what it does? Yes, of course. So Walkway is basically just like the magic where you go to GitHub, press the period, and then you get a full-blown code editor.
Starting point is 00:06:29 That's the kind of experience I'm eventually aiming to create, where you can create a simulation of a complete project with the code and all the parts and you can just send the link to somebody and they open it and boom they they can run their project your project in their browser without having to download or install anything or you know to buy wires and connect them and then fry their microcontroller because they connected the 5V to ground. You did that, right? Of course I've done that. So when I open it, it opens an Arduino. I clicked on Arduino Omega as one of the boards to play with.
Starting point is 00:07:20 And it opens an INO style setup and loop file that I can type into on the left. And then on the right, it has the Arduino Mega board. And if I click on things with the plus button, I can put in keypads or buzzers or LCDs, and then I can just hook those to this board and it, it just, you know, it works. I mean, as though my wiring was perfect the first time and I haven't blown up any boards at all. And if it isn't, I can play with it until it is. And I don't have to use a soldering iron. Why, why did you make this? I mean, it's very cool what but but why so thank you so um the reason is i was actually what we started is something completely different i wanted to i started working on a service where you could create your own uh customized arduino uno. So if you want an Arduino Uno,
Starting point is 00:08:25 but with a USB type C connector instead of the bulky printer style USB connector. So, and you want it pink for some reason, even though pink wasn't in the options. So you want it blue with green connectors and your own logo. And you also want to add an accelerometer into it. So that was the first version of Walkway.
Starting point is 00:08:52 And I started working on that product. And eventually I realized I would need to market it somehow to get to potential users. So I started writing a blog and writing about Arduino. So I think my first blog post, there was five ways to blink an LED in Arduino. And it's still a pretty popular blog post. But when I wrote this blog post, it felt weird to me that I can embed, like, include code examples.
Starting point is 00:09:28 But then if you actually wanted to try those code examples, you have to find an Arduino board, connect an LED, plug it into your computer. Then if you don't have the setup, download Arduino IDE, fight with drivers, and eventually, hopefully, see what I'm like, run the code for my blog post. And I'm coming from web development background. And in web development, we have this concept where you have live documentation. So you have documentation about something and there are code examples and you can just edit them and see the results. And I was like, hmm, can we have this in hardware too, pretty please? But you didn't just simulate the board.
Starting point is 00:10:17 You actually simulate the processor in assembly and stuff, right? Right. I started with something that was sort of even not even simulating the board. So if you go back to that very blog post about five ways to blink an LED on Arduino, there is a section that talks about timers. And they had like this small simulation written in JavaScript where you can see how the timer is counting these clock cycles and how the different Arduino timers have like different resolutions,
Starting point is 00:10:58 8 bits and 16 bits. And so the first kind of simulation I did was that. But eventually I figured out that if I want this to be useful to other people, then it has to be the whole thing. I mean, I can create things as needed for my own blog post. But if I want it to be something everyone can embed into their documentation, blog posts, or even use for other use cases, which we can talk about if you have some ideas, then it has to be that.
Starting point is 00:11:38 It has to be the entire thing. But had you had much experience with simulating micros before? Simulating processor cores? No. It was my first time I actually simulated a processor core. I mean, I think, I guess in the past, I did write some compilers when I studied computer science and that kind of stuff. But I think my first renovation was how little of the AVR, the core of the Arduino, how little of the AVR functionality I actually had to implement in order to get Blink working. I was thinking I would have to work very hard together,
Starting point is 00:12:33 but then I realized most Arduino programs aren't using all the obscure features of the microcontrollers. If you have most of the instructions set, even not all of it, and for blinking it's just the timers and a bit of GPIO, it works. And how long did you end up spending with the AVR Core reference manual? I mean, I still read it when I go to bed. But seriously, to go to bed but but seriously um there is uh this is like the only good way of uh source of information other than um the um arduino libraries that interface with the microcontroller so
Starting point is 00:13:20 whenever i implement a device uh not just a microcontroller core, but even a shift register or something like that, I spend about half of my time reading through the data sheet. code or libraries that use that device. So to understand which parts are actually used by the libraries and in which ways, because sometimes the data sheet, for instance, if we go back to AVR, there is the DWI, the 2-wire interface, and it has a pretty complex state machine, and it can be used with interrupt and without interrupt, and you can spend days implementing all of the things the datasheet says. Sometimes it doesn't even specify all the edge cases. But then you could also just look at how the libraries use it. So if we work with Arduino, then let's check out how the Arduino core, the wiring library, uses the DWI interface and focus on the data part.
Starting point is 00:14:37 So I'm very impressed that you just decided to do this from scratch. I think I would have looked at QEMU and stuff, but that probably wouldn't integrate well into a web application, right? To use some package like that. Yeah, I think there are some existing projects also for AVR. I think QEMU doesn't do AVR because it's like an 8-bit architecture
Starting point is 00:15:01 and it's pretty different from other 32-bit architectures in some aspects. But there are like SimAVR and there are a few other open source and great AVR simulators. But then the thing is, you can compile them to work on the web, but if you really want to have a good control of how everything connects and you want to be able to tune the performance as needed, you really need to be familiar with the internals. So I haven't tried that, but it's sort of a trade-off.
Starting point is 00:15:45 Either you work on something from scratch and then you know everything about it, and you can look at the other implementations if you get stuck to get some ideas how to implement stuff. Or you can really study other code, like an existing simulator thoroughly and I get to the point where you really understand how everything is connected and then I think you in both cases you will probably be in the same position where you can make any change that you want. But then if you write it from scratch, then you are not bound by the decisions, the architectural decisions of the original maker. So that might be an advantage.
Starting point is 00:16:35 I don't know because I haven't tried, but that's what I think. At what point did you go from, I'm going to simulate a little timer, and then I'm going to simulate the Arduino enough to talk to some of the libraries to, oh, to heck with it, I'll just start simulating all kinds of processors. Going from timers to a full-blown AVR core was pretty quick. Like, I would say a few days, it was more like, hmm, can I make it? Like, I want it. Can I make it happen? This generic Arduino simulation or AVR simulation library that runs in a web browser.
Starting point is 00:17:23 And then I spent, I think, two or three days just, I think it was a weekend, I can check in the Git commit history. But, you know, just hacking code like crazy and trying to get just Blink to work and figuring out how to load hex files and how to map everything. Like I was trying to connect all the pieces together just, you know, to get something that can run Blink. And then a few, I think it was two or three days later, I finally got LED on, LED off prints
Starting point is 00:18:04 spaced about one second in between on my screen. And I was like, yeah, now I'm going to publish it and share it with the world. And then the hard work started. Yes. At that point, had you simulated all of the AVR and the peripherals in the Arduino Uno processor, the Atmega328? Of course not. If you go to the AVR-AGS repo, that's the open source project that simulates the AVR core, you can see there is still like an open issue from almost two years ago to simulate the iSquare C slave.
Starting point is 00:18:46 And I think the watchdog timer, no, I implemented that lately. So there are like things that people don't really need or don't use that much. So I have never spent time on implementing them. And it took me a pretty long time to get to a state where I can say it covers most of the peripherals, but it's pretty much useful for everyone that needed it so far.
Starting point is 00:19:16 So I think it covers almost all of the use cases. I've been thinking about simulators for testing, for not quite unit testing, but sorts of offline sandbox testing. And I like the idea that you don't have to simulate everything. You can simulate what you need. I think that's a good approach. So you mentioned GitHub, and your code is all in GitHub and readable. It's actually quite readable.
Starting point is 00:19:49 And you have things separated by the CPU and the peripherals and examples. And I had a question. I was going somewhere with this. Oh, right. What are ts files oh yeah so i think it's a kind of subtitles files that's what windows when i double click on them ask me what i do to do with these subtitles files um but in web development TS is just a language called TypeScript, which is JavaScript, but with types. And it's fun.
Starting point is 00:20:29 If you are going to develop for the web, then go learn TypeScript. Microsoft did that, right? Is that right? Yeah, I think it started like 10 years ago or so in Microsoft. I think the person who worked on C Sharp was also one of the architects of TypeScript, but I might be wrong about it. I'm not very good at history.
Starting point is 00:20:53 So you started with the AVR series, but you've also got a whole bunch of other architectures on here, including fairly recent stuff like the Raspberry Pi Pico, right? Was that harder? Were the other architectures easier or harder having already done the AVR? I feel like, well, the ESP32, I feel like would be less documented. Yes, that's true. And for the Raspberry Pi Pico, it came out, I think it was January 33 this year or something, or 21 this year.
Starting point is 00:21:28 And I was like, hmm, cool. That seems like a pretty useful board and the price point for bugs that many makers are going to want to use. And there is nothing that simulates that right now. And at that time, I already wanted to do, I had this idea for some time where I wanted to live code something. So do some kind of hardcore coding in a live stream. And the PyPico just came out and I was like, hmm, let's try that. And then about a week after it came out, I started a weekly series of live coding sessions where I would just code different features of the simulator from scratch every week. So it was different in many aspects from the AVR. And I think one of the major hurdles was that with AVR, you get all the documentation
Starting point is 00:22:40 in a single data sheet, or there is a different datasheet for the instruction set, but they are in a pretty similar format and they are pretty simple. And then with the PyPico, there is their datasheet from Raspberry Pi, which is great. And then there is the instruction set and the entire Cortex-M core datasheet,
Starting point is 00:23:04 which is, I don't know if you take the word data sheet and leave data out. So, yeah. So, I mean, I'm sure they had good intentions, but it tries to be very generic. So it's, and it's written in some kind of pseudo-programming language so I spend a lot of time just figuring out what they mean and which part of their description of their pseudo-code for the instructions
Starting point is 00:23:37 are even relevant for the Cortex M0 so the cool thing is that you can actually watch all the implementation live on youtube so it's all recorded you can watch uh from the very first moment when i create a directory and initialize the git repo and write the first files and set up typescript so if you want to learn more about ts files up to uh implementing the peripherals uh the pio and there are even a few points where i introduced bugs so um when i uh eventually figured out the bugs. I went back to the video and was like looking at myself when I made that bug. And usually I realized it was near the end of the session.
Starting point is 00:24:35 So, yeah, don't do two and a half hours coding session. That's too long. Yes, I get that. So this ends up being, looking at this code, it's like a class in microcontrollers. Because I can compare the AVR with the Cortex-M0, with the ESP32, and look and see, well, they all have stack pointers, of course. But what else is different about and the same about the implementations? Did you start thinking these are all the same or did you start realizing just how different they were?
Starting point is 00:25:21 That's a good question, actually. I think when I started working on the PyPico, I was thinking it's going to be, my experience will be similar to working on the AVR, and it turned out pretty different. And I'm not sure what the reason for that was. I have a feeling that the live coding format made it a bit more stressful. It was like, I was, for instance, when I worked in the first session of working on the PyPico, I really wanted to have Blink working at the end of the session.
Starting point is 00:26:04 So I cut a lot of corners and really tried to get her. I think I eventually did. But it was like I had an audience and I wanted it to be as accessible as possible to the audience. So I spent time explaining what I was doing. And I was also trying to think before I code. So usually I just try something, it doesn't work. I try something else. And this can be pretty confusing if you are just watching me and you have no context. So I tried to keep it a bit simpler to slow down the pace and not to get too adventurous. And I think this made the experience different for me.
Starting point is 00:26:49 So now it's hard for me to compare how different they actually are. And the ESP32, that's a different core as well. Yes, the ESP32, I think the biggest challenge with it is, first of all, it's very messy. Like there are so many peripherals and every peripheral has like different kind of conventions. And the data sheet has some of the information, and then the ESP-IDF has, it's usually a better place to look for information because sometimes there are registers and some bits do not appear in the datasheet. And then when you go to the ESP-IDF, you actually see there are other bits that do not appear in the datasheet, but the code, the ESP-IDF uses them.
Starting point is 00:27:46 So the ESP-IDF is my first source of truth. And then the datasheet is sort of a backup. And then there is the Wi-Fi and the Bluetooth stack, which are mostly like the radio stuff is totally closed source. So if you want to simulate that, then I started reverse engineering their code to figure out how to simulate the Wi-Fi and the Bluetooth. You gave a talk about that at Remotecon, right?
Starting point is 00:28:21 That's where we met. Exactly. I just wanted to make sure that was the talk that i remembered it was interesting because when we think about things outside of of the simulation environment do i care if the software is doing this or the hardware i mean mean, as long as I'm simulating sending packets, what difference does it make? But you wanted it to be fairly true. Why?
Starting point is 00:28:55 So when you work on simulators, you have a choice that you need to make. Either you simulate a system as accurate as possible, at least from the user code point of view, either you work really hard to simulate the functionality that the user code has to offer. So many simulators for Arduino, they just run compiler code to the C++ of the native processor. I mean, to the machine code of the native processor, or C++ to the instruction set of your x82 or ARM processor.
Starting point is 00:29:34 And then they simulate all the Arduino calls, like digital read, digital write, etc. But then you lose a very important thing, which is the ecosystem. When you lose a very important thing which is the ecosystem when you write a simulator or at least when I created the simulator it was very important for me to make it possible for the users
Starting point is 00:29:57 to use any library that they want or any code example that they want out of the box and if I don't go at implementing the hardware as accurate as possible route, and I just try to simulate at the higher level, at the API level, then there is like endless surface that I have to cover
Starting point is 00:30:24 if I wanted to support all the libraries and things that exist in the ecosystem. So going below to actually simulating or emulating the microcontrollers and the peripherals in a way that is transparent to the code that is running inside them that what makes it possible to just you know it gives me all the ecosystem out of the box theoretically practically there are always like exceptions like one example is the fast led library it assumes that specific instructions take a number of cycles, like a specific number of cycles, and it uses that to time the signal. And if you get even one instruction off, then that's not going to work. And even if you compile your Arduino program in debug mode, then the compiler is going to do a little,
Starting point is 00:31:28 the optimization is a little different or not do some of the optimizations, and that won't work. So it not only depends on the timing of the instructions, it also depends on the implementation of the compiler. So if you don't go with the actual compiler, the same compiler that Arduino uses, and you don't implement the hardware as accurate as you can,
Starting point is 00:31:55 fast LED won't work, and you will have to create a new backend just for your simulator or implement their API from scratch, which is a lot of work. Yeah, since there are so many different tweaky little things with embedded devices and their peripherals, it seems like simulation is not a path that,
Starting point is 00:32:17 unless you want to have workarounds and special cases for everything under the sun, it seems like emulation is the the way to go and even in that case even in that case uh sometimes um i mean take circuit python for example i run it on the pipe eco but then when you start it on the physical device it just waits for you for once you just wait for one second for the user to press on the boot button. But when I run it in the simulation, I don't want to spend one second of simulation doing busy waiting.
Starting point is 00:32:55 So I had to implement a workaround that detect that this is happening and skips the time forward so the user doesn't have to wait that second. So when I choose Raspberry Pi Pico, and it says serial.begin, and it has the baud rate, and then serial.print, hello Raspberry Pi Pico, in the sketch that's put up, that compiles using a GCC ARM compiler to ARM code, and then you simulate from there?
Starting point is 00:33:32 I think that the answer is yes. I'm not sure exactly which compiler version it uses, because I don't know. It uses the Arduino CLI to compile that, and this is all transparent for me because I believe they use the GCC ARM compiler. That makes sense. But I try to keep it myself as far as I can
Starting point is 00:33:57 from the implementation details and just use the Arduino CLI as is so I get all the ecosystem compatibility just out of the box. And an interesting thing, I think, to watch is you mentioned that you call serial begin with a baud rate and serial pretlan. And then if you check the add component menu,
Starting point is 00:34:25 there is a logic analyzer that you can add there. And you can connect it to the TX and RX pins, I think, zero and one on the Pi Pico. And then you can actually see the serial signals that are simulated. Oh, that is very cute. That is super cool. But do you use the hex or do you do LLVM or something in between? Do you actually just go to the binary file and emulate from there? Yes, you can actually press F1 and load pre-compiled hex file
Starting point is 00:35:03 and just bring your own hex and that would work. That's the benefit of emulation too. It's actually doing it. It's just a little, you know... When you take it to real hardware, there's not a big shift or vice versa, right? There's not something you have to do to, oh, it's not going to work on this because it's pretending.
Starting point is 00:35:21 But if you make a Cortex, an ARM processor, a Cortex M0 like this, you have to pay for all of the ARM Cortex information. It's very expensive to make a processor like this. So I would have thought that making a simulator like this would require all that information that you would need to make the processor. No, because they have to document all that stuff for somebody to write software for it. So anything you know to write software for it is enough. And that's public. The IP is all their silly silicon stuff that none of us care about. I seem to recall in your presentation,
Starting point is 00:36:01 you were also using GDB on your sketches, in your simulator. How do I load up GDB here? So yeah, that was another challenge that I wanted you to be able to use GDB with the simulation, but implementing the GDB protocol, and you can watch me in the Raspberry Pi Pico live streams actually implement it. It wasn't too hard, like a few hours of work. But then making it possible for you to use GDB
Starting point is 00:36:39 without having to install stuff on your machine and set up WebSockets and all of that stuff, that was pretty challenging. So if you press F1 and then type GDB, you will get like F1 opens a menu with some secret commands. And then you can start a WebGDB session. And this is actually pretty interesting because GDB is running inside a virtual Linux machine
Starting point is 00:37:13 that runs in your browser. It's installing and booting. And when you say F1, I need to be in the window. Otherwise, I get a help window for my browser. Yeah, in the code window, right. And now it's... Okay, so you have a compiler running online, and now you're going to have a GDB running online.
Starting point is 00:37:34 And so there has to be a backend to this. How are you... Okay, how are you going to make money off this so you can pay for all of your... No backend. I mean... Oh, this is all in my for all of your... No backend. I mean... Oh, this is all in my browser. It's using my cycles. That's why he wrote it in TypeScript
Starting point is 00:37:49 and that's why he's running a virtual machine in your... But what if I don't have GCC installed? Okay, so let's untangle the mess. Title. There are a few things that are going on.
Starting point is 00:38:09 Like it's very confusing. People, users are always asking about it. The simulation itself, once you have the hex file, runs in your browser. Same goes for GDB. When you start it, it downloads a small Linux build root image, which includes the GDB binary. And it also downloads a small x86 simulator that runs that in your browser. So as long as you are loading hex files or running pre-compiled ones
Starting point is 00:38:39 like MicroPython or CircuitPython or using GDB, then everything happens in your browser and I only have to pay for the bandwidth that allows you to download the files, but there is no backend. With the compilation, that's a different story because nobody, as far as I know, runs GCC in the browser in a production website.
Starting point is 00:39:11 And at some point, they actually tried that. And it turned out that you could run the Arduino CLI and compile a link in the browser. It just takes two minutes. So it's not really useful. It takes two minutes and you would have to download like 85 megabytes of data just to get a compiler and all the Arduino stuff and the CLI and everything.
Starting point is 00:39:36 So that's not practical. So the only thing that currently runs in the cloud is the compiler. And for now, answering your second question, how do I pay for it? And there is even larger cost or more prominent cost, which is my wife and my time. We are working on it full time now. So we are still figuring this out.
Starting point is 00:40:09 If you have good ideas, I would love to hear you or the listeners. One thing we are doing right now, if you go to walkway.com slash features, you can see a list of all the features users ask for. And asking for a feature is just opening an issue on GitHub. And then users can vote for them. And they can buy vote powers which let them vote. So they can vote with their money. And this has been solving a need that I had.
Starting point is 00:40:42 Because whenever a new request came, I was just trying to implement everything everyone requested. And at some point, it became too hard to keep up. So now I use this as a solution to prioritizing what to work on. If you go now to the list, you will see like simulate and SD card drive is on the top because it was very important for users so they paid for this so now i know what i should work on that's ingenious thank you are you familiar with godbolt yeah um what about it i just you you're both solving similar problems with compiling.
Starting point is 00:41:26 And Matt's really great. And I feel like I should introduce you because you're going to have similar problems with hosting. I had no real, you know, salsa beat machine. Can you tell us about the salsa beat machine? All right. Context shift. Yeah, I need to tell you for Christopher. So yeah, but please introduce us.
Starting point is 00:41:47 I like meeting great minds. So please introduce us. Salsa Beat Machine. So yeah, so a long, long time ago. Oh, that's... Sorry. It's okay long long time ago i used to uh be a salsa dance teacher we had a salsa dancing school and we had uh weekly uh socials where everybody would meet and learn how to dance and dance and this is how our ariella and i met uh more than 10 years ago um and i was
Starting point is 00:42:29 when i was uh trying to uh learn how to like learn how to dance i had a real problem i couldn't find the beat in the music people would always say you are dancing on the two or on the three. And I was like, huh? Where do you see numbers here? Yes. Exactly. Okay, go ahead. I totally understand the problem.
Starting point is 00:42:56 I've had this problem. So it turns out Latin music is pretty complex. There are a lot of instruments that play at the same time and the patterns are pretty unusual to on one instrument at a time and then gradually add more instruments. There is a salsa song that does exactly that, by the way. La Salsa Nunca Se Acaba by Suzy Hansen. It begins with one instrument and then they are gradually adding up more and more instruments and how they play together and how they form this rhythm, this mysterious count that I couldn't figure out. And it started as a Python script that used the MIDI API.
Starting point is 00:44:17 I found, a friend gave me some book about Latin rhythms and I just went over the book and implemented every kind of freedom that i could find and then i had to undergo a surgery and i had to stay home after the surgery for like a week or two and i spent the time learning about flex which was back a thing. It was a way you could develop web applications with Flash, some kind of development platform framework. And I just converted that Python script into a web application.
Starting point is 00:44:58 And since that day, it became the Salsa bit machine. And I think it's pretty popular nowadays. I don't really, the code is open on GitHub and I don't really spend much time on it right now, nowadays, but I think it's still being used a lot. And it's on the web. And Chris is a drummer. Yes, yes, and Chris is a drummer.
Starting point is 00:45:20 What do you think of it, Christopher? Have you played with it? It's very cool. Yeah, I played with it. That is one of the difficult things with um especially latin kind of beats is there's well they were designed for wow i'm going to start talking about this you know all this but they were designed for big groups of people with different instruments and when you're trying to translate that to drum set is you're just the one person. And so you have all these rhythms that maybe aren't difficult. Well, they're still difficult, but they aren't as challenging for four people to do.
Starting point is 00:45:52 And trying to have each hand do something that's kind of polyrhythmic, it's very challenging. So breaking these down into individual parts that you can kind of concentrate on and and get into your mind before adding more it's really really great idea um because that's kind of how it's natural to learn stuff but it's it's sort of hard to do that by yourself sometimes and hear what it's supposed to be doing because you're trying to learn at the same time did the salsa beat machine come before Wakui? Wakui. Yeah, it was like, I think 10 years ago. And then something like three, seven years ago, I started another tool that would just let you play popular salsa songs and then see either shoes dancing to the rhythm.
Starting point is 00:46:43 So performing the bass and salsa steps, so you could program your brain to match what you are hearing with a visual representation of the rhythm. And at least for myself, I found this very helpful, sort of training the brain to make the connection between what you hear
Starting point is 00:47:03 and another sense. And then Walkways, I think I started it a little bit more than two years ago. So it's pretty young. Was Salsa Beat Machine your first open source thing that other people were using? I think it was my first thing that other people in using? I think it was my first thing that other people in the world were using. When I was serving in the Israeli IDF, Israeli Defense Force,
Starting point is 00:47:37 I wrote a small plugin for Microsoft Messenger that would save the history of the chat because it didn't have that feature. And that was sort of my first open source because I distributed it over mail with the source code that the other people were using. But Salsa Bit Machine was really something that I made and many people around the world started using.
Starting point is 00:48:02 And it wasn't open source at the beginning and it didn't open source at the beginning and it didn't really matter actually there is something similar between um salsa bit machine and um the simulation libraries like the avr and cortex m the users aren't don't have have enough knowledge or willingness to contribute. It probably takes a lot of expertise that is different from what they have
Starting point is 00:48:34 if they wanted to contribute code. So even though the Salzow bit machine has been open for like five or six years, I get almost no source code contributions. And same goes for the simulators. Really?
Starting point is 00:48:50 That's interesting. And it's true because the people who would use it, the people who want features probably are not the people who have enough microcontroller, microprocessor development knowledge. Well, that leads me to a question that I had in the back of my mind, going back to the emulator. Right now it's focused on Arduino, but you have all of the emulation capabilities for all of these processors, there's no reason that you have to keep Arduino as the... Let me rephrase this.
Starting point is 00:49:31 Are you looking to go beyond Arduino? Is that a thought in your mind? He did MicroPython. Okay. Beyond hobbyists. To like, okay, we can run anything on this. Let's put some IAR on here. Not IAR, but, you know, have VS Code in the browser
Starting point is 00:49:54 and just have the bare metal stuff and be able to do all the emulation of a more professional environment. We should buy some Vodian Power. Yeah, I need more people like Alicia to say yeah to this. And I'm in a pretty interesting situation. Like I have a lot of ideas where I could take it to.
Starting point is 00:50:19 And I think Alicia mentioned testing. So I have an idea where you could use this in your CI to just run the tests. And there is already, if you go to wokwi.com slash Arduino slash automa dash test, then there is like a bunch of tests that I use to just test the simulator see that blink is still blinking and the sd card still works and the usb works and you know now i'm
Starting point is 00:50:54 going to add some tests for the wi-fi so basically the simulator is pretty complex and i want to make sure that if i change something it doesn't break something else, which happens a lot of time. So that's another direction we could take it. And I think for now, the features page does give me a good picture of what users care about but um i don't know if users are able to um see beyond their specific needs to generalize and i think that's one of the challenges um coming up with uh new places where the simulator can be uh or this environment can be useful for engineers and finding where the gap is. And I don't know, perhaps the gap is not even in the tools
Starting point is 00:51:54 as much as the messaging. I know some of the users have, one user just wrote to me yesterday that he started using WalkMe for work after he used it for a hobby, and he found it really useful to cut down on their development cycle time. So please help me make this happen. Figure this out. I'm happy to. So there's the embed processor, embed online compiler from ARM, which is rapidly not being supported. They've moved over to something called Kyle Studio Cloud or something.
Starting point is 00:52:38 And they had a simulator that was kind of a, I don't want to say a summer intern project, because I know some really good engineers worked on it. But it was sort of an out there, not very well supported program, but it was really neat to have the simulator. And with COVID, a lot of professors were using it because you couldn't go to class and help people with hardware. And so the simulator became very popular. I'm actually using it in my class for the same reason, because I can give students code. And if it's in the simulator, I know it works,
Starting point is 00:53:17 but I'm really trying to break them of the habit of using the Arduino IDE. So I want to use VS Code, really, and be able to simulate boards. Yeah, I have many ideas for features. And it starts with make it available to use for college classes so that they can compile C files or C++ files and not be stuck with the Arduino interface, which is awesome. I love the Arduino interface. I have lots of hearts and kisses for the Arduino interface, but I would like people to not have to use the Arduino interface.
Starting point is 00:53:59 When you're saying Arduino interface, you mean the editor, the libraries, and wiring? Wiring. The setup and the loop is the first part. The libraries, if you look around, a lot of the libraries are implemented in pretty good C++, or there's some version implemented in C++ that's similar. And you can use those. And I think people should, as long as they don't need the extra cycles or extra RAM that they bring in.
Starting point is 00:54:36 So it isn't the library so much. It's actually just the setup and loop, and having people understand that you have to have hardware setup. You can't just assume it will all be taken care of for you under the hood. Similar to what you have the embed simulator, you can put in different peripherals. I did a lecture that's going up like today or tomorrow, where I started with embed and I did a PWM out in the simulator with an LED so that you could see what PWM looked like. And then I put a speaker on it so you could hear what it sounds like. And then I changed the period of the PWM
Starting point is 00:55:21 so you could hear the pitch shifting of the frequency parameter. And that was all really fun for me. But then I went through all of the code associated with going from PWM out as a variable to getting to registers in the data sheet, in the reference manual. And I feel like your tool would be able to do that much easier because I could look at GDB along the way and show stack traces and show variables and then show actual memory in the processor. Well, I mean simulated actual memory. Actual simulated memory? memory in the processor. Well, I mean simulated actual memory. Show the address where the register
Starting point is 00:56:08 is supposed to be set and help people understand that you go from a high-level variable through three layers of hardware abstraction, but in the end you get to a memory that you write a bit to or a variable to. And it's not, it feels like magic because I agree typing serial.begin and a baud rate feels kind of like magic compared to what I used to have to do. But what I used to have to do with writing a serial driver is all still there. It's just not as obvious. Okay, so when will you be done? As soon as you contribute. Start filing some PRs.
Starting point is 00:56:54 Yeah. That's what I think. It's a pretty interesting time in the development of Walkway because right now there aren't so many users, so it's pretty easy to get your voice heard or anybody's voice heard and set the direction of where this is going. And hopefully if Walkway grows, then it won't be the same in a few months or in a year
Starting point is 00:57:23 when there will be many more users and it will take much more power to steer the same in a few months or in a year when there will be many more users and it will take much more power to steer the boat i don't know maybe and i think um you know back to the dilemma you were talking about how do i get more contributors that's one thing where heading towards having a version that supports more bare metal stuff, those kind of people might be the same kind of people who would contribute both to the simulator and be the people who would use it. Yeah, because they're the professional engineers,
Starting point is 00:57:55 but they're the professional embedded engineers as opposed to people who write good web software. What does TS mean again? I've already forgotten. Oh, TypeScript. Yeah, you got it right i think yeah that's uh one of the problem is that uh you have to be good both at uh the embedded development or at least understand understand some of the deeper concept and also be fairly okay with i won't say web development because uh it you can pick up i guess some of the the important parts pretty quick but you still need to have like this mentality of if you classify yourself as an embedded developer and then you go and see a code base in TypeScript,
Starting point is 00:58:45 you still have to have this mentality of, okay, this is code. I can manage that. Yeah. But there is more crossover than I ever expected. I do meet more and more web engineers who are interested in embedded and more embedded engineers who are using web as part of their development. We talked to Tyler last week about using web tools instead of having to compile things. So that was pretty cool.
Starting point is 00:59:17 And we talked to Carlotta about Arduino, which she had a good point. She doesn't want to have hardware that she has to spend all semester setting up. And the simulator would, again, help the students go from Arduino easy level to being able to understand the deeper what's happening under the hood. This is very cool. I'm happy. Please continue. But you not only write the code, you also have blog posts that are really cool.
Starting point is 00:59:51 Where do you find the time? I don't know. In my schedule? I mean, yeah, I mean, one of the things I'm trying to, is to learn is how to ask for help and it sometimes works like i think uh there have been some pretty amazing things happening with um
Starting point is 01:00:18 i was talking about the fact that people were not contributing to the AVR simulation core, which was or nearly not to the Raspberry Pi Pico core, to the RP2040JS library, the Raspberry Pi Pico simulator. But people do contribute on a lot of other things. Like, I think one of the most impressive efforts is by a person called Anderson Costa from Brazil. And he constantly translates all the documentation that they produce to Portuguese. He translated over, I think, 50 pages of documentation or so, so far. And he keeps doing it. And it makes WorkWe so much more accessible. I watched a video of somebody from Brazil
Starting point is 01:01:07 introducing Walkway in Portuguese and then he clicks on the docs, on the question mark next to one of the parts, and it opened the Brazilian, the Portuguese site. And it feels, I guess, for the people who watch this, it feels much more home when they see that the documentation is in their own language. And this is just a user who really loves the product and does this translation. It's amazing how people think that to contribute to an open source project,
Starting point is 01:01:41 they have to dig deep into the code and find the smallest bugs to work on. When the truth is, a lot of open source projects, they need help explaining what they do, getting the word out, being translated into different languages, checking the docs for grammar errors. I mean, it doesn't have to be hard to contribute. Yeah, one of the users just sent me last week, and I was working on it before we started recording this, one pager explaining the benefits of Walkway. And I'm like, okay, you explain it so much better than I do. And now I'm trying to sort of wrap my head around it
Starting point is 01:02:28 and see how I can break this down, like all the information that he shared with me and use this for my communication to explain to people what work we can do for them. And that person, I don't think even if he contributed a feature, I don't think it would have the same impact as like letting me know what the perspective of users is,
Starting point is 01:02:59 how he sees Walkway, how he sees the advantages, how he sees the advantages or the benefits of the simulator. Yes, yes. Sometimes users and listeners are amazing in that they see things that we're too close to see. Exactly. Like, I will just give you one bullet.
Starting point is 01:03:26 Mistakes are okay no hardware can be destroyed i haven't thought of that i've let out a lot of magic smoke in my career i that is that is the awesome thing about simulators is it's yeah you can do really stupid things although i do want a simulator that when i hook things up wrong it like shouts at you no i wanted to fake explode i wanted fire outrageous yeah beyond reality fire yeah yeah well uh maybe i can work to put some 3d shader stuff into here that seems like an important contribution that would be accepted. Do you do 3D shaders? Not, not.
Starting point is 01:04:11 I've done some. I've played around, but not professionally, no. So a funny story about 3D shaders. At some point, I wanted to speed up the implementation of the LED matrix simulation. So I tried to write a shader to do that. And it worked pretty good on my machine, which has RDX something NVIDIA card. And then users complained it was super slow on their machines. And then I just reverted back to the CSS implementation.
Starting point is 01:04:45 And then it ran fast for everyone. So shaders are a lie. Before we let you go, you've taught a couple of courses at Hackaday. Could you talk about those briefly? Yeah, so those courses were one of the drivers for me to implement some of the more advanced features in the simulator. For instance, the first one was about AVR, the architecture, the assembly, and how to approach reverse engineering AVR programs, Arduino programs. And I decided to try to use the simulator for the entire course.
Starting point is 01:05:26 And that's one of the major reasons we now have the GDB on the web, because I wanted the students to use GDB. And, you know, I didn't want to spend time or them to spend time configuring gdb setting it up you know windows versus linux versus mac and all of that stuff so um i i just try to build all the features or if you go to any arduino program and you press uh f1 in the code editor and then type view assembly code listing, you will actually get a tab with the assembly code listing. So that's another feature that I built especially for that course. And the second course was about the Raspberry Pi Pico a few months after it came out. And as soon as I started working on the simulator, and you asked about the datasheet, so I spent so much time studying the datasheet,
Starting point is 01:06:29 I figured out that I have gained a considerable amount of knowledge about the internals of this chip. And that's something I can share. So this is how the second course was born, diving into the depth of the Raspberry Pi Pico. And for that course, I implemented a small PIO debugger. So if you're running a Raspberry Pi Pico programs that use the PIO peripheral, there will be a new tab where you can step through the instructions of the PIO machines, set breakpoint, see the registers. So that's something I implemented just for that course, again, to make my life as a teacher easier.
Starting point is 01:07:15 You've done a great job sharing the knowledge as well as gaining it. It's just really cool. I like Walkway and I expect to be using more of it in the future. And I really encourage people, if you go play with this, to read the docs. They're really good. The code's really good too. The code is good and make sure you click on the little thing after you sign up with
Starting point is 01:07:36 an account with your avatar or whatever because there's a bunch of other stuff like the feature roadmap and the Discord and stuff and links and things that aren't obvious immediately on the webpage. Uri, do you have any thoughts you'd like to leave
Starting point is 01:07:52 us with? Okay, so I think my parting thought is when I'm working on this whole platform, I really enjoy doing the code, like working on the code, coding, all the engineering stuff. It's fun for me. But then I think one of the major things that makes it a lot more fun is the community that evolves around this.
Starting point is 01:08:22 So I really love the community and you know there are people who hang on the discord server and they just answer random questions um of other people and they are so helpful and you you really i just sometimes i just come back and see a discussion in the Discord server. Somebody asked a question about connecting LEDs and people helping with power supplies, which has nothing to do with a simulator. But then it creates so much value for that person. And I think that's the other thing that really helps me go forward and continue with this. The people that are so involved and care so much about Walkway and want it to be better.
Starting point is 01:09:18 So my parting thought is just to say thank you. Our guest has been Uri Shaked, maker and serial warranty voider. You can find his simulators at wokwi.com that's W-O-K-W-I dot com. And of course we'll have links
Starting point is 01:09:38 in the show notes, including links to the GitHub site where his code is all open and very interesting. Thanks, Siri. It was fun to talk to you. Thank you. Until the next time. Thank you to Christopher for producing and co-hosting. And thank you for listening.
Starting point is 01:09:59 You can always contact us at show at embedded.fm or hit the contact link on Embedded.fm. I don't have a quote to leave you with, so here's a little bit of Samba that Christopher wrote. No. Please! I'm not going to write that. That is outside my area of expertise
Starting point is 01:10:15 musically. I can play something on my pen flute if you want. Go for it. Let's see if you recognize this. Perfect. Perfect. Thank you.

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.