Hey, everyone. Welcome to our talk about Behind the Badge. And it's kind of a story on how we worked on improving our Aerospace Village badge from last year, as well as the design process and some of the challenges we've encountered while developing our SAO Charlie for this year. So I'm Robert Pafford. And I'm Adam Vettori. And yeah, this is a Behind the Badge. So a little kind of refresher on the badge we developed last year. So this is a Linux badge running with a nice circular screen. And its whole idea is it's designed to receive ADS-B packets that are sent out from airplanes. So it picks it up on an internal antenna or external antenna and displays it on the nice screen. It runs Linux. It's got a dual core ARM core, as well as a DSP which we use to receive all these ADS-B packets. So this past year, we've been kind of working on improving these algorithms to get better performance and be able to see more planes around you. And so we actually pushed a software update this DEF CON. So if you have a badge from last year and haven't gotten it, make sure to either stop by the village or check out our GitHub to get the links to update your badge to get these new improvements. But part of this process was kind of actually optimizing the assembly. So the HiFi 4 DSP has a lot of SIMD capabilities, but they weren't being used last year. So we did some work to kind of optimize all this assembly and really leverage the full capabilities of this core to get all the performance out of it. Additionally, we realized we had the cache turned off. So when we turned on the cache, we actually were able to hit real-time decode and actually faster than real-time. So we were able to receive all the packets and process all the data we have coming into the badge. So this was a big performance boost, and we kind of pushed it out as a soft update for some of our testers over winter. But we started to see some intermittent crashes every few minutes to actually every several hours on this new DSP firmware. And this made it really difficult to debug of when you have a crash every few hours and you try and see, oh, did this fix it? You have to wait six plus hours to see if it actually solved it. So the crash was a kernel panic would occur, but it wasn't really consistent on what the message was. You typically have a very corrupted stack message. You wouldn't get a lot of registers or dumps. Sometime it'd just be one or two lines of a panic message. And it didn't even seem to have to do with anything related to the DSP. And it appeared to be a memory corruption of some kind, some sort of issue on the TV decoder, some race condition. We weren't really sure, and it was really difficult trying to debug it. But after kind of working on this issue for several days, like a couple weeks, we were able to finally narrow down the bug. And the solution to solve it ended up just be the big hammer of dump 128 megabytes of DRAM over JTAG. It took around 45 minutes to get this whole dump out. But from there, we were able to actually start to figure out where is this kernel panic coming from, of all it would be is some random memory pointer. But when you searched for what that memory pointer was, you'd see that there's actually a large number of matches inside of the buffer that we get the raw ADC samples out. And you'd actually be able to see in the buffer region we assigned for the TV decoder, it was there. We'd also see a large number of matches at the start of DRAM, which was very interesting . At the start of DRAM, it's reserved for the Linux kernel to keep all of its important structures and needs to actually boot up and actually run the operating system. But if you inspected it on the crashed system, it actually looked like the start of DRAM was instead just a lot of signed 12-bit numbers , which looked a lot like the buffer from the TV decoder. And it seemed that there was some sort of one in a million chance of a hardware bug that the TV decoder DMA would just instead of writing to where it's supposed to go, just dump it to the start of DRAM, and then destroy all of the kernel memory, and you would actually crash the device. So this was a very difficult problem to actually like solve of like, well , it's a hardware bug, we can't really fix that. How do you go about preventing it from randomly writing to the start of DRAM ? The solution was to just move the DMA buffer to the start of DRAM , tell the Linux kernel to get out of the way. So if it glitches, it'll just go where it's supposed to anyways. And if you look at the memory map, it's kernels been moved out of the way. And that's what you're running, that we're running on these badges now. So we can now receive it. And we have solved the hardware bug with software. So a another hardware feature we want to revisit from last year and kind of add some extra polish on for this year was the our dual role USB C port. So we put when we put the C port on the badge, we have the intention of it being both a device and a host. So the intent is you get this badge, you plug it into your computer, and your computer is the host, this will act as a USB to Ethernet emulation gadget and lets you just SSH in kind of automagically. But you know, it's DEF CON, we're all hackers, we want to have some fun with this portable Linux device. If I have a flash drive or like a keyboard or some other smaller USB C device, I want to be able to plug it into this USB C port, have the badge act as the host. And our power management chip will give you the five volts boosted from the battery. And it should let you not use like, you know, any other normal USB device on Linux. But when we were doing hardware bring up, we started seeing these, like very, again, interesting transient flaws where, you know, maybe about, like 70% of the time, we'd have these USB enumeration errors, but only in host mode. And that tells us that it's likely not an issue in the actual hardware, like the signal integrity, since we can run high speed USB, like USB device 100% non like non stop, no problem. But it's only in this host mode that this issue actually occurs. So like, I was going into this thinking that there, okay, there might be some bug in the kernel driver, like, that would make sense, like, let's do some kernel debugging. And another like data point we thought we saw is that the original all winner vendor like PSP kernel, the USB host mode also work fine on the same board. So again, very likely not a PCB bug, just something in the mainline kernel might be bugged. And as we're looking into the implementation of how all winner specifically does the dual role USB device switching, they actually like with some of these other IP cores have a pretty interesting way of solving the problem, where they have two effectively host controllers, the main device controllers, the mentor graphics like the MUSB HDRC, it's a dual role controller, so it can do host and device mode in the same like a little like IP block. And this has been used in a lot of devices. So there's tons of info on it, like available online. And for some reason, all winner actually only uses this in device mode. They like on top of that, we'll glue on an EHCI OHCI, like second pair of host controllers, and add this like interesting UTMI mux. Well, they claim it's UTMI mux, we have some, like things we found in the kernel code and like the, the like other data sheets that make it sound like it's actually not exactly that simple. So how exactly they're doing the muxing and switching is not super clear. But, you know, it doesn't really matter for right now. And we, like, we see that, okay, the host mode itself works, sometimes when it enumerates, and the device works basically all the time. And so we were looking at the actual USB PHY, like the, the, like, basically undocumented IP core that talks to the physical differential pairs on the USB port, and then takes that information passes it to the host control like EHCI OHCI controllers. This interface is not your standard mem mapped like MMIO, it's a pretty cursed bitbang interface, where you can see that to actually read and write these, we call them like sub registers, like these very low level registers embedded deep in the the analog blocks of the PHY, you basically are bitbanging some sort of serial shift register interface through these otherwise MMIO registers. And, like, look, you're trying to debug the mainline kernel code, it seems to be using in a sane way. There's only two times that ever actually really talks to this PHY, it's when the board turns on and does the setup. And then when you do the actual roll switch, so sounds like we're on the right track. And, you know, we were looking at bugs in the driver . And it turns out that actually the entire mainline driver was the bug. Allwinner has a whole, like, plethora of chips. And they have these like code names, that's could be a whole other like our talk to explain that mess. But they have the they have a quirks table that let you like try and handle different quirks between different versions of the silicon . But overall, it's the same code for all the Allwinner SoCs . Well, what we found in looking through a specific version of the Allwinner BSP kernel is that they had these interesting comments . They're saying, Oh, yeah, we have this new PHY . It's for the new PHY. And it's for self developed by self. So we suppose that Allwinner actually made what we call a v3 PHY. They made their own in house, analog IP core. And as a result, you'd have you need new ways of controlling that, especially with a really, really silicon specific analog low level control blocks. And it seems that no one from like the mainline kernel actually noticed that. Or if they did, they thought that the old driver would just work. And it doesn't work at all, actually. Like the registers it sets in this analog interface sub block are completely wrong. Like they don't exist on the new v3 PHY. The trim algorithms that the mainline kernel uses from the v2 PHYs don't apply at all to the v3. Those actually done in factory now and loaded from fuse. And we saw that, of course, mainline doesn't touch the fuses at all. So we know that is completely not driving it correctly. So this actually seems like it could be a good like explanation that the analog trims were not loaded from fuse and were just running untrimmed. But actually no, that it somehow still actually just works fully untrimmed. The real for real issue was that the kernel drive was not switching the PHY power bit correctly. So regardless, we implemented both the like correct bring up initialization trimming functionality and the correct power switching. And now with an actual proper v3 PHY driver, we finally just have it just works both USB device and host dual role switch over in the in the kernel. So that's also packaged in a new new kernel update that we have shipped with our v2 firmware. All right, and with those winglet updates, or updates our main ADS-B badge brings us to Charlie, which is the new SAO hardware we designed and brought to DEF CON this year. So Charlie, as we call him, is designed to add some extra radio and like now audio capabilities to the Linux badge. And in the vein of aerospace, we want to come up with some cool things around, you know, around air space and radio. And we settled on trying to receive airband voice as a as an expansion of receiving the ADS-B messages from the planes with the base badge. We have a headphone jack to listen to it, which also doubles as our antenna , the headphone wire. And we figured like, hey, if we already are shipping headphones and audio processing, like, can we receive broadcast FM, that would be kind of cool. It's something that's kind of around you no matter where you go, even if you're not near an airport or you're not line of sight to a plane . And if we're going to do broadcast FM, we might as well do a nice stereo because we want only the best user experience. We also have a pretty neat menu system and animations on this. We are running full four color grayscale on the OLED, which we will absolutely get to in a little bit. And as I like to say , to make all this run on our little microcontroller, we are programming five out of the two cores on it. Because I mean, we need we need that much performance. Yeah, so this a very powerful five core microcontroller. Which one is that? This is the TI SimpleLink CC1312R RF microcontroller. It's a like sub gigahertz wireless microcontroller you might find in like, like wireless remotes or any sort of device that needs to communicate like long range over sub gigahertz. The actual core of the microcontroller is a pretty standard like ARM Cortex M4F. It's downclocked pretty low at 48 megahertz. And it's got a your standard basic set of peripherals of UART, SPI, things like that. So from the like a microcontroller point of view, it's pretty standard. One interesting part is it has a thing called the sensor interface in the bottom right. And that actually has a second core which you can program. They give you all the tool chain to develop. It's a sensor controller, they call it. And it's a 16 bit DSP that's 16 bit CPU core, which is just ultra low power, super basic, basic edition. But it's designed for like background sensor pulling tasks. And it's a very low power core that can run while the entire main rest of the system is like power gated and turned off. So that was very interesting, because you can actually use that for more features and adding more stuff into it. From the RF side, it's great because it can receive sub gigahertz. But there are a few short, few small issues when you're trying to develop with this . One, the TI SimpleLink actually can't tune to the frequencies required for it. So we wouldn't actually be able to tune to FM or airband if we chose this microcontroller. And the microcontroller is only designed to receive digital signals . But airband is an analog signal. So a few small challenges we had to overcome to actually make this possible for this SAO. So to actually do that, we have to kind of unlock more features of the RF core to convince it to receive analog and kind of go outside of what it's intended for by the manufacturer. So we needed to convince the RF chain to kind of go and receive analog. And the thing is that all the signals coming into the chip have to be analog. And looking at the block diagram that they show here on the right, you can see that it's actually pulling two ADCs for IQ sampling. So at some point in the signal processing chain, there should be raw IQ samples flowing through this chip. So if we could figure out how to actually pull the samples out early enough in the processing chain, we could get the raw analog samples and we could actually receive these analog signals. The problem is that there is absolutely no documentation on how any of this RF core works. Pretty much any RF microcontroller you'll work with is like this. They don't give you any of the register maps or documentation. They just say, use our APIs, use this pre-compiled blob. They don't even really give you source code to use it. This chip takes it an extra step further. And actually, the APIs, they give you the source code for, but all they do is talk to a mailbox to a third processor inside of this chip, which you can't, you're not supposed to run code on. They say, oh, just use our APIs. It's got a ROM with all the code it needs. And it actually makes it more difficult to reverse engineer because you don't actually have a reference for even like a pre-compiled binary to look at. It's just all in this walled off box. But being able to directly drive the peripherals would give us full control and being able to do it on a second core would even take load off of the main CPU and we could do more cool stuff with the main core. So that was kind of the objective for this. The nice part is that what allowed this to be possible is TI creates a thing called RF patches. So the whole idea behind this is they released this microcontroller when Bluetooth 5 was the latest and greatest. But Bluetooth 6 comes out and they don't want to respin the silicon and change a bunch of ROMs out just to support Bluetooth 6. So instead they created this concept of patches where in an SDK update they will give you some opaque binary blobs that you load in and it will put it in magic locations in the chip and it will actually be able to change the behavior of the RF subsystem. So this seemed to be the best way to actually change the behavior and actually implement our own custom RF control on the chip. So these are just after kind of looking through and reverse engineering these a bit. These patches are just executable code that gets loaded into various parts of RAM and hooked into the various parts of the RF core. Now the other interesting thing is that when you look through the RF patches, they talk about CPE patches, which stands for the Command Packet Engine, is that Cortex M0 in the previous slide that kind of all the RF libraries interact with. This has like the mailbox system and does all of that and does like the high level management and power up and power down of the RF subsystem. But there's two other types of patches, MCE and RFE, which are designed to do more real-time processing tasks on the chip. And these are a completely undocumented ISA, which required some reverse engineering to figure out how to actually create and develop code for these processing cores. But they are two additional CPU cores, which also run at a rather fast speed, and they're able to do a bunch of real-time decoding and management of the RF subsystem. So being able to leverage these cores, unlock even more capabilities and give you even lower level access into the RF subsystem. And so all these CPUs can be patched. And we had to create custom patches for all of these cores to be able to modify their behavior and actually start to pull out these analog samples and actually make all of these things possible. So how do we get it to work on Charlie? And how do we actually receive airband audio? So the actual chip itself has a hardware IP block called the magnitude estimator. So this converts the raw IQ RF samples into a magnitude. So this is effectively an AMD modulator, where you can just get the absolute magnitude of the incoming waveform. And if you were to take that audio out and play it, you would get roughly some sort of AM tape signal, and it would be very low quality, you could use that. So we take that magnitude block out and we use the MCE firmware, we made a custom patch to kind of periodically pull this magnitude estimator and use debug registers to pull the samples directly out of the chain at an early point, and actually get it before it goes to the digitizer and then just forward that out into the FIFO that's typically used for digital packets that are received. Then we create a custom CPE patch, which will be able to do all of the filtering of this data. So this will take the samples coming in from the MCE, and it will be able to do like basic filtering. So this hard audio doesn't sound as harsh, and you can kind of hear the airband voice and a little bit clearer, as well as it does the squelch algorithm. So you don't hear static in the background, as you're kind of listening to dead air, it'll actually kind of mute that. So part of that process, we were able to kind of talk to the RFE, which does all the power estimation. So having all of these systems work together, we were able to create the airband receiver. So when it's not, when you just have a transmission, you're able to pick it up, hear it rather clearly. And then when there's nothing going on, it just silently mutes itself. And this is all, once all this processing is done, you have audio samples written to a buffer , and it's sent to I2S. And so the main CPU allocates the buffer, but after it does the handoff to the CPE, it pretty much steps completely away. And so all the receiving is done with zero overhead to the main CPU. So we're able to do a bunch of other interesting stuff in the meantime. So that's the airband audio receiver. And that was, we got working. But we also wanted to make sure that we could receive FM, because you might not be directly near an airport, but it'd be nice to be able to still use Charlie and actually be able to pick up some sort of audio and kind of mess around with the SAO. So part of this was, we wanted to get stereo FM. Basic, like mono FM is pretty simple. At the, this is the spectrum view of your RF spectrum, or the post frequency demodulation, what your spectrum will look like when you, for an FM station. So everything below 15 kilohertz, you can kind of see is marked as L plus R. And so that is your mono audio. So your basic FM receiver will just put a filter, everything below 15 kilohertz, just put out over the speaker, everything above discard, and you can get a basic FM audio stream like that. And so the first implementations we had of FM on the development boards were just basic mono audio. But stereo actually sounds, even though you might not have the full high quality CD level audio you'd expect from modern digital electronics, stereo adds an extra sort of feeling to the audio that it makes it sound better. And so I was determined that, okay, we are going to get stereo FM on this thing. And we're going to figure out some way to get the signal processing chain to do this. So the way you actually receive stereo is a little bit more complicated, because again, the everything below 15 kilohertz is mono audio. So rather than to be able to separate the left and right channels, they don't have the left and right transmitted separately. Instead, they have up at the 39 kilohertz point, this left minus right signal, which allows you to do addition and subtraction operations. So if you add the two signals together, you'll get the left channel. And if you subtract the two signals, you get the right channel. So we would have to go in and kind of narrow out this sort of center left minus our region, and then add the two signals together. And you do this with this 19 kilohertz pilot tone, where you will be able to see this tone, if you filter it, that will give you a pure tone, which you can multiply by two to get the dead center of your left minus right audio. And then you're able to kind of go from there to actually receive it. So the actual algorithm to do this is we take in the raw FM demodulation from the MCE. And we first go through in the middle path to go through and I think I can do this. So you go through the middle path, which is the 19 kilohertz pilot band pass to kind of isolate this center carrier frequency. And then you run it through a phase lock loop. So this turns it from a very noisy 19 kilohertz tone, depending on how close you are to the transmitter or how much noise is present. This cleans it all up and does best effort to try and recreate this 19 kilohertz pilot carrier to then be used later in the chain. We then multiply it by two and then are able to get a 39 kilohertz, which is our reference for what we need to shift our like the L minus R band down to, to actually get the L minus R signal. So we shift the 39 kilohertz back down to zero and then filter it. So we just get the L minus R signal. So at this point right here, we have L minus R. For the L plus R, aka the mono audio, you just have to filter it. And then you get an L plus R. Then you do the addition and subtraction operations, and you will get your FM, left channel and right channel. And then after a little bit of the emphasis to correct the frequency response, you're able to get your left and right channels out of FM. So there's a lot of filtering steps and a lot of various math that needs to be done to do this. And there's a lot of demos online, and you can do this on your radio or on your computer with an SDR. But we have a 48 megahertz Cortex M0, which is not a DSP. We were lucky to get a multiplier. So we had to kind of create a whole custom patch system to do this DSP in a very small amount of time. So at this, we have a 200... at the audio rates we get, you need 200 kilo samples per second to get your 100 kilohertz of bandwidth required for FM. So this is the absolute minimum. You should really do 250, but we couldn't afford the cycles for that. So we got 200. And so this gives us around 240 cycles per sample to run an algorithm of two six-order IAR low-pass filters, a PLL , DDS, a bandpass filter, and two FM de-emphasis filters. So this was done with a very custom Cortex M0 assembly routine, where to actually save CPU cycles, a load and store on the Cortex M0 actually used two cycles per. We actually ended up moving the stack pointer and reusing it as a general purpose register to actually save CPU cycles while loading and storing to try and inch every piece of performance out of this chip. But we were able to squeeze it just under with 235 out of 240 CPU cycles are in use to receive this FM. And that leaves a few spare for bus arbitration. But with all of this, you are now able to enjoy stereo FM, which is something your car can do, but now so can your SAO. All right. So this is great. But to be able to like leverage any of this, we actually need to get the FM or airband signal into the chip. And as we mentioned before, that that's not really possible on the SimpleLink, even though it's a sub -G chip. FM requires you to tune to 88 megahertz, that's the lowest end that like we need to pick up. And even though it's a sub-G chip around TI officially says around 169 megahertz, and there's gaps, it's not a full continuous spectrum. But this chip will do 169 megahertz to about 1000 megahertz with some gaps in between. And that's not enough to 88. And we tried a few things to get this chip to tune down that low. And I assure you we tried everything we could, including actually throwing away the existing PLL driver. TI uses an interesting architecture called the ADPLL or all digital PLL. So there's a few papers and like IEEE talks, they did on this. And there's some cool stuff in there, like, this is interesting to you, where, for example, like they don't run the feedback loop in analog, in an analog mode, they actually run it as you can imagine, like a digital clock with just very, very fast, like up to 2.4 gigahertz fast counters as your phase comparators and all their PLL stuff . But we were thinking, okay, well, if the existing PLL driver code does not let you tune this low, what if we write our own PLL driver code and see how low we can push the silicon? And the answer is around 140 megahertz, which is still not even close enough to 88. And for some other reasons in the hardware, like we have pretty good reason to believe that silicon physically cannot support this, this low frequency, like we're missing a few extra gates, we're missing a few extra divider chains, we're missing enough hardware in the actual RF core where there's realistically no way that this can happen in silicon. So begrudgingly, we had to add some parts. And one of those is external mixer. Usually when you start buying discrete RF parts, they get expensive because the companies that make them know that you're probably pretty smart if you're buying RF parts, and you can afford it. But we found a nice old, decently old part, it's called a max 2671. It's a up converter mixer for I believe, like decked cordless phones, but they operate in about the right frequency range. Because they have multiple part numbers that's effectively the same silicon, and we're jellybean parts in like the late 90s, there's still enough stock floating around where you can get these quite cheap for like what they are. And because these are dedicated mixer ICs, we do get the benefit of it being a proper like Gilbert cell double balanced mixer. So the silicon quality of the mixer is very nice. And like, you know, we'll take every bit of dynamic range and noise, like low noise figure that we can. The downside to using a mixer though, like a discrete mixer is that we need to generate our own LO or like our own local oscillator frequency reference for how much we want to shift the incoming radio signals by. And to generate an LO, again, the off the shelf solution would be to buy a dedicated RF synthesizer chip. But once again, these are expensive and also quite power hungry. So we're thinking, well, if we don't want to buy a dedicated RF synthesizer, like what other options could we have? And as I was like looking through just any chip I could find that kind of does anything related to RF, I came across these series of chips, like really, really tiny SAW 23 guys used in like these ultra low cost AliExpress garage door openers. And it gives you these like random, like throwaway little, you know, you press a button and it receives it on the other end, like as like a GPI open basically, but it's over RF. And what these are, are either OK, like on off keying or like GFSK, little single transmitter receiver pairs. And the specific part we chose a CMT2119A, it's transmit only, but it has a like SPI retunable range of 240 to 960 megahertz. Now this is designed to where you have a data pin that you clock in your digital data on and it, you know, translates that to like, it modulates that into RF, then you receive it on the other end. But I mean, if you think about it, like on off keying, where you just hold the data pin high forever, I mean, that's basically continuous wave, right? It's only on off keying if you turn it off and we don't turn it off. And you're like, there's no way this works, right? Like will the chip work? And so we like threw together a quick test board and like to our surprise, not only did like the chip work, like really, really well, like it, you know, handled it running indefinitely long, we found that our actual like phase noise and like our spur performance is really, really good . And would actually like quite handily beat my USRP, like SDR for both frequency stability, power stability and like spurs. So not only like what we like, we went into this thing that we might have a comp, like, we might have to make a compromise with this, like chip as our LO, but actually turned out to be a really, really good RF synthesizer. So with this RF synth chip, our mixer, and then the SimpleLynx front end and the demodulation and RF core, like that finally gets like lets us complete the entire signal chain and do antenna to up conversion to down conversion in the SimpleLynx demodulation, like the signal chain processing, audio DSP, all that, like all that good audio processing stuff that Robert was just talking about, and then DMA that out to our I2S stack and then finally get in your earbuds. So with that, there's one more feature that we want to talk about and that's our OLED. So pretty early in the design phase, we came up with the aesthetic choice to use this like commodity 1.3 inch I2C OLED, but commonly I2C, they support other standards, and we're using SPI. And they will be listed as SSD 1306. Although as we're about to find out that might not be true. But we like these because I mean, they look they look good, you have really good contrast. And they're also pretty common parts, they're fairly low cost. And we were thinking that, hey, this is, you know, tons of people use these in projects, like you can find 1000s of projects out there with this, like this little SSD 1306 screen. So sure, like this will be great, because we can save a bunch of time, we don't have to reinvent the drivers from the ground up, and it'll just work, right. So we wanted to do SPI and DMA as the highest possible FPS interface to the screen to get a nice fluid UI. And right away, we noticed a problem that, well, yeah, you have really bad screen tearing. And this is to be expected, like we're throwing pixels at it as fast as our SPI, like in DMA can do. And there's no sync. So we like until we are synchronized, the displays frequency, of course, we'll get screen tearing. So sure, this works, just how do we turn on screen tearing. So we started looking into this, maybe we should have looked at this before we committed to it. But we started looking at this. And what do I see? Oh, apparently, this is unsolvable. So what are we up against? Well, in theory, the SSD 1306 controller outputs a sync signal on this pin they call FR, like frame, I don't know what it is, they don't think they actually ever tell you what it stands for. But this is really actually interesting and kind of an inversion of the normal paradigm with like screens, because this screen, not the host is what control sync, the pixel clock for the screen is not is not something you feed to the screen, it's actually generated internal to the screen with a little like RC oscillator. And like any other like any RC oscillator, that's like the actual exact frequency of that is subject to trims, like, you know, the exact temperature, time, like humidity, a bunch of environmental factors, process factors, just manufacturing variability, it's basically, it's a complete unknown and you would need like closed loop. Without a closed loop feedback system, such as this, like FR signal, you cannot know, like 100%, what the actual pixel clock is. And while this sounds great, and we saw this on the data sheet, like, oh, yeah, there's a signal, like, it'll be it'll be fine. It turns out that actually none of the panels that are manufactured have this signal broken out from the chip to the ribbon cable. And as we found, actually, a lot of them don't even have it broken out from the ASIC at all. So I went in search of this FR pin, and see, can we probe it at all, like even just for debugging. And my first thought was to probe the traces on the glass directly, like this metallization layer that's deposited on the glass, and then the chip is like kind of pasted on top. And something I found that we weren't expecting is that what all these little displays that they call like the SSD 1306, most vendors actually have no idea what they're selling. See, the SSD 1306 is not the only OLED controller, it's one of the OLED controllers. And a lot of people have been making clones, and then clones of the clones and clones of the clones of the clones, and then clones of those. So as we were trying to like back solve the device, the family tree of this controller, we found that there's multiple companies, some which are seemingly related and not. And there's this whole huge mess of like, what controllers could actually be on your panel. And the problem is the vendors generally don't know. And even things like the exact like the silk screening on the actual ribbon cable that's bonded to the screen, I found examples where even that is wrong. So because they, the manufacturers view this as compatible, like either 100% binary compatible, or like, you know, oh, you change one register and your code still works. Well, it's not the same chip. And as we're like finding out that there are like notable differences between them, that makes some things work on certain controllers, and some things work on only other controllers. And actually being able to know what controller you have is a very, very difficult problem. And I'm not sure there is a guaranteed way to know. But, like, why does this even matter? Well, it turns out the SSD 1306 is one of the earlier controllers and one of the more well featured ones. And while that has an FR pin, the clones do not, or the derivatives of that do not, the cheaper, lower cost controllers. And it's kind of like a cache 22. Because no one was bonding out that pin from the SSD 1306s, the clone guys like, well, we're gonna save the pin, we don't need it. So they actually just got like they get rid of the sink pad on the actual silicon, like the circuitry in the silicon just doesn't exist. So then the manufacturers like buying these cheaper chips will be like, well, there's no sink pin on the silicon, so we're not going to bond it out. And then that's like the feedback cycle of you end up with no OLEDs with this sink pin in existence. So as I took some microscope shots on the lower right picture, you can see this kind of like, little frowny face, that darks that the darker rectangle is the actual pad on the silicon where this FR pin on an SSD on an actual authentic SSD 1306 is, and it's not connected. So I can't probe that. Well, that led us to look for other ideas. If we can't extract timing information from the display, can we inject it? You actually can supply your own clock to these panels, which would actually solve all of our problems, because if I can give it the clock, I will always know like deterministically what that clock is. And it's called, you know, they give you a nice clock multiplexer so you can feed it in. And of course, no one bonds that out either. So that pin also exists and you can't get it. We've asked the manufacturers this is the kind of problem where they're like, okay, if you're not ordering 5 million of these OLEDs right now, we're not going to like entertain this idea. The SPI or I2C interface is read only because that saves like, you know, four more AND gates of not having to support register readback. So you can really only just throw data at the screen, you can set up a couple configuration registers, and really, they just wanted to throw data at it and you can't read anything back. So the any thoughts of like trying to find a register or like, maybe there's a register that has like a current scan line or anything of that sort is completely off the table because the digital interface to it is basically write only. And the only other pins that we have on the ribbon cable are for power. So we don't want to modify the OLED like and try to do something custom because that's unsolvably expensive. So we are effectively out of options. Now there's the sync pin doesn't exist on the ribbon cable. The like digital interface is write only and all we have left is power. So is there anything we can do with the power pins? Well, aside from 3v3 logic, like the actual digital interface to your microcontroller, the OLED needs like higher voltages to actually drive the pixels and make them glow, nominally like call it around six and eight and a half volts, like something in that neighborhood. And as a like little convenience feature, these controllers have charge pumps that will do a doubling and tripling of your 3v3 rail to generate these higher voltages. And so just so you don't have to do it, all you do is throw on two capacitors and like you're you're done. And charge pumps are a form of switching regulator. And the way that they do this is by switching the voltage on and off the capacitors. And well, as I was doing some testing, since there's a register you can actually set that margins the oscillator frequency higher or lower, I found that hey, the like, as I make the pixel clock go faster and slower, the charge pump clock happens to go a little bit faster and slower. deterministically with how I set the pixel clock. And it turns out like probing the actual charge pump capacitors that yes, the charge pump switching frequency is actually an exact integer ratio. It's like half the speed of the pixel clock oscillator. And this makes a side channel possible, right? That we can recover the clock we can do if we do clock recovery on this charge pump signal, we can actually recover the exact closed loop frequency that the pixel clock is running at. And there's only one other problem with this is that the density of the pulses since it's not on on the on all the time has to do with the contents of the pixels on the screen. So for example, if you're showing 100% all white pixels on the display, then you need the most current from the charge pumps to drive all of those pixels on. So the charge pumps will be running basically as a square wave of you know, constant, constant on time and duty cycle with 100% density, it's a square like it is trying to drive as much current as it can to the pixels. But if you make that display then all black, you're effectively requesting no current from the charge pumps. And because it's a power regulation loop, they will go to a very low pulse density and I mean, they don't need to drive current. And that's solvable with a PLL or like other clock recovery techniques. But as we already talked about, this is a 48 megahertz little microcontroller like doing this kind of like dynamic side channel and correlating that to the pixel contents of the screen and then doing that fast enough to know where we are in sync and then making sure we don't lose the sync like this is a this gets pretty pretty like yucky pretty fast. And then also a little bit like a side tangent that this technique also seems to only work on some of the controllers. So like the aforementioned SSD 1306 works, the very low cost CH1116 is also like has this effect. And we found that the maybe now more common SH1106 controller actually does not work like this. The charge pump frequency does not depend on the pixel clock. And we said, like we think that either it has its own, like completely separate way of clocking or there's just no clock and it's just done in analog. Well, going back to this, though, if we could get 100% pulse density, like not related to what's on the screen, instead of doing all this like complicated PLL side channel recovery timing shenanigans, like all you'd have to do is count edges, right? The number of pixels on your screen doesn't change per frame. And all you'd have to do is count edges. And as we like talked just like mentioned that the density of these pulses relates to panel current. And as we started looking into this, we went, maybe I went a little bit too far, because we started decapping these chips, found a way to pull them off the glass. And then we're just looking, just kind of like hunting around for anything we could find that might help us get more information on this and get closer to this achieving this sync. And the opcode space for this controller is like you send an 8-bit opcode. But of all the documented commands in the data sheet, if you kind of like, you know, graph them out, you'll see that there's a lot of holes in there. And a lot of undocumented or reserved space. And well, what do you do when you have a bunch of undocumented opcodes, we do automated fuzzing in hardware on an OLED controller. And after running this for a couple hours and a couple days, I was basically listening to the charge pump as an audio signal, trying to see, you know, can we get any change in these in the behavior of the silicon actually started yielding some very interesting findings. There's actually multiple undocumented charge pump modes, like in the register that sets voltage. For example, what that lets us do is instead of doing the pixel clock divided by two frequency, you can actually overclock your charge pump and run it at the pixel clock frequency doesn't really get us anything right now. But it is something interesting that to see results basically right away, that there are a lot of secrets buried in here. And then when we see that there's maybe one secret buried in here, then we're going to go all in and try to find all the secrets buried in here. I found another undocumented command that lets you well, I suppose lets you adjust the internal references. So kind of like your current and voltage references. And as you start tampering with that knob, if you make the chip believe that it's actually pushing less current than it really is, then it will run the charge pumps harder. And running the charge pumps harder, of course means increasing your pulse density. And that's when I found for the first time that on at least the screen I was testing with on a fully black screen, we could get 100% charge pump density, aka we win perfect sync of just edge counting. And while that is amazing, was really exciting at the time, certain screens then as like, again, depending on manufacturing tolerances, will then not do 100% density at that cranked up mode, like maybe we'll work on some but then on some other ones, it doesn't. So more fuzzing, more searching through opcodes. But then finally, we landed on the our final solution here, which is the burn in mode register or what we believe is the burn in mode register. And if you are interested in playing around this at home is command D zero and you set it to 01. But what this does is basically just tell the charge pumps to run at 100% all the time, like it does exactly what we need to do somehow. And regardless of the pixel contents, regardless of any other setting, this command mode will tell the charge pumps to just run 100% on all the time, max voltage, doesn't matter what's on the screen doesn't matter what else you do. And this lets us get our perfect sync, we have 100% guaranteed deterministic closed loop control, all we have to do is count edges, and which we know by just how many pixels we're clocking out. And then you take that through and a few other undocumented commands for good measure like that margining and some things to make it nice. And then that lets us finally for real achieve the effect we want to go for, which is our four color perfectly stable gray scale, regardless of pixel contents. So now that we've got this great display synchronization, we wanted to create a graphics engine to actually drive the OLED. We wanted to have a cool UI and some really nice graphics but didn't particularly want to write a full animation rendering engine in C. So instead, we wrote a virtual machine to run a full animation system to actually render all the animations, which we call ANSM or animation state machine. So the idea behind this was just create a sequence of multiple frames with the delay in between. But as all things do, it slowly started to gain more features. But the whole, we wanted to be able to allow graphics to be developed independently of firmware. So while we were doing all the development with the sort of, like OLED and the DSP, the frames and stuff and all the graphics can be generated. So some of the features we wanted to kind of ended up going in here was you could have multiple frames kind of be chained together of either grayscale or monochrome, but it's got your standard jumps, loops or randomness. It can also support input events. So allows like any sort of button presses to actually cause reaction. So every time in your main menu, when you hit the up button, that's not C code actually seeing the up button and doing the action. That is a virtual machine which forwards it into the ANSM script, which will then have a vector handler to then react to the button press. Then to actually allow multiple events to kind of exist and have different menu modes, you can actually chain multiple of these ANSM scripts together. So after you finish the button press animation, you can then go into another ANSM program for like the next menu item or the sub menu for like the airband player and things like that. There's also support for preemption to kind of every time you see a sleep animation, it's actually preempting and launching another ANSM script while another one is kind of in sleep mode. And it allows, it'll yield back controls to the previous script when it's done. And you can also send signals out. So on the actual, when you hit like the volume up button on the volume menu, that's the ANSM script actually saying, hey, to the firmware, please turn up the volume. So all of this, like the UI was actually not really developed in C, but it was developed in this ANSM scripting language. And so this just allows a lot of the UI to be offloaded and live in ANSM scripts rather than inside of the actual C code. And of course, there's also a host emulator. So you can run the VM and develop all this without even having an SAO. So this was one of those small creature comfort things that ended up spiraling into a full virtual machine. But that's what's running your, your UI on here, this ANSM script. So and one final small thing is the ITC support for this, we wanted to have the ability for winglet to control it, like the main badge, as well as so you have your basic tuning, but all the settings and presets we loaded in with presets for Vegas, but you're going to go home and you're probably going to want presets from your local region. So if you have a badge, you can program it with the UI, it'll give you settings to modify it. But it's also available over ITC. So we'll be looking at trying to release all the commands to do the reprogramming. So you can just have an Arduino or an ESP 32 and change all the presets yourself. So all this control is available over ITC. But the only issue with that is there's only one ITC interface. And we also need ITC to control the DAC. Now, the same thing would be to do the ITC device inside of the actual hardware peripheral, which is designed to be asynchronous clock and derive the clock from like the ITC controller with like bit banging it. But we wanted to use ARP to allow easy hotplug detection and make it kind of just work when you plug it in. So the we're using this fifth sensor controller core inside of the chip just to run an ITC controller, do all the clock recovery and clock synchronization to fully implement like an ARP compliant ITC device. So you can listen to two addresses at the same time. So it has auto hotplug detection, removal detection, you don't have to worry about colliding IDs, you can plug three of them on the same ITC bus and they will all just work and figure each other out. And it also we're also trying to work with other badge makers to kind of standardize this SAO identification and hotplug. So all the SAOs that have like microcontrollers on them can have this kind of just works experience and auto detection. So that's the thing for that. But yeah, that's our the work we've been doing this past year. Thank you. Yeah, I think we have at least around five ish minutes for Q&A. So if you have a yeah, if there's any questions. I don't believe we have any more right now. And I don't I have no, I don't know if we'll have any more. That's a ask their their space village leads question. But unfortunately, no, I think we are out of stock. Question. It can transmit I have removed all the transmit capabilities. So we aren't transmitting out on airband and things like that. So yeah , there is a some some things have been removed to make sure it's receive only but yes, it's a transmit capable and it would be interesting to do other projects with this to kind of create things because it's a very powerful chip and having this low level access would be really nice. One thing like maybe worth mentioning as a side note on like transmit is that while we can do arbitrary IQ receive these chips do not support arbitrary IQ transmit. They are quite flexible. And you know, the more like crazy you get with the low level firmware, you can make them do crazier things. But just like we also had that initial idea of like, hey, can we do IQ transmit? No. But it is quite flexible in the transmit modes regardless. Question. We will open source. I think the ANSM and then we'll like the all the ITC stuff but some of the we've been very busy. As you can imagine getting everything ready for this DEF CON. So we don't have things ready like right now right now. But we're hoping to trickle some stuff out in the coming, you know, coming weeks, as we as we recover on sleep, like like the ANSM toolkit, like I think that's pretty cool having like that animation framework. And you know, since we already made a virtual machine, if you can put it on anything else, like all the tooling, all the scripting is there and like, we'll go through what we can. All right. Thank you.