[00:03.400 --> 00:10.900] Is this thing on? Are you sure? I don't know why I keep having to give everybody intros, [00:10.900 --> 00:14.520] but hi, my name is Zero Chaos. Welcome very much to the Wireless Village. I'm so happy [00:14.520 --> 00:21.400] to have you here. This man has designed something that appears to be an EKG or what's that thing [00:21.400 --> 00:26.160] in Ghostbusters? He's got one of those things from Ghostbusters. Did you just throw a throwing [00:26.160 --> 00:34.960] star at me? I'm keeping this. Anyway, he designed a Game Boy that I've always wanted, [00:34.960 --> 00:39.720] so here he is to talk about the brand new replacement for your iPod, Jared Boone. [00:41.160 --> 00:49.460] Howdy. So yeah, my name is Jared Boone. I've been doing open source hardware for a couple [00:49.460 --> 00:55.600] of years, three years now, working with Mike Osman on the HackRF design. And I want to [00:55.600 --> 01:00.540] talk today about, you still can't hear me? Okay. I don't want to sound like a skinny [01:00.540 --> 01:16.760] puppy here. So, yeah, so you totally blew my, so yeah, I got this kind of crazy idea [01:16.760 --> 01:23.100] that being able to work with the HackRF without a computer might be a cool thing to be able [01:23.100 --> 01:28.900] to do. So I set about actually figuring that out. This is how you normally use a HackRF, [01:28.900 --> 01:35.420] you know, plugged into a laptop, either writing code or running GNU radio, creating flow graphs [01:35.420 --> 01:40.740] and running them, capturing data. And that's all cool. In fact, this is really the right [01:40.740 --> 01:46.520] way to do things most of the time. But sometimes you need to get out and about and look for [01:46.520 --> 01:50.860] interesting targets or get close to them if you can't bring them into your lab or into [01:50.860 --> 01:57.840] your office or whatever. And that's pretty much what the PortaPak is all about. So let [01:57.840 --> 02:02.500] me show you quickly what the architecture of the PortaPak is like. We got the HackRF [02:03.680 --> 02:10.140] board, you know, this is a HackRF one. And on top of it, I created a board that attaches [02:10.140 --> 02:16.180] to the headers that Mike was talking about that adds micro SD card, real time clock, [02:16.180 --> 02:22.080] battery backup so it can maintain calendar time. An audio interface so you can plug in [02:22.080 --> 02:29.100] like an Android or iOS headset and have headphones and a microphone. So if you wanted to transmit [02:29.100 --> 02:36.160] audio for some reason, you could do that. A 240 by 320 RGB LCD. It's only 2.4 inches [02:36.160 --> 02:43.040] large but seems to work out pretty well. Resistive touch screen. So you'd be able to go and key [02:43.040 --> 02:48.600] in information or maybe slide spectrum back and forth when I write the code or when somebody [02:48.600 --> 02:54.220] else helps me write the code. And then a bunch of mechanical controls. So you've got a four [02:54.220 --> 02:58.000] way navigation switch so you can move up, down, left, right. And then there's a nice [02:58.000 --> 03:01.920] ring control which allows you to jog left and right which is great for tuning or turning [03:01.920 --> 03:05.540] the volume up and down. And then a select button that I still haven't figured out what [03:05.540 --> 03:11.100] to do with yet. But, you know, the user interface is still evolving. There's a CPLD, a really [03:11.100 --> 03:16.500] small one, a Max 5 from Altera which ties all this stuff together. So don't get your [03:16.500 --> 03:19.700] hopes up that you might be able to do some signal processing inside the CPLD. There's [03:19.700 --> 03:26.940] not much there. Just basically glue logic. So let's step back for a second and think [03:26.940 --> 03:32.640] about what we have to deal with if we're not going to work with a PC. Here are your typical [03:32.640 --> 03:39.380] specs for a laptop or desktop PC nowadays. And here is the performance characteristics [03:39.380 --> 03:44.320] of the processor in the HackRF. You can see we're talking, you know, a couple orders of [03:44.320 --> 03:50.820] magnitude difference in a lot of cases. So, but, you know, the reason why is you can buy [03:51.420 --> 03:57.060] this ARM processor for 5 bucks and, you know, produce a really inexpensive software defined [03:57.060 --> 04:04.800] radio. And you can also power it off of USB because it doesn't suck 50 watts. So in essence [04:04.800 --> 04:11.480] we're going back to 1996. Although actually a Pentium Pro I think is even faster than [04:11.480 --> 04:18.800] this ARM by just a little bit. So I was going to try and delve into some of the signal processing [04:18.800 --> 04:25.560] tricks that I did with the PortaPak in order to get it to demodulate AM and FM radio and [04:25.560 --> 04:31.180] tire pressure monitors, my personal favorite thing to mess with. But I realized there's [04:31.180 --> 04:34.480] no way I'm going to be able to do it in 20 or 30 minutes. So I'm just going to brush [04:34.480 --> 04:39.840] over some stuff really quickly and talk about how when developing code for this thing you've [04:39.840 --> 04:44.940] got a lot of interesting constraints you haven't had to deal with before in a desktop platform. [04:44.940 --> 04:49.580] To start with, the processor's got two cores, which is actually kind of cool, but they're [04:49.580 --> 04:56.520] not both really fast Cortex M4 processors. One's an M0. It doesn't have any DSP capability [04:56.520 --> 05:00.560] to speak of. It's just not very well suited for doing all the signal processing you might [05:00.560 --> 05:06.140] want to do for software radio. And then we've got four different very small chunks of RAM. [05:06.140 --> 05:14.180] I think the top one's maybe 64K and then there's like a 20K block and 16K here. Not very much [05:14.180 --> 05:19.340] RAM. But the nice thing is they're completely distinct and they're all hooked together through [05:19.480 --> 05:24.880] a bus matrix. So if the M4 wants to run code out of this RAM block, it does not interfere [05:24.880 --> 05:30.540] with the M0 running code out of another RAM block. Most importantly, it also doesn't interfere [05:30.540 --> 05:36.500] with the baseband data coming from the radio portion of the design getting into or coming [05:36.500 --> 05:40.760] out of another block of RAM. So you can have all this stuff going on simultaneously and [05:40.760 --> 05:46.880] not have to worry much about contention for RAM resources. So this is how it wound up [05:46.880 --> 05:56.740] working out. The Cortex M4 on the HackerRef does have hardware floating point, but it [05:56.740 --> 06:03.060] turns out it isn't much of an advantage when you're doing signal processing. The HackerRef [06:03.060 --> 06:08.720] works with 8-bit samples, so we're talking pretty low signal-to-noise ratio compared [06:08.720 --> 06:14.660] to floating point. Floating point is overkill from a numerical representation standpoint. [06:14.660 --> 06:18.280] It just makes life a lot easier when you're doing signal processing to not have to worry [06:18.280 --> 06:26.000] about overflowing your number space or winding up not having enough signal dynamic range [06:26.000 --> 06:30.860] to retain a signal as you're processing it. So floating point is great, it's just that [06:30.860 --> 06:35.940] in this case, doing integer arithmetic on these small samples we're dealing with is [06:35.940 --> 06:42.580] quite a bit faster because the M4 has vector integer instructions. And so I wound up writing [06:42.740 --> 06:49.860] a lot of integer code. And to do that, basically you have to use fixed point arithmetic where [06:49.860 --> 06:55.200] instead of letting the floating point hardware manage where the decimal point is when you [06:55.200 --> 06:59.500] multiply two numbers together, you have to keep track of it yourself. So you can see [06:59.500 --> 07:05.580] here if we're just multiplying integers, the obvious thing happens. If you're using fixed [07:05.580 --> 07:10.920] point arithmetic, you just sort of mentally decide in your code where you want that decimal [07:10.920 --> 07:17.040] point to exist, and you create fractions out of the number of bits that wind up being to [07:17.040 --> 07:23.800] the right of the decimal point. Here are some of the typical signal processing tasks you [07:23.800 --> 07:28.280] might do in a radio receiver. And I'm going to brush through this really quickly so that [07:28.280 --> 07:33.880] I can get on to the demo. Basically, as you receive a signal, you want to be able to go [07:33.880 --> 07:41.480] and shift the signal of interest down to around zero hertz. Long story short, you can have [07:41.480 --> 07:46.820] negative frequencies if you use complex number system, and being able to translate things [07:46.820 --> 07:52.120] around zero allows you to simplify later steps in the process, including filtering. [07:53.260 --> 07:57.260] So it looks kind of like this. You know, you've got a spectrum of some signal you're after, [07:57.260 --> 08:03.000] and then you perform a translation operation and shift it down to the center frequency. [08:03.680 --> 08:07.560] And ordinarily, you would create some sort of an oscillator, a complex oscillator that [08:07.560 --> 08:12.760] would generate outputs in the form of a cosine and sine wave, and you would multiply it with [08:12.760 --> 08:17.060] your input signal, and you would get an output signal. But as I mentioned, the hardware floating [08:17.060 --> 08:24.140] point on this processor is okay, and doing cosine and sine, not okay. There is no hardware [08:24.140 --> 08:29.240] sine and cosine function, so you'd have to do a lookup table or something else. But it [08:29.240 --> 08:35.820] turns out, if you want to translate by a very specific amount, typically one quarter of [08:35.820 --> 08:40.340] your sampling frequency, you can pull a very simple trick, turning all those multiplications [08:40.340 --> 08:47.100] of complex numbers into simple additions and subtractions. And I won't go too deep [08:47.100 --> 08:51.260] into this, but there are a lot of interesting signal processing techniques you can bring [08:51.260 --> 08:57.520] to bear when you're doing signal processing in a very constrained manner. Filtering is [08:57.520 --> 09:02.840] the same way. If you want to filter a signal so you remove all of the noise that is not [09:02.840 --> 09:09.140] your intended signal, you use an FIR filter. And that basically involves taking data and [09:09.140 --> 09:13.380] shifting it through an array, while you multiply all of the elements of the array by coefficients [09:13.380 --> 09:18.860] that represent the filter characteristic that you intend, and then adding up the results. [09:19.160 --> 09:23.060] But if you combine that with a decimation step, which I certainly need to do because [09:23.060 --> 09:29.960] I can't deal with 20 megasamples a second on an ARM processor, you can combine steps [09:29.960 --> 09:36.380] of filtering and decimation, and in the process, cut your work in half or even a quarter by [09:36.380 --> 09:43.920] eliminating certain steps in the FIR filter. And then I was going to explain a few other [09:43.920 --> 09:55.900] things, and it's nine minutes until the end, so I'm going to demo stuff. Post-it note. [09:56.820 --> 10:05.400] Hey! All right. I don't know how closely this thing focuses, but hopefully you can see here. [10:05.400 --> 10:16.200] Terrible. Oh, okay. Not great. Yeah, or something. I'm mostly getting glare off the screen, so [10:16.200 --> 10:28.900] that may just be solved by turning it down. Okay. Anyone getting sick yet? Okay. This [10:28.900 --> 10:36.940] is not great. Okay. So if you can look really carefully on the display, on the screen, you [10:36.960 --> 10:41.100] can see on the display, we've got the real-time clock showing up, we've got a tuning frequency [10:41.100 --> 10:47.260] which we can control by turning the knob here left and right, navigate around to different [10:47.260 --> 10:52.180] fields by just clicking, you know, the arrow keys, and right now it's doing a spectrum [10:52.180 --> 10:59.000] analysis of about 8 megahertz worth of bandwidth in the cellular region. 850 megahertz roughly. [10:59.460 --> 11:03.400] I can switch it over, and this will also be an interesting demo if I can actually get [11:03.400 --> 11:12.700] it to work. I'm going to shift down to just say FM radio band. And we'll maybe listen [11:12.700 --> 11:33.060] to some good tunes. Let's see. Wide band FM. I don't think I'm tuned on frequency yet here. [11:34.480 --> 12:01.340] It could be. Yeah, so at this point it will do narrow band AM, so like aviation radio. [12:02.280 --> 12:08.880] Actually that's about the only people who use AM anymore, right? Well, yeah, aviation [12:08.880 --> 12:14.260] radio, that's like everything else they've got with the frequency modulation bandwagon. [12:14.360 --> 12:18.600] So narrow band FM, so you could listen to all of the various walkie-talkies running [12:18.600 --> 12:27.220] around here. You can FM demodulate pager signals. Then you have to actually go and decode the [12:27.220 --> 12:33.280] baseband data, the modulation of the data. It will do wide band FM as we just heard, [12:33.280 --> 12:37.560] and then I, just as a proof of concept that you can do digital modes as well, I coded [12:37.560 --> 12:45.160] up some tire pressure monitor decoding. So I was out with Skyler, the 14-year-old kid, [12:45.160 --> 12:50.980] out on the main drag here last night with the Portapak, and we were watching packets [12:50.980 --> 12:57.940] coming off of people's wheels. That was a lot of fun. If anyone wants to hang out, play [12:57.940 --> 13:03.380] in the street, I'm happy to walk out there and do it. So yeah, that's pretty much it. [13:03.380 --> 13:08.160] I think maybe I've even managed to get us back on time here. And any questions? [13:12.520 --> 13:19.920] Oh, yeah, that's not a very good sight. Where's my post-it note? Oh, I've lost it. My security [13:19.920 --> 13:28.500] device. That solves it. All right. Any questions? Yes, go ahead. [13:29.840 --> 13:36.800] Can you buy one and how much will it cost? I am working with a gentleman I know in my [13:36.800 --> 13:43.640] city who is an assembler who wants to help me build the first round of these. And if [13:43.640 --> 13:50.120] all goes well, these should be out in a month. I am a little concerned that with the amount [13:50.120 --> 13:56.240] of interest I've seen so far, that they may not be around for long. But I do have, my [13:56.240 --> 14:00.740] intent is to sell through retailers. So I've talked with a couple of the retailers that [14:00.740 --> 14:06.720] you would find out in the main vendor area. And they should be carrying them and maybe [14:06.720 --> 14:15.100] even pre-ordering them. We still have to work out the details. I'm trying to keep the price [14:15.100 --> 14:19.180] in like the 100, 120 range, but we'll see how it actually works out once my assembler [14:19.180 --> 14:32.260] sends me a quote. In my experience, the compiler does not help all that much with vectorization. [14:32.260 --> 14:37.060] And it may just be that I'm not writing code that it sees as being vectorizable. I know [14:37.060 --> 14:44.060] that there are some C tricks around trying to tell the compiler that there are no potential [14:44.920 --> 14:50.100] overlaps in pointers, so that it can make some assumptions about the pointers not having [14:50.100 --> 14:56.300] any overlap. But I just drop straight to assembly because I know exactly what instructions [14:56.300 --> 15:01.360] I want to use. And moreover, there's no way to express in C like the ability to go and [15:01.360 --> 15:05.080] say, I want to do saturating arithmetic. Where when you multiply these two numbers together [15:05.080 --> 15:09.560] and they're too big for the resulting data type, that they saturate to a positive and [15:09.560 --> 15:15.920] negative extreme. So it is kind of nice to just drop into assembly at that point. Other [15:15.920 --> 15:28.420] questions? Yes? Oh yeah. So, silly me. If you don't mind me roodling in my bag for five [15:28.420 --> 15:42.880] seconds. This book made the port-a-pack possible. There is a chapter 13, which is about a third [15:42.880 --> 15:48.240] of the book, which describes practically all the signal processing tricks I use to get [15:48.240 --> 15:53.400] speed out of the ARM processor. It's called, Understanding Digital Signal Processing and [15:53.400 --> 16:00.260] it's by Richard Lyons. It's now in its third edition and I think it's $90 retail, obviously [16:00.260 --> 16:06.940] cheaper at Amazon. So if any of you guys are looking to do some tight SDR coding, get the [16:06.940 --> 16:20.740] book. Yes? It's pretty high. I did have a bug where I had my CPU clock rate set wrong [16:20.760 --> 16:25.200] and so the statistics I recall off the top of my head are probably incorrect because [16:25.620 --> 16:29.340] I only noticed the stats before I fixed the clock issue. But I feel like it's probably [16:29.340 --> 16:35.020] in the 70 or 80 range, 80% range. Now that said, I haven't spent a lot of time optimizing [16:35.020 --> 16:39.800] that stuff. So I've got like an arc tangent function which does the FMD mod and I think [16:39.800 --> 16:46.360] it could be significantly faster. And that's where a lot of the cycles are going. Anyone [16:46.360 --> 16:46.780] else?