WEBVTT

00:00.000 --> 00:00.660
Hey, everyone.

00:00.660 --> 00:03.780
Welcome to our talk about Behind the Badge.

00:03.780 --> 00:16.080
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.

00:16.080 --> 00:17.860
So I'm Robert Pafford.

00:18.620 --> 00:20.060
And I'm Adam Vettori.

00:21.020 --> 00:23.780
And yeah, this is a Behind the Badge.

00:23.820 --> 00:28.500
So a little kind of refresher on the badge we developed last year.

00:28.500 --> 00:32.740
So this is a Linux badge running with a nice circular screen.

00:32.740 --> 00:38.900
And its whole idea is it's designed to receive ADS-B packets that are sent out from airplanes.

00:39.040 --> 00:44.600
So it picks it up on an internal antenna or external antenna and displays it on the nice screen.

00:44.600 --> 00:45.940
It runs Linux.

00:45.940 --> 00:52.720
It's got a dual core ARM core, as well as a DSP which we use to receive all these ADS-B packets.

00:52.900 --> 01:00.120
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.

01:00.140 --> 01:02.200
And so we actually pushed a software update this DEF CON.

01:02.200 --> 01:09.680
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.

01:10.000 --> 01:15.360
But part of this process was kind of actually optimizing the assembly.

01:15.380 --> 01:20.580
So the HiFi 4 DSP has a lot of SIMD capabilities, but they weren't being used last year.

01:20.720 --> 01:29.420
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.

01:29.620 --> 01:32.120
Additionally, we realized we had the cache turned off.

01:32.120 --> 01:36.920
So when we turned on the cache, we actually were able to hit real-time decode and actually faster than real-time.

01:36.920 --> 01:41.560
So we were able to receive all the packets and process all the data we have coming into the badge.

01:41.800 --> 01:49.480
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.

01:49.480 --> 01:57.380
But we started to see some intermittent crashes every few minutes to actually every several hours on this new DSP firmware.

01:57.900 --> 02:03.960
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?

02:03.960 --> 02:07.580
You have to wait six plus hours to see if it actually solved it.

02:08.040 --> 02:14.420
So the crash was a kernel panic would occur, but it wasn't really consistent on what the message was.

02:14.420 --> 02:17.180
You typically have a very corrupted stack message.

02:17.180 --> 02:19.220
You wouldn't get a lot of registers or dumps.

02:19.220 --> 02:21.720
Sometime it'd just be one or two lines of a panic message.

02:21.900 --> 02:25.860
And it didn't even seem to have to do with anything related to the DSP.

02:25.860 --> 02:33.120
And it appeared to be a memory corruption of some kind, some sort of issue on the TV decoder, some race condition.

02:33.120 --> 02:36.480
We weren't really sure, and it was really difficult trying to debug it.

02:37.780 --> 02:47.120
But after kind of working on this issue for several days, like a couple weeks, we were able to finally narrow down the bug.

02:47.120 --> 02:54.860
And the solution to solve it ended up just be the big hammer of dump 128 megabytes of DRAM over JTAG.

02:54.860 --> 02:58.280
It took around 45 minutes to get this whole dump out.

02:58.280 --> 03:05.360
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.

03:05.360 --> 03:16.300
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.

03:16.400 --> 03:22.000
And you'd actually be able to see in the buffer region we assigned for the TV decoder, it was there.

03:22.000 --> 03:26.280
We'd also see a large number of matches at the start of DRAM, which was very interesting .

03:26.620 --> 03:34.880
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.

03:34.880 --> 03:44.280
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.

03:44.400 --> 03:58.440
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.

03:59.100 --> 04:05.160
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.

04:05.160 --> 04:09.160
How do you go about preventing it from randomly writing to the start of DRAM ?

04:09.940 --> 04:14.940
The solution was to just move the DMA buffer to the start of DRAM , tell the Linux kernel to get out of the way.

04:14.940 --> 04:17.640
So if it glitches, it'll just go where it's supposed to anyways.

04:17.700 --> 04:21.600
And if you look at the memory map, it's kernels been moved out of the way.

04:21.600 --> 04:24.760
And that's what you're running, that we're running on these badges now.

04:24.760 --> 04:26.640
So we can now receive it.

04:26.640 --> 04:29.620
And we have solved the hardware bug with software.

04:35.430 --> 04:43.930
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.

04:44.370 --> 04:50.050
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.

04:50.310 --> 05:00.370
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.

05:00.630 --> 05:04.230
But you know, it's DEF CON, we're all hackers, we want to have some fun with this portable Linux device.

05:04.230 --> 05:12.230
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.

05:12.510 --> 05:16.730
And our power management chip will give you the five volts boosted from the battery.

05:16.950 --> 05:21.230
And it should let you not use like, you know, any other normal USB device on Linux.

05:21.510 --> 05:32.710
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.

05:32.890 --> 05:43.450
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.

05:43.850 --> 05:47.430
But it's only in this host mode that this issue actually occurs.

05:47.690 --> 05:55.270
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.

05:55.990 --> 06:04.870
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.

06:04.870 --> 06:09.930
So again, very likely not a PCB bug, just something in the mainline kernel might be bugged.

06:11.150 --> 06:28.870
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,

06:28.870 --> 06:39.230
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.

06:39.230 --> 06:41.590
And this has been used in a lot of devices.

06:41.590 --> 06:44.310
So there's tons of info on it, like available online.

06:44.450 --> 06:48.330
And for some reason, all winner actually only uses this in device mode.

06:48.710 --> 06:58.410
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.

06:58.410 --> 07:08.850
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.

07:08.850 --> 07:12.250
So how exactly they're doing the muxing and switching is not super clear.

07:12.250 --> 07:14.450
But, you know, it doesn't really matter for right now.

07:18.230 --> 07:28.730
And we, like, we see that, okay, the host mode itself works, sometimes when it enumerates, and the device works basically all the time.

07:28.730 --> 07:44.050
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.

07:44.230 --> 08:01.850
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,

08:01.850 --> 08:08.950
you basically are bitbanging some sort of serial shift register interface through these otherwise MMIO registers.

08:10.190 --> 08:15.030
And, like, look, you're trying to debug the mainline kernel code, it seems to be using in a sane way.

08:15.110 --> 08:20.190
There's only two times that ever actually really talks to this PHY, it's when the board turns on and does the setup.

08:20.190 --> 08:24.930
And then when you do the actual roll switch, so sounds like we're on the right track.

08:24.970 --> 08:27.270
And, you know, we were looking at bugs in the driver .

08:27.770 --> 08:31.850
And it turns out that actually the entire mainline driver was the bug.

08:33.310 --> 08:36.330
Allwinner has a whole, like, plethora of chips.

08:36.330 --> 08:41.310
And they have these like code names, that's could be a whole other like our talk to explain that mess.

08:41.650 --> 08:48.590
But they have the they have a quirks table that let you like try and handle different quirks between different versions of the silicon .

08:48.590 --> 08:51.210
But overall, it's the same code for all the Allwinner SoCs .

08:51.330 --> 08:57.690
Well, what we found in looking through a specific version of the Allwinner BSP kernel is that they had these interesting comments .

08:57.690 --> 08:59.870
They're saying, Oh, yeah, we have this new PHY .

08:59.990 --> 09:01.030
It's for the new PHY.

09:01.030 --> 09:03.870
And it's for self developed by self.

09:04.190 --> 09:08.410
So we suppose that Allwinner actually made what we call a v3 PHY.

09:08.410 --> 09:11.870
They made their own in house, analog IP core.

09:12.010 --> 09:19.970
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.

09:20.110 --> 09:23.470
And it seems that no one from like the mainline kernel actually noticed that.

09:23.470 --> 09:26.550
Or if they did, they thought that the old driver would just work.

09:26.790 --> 09:29.370
And it doesn't work at all, actually.

09:29.990 --> 09:35.010
Like the registers it sets in this analog interface sub block are completely wrong.

09:35.010 --> 09:37.250
Like they don't exist on the new v3 PHY.

09:37.490 --> 09:43.290
The trim algorithms that the mainline kernel uses from the v2 PHYs don't apply at all to the v3.

09:43.290 --> 09:46.390
Those actually done in factory now and loaded from fuse.

09:46.390 --> 09:49.650
And we saw that, of course, mainline doesn't touch the fuses at all.

09:49.650 --> 09:53.630
So we know that is completely not driving it correctly.

09:54.190 --> 10:04.110
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.

10:04.110 --> 10:08.050
But actually no, that it somehow still actually just works fully untrimmed.

10:08.050 --> 10:14.790
The real for real issue was that the kernel drive was not switching the PHY power bit correctly.

10:15.250 --> 10:24.900
So regardless, we implemented both the like correct bring up initialization trimming functionality and the correct power switching.

10:24.900 --> 10:36.280
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.

10:36.280 --> 10:41.740
So that's also packaged in a new new kernel update that we have shipped with our v2 firmware.

10:43.640 --> 10:54.180
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.

10:55.320 --> 11:02.840
So Charlie, as we call him, is designed to add some extra radio and like now audio capabilities to the Linux badge.

11:03.120 --> 11:09.880
And in the vein of aerospace, we want to come up with some cool things around, you know, around air space and radio.

11:09.900 --> 11:18.000
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.

11:18.440 --> 11:22.700
We have a headphone jack to listen to it, which also doubles as our antenna , the headphone wire.

11:22.900 --> 11:29.500
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.

11:29.500 --> 11:34.800
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 .

11:35.760 --> 11:42.040
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.

11:43.240 --> 11:46.700
We also have a pretty neat menu system and animations on this.

11:46.700 --> 11:51.740
We are running full four color grayscale on the OLED, which we will absolutely get to in a little bit.

11:51.880 --> 11:58.360
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.

11:58.560 --> 12:01.800
Because I mean, we need we need that much performance.

12:04.770 --> 12:08.470
Yeah, so this a very powerful five core microcontroller.

12:08.470 --> 12:09.570
Which one is that?

12:09.850 --> 12:15.570
This is the TI SimpleLink CC1312R RF microcontroller.

12:15.570 --> 12:25.310
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.

12:25.550 --> 12:30.770
The actual core of the microcontroller is a pretty standard like ARM Cortex M4F.

12:30.770 --> 12:33.810
It's downclocked pretty low at 48 megahertz.

12:34.070 --> 12:38.710
And it's got a your standard basic set of peripherals of UART, SPI, things like that.

12:38.770 --> 12:42.370
So from the like a microcontroller point of view, it's pretty standard.

12:42.410 --> 12:47.870
One interesting part is it has a thing called the sensor interface in the bottom right.

12:47.890 --> 12:50.730
And that actually has a second core which you can program.

12:50.730 --> 12:52.590
They give you all the tool chain to develop.

12:52.590 --> 12:55.790
It's a sensor controller, they call it.

12:55.830 --> 13:04.450
And it's a 16 bit DSP that's 16 bit CPU core, which is just ultra low power, super basic, basic edition.

13:04.910 --> 13:07.870
But it's designed for like background sensor pulling tasks.

13:07.870 --> 13:13.490
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.

13:13.650 --> 13:19.710
So that was very interesting, because you can actually use that for more features and adding more stuff into it.

13:19.910 --> 13:23.970
From the RF side, it's great because it can receive sub gigahertz.

13:23.970 --> 13:28.590
But there are a few short, few small issues when you're trying to develop with this .

13:28.590 --> 13:33.250
One, the TI SimpleLink actually can't tune to the frequencies required for it.

13:33.250 --> 13:37.690
So we wouldn't actually be able to tune to FM or airband if we chose this microcontroller.

13:37.970 --> 13:41.410
And the microcontroller is only designed to receive digital signals .

13:41.870 --> 13:44.450
But airband is an analog signal.

13:44.510 --> 13:49.310
So a few small challenges we had to overcome to actually make this possible for this SAO.

13:49.850 --> 14:00.090
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.

14:00.390 --> 14:04.670
So we needed to convince the RF chain to kind of go and receive analog.

14:04.670 --> 14:08.210
And the thing is that all the signals coming into the chip have to be analog.

14:08.210 --> 14:15.090
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.

14:15.090 --> 14:20.890
So at some point in the signal processing chain, there should be raw IQ samples flowing through this chip.

14:20.910 --> 14:29.930
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.

14:30.050 --> 14:35.210
The problem is that there is absolutely no documentation on how any of this RF core works.

14:35.370 --> 14:38.230
Pretty much any RF microcontroller you'll work with is like this.

14:38.230 --> 14:40.750
They don't give you any of the register maps or documentation.

14:40.750 --> 14:44.490
They just say, use our APIs, use this pre-compiled blob.

14:44.490 --> 14:46.810
They don't even really give you source code to use it.

14:47.070 --> 14:49.070
This chip takes it an extra step further.

14:49.070 --> 15:00.190
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.

15:00.190 --> 15:01.950
They say, oh, just use our APIs.

15:01.950 --> 15:04.130
It's got a ROM with all the code it needs.

15:04.330 --> 15:11.290
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.

15:11.290 --> 15:14.030
It's just all in this walled off box.

15:14.370 --> 15:24.670
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.

15:24.670 --> 15:27.650
So that was kind of the objective for this.

15:28.190 --> 15:34.590
The nice part is that what allowed this to be possible is TI creates a thing called RF patches.

15:34.590 --> 15:41.290
So the whole idea behind this is they released this microcontroller when Bluetooth 5 was the latest and greatest.

15:41.290 --> 15:47.490
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.

15:47.510 --> 16:00.190
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.

16:00.370 --> 16:07.830
So this seemed to be the best way to actually change the behavior and actually implement our own custom RF control on the chip.

16:08.310 --> 16:12.950
So these are just after kind of looking through and reverse engineering these a bit.

16:13.010 --> 16:21.750
These patches are just executable code that gets loaded into various parts of RAM and hooked into the various parts of the RF core.

16:22.850 --> 16:36.290
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.

16:36.290 --> 16:43.890
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.

16:43.890 --> 16:52.110
But there's two other types of patches, MCE and RFE, which are designed to do more real-time processing tasks on the chip.

16:52.110 --> 17:02.870
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.

17:02.910 --> 17:14.050
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.

17:14.050 --> 17:21.010
So being able to leverage these cores, unlock even more capabilities and give you even lower level access into the RF subsystem.

17:21.930 --> 17:24.990
And so all these CPUs can be patched.

17:24.990 --> 17:34.750
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.

17:36.130 --> 17:40.110
So how do we get it to work on Charlie?

17:40.110 --> 17:42.190
And how do we actually receive airband audio?

17:42.190 --> 17:48.510
So the actual chip itself has a hardware IP block called the magnitude estimator.

17:48.510 --> 17:52.590
So this converts the raw IQ RF samples into a magnitude.

17:52.590 --> 17:59.490
So this is effectively an AMD modulator, where you can just get the absolute magnitude of the incoming waveform.

17:59.610 --> 18:08.730
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.

18:08.790 --> 18:29.670
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.

18:30.570 --> 18:36.270
Then we create a custom CPE patch, which will be able to do all of the filtering of this data.

18:36.270 --> 18:42.670
So this will take the samples coming in from the MCE, and it will be able to do like basic filtering.

18:42.670 --> 18:50.570
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.

18:50.570 --> 18:56.750
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.

18:57.070 --> 19:02.830
So part of that process, we were able to kind of talk to the RFE, which does all the power estimation.

19:02.890 --> 19:08.110
So having all of these systems work together, we were able to create the airband receiver.

19:08.410 --> 19:13.190
So when it's not, when you just have a transmission, you're able to pick it up, hear it rather clearly.

19:13.190 --> 19:16.050
And then when there's nothing going on, it just silently mutes itself.

19:16.430 --> 19:23.330
And this is all, once all this processing is done, you have audio samples written to a buffer , and it's sent to I2S.

19:23.330 --> 19:29.570
And so the main CPU allocates the buffer, but after it does the handoff to the CPE, it pretty much steps completely away.

19:29.570 --> 19:33.370
And so all the receiving is done with zero overhead to the main CPU.

19:33.370 --> 19:36.070
So we're able to do a bunch of other interesting stuff in the meantime.

19:36.970 --> 19:39.650
So that's the airband audio receiver.

19:40.390 --> 19:42.910
And that was, we got working.

19:42.990 --> 19:55.750
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.

19:55.750 --> 19:58.890
So part of this was, we wanted to get stereo FM.

19:59.510 --> 20:02.410
Basic, like mono FM is pretty simple.

20:02.950 --> 20:13.590
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.

20:13.630 --> 20:19.530
So everything below 15 kilohertz, you can kind of see is marked as L plus R.

20:19.530 --> 20:21.150
And so that is your mono audio.

20:21.150 --> 20:32.610
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.

20:32.610 --> 20:37.690
And so the first implementations we had of FM on the development boards were just basic mono audio.

20:37.970 --> 20:52.230
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.

20:52.230 --> 20:57.310
And so I was determined that, okay, we are going to get stereo FM on this thing.

20:57.330 --> 21:01.670
And we're going to figure out some way to get the signal processing chain to do this.

21:02.070 --> 21:09.930
So the way you actually receive stereo is a little bit more complicated, because again, the everything below 15 kilohertz is mono audio.

21:10.090 --> 21:16.370
So rather than to be able to separate the left and right channels, they don't have the left and right transmitted separately.

21:16.430 --> 21:25.970
Instead, they have up at the 39 kilohertz point, this left minus right signal, which allows you to do addition and subtraction operations.

21:25.970 --> 21:28.530
So if you add the two signals together, you'll get the left channel.

21:28.530 --> 21:30.970
And if you subtract the two signals, you get the right channel.

21:31.290 --> 21:39.190
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.

21:39.190 --> 21:51.030
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.

21:51.070 --> 21:54.230
And then you're able to kind of go from there to actually receive it.

21:55.050 --> 22:01.550
So the actual algorithm to do this is we take in the raw FM demodulation from the MCE.

22:01.830 --> 22:08.430
And we first go through in the middle path to go through and I think I can do this.

22:08.430 --> 22:16.210
So you go through the middle path, which is the 19 kilohertz pilot band pass to kind of isolate this center carrier frequency.

22:16.230 --> 22:18.690
And then you run it through a phase lock loop.

22:18.690 --> 22:24.630
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.

22:24.630 --> 22:33.890
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.

22:33.890 --> 22:47.610
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.

22:47.610 --> 22:51.450
So we shift the 39 kilohertz back down to zero and then filter it.

22:51.450 --> 22:53.570
So we just get the L minus R signal.

22:53.710 --> 22:55.970
So at this point right here, we have L minus R.

22:56.050 --> 23:00.030
For the L plus R, aka the mono audio, you just have to filter it.

23:00.110 --> 23:01.910
And then you get an L plus R.

23:01.910 --> 23:07.010
Then you do the addition and subtraction operations, and you will get your FM, left channel and right channel.

23:07.010 --> 23:15.030
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.

23:15.270 --> 23:20.790
So there's a lot of filtering steps and a lot of various math that needs to be done to do this.

23:20.950 --> 23:26.210
And there's a lot of demos online, and you can do this on your radio or on your computer with an SDR.

23:26.270 --> 23:31.610
But we have a 48 megahertz Cortex M0, which is not a DSP.

23:31.610 --> 23:33.570
We were lucky to get a multiplier.

23:33.630 --> 23:42.090
So we had to kind of create a whole custom patch system to do this DSP in a very small amount of time.

23:42.610 --> 23:51.070
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.

23:51.110 --> 23:52.690
So this is the absolute minimum.

23:52.690 --> 23:56.510
You should really do 250, but we couldn't afford the cycles for that.

23:56.510 --> 23:57.770
So we got 200.

23:57.870 --> 24:10.330
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.

24:10.610 --> 24:22.010
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.

24:22.010 --> 24:32.370
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.

24:32.510 --> 24:40.450
But we were able to squeeze it just under with 235 out of 240 CPU cycles are in use to receive this FM.

24:40.450 --> 24:42.670
And that leaves a few spare for bus arbitration.

24:42.670 --> 24:49.550
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.

24:59.880 --> 25:00.920
All right.

25:01.360 --> 25:02.980
So this is great.

25:03.060 --> 25:08.680
But to be able to like leverage any of this, we actually need to get the FM or airband signal into the chip.

25:08.680 --> 25:13.840
And as we mentioned before, that that's not really possible on the SimpleLink, even though it's a sub -G chip.

25:14.460 --> 25:19.440
FM requires you to tune to 88 megahertz, that's the lowest end that like we need to pick up.

25:19.720 --> 25:27.140
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.

25:27.140 --> 25:32.460
But this chip will do 169 megahertz to about 1000 megahertz with some gaps in between.

25:32.740 --> 25:36.040
And that's not enough to 88.

25:36.600 --> 25:41.440
And we tried a few things to get this chip to tune down that low.

25:41.440 --> 25:48.540
And I assure you we tried everything we could, including actually throwing away the existing PLL driver.

25:48.540 --> 25:52.960
TI uses an interesting architecture called the ADPLL or all digital PLL.

25:53.220 --> 25:57.280
So there's a few papers and like IEEE talks, they did on this.

25:57.280 --> 26:15.080
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 .

26:15.460 --> 26:25.580
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?

26:25.740 --> 26:30.660
And the answer is around 140 megahertz, which is still not even close enough to 88.

26:31.060 --> 26:49.160
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.

26:49.420 --> 26:51.680
So begrudgingly, we had to add some parts.

26:51.740 --> 26:53.980
And one of those is external mixer.

26:54.580 --> 27:02.500
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.

27:02.720 --> 27:08.160
But we found a nice old, decently old part, it's called a max 2671.

27:08.160 --> 27:15.900
It's a up converter mixer for I believe, like decked cordless phones, but they operate in about the right frequency range.

27:15.900 --> 27:26.040
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.

27:26.780 --> 27:33.640
And because these are dedicated mixer ICs, we do get the benefit of it being a proper like Gilbert cell double balanced mixer.

27:33.660 --> 27:36.560
So the silicon quality of the mixer is very nice.

27:36.640 --> 27:41.960
And like, you know, we'll take every bit of dynamic range and noise, like low noise figure that we can.

27:42.540 --> 27:53.700
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.

27:54.360 --> 28:00.720
And to generate an LO, again, the off the shelf solution would be to buy a dedicated RF synthesizer chip.

28:00.720 --> 28:03.500
But once again, these are expensive and also quite power hungry.

28:03.660 --> 28:09.840
So we're thinking, well, if we don't want to buy a dedicated RF synthesizer, like what other options could we have?

28:10.120 --> 28:23.880
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.

28:23.880 --> 28:32.440
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.

28:32.460 --> 28:39.880
And what these are, are either OK, like on off keying or like GFSK, little single transmitter receiver pairs.

28:40.240 --> 28:50.180
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.

28:50.380 --> 28:59.700
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.

28:59.700 --> 29:06.600
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?

29:07.500 --> 29:11.280
It's only on off keying if you turn it off and we don't turn it off.

29:11.280 --> 29:14.000
And you're like, there's no way this works, right?

29:14.000 --> 29:16.020
Like will the chip work?

29:16.040 --> 29:30.000
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,

29:30.000 --> 29:30.640
really good .

29:30.960 --> 29:39.900
And would actually like quite handily beat my USRP, like SDR for both frequency stability, power stability and like spurs.

29:40.160 --> 29:52.160
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.

29:52.400 --> 30:10.520
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,

30:10.520 --> 30:21.680
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.

30:24.340 --> 30:30.020
So with that, there's one more feature that we want to talk about and that's our OLED.

30:30.780 --> 30:41.980
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.

30:42.320 --> 30:45.440
And they will be listed as SSD 1306.

30:45.440 --> 30:47.960
Although as we're about to find out that might not be true.

30:48.660 --> 30:52.160
But we like these because I mean, they look they look good, you have really good contrast.

30:52.160 --> 30:55.100
And they're also pretty common parts, they're fairly low cost.

30:55.100 --> 31:03.920
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.

31:04.040 --> 31:10.520
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.

31:12.640 --> 31:19.140
So we wanted to do SPI and DMA as the highest possible FPS interface to the screen to get a nice fluid UI.

31:19.340 --> 31:23.600
And right away, we noticed a problem that, well, yeah, you have really bad screen tearing.

31:23.760 --> 31:29.520
And this is to be expected, like we're throwing pixels at it as fast as our SPI, like in DMA can do.

31:29.600 --> 31:31.160
And there's no sync.

31:31.340 --> 31:35.820
So we like until we are synchronized, the displays frequency, of course, we'll get screen tearing.

31:36.060 --> 31:39.760
So sure, this works, just how do we turn on screen tearing.

31:39.880 --> 31:45.320
So we started looking into this, maybe we should have looked at this before we committed to it.

31:45.380 --> 31:46.780
But we started looking at this.

31:46.780 --> 31:48.260
And what do I see?

31:49.140 --> 31:54.780
Oh, apparently, this is unsolvable.

31:57.200 --> 32:00.460
So what are we up against?

32:00.840 --> 32:11.340
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.

32:11.600 --> 32:28.860
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.

32:29.160 --> 32:45.140
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,

32:45.140 --> 32:50.360
it's basically, it's a complete unknown and you would need like closed loop.

32:51.000 --> 32:59.900
Without a closed loop feedback system, such as this, like FR signal, you cannot know, like 100%, what the actual pixel clock is.

33:00.980 --> 33:05.920
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.

33:05.980 --> 33:13.180
It turns out that actually none of the panels that are manufactured have this signal broken out from the chip to the ribbon cable.

33:13.600 --> 33:17.800
And as we found, actually, a lot of them don't even have it broken out from the ASIC at all.

33:18.620 --> 33:24.260
So I went in search of this FR pin, and see, can we probe it at all, like even just for debugging.

33:24.740 --> 33:32.980
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.

33:34.020 --> 33:44.140
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.

33:44.160 --> 33:51.360
See, the SSD 1306 is not the only OLED controller, it's one of the OLED controllers.

33:51.700 --> 33:59.820
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.

33:59.860 --> 34:08.680
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.

34:08.680 --> 34:13.300
And there's this whole huge mess of like, what controllers could actually be on your panel.

34:13.300 --> 34:15.340
And the problem is the vendors generally don't know.

34:15.520 --> 34:23.840
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.

34:24.040 --> 34:35.080
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.

34:35.080 --> 34:36.840
Well, it's not the same chip.

34:36.840 --> 34:45.560
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.

34:45.560 --> 34:50.380
And actually being able to know what controller you have is a very, very difficult problem.

34:50.580 --> 34:53.680
And I'm not sure there is a guaranteed way to know.

34:54.580 --> 34:57.340
But, like, why does this even matter?

34:57.340 --> 35:02.440
Well, it turns out the SSD 1306 is one of the earlier controllers and one of the more well featured ones.

35:02.760 --> 35:10.060
And while that has an FR pin, the clones do not, or the derivatives of that do not, the cheaper, lower cost controllers.

35:10.140 --> 35:11.920
And it's kind of like a cache 22.

35:11.920 --> 35:19.000
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.

35:19.000 --> 35:26.480
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.

35:26.700 --> 35:33.880
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.

35:33.880 --> 35:40.020
And then that's like the feedback cycle of you end up with no OLEDs with this sink pin in existence.

35:40.740 --> 36:02.100
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.

36:02.100 --> 36:04.520
So I can't probe that.

36:04.880 --> 36:08.240
Well, that led us to look for other ideas.

36:08.240 --> 36:12.280
If we can't extract timing information from the display, can we inject it?

36:13.540 --> 36:23.780
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.

36:24.200 --> 36:28.420
And it's called, you know, they give you a nice clock multiplexer so you can feed it in.

36:28.420 --> 36:30.420
And of course, no one bonds that out either.

36:30.460 --> 36:33.480
So that pin also exists and you can't get it.

36:34.460 --> 36:41.920
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.

36:42.600 --> 36:49.780
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.

36:49.780 --> 36:57.920
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.

36:58.220 --> 37:09.340
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.

37:09.720 --> 37:12.920
And the only other pins that we have on the ribbon cable are for power.

37:13.060 --> 37:19.720
So we don't want to modify the OLED like and try to do something custom because that's unsolvably expensive.

37:19.880 --> 37:22.520
So we are effectively out of options.

37:22.520 --> 37:25.060
Now there's the sync pin doesn't exist on the ribbon cable.

37:25.080 --> 37:29.760
The like digital interface is write only and all we have left is power.

37:30.140 --> 37:33.260
So is there anything we can do with the power pins?

37:34.240 --> 37:46.680
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.

37:47.680 --> 37:56.720
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.

37:57.040 --> 38:02.140
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.

38:02.500 --> 38:05.400
And charge pumps are a form of switching regulator.

38:05.440 --> 38:09.760
And the way that they do this is by switching the voltage on and off the capacitors.

38:10.280 --> 38:25.680
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.

38:25.920 --> 38:28.800
deterministically with how I set the pixel clock.

38:31.300 --> 38:40.020
And it turns out like probing the actual charge pump capacitors that yes, the charge pump switching frequency is actually an exact integer ratio.

38:40.020 --> 38:42.620
It's like half the speed of the pixel clock oscillator.

38:42.620 --> 38:45.660
And this makes a side channel possible, right?

38:45.700 --> 38:54.660
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.

38:54.940 --> 39:04.960
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.

39:05.060 --> 39:13.800
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.

39:13.800 --> 39:27.740
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.

39:27.820 --> 39:32.900
But if you make that display then all black, you're effectively requesting no current from the charge pumps.

39:33.120 --> 39:40.220
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.

39:40.940 --> 39:45.620
And that's solvable with a PLL or like other clock recovery techniques.

39:45.620 --> 40:04.020
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.

40:04.200 --> 40:10.980
And then also a little bit like a side tangent that this technique also seems to only work on some of the controllers.

40:10.980 --> 40:19.220
So like the aforementioned SSD 1306 works, the very low cost CH1116 is also like has this effect.

40:19.220 --> 40:25.280
And we found that the maybe now more common SH1106 controller actually does not work like this.

40:25.280 --> 40:28.940
The charge pump frequency does not depend on the pixel clock.

40:28.940 --> 40:35.060
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.

40:37.000 --> 40:50.140
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?

40:50.140 --> 40:53.460
The number of pixels on your screen doesn't change per frame.

40:53.880 --> 40:55.660
And all you'd have to do is count edges.

40:56.520 --> 41:02.060
And as we like talked just like mentioned that the density of these pulses relates to panel current.

41:03.280 --> 41:11.560
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.

41:11.560 --> 41:19.280
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.

41:19.840 --> 41:24.960
And the opcode space for this controller is like you send an 8-bit opcode.

41:25.100 --> 41:31.380
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.

41:31.580 --> 41:35.700
And a lot of undocumented or reserved space.

41:36.100 --> 41:43.880
And well, what do you do when you have a bunch of undocumented opcodes, we do automated fuzzing in hardware on an OLED controller.

41:44.060 --> 41:58.460
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.

41:58.940 --> 42:03.680
There's actually multiple undocumented charge pump modes, like in the register that sets voltage.

42:04.280 --> 42:15.640
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.

42:15.640 --> 42:22.320
But it is something interesting that to see results basically right away, that there are a lot of secrets buried in here.

42:22.320 --> 42:28.960
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.

42:29.460 --> 42:35.240
I found another undocumented command that lets you well, I suppose lets you adjust the internal references.

42:35.260 --> 42:38.060
So kind of like your current and voltage references.

42:38.060 --> 42:45.860
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.

42:46.200 --> 42:50.100
And running the charge pumps harder, of course means increasing your pulse density.

42:50.280 --> 43:00.680
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.

43:01.220 --> 43:16.540
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.

43:16.620 --> 43:19.520
So more fuzzing, more searching through opcodes.

43:19.680 --> 43:28.980
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.

43:29.380 --> 43:35.180
And if you are interested in playing around this at home is command D zero and you set it to 01.

43:35.860 --> 43:43.200
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.

43:43.580 --> 43:55.200
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.

43:55.320 --> 44:05.960
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.

44:06.020 --> 44:12.340
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.

44:12.380 --> 44:22.280
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.

44:26.760 --> 44:34.520
So now that we've got this great display synchronization, we wanted to create a graphics engine to actually drive the OLED.

44:34.600 --> 44:42.880
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.

44:42.980 --> 44:52.740
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.

44:52.920 --> 44:57.920
So the idea behind this was just create a sequence of multiple frames with the delay in between.

44:57.920 --> 45:01.400
But as all things do, it slowly started to gain more features.

45:02.060 --> 45:06.620
But the whole, we wanted to be able to allow graphics to be developed independently of firmware.

45:06.620 --> 45:16.120
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.

45:17.100 --> 45:30.360
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.

45:30.360 --> 45:32.020
It can also support input events.

45:32.060 --> 45:35.760
So allows like any sort of button presses to actually cause reaction.

45:35.760 --> 45:41.580
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.

45:41.580 --> 45:49.020
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.

45:49.180 --> 45:56.320
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.

45:56.380 --> 46:06.200
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.

46:06.400 --> 46:15.660
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.

46:15.880 --> 46:19.920
And it allows, it'll yield back controls to the previous script when it's done.

46:19.920 --> 46:21.860
And you can also send signals out.

46:21.860 --> 46:30.060
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.

46:30.180 --> 46:36.780
So all of this, like the UI was actually not really developed in C, but it was developed in this ANSM scripting language.

46:37.040 --> 46:45.680
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.

46:45.680 --> 46:47.740
And of course, there's also a host emulator.

46:47.740 --> 46:51.480
So you can run the VM and develop all this without even having an SAO.

46:51.480 --> 46:58.420
So this was one of those small creature comfort things that ended up spiraling into a full virtual machine.

46:58.420 --> 47:02.420
But that's what's running your, your UI on here, this ANSM script.

47:02.420 --> 47:24.120
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.

47:24.120 --> 47:29.100
So if you have a badge, you can program it with the UI, it'll give you settings to modify it.

47:29.100 --> 47:30.860
But it's also available over ITC.

47:30.860 --> 47:35.760
So we'll be looking at trying to release all the commands to do the reprogramming.

47:35.760 --> 47:39.800
So you can just have an Arduino or an ESP 32 and change all the presets yourself.

47:39.800 --> 47:43.180
So all this control is available over ITC.

47:43.540 --> 47:46.820
But the only issue with that is there's only one ITC interface.

47:46.820 --> 47:50.300
And we also need ITC to control the DAC.

47:50.540 --> 48:03.560
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.

48:03.560 --> 48:09.220
But we wanted to use ARP to allow easy hotplug detection and make it kind of just work when you plug it in.

48:09.640 --> 48:21.720
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.

48:21.720 --> 48:23.760
So you can listen to two addresses at the same time.

48:23.760 --> 48:33.480
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.

48:34.360 --> 48:40.260
And it also we're also trying to work with other badge makers to kind of standardize this SAO identification and hotplug.

48:40.260 --> 48:46.140
So all the SAOs that have like microcontrollers on them can have this kind of just works experience and auto detection.

48:46.140 --> 48:49.140
So that's the thing for that.

48:49.140 --> 48:53.320
But yeah, that's our the work we've been doing this past year.

48:53.560 --> 48:54.680
Thank you.

49:04.120 --> 49:06.960
Yeah, I think we have at least around five ish minutes for Q&A.

49:06.960 --> 49:09.760
So if you have a yeah, if there's any questions.

49:15.100 --> 49:18.020
I don't believe we have any more right now.

49:18.020 --> 49:23.180
And I don't I have no, I don't know if we'll have any more.

49:23.260 --> 49:26.260
That's a ask their their space village leads question.

49:26.260 --> 49:29.220
But unfortunately, no, I think we are out of stock.

49:32.370 --> 49:33.330
Question.

49:37.790 --> 49:41.730
It can transmit I have removed all the transmit capabilities.

49:41.730 --> 49:44.490
So we aren't transmitting out on airband and things like that.

49:44.510 --> 49:44.830
So

49:48.290 --> 50:02.690
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.

50:02.690 --> 50:12.210
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.

50:12.310 --> 50:13.630
They are quite flexible.

50:13.630 --> 50:18.290
And you know, the more like crazy you get with the low level firmware, you can make them do crazier things.

50:18.290 --> 50:23.970
But just like we also had that initial idea of like, hey, can we do IQ transmit?

50:23.970 --> 50:24.570
No.

50:24.770 --> 50:28.190
But it is quite flexible in the transmit modes regardless.

50:30.250 --> 50:31.130
Question.

50:32.210 --> 50:34.150
We will open source.

50:34.150 --> 50:41.470
I think the ANSM and then we'll like the all the ITC stuff but some of the we've been very busy.

50:41.730 --> 50:44.590
As you can imagine getting everything ready for this DEF CON.

50:44.590 --> 50:46.650
So we don't have things ready like right now right now.

50:46.730 --> 50:57.010
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.

50:57.470 --> 51:06.250
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.

51:10.260 --> 51:11.140
All right.

51:11.300 --> 51:12.300
Thank you.

