All right. Thank you, everyone, for coming out. And apologies, there's a little delay, as happens with these things. But we're gonna go pretty fast. We have a lot to go over, thanks in no part to our Silicon vendors, our supply chain, our DHL. But yeah, we're excited to talk about behind the badge and a little on how we use an abuse hardware to create the ADS-B receiver on a badge for the Aerospace Emotions here. My name is Adam Latorre. This is Robert Bradford. And let's get into it. So we start off with some theory and some practice. But the theory of the badge is when, yeah, the idea we have for the badge is actually one that Aerospace Village has had kind of in the back pocket for a while, which is it wouldn't be so super cool to do an ADS-B receiver on a badge, fully integrated and able to run without needing a network connection from a service like FlightAware or anything that feeds community crowdsource ADS-B. So for those of you that might not be aware, ADS-B is, or Automatic Dependent Surveillance Broadcast, is a protocol. It's a type of signal that's a very important aspect of aviation safety. It is transmitted between airplanes, between ground stations, and in some cases even with satellites that can transmit a whole host of messages between different stations. The most relevant for us are things like call signs, flight numbers, ICAO addresses, altitude, headings, so information about planes that you can see flying overhead. And while it's intended uses for safety and air traffic control, a common hobbyist and enthusiast use case is it's just cool to be able to see a map of all the planes and aircraft around you overhead and be able to see what flight number it is, it's heading, where it's going, flight plans. And ADS-B itself can exist over multiple types of data links, but when we say ADS-B, the most common physical medium that it's sent over is the MODIS downlink at 1090 megahertz. And if you want more information on ADS-B or what it's used for, talk to the Aerospace Militia. But where we come in as like hardware design and badge designers is how do we actually, we have this signal, we know what we want to receive, but how do we actually implement and make a badge that can receive this signal? So the most common like enthusiast receivers utilize SDRs or software defined radios like the RTL-SDR. And because this was designed a long time ago, the protocol and the modulation is actually fairly simple to demodulate and decode. It's on-off keyed, which is effectively digital amplitude modulation. It's either on or off. You're either getting RF or you are not on the 1090 megahertz. And the data bits themselves are Manchester encoded, meaning that the data exists in the transitions between 1 and 0 or 0 and 1. Now to do this on a badge, if you want to do a so-called real SDR receiver, the chips that are required for that is expensive. They are like very high-end RF chipsets and it's way too expensive to put on a badge. Think of something like a Hyper-RF, for example, as a proper SDR. The SDRs like the RTL-SDR uses a DVB-T, which is a digital terrestrial broadcast television. And they overdrive those chips to run faster than they're intended to, which lets you get into that 1090 megahertz band and then receive it and decode it in software. One of the issues that we found when we started looking into using one of these DVB-T tuner chips ourselves, though, is that they are very power-hungry, especially when being overdriven to hit the 1090 megahertz band. And in addition to just getting really, really hot, the battery life of the badge would be next to zero. So we had to come up with a new way to do it. And the third major way of receiving ADS-B is the Log-Amp architecture. This uses a very fast RF power level meter, which converts the logarithmic received RF power into a linear output voltage. And in this mode, it can act as an envelope detector when filtered with some very tight 1090 megahertz saw filters. So the way that the architecture, the receive chain works, is that you get the entire RF spectrum coming in through your antenna that gets amplified and filtered and amplified and filtered again through very tight 1090 megahertz bandpass filters. So we can extract only the very specific slice of the spectrum that is centered at 1090 megahertz. And then because the signal that we are trying to demodulate is just on and off, the RF power meter will let us know, is it seeing no RF or is it seeing more RF? And that lets us turn the 1090 megahertz ADS-B packets in the air into a two megahertz baseband level output. And we actually used an amplifier and anti-aliasing filter chip from a composite video receiver because it is very cheap. If you want to buy an eighth order Butterworth filter with multiple channels and power amplifiers and clamp diodes, well, analog devices would love to charge you a lot of money for that. But if you want the... I mean, no one uses composite video anymore, right? But if you want this composite video amplifier with an eighth order Butterworth filter implemented into it and multiple chains and an amplifier, well, please take it. Who uses composite video? But the last step in this process is digitizing the signal itself. Again, the common way of doing it is to put it into a fast analog to digital converter, an ADC. But again, high-performance RF-intended ADCs are expensive. And when trying to optimize design, the best chip is no chip. So the SoC that we're using for the main Linux component of the badge is the Allwinner T113. It has dual Cortex-A7s, and we'll get into some more of the specs a little bit later. But it doesn't have any fast ADCs on board, at least nothing that's actually fast enough to demodulate ADS-B. Well, it is intended actually for automotive video applications. So it has multiple video inputs and outputs. And one of the supported video input modes is composite video. Well, if you know your composite video trivia, the baseband signal has frequency components that require at least a 27-megasample ADC. And sure enough, if you look at the block diagram we have in our datasheet, it says that on the left side next to the PGA is an ADC block, because you must have a fast ADC to be able to digitize composite video. And it's a fast ADC, but if you actually go back, you can see the ADC is not isolated. It's wrapped inside a bunch of filters. You have the PGA. You have all the hardware blocks that are designed to demodulate composite video. So you don't get raw samples from the ADC. You get pixels, basically. So it tries to find the lock. It tries to find H-sync. It tries to find V-sync. It has built-in filters to do color correction, which means that as it stands, it could not receive ADS-B. It couldn't actually get you samples, because it would just always say, oh, I can't find a signal. I can't see a video signal, and just do nothing. But the ADC itself is in the silicon. And as we like to say, we paid for the whole silicon, and we want to use the whole silicon. And, well, we had to do some reverse engineering on how to be able to disable these filters. And we were able to discover certain undocumented registers that... some undocumented registers in the all-owner chip itself that let you put it into this special manufacturing test mode. See, making fast ADCs, the reason it's expensive and isolation is that it's kind of hard to fabricate and then verify the harmonic performance of. So, the silicon manufacturer will put in these modes that let you basically bypass out the actual video, the H-sync, V-sync blocks, because those would probably work. But the ADC itself can then be isolated in the special test mode, which can get you the true raw samples out. And then when you have the true raw samples, you can verify the performance. So, that's exactly what we want, to be able to abuse this as a standalone straightforward ADC. And that's exactly what we did. We did some reverse engineering, we found the registers, and when we put into this test mode, as you can see from the trace, that is pulled from a badge with the RF front end attached. That is the ADSB preamble and the start of a data packet being received as raw samples from the onboard ADC. And actually, I will go back. You see the preamble pattern, the 101-101, and that's exactly what we're seeing on the output of our ADC. And this was our proof of concept to say that, okay, we can actually do this. We can get away with not using any external ADC or SDR chips or really anything intended to be used in this way, except like the saw filters, and do it fully integrated on just the core Linux SoC. Now, as I said, the specs of the badge itself, outside of just the RF, we are running full mainline Linux 6.6. We thought it would be really cool to bring basically a Linux death kit on a board. And since we have the power of our SoC to do the RF decoding, and we have to write a bunch of software to manage the Wi-Fi and everything, we're like, hey, instead of writing all the drivers ourselves, mainline Linux is out there, and it's great. Let's use it. Our display is a 40 by 40 circular display, which we got custom manufactured for us. A lot of people actually thought, it's not a smart watch screen. We actually don't really know where it's from, but when our display manufacturer said, hey, guys, we have these like cool, we have the circular displays you're talking about, and this 2.7 inch form factor, what do you think? We're like, this is perfect. It looks like a radar scope, it looks like an oscilloscope. Let's go. Outside of the ADC, on the core T113 SoC itself, we have the dual core A7s running at 1.2 gigahertz each, and that's the application processor cluster that is running Linux. And then another bonus that we got on our silicon is the HiFi4 DSP, which we'll talk about a little bit more in a few slides, but that's a DSP core that's designed to be an audio core processor that we are, again, reprogramming outside the manufacturer's use case to actually do the demodulation, Manchester decode, and ADS-B bit slicing. In the package, we have embedded 120 megs of DDR3 SD-RAM, 8 gigabytes of VMMC onboard storage, and some other RF implementations. We have GPS and Wi-Fi, because why not? We're already going all out. We're already doing full custom RF and printed PCB antennas. Let's go for broke. Let's add GPS. Let's add Wi-Fi. So that's all in theory. Before that, I think there's a badge giveaway that's going to be... Okay, I'll keep going. Okay, okay. So now this is all what we had in theory. This is what came up with the designs, and then we get it manufactured by our manufacturer, and then they come back, and now we actually get to implement it and go through all the crazy systems and actually do the reverse engineering and make sure that we can actually get this ADS-B receiver running inside of this badge. So you'd think the most challenging part of this whole design process would be the fully custom ADS-B receiver running with an ADC in an undocumented test mode, and then piping it into an audio DSP, which was never designed with the goal of actually doing ADS-B decoding. But that was actually the easiest part. We had the RF. Adam, being a mad lad, made a full zero to tri-band microwave RF in just four months. This is his first RF project. And then the TV decoder code, we got it working after a night of debugging, and we actually had a cool oscilloscope mode that we could actually read directly from the ADC in and get it plotted on our screen. And then we got the DSP code execution in a week, and then after that we did a week for Linux kernel dev, and then a week for algorithms, and we got ADS-B. That was the easy part. It was everything else that should have just worked that didn't, mainly which if any of you guys have ever worked with USB-C before can probably understand why it's USB-C. And then of course the AXP2585 battery management chip, which we will go into more detail later about the whole experience with that. So before we get into the more challenging parts, here's a quick guide on running code on your HiFi4 DSP. So the Allwinner T113, it has a HiFi4 DSP, and they advertise it as, oh, you have a third core. But what they don't tell you is that they only give you the firmware. It's like a blob that gets loaded in, and it's only for audio processing because it has an audio out, and it does all the codecs with that. And the mainline kernel doesn't even touch the DSP. But it is its own CPU core, it can be programmed, and if you find the right resources, you can actually program it. Because we're doing all of these ADSB processing, we want to try and get the maximum performance to get as high speed out as possible so we can increase the sample rate and have better performance. So we wanted to do the full SIMD vectorization and actually use the real HiFi4 toolchain from the vendor, rather than using a lot of like the open source ones you might find with ESP32 running with GCC. So if you find the extensive toolchain, you get the extensive toolchain and compiler with the vendor tools, but you also need to actually get the custom vendor IP block which was used to generate that exact silicon. The great part about HiFi4 is it can be exactly customized to the exact chip you want to build. So if you want to have all of these advanced vector units, you can add them in. If not, you can remove them, you can have however many registers you want, and it's all configurable to the silicon vendor, but that means that the compiler needs to know what it has available. And the way they do that is a full blob which has full Verilog for the chip that actually gets produced as just a giant zip file, and you load it all into the toolchain and it figures out how to program for your chip. So once you find that, then you have to compare that with the exact version of the extensive toolchain that it was built with, and then you have to locate all the drivers from Allwinner and source them and gather them up to actually do the interrupt controller, timers, mailbox, and then you just download the FreeRTOS port from GitHub. And you combine them all together, and you can actually get one of the most stable development environments we've had on this entire badge, where you just run Extended Explorer and it just works. So that's kind of the process for getting DSP. And now actually for Linux on the badge, we are again, we mentioned we're using mainline Linux, and that actually drastically sped up the dev time, where you don't have to do, a lot of the drivers came pre-baked, you just have to configure them correctly. It just works. But you have to figure out how to configure it, so a lot of the time it's finding magical incantations and device trees that you forget to set, that cause it to panic, all of that. And then if you put all the things together and you figure out that it should be working, but it's not, then it's a bug, and then you spend three weeks doing advanced kernel debugging, figuring out why your display is not working. Speaking of which, display trivia. Take a guess, which of these four options caused the artifacting of the clock being messed up, you have too large of a back porch, there's an unknown silicon bug that only happens when the Linux driver sets an undocumented bit, which just happens to exist in a sister chip, but is not in our system on chip, or the display controller registers were initialized in the wrong order, they never tell you the right order. The answer is E, you didn't seat the cable properly when you're trying to solve all the other previous ones, and you're trying to debug the issue above. This is the silicon bug. So this was just a fun thing, and we spent three weeks trying to solve this silicon bug right here, where actually the display would turn green, and it was because they were setting some, the driver for the sister chip had a bit which they were setting, but it caused this chip to glitch in a weird way, causing the MSB of that green channel to be set high, but it only occurred on this one, and you have to go through all 10,000 lines of the display driver and find the exact line you have to comment out which caused the display not to turn green. But if you do that, then you have a working screen. So here's a continuation of the meme. The AXV2585 has been the thing that has been battling us and fighting us for the entire badge. So this chip, it's just a USB-C negotiator, battery charger, BME all-in-one. It's actually a very unique chip, because there's not that many that do all of these. A lot of the time you have to get several chips and stitch them together. So there's no firmware, it's not like some embedded 8081 core, 8051 core, all that. It's just basic I2C registers you need to configure. How difficult could it be to program? It's just flip-flops, right? There were several bugs that we found in the AXV2585, and all of them battled us throughout development. From the first bring up, we've had battery detection, which says it should try and detect if there's a battery and not try and charge it if it doesn't see one. But they say it should always try and do that by default, but all of the chips we get actually are cleared and they assume a battery is present, causing weird instability until you program it in the boot loader and in Linux. There's also fun things where if you get power or any sort of hardware glitches, it causes undefined results in the silicon, where certain registers stop working or things stop writing. There's also the joys of USB Type-C, where we learned that if you plug it into certain model MacBooks, instead of the MacBook charging the badge, the badge will try to charge the MacBook, which does not work. And there's also the biggest thing that actually delayed us a lot right at DEF CON when we were trying to solve this, and we spent a big part of the time when we were trying to get things ready, trying to debug why the actual IRQ pin to interrupt the Linux kernel and say data is available, actually not going low. And this was all due to a certain manufacturing issue. It was not actually a bug in the chip or a configuration issue, but one of the pins was not soldered correctly by the board manufacturer. It passed all visual inspection, but one of the ground pins was not soldered well enough, and it got just enough of a ground pin connection through the other ground pad that it worked enough, but not enough to have a bunch of weird glitches and voltage dropping out and weird chip instability. So we have probably... this AXP2585, it's a great chip for the cost and everything, but the true cost for this chip is really in the development hours of all these bugs trying to solve the USB-C issues and bring up and try and figure out why the chip isn't booting. But if we wrangled it enough to actually get the badge running and we have a stable system, just make sure you have a battery in when booting up, because BMU gremlins will come up without it because of instabilities. So yeah. All right, so yeah, thank you so much for joining us for this overview. I know it's, as you can see, we've been battling gremlins for untold amount of time, so everything is a little bit rushed, but we have zero minutes. So if you have any questions, we will be more than happy to chat after either here at the village. Basically, come find us. We'd love to chat some more. And yeah, if you have a badge out there, tag us on the aerospace village Twitter. We'd love to see where they travel to and what planes are picking up. And with that, thank you.