1 00:00:03,400 --> 00:00:05,000 Is this thing on? 2 00:00:06,740 --> 00:00:07,740 Are you sure? 3 00:00:08,500 --> 00:00:12,120 I don't know why I keep having to give everybody intros, but hi, my name is Zero Chaos. 4 00:00:12,120 --> 00:00:13,840 Welcome very much to the Wireless Village. 5 00:00:13,840 --> 00:00:15,380 I'm so happy to have you here. 6 00:00:15,640 --> 00:00:22,400 This man has designed something that appears to be an EKG or what's that thing in Ghostbusters? 7 00:00:22,540 --> 00:00:24,880 He's got one of those things from Ghostbusters. 8 00:00:25,180 --> 00:00:27,120 Did you just throw a throwing star at me? 9 00:00:29,380 --> 00:00:30,960 I'm keeping this. 10 00:00:31,840 --> 00:00:39,720 Anyway, he designed a Game Boy that I've always wanted, so here he is to talk about the brand new replacement for your iPod, Jared Boone. 11 00:00:41,160 --> 00:00:42,120 Howdy. 12 00:00:44,820 --> 00:00:46,660 So yeah, my name is Jared Boone. 13 00:00:46,840 --> 00:00:54,380 I've been doing open source hardware for a couple of years, three years now, working with Mike Osman on the HackRF design. 14 00:00:54,960 --> 00:00:58,520 And I want to talk today about, you still can't hear me? 15 00:00:58,520 --> 00:00:59,140 Okay. 16 00:00:59,140 --> 00:01:01,700 I don't want to sound like a skinny puppy here. 17 00:01:03,040 --> 00:01:23,700 So, yeah, so you totally blew my, so yeah, I got this kind of crazy idea that being able to work with the HackRF without a computer might be a cool thing to be able to do. 18 00:01:23,700 --> 00:01:26,960 So I set about actually figuring that out. 19 00:01:26,960 --> 00:01:37,560 This is how you normally use a HackRF, you know, plugged into a laptop, either writing code or running GNU radio, creating flow graphs and running them, capturing data. 20 00:01:38,060 --> 00:01:39,260 And that's all cool. 21 00:01:39,260 --> 00:01:43,020 In fact, this is really the right way to do things most of the time. 22 00:01:43,020 --> 00:01:52,660 But sometimes you need to get out and about and look for interesting targets or get close to them if you can't bring them into your lab or into your office or whatever. 23 00:01:53,260 --> 00:01:56,620 And that's pretty much what the PortaPak is all about. 24 00:01:57,040 --> 00:02:01,380 So let me show you quickly what the architecture of the PortaPak is like. 25 00:02:01,400 --> 00:02:06,720 We got the HackRF board, you know, this is a HackRF one. 26 00:02:07,120 --> 00:02:19,540 And on top of it, I created a board that attaches to the headers that Mike was talking about that adds micro SD card, real time clock, battery backup so it can maintain calendar time. 27 00:02:19,960 --> 00:02:27,300 An audio interface so you can plug in like an Android or iOS headset and have headphones and a microphone. 28 00:02:28,200 --> 00:02:30,920 So if you wanted to transmit audio for some reason, you could do that. 29 00:02:31,520 --> 00:02:34,780 A 240 by 320 RGB LCD. 30 00:02:34,900 --> 00:02:39,820 It's only 2.4 inches large but seems to work out pretty well. 31 00:02:40,440 --> 00:02:41,660 Resistive touch screen. 32 00:02:41,660 --> 00:02:49,980 So you'd be able to go and key in information or maybe slide spectrum back and forth when I write the code or when somebody else helps me write the code. 33 00:02:50,520 --> 00:02:53,420 And then a bunch of mechanical controls. 34 00:02:53,420 --> 00:02:56,860 So you've got a four way navigation switch so you can move up, down, left, right. 35 00:02:56,860 --> 00:03:03,340 And then there's a nice ring control which allows you to jog left and right which is great for tuning or turning the volume up and down. 36 00:03:03,420 --> 00:03:06,540 And then a select button that I still haven't figured out what to do with yet. 37 00:03:06,540 --> 00:03:09,040 But, you know, the user interface is still evolving. 38 00:03:09,680 --> 00:03:15,600 There's a CPLD, a really small one, a Max 5 from Altera which ties all this stuff together. 39 00:03:15,640 --> 00:03:19,620 So don't get your hopes up that you might be able to do some signal processing inside the CPLD. 40 00:03:19,620 --> 00:03:20,760 There's not much there. 41 00:03:20,760 --> 00:03:22,860 Just basically glue logic. 42 00:03:23,900 --> 00:03:30,780 So let's step back for a second and think about what we have to deal with if we're not going to work with a PC. 43 00:03:31,520 --> 00:03:36,840 Here are your typical specs for a laptop or desktop PC nowadays. 44 00:03:37,040 --> 00:03:42,060 And here is the performance characteristics of the processor in the HackRF. 45 00:03:42,120 --> 00:03:46,660 You can see we're talking, you know, a couple orders of magnitude difference in a lot of cases. 46 00:03:47,100 --> 00:03:57,860 So, but, you know, the reason why is you can buy this ARM processor for 5 bucks and, you know, produce a really inexpensive software defined radio. 47 00:03:57,860 --> 00:04:02,620 And you can also power it off of USB because it doesn't suck 50 watts. 48 00:04:03,580 --> 00:04:07,040 So in essence we're going back to 1996. 49 00:04:09,200 --> 00:04:13,700 Although actually a Pentium Pro I think is even faster than this ARM by just a little bit. 50 00:04:14,040 --> 00:04:29,040 So I was going to try and delve into some of the signal processing tricks that I did with the PortaPak in order to get it to demodulate AM and FM radio and tire pressure monitors, my personal favorite thing to mess with. 51 00:04:30,000 --> 00:04:33,220 But I realized there's no way I'm going to be able to do it in 20 or 30 minutes. 52 00:04:33,220 --> 00:04:44,940 So I'm just going to brush over some stuff really quickly and talk about how when developing code for this thing you've got a lot of interesting constraints you haven't had to deal with before in a desktop platform. 53 00:04:44,940 --> 00:04:53,380 To start with, the processor's got two cores, which is actually kind of cool, but they're not both really fast Cortex M4 processors. 54 00:04:53,380 --> 00:04:54,600 One's an M0. 55 00:04:54,620 --> 00:04:57,220 It doesn't have any DSP capability to speak of. 56 00:04:57,360 --> 00:05:02,360 It's just not very well suited for doing all the signal processing you might want to do for software radio. 57 00:05:02,980 --> 00:05:06,140 And then we've got four different very small chunks of RAM. 58 00:05:06,140 --> 00:05:13,480 I think the top one's maybe 64K and then there's like a 20K block and 16K here. 59 00:05:13,480 --> 00:05:14,500 Not very much RAM. 60 00:05:14,500 --> 00:05:20,300 But the nice thing is they're completely distinct and they're all hooked together through a bus matrix. 61 00:05:20,300 --> 00:05:28,220 So if the M4 wants to run code out of this RAM block, it does not interfere with the M0 running code out of another RAM block. 62 00:05:28,220 --> 00:05:38,460 Most importantly, it also doesn't interfere with the baseband data coming from the radio portion of the design getting into or coming out of another block of RAM. 63 00:05:38,460 --> 00:05:44,700 So you can have all this stuff going on simultaneously and not have to worry much about contention for RAM resources. 64 00:05:45,720 --> 00:05:47,880 So this is how it wound up working out. 65 00:05:50,380 --> 00:06:02,180 The Cortex M4 on the HackerRef does have hardware floating point, but it turns out it isn't much of an advantage when you're doing signal processing. 66 00:06:02,280 --> 00:06:09,500 The HackerRef works with 8-bit samples, so we're talking pretty low signal-to-noise ratio compared to floating point. 67 00:06:09,500 --> 00:06:14,660 Floating point is overkill from a numerical representation standpoint. 68 00:06:14,660 --> 00:06:28,600 It just makes life a lot easier when you're doing signal processing to not have to worry about overflowing your number space or winding up not having enough signal dynamic range to retain a signal as you're processing it. 69 00:06:28,600 --> 00:06:41,260 So floating point is great, it's just that in this case, doing integer arithmetic on these small samples we're dealing with is quite a bit faster because the M4 has vector integer instructions. 70 00:06:41,600 --> 00:06:45,140 And so I wound up writing a lot of integer code. 71 00:06:45,540 --> 00:06:58,560 And to do that, basically you have to use fixed point arithmetic where instead of letting the floating point hardware manage where the decimal point is when you multiply two numbers together, you have to keep track of it yourself. 72 00:06:58,760 --> 00:07:03,100 So you can see here if we're just multiplying integers, the obvious thing happens. 73 00:07:04,320 --> 00:07:19,200 If you're using fixed point arithmetic, you just sort of mentally decide in your code where you want that decimal point to exist, and you create fractions out of the number of bits that wind up being to the right of the decimal point. 74 00:07:21,000 --> 00:07:25,560 Here are some of the typical signal processing tasks you might do in a radio receiver. 75 00:07:26,100 --> 00:07:29,580 And I'm going to brush through this really quickly so that I can get on to the demo. 76 00:07:30,620 --> 00:07:38,820 Basically, as you receive a signal, you want to be able to go and shift the signal of interest down to around zero hertz. 77 00:07:39,420 --> 00:07:52,120 Long story short, you can have negative frequencies if you use complex number system, and being able to translate things around zero allows you to simplify later steps in the process, including filtering. 78 00:07:53,260 --> 00:07:55,100 So it looks kind of like this. 79 00:07:55,100 --> 00:08:03,000 You know, you've got a spectrum of some signal you're after, and then you perform a translation operation and shift it down to the center frequency. 80 00:08:03,680 --> 00:08:15,000 And ordinarily, you would create some sort of an oscillator, a complex oscillator that would generate outputs in the form of a cosine and sine wave, and you would multiply it with your input signal, and you would get an output signal. 81 00:08:15,260 --> 00:08:23,080 But as I mentioned, the hardware floating point on this processor is okay, and doing cosine and sine, not okay. 82 00:08:23,080 --> 00:08:28,980 There is no hardware sine and cosine function, so you'd have to do a lookup table or something else. 83 00:08:28,980 --> 00:08:44,700 But it turns out, if you want to translate by a very specific amount, typically one quarter of your sampling frequency, you can pull a very simple trick, turning all those multiplications of complex numbers into simple additions and subtractions. 84 00:08:45,360 --> 00:08:56,760 And I won't go too deep into this, but there are a lot of interesting signal processing techniques you can bring to bear when you're doing signal processing in a very constrained manner. 85 00:08:56,860 --> 00:08:58,420 Filtering is the same way. 86 00:08:58,420 --> 00:09:05,980 If you want to filter a signal so you remove all of the noise that is not your intended signal, you use an FIR filter. 87 00:09:05,980 --> 00:09:18,860 And that basically involves taking data and shifting it through an array, while you multiply all of the elements of the array by coefficients that represent the filter characteristic that you intend, and then adding up the results. 88 00:09:19,160 --> 00:09:40,520 But if you combine that with a decimation step, which I certainly need to do because I can't deal with 20 megasamples a second on an ARM processor, you can combine steps of filtering and decimation, and in the process, cut your work in half or even a quarter by eliminating certain steps in the FIR filter. 89 00:09:42,020 --> 00:09:49,020 And then I was going to explain a few other things, and it's nine minutes until the end, so I'm going to demo stuff. 90 00:09:54,540 --> 00:09:55,900 Post-it note. 91 00:09:56,820 --> 00:09:57,860 Hey! 92 00:09:58,000 --> 00:09:58,840 All right. 93 00:09:58,860 --> 00:10:05,400 I don't know how closely this thing focuses, but hopefully you can see here. 94 00:10:05,400 --> 00:10:06,200 Terrible. 95 00:10:06,200 --> 00:10:06,960 Oh, okay. 96 00:10:06,960 --> 00:10:07,900 Not great. 97 00:10:11,320 --> 00:10:13,100 Yeah, or something. 98 00:10:14,360 --> 00:10:18,700 I'm mostly getting glare off the screen, so that may just be solved by turning it down. 99 00:10:20,340 --> 00:10:20,960 Okay. 100 00:10:20,960 --> 00:10:22,240 Anyone getting sick yet? 101 00:10:26,920 --> 00:10:27,880 Okay. 102 00:10:28,600 --> 00:10:29,820 This is not great. 103 00:10:30,120 --> 00:10:30,520 Okay. 104 00:10:30,520 --> 00:10:49,040 So if you can look really carefully on the display, on the screen, you can see on the display, we've got the real-time clock showing up, we've got a tuning frequency which we can control by turning the knob here left and right, navigate around to different fields by just clicking, 105 00:10:49,040 --> 00:10:57,060 you know, the arrow keys, and right now it's doing a spectrum analysis of about 8 megahertz worth of bandwidth in the cellular region. 106 00:10:57,340 --> 00:10:59,000 850 megahertz roughly. 107 00:10:59,460 --> 00:11:04,560 I can switch it over, and this will also be an interesting demo if I can actually get it to work. 108 00:11:04,580 --> 00:11:09,400 I'm going to shift down to just say FM radio band. 109 00:11:10,340 --> 00:11:14,180 And we'll maybe listen to some good tunes. 110 00:11:19,680 --> 00:11:21,440 Let's see. 111 00:11:21,500 --> 00:11:23,220 Wide band FM. 112 00:11:29,980 --> 00:11:33,060 I don't think I'm tuned on frequency yet here. 113 00:11:34,480 --> 00:11:35,980 It could be. 114 00:11:53,400 --> 00:12:01,340 Yeah, so at this point it will do narrow band AM, so like aviation radio. 115 00:12:02,280 --> 00:12:06,600 Actually that's about the only people who use AM anymore, right? 116 00:12:08,020 --> 00:12:14,260 Well, yeah, aviation radio, that's like everything else they've got with the frequency modulation bandwagon. 117 00:12:14,360 --> 00:12:19,740 So narrow band FM, so you could listen to all of the various walkie-talkies running around here. 118 00:12:20,380 --> 00:12:25,320 You can FM demodulate pager signals. 119 00:12:25,320 --> 00:12:30,280 Then you have to actually go and decode the baseband data, the modulation of the data. 120 00:12:30,920 --> 00:12:39,840 It will do wide band FM as we just heard, and then I, just as a proof of concept that you can do digital modes as well, I coded up some tire pressure monitor decoding. 121 00:12:39,840 --> 00:12:52,660 So I was out with Skyler, the 14-year-old kid, out on the main drag here last night with the Portapak, and we were watching packets coming off of people's wheels. 122 00:12:53,740 --> 00:12:55,240 That was a lot of fun. 123 00:12:55,560 --> 00:13:01,600 If anyone wants to hang out, play in the street, I'm happy to walk out there and do it. 124 00:13:01,860 --> 00:13:03,380 So yeah, that's pretty much it. 125 00:13:03,380 --> 00:13:06,500 I think maybe I've even managed to get us back on time here. 126 00:13:06,860 --> 00:13:08,160 And any questions? 127 00:13:12,520 --> 00:13:15,140 Oh, yeah, that's not a very good sight. 128 00:13:16,240 --> 00:13:17,760 Where's my post-it note? 129 00:13:18,540 --> 00:13:19,400 Oh, I've lost it. 130 00:13:19,400 --> 00:13:20,760 My security device. 131 00:13:22,500 --> 00:13:23,600 That solves it. 132 00:13:24,800 --> 00:13:25,460 All right. 133 00:13:25,460 --> 00:13:26,440 Any questions? 134 00:13:27,700 --> 00:13:28,500 Yes, go ahead. 135 00:13:29,840 --> 00:13:32,500 Can you buy one and how much will it cost? 136 00:13:32,520 --> 00:13:42,560 I am working with a gentleman I know in my city who is an assembler who wants to help me build the first round of these. 137 00:13:42,820 --> 00:13:46,920 And if all goes well, these should be out in a month. 138 00:13:46,920 --> 00:13:53,400 I am a little concerned that with the amount of interest I've seen so far, that they may not be around for long. 139 00:13:53,500 --> 00:13:58,480 But I do have, my intent is to sell through retailers. 140 00:13:58,500 --> 00:14:04,000 So I've talked with a couple of the retailers that you would find out in the main vendor area. 141 00:14:04,160 --> 00:14:08,380 And they should be carrying them and maybe even pre-ordering them. 142 00:14:08,520 --> 00:14:10,400 We still have to work out the details. 143 00:14:13,220 --> 00:14:20,860 I'm trying to keep the price in like the 100, 120 range, but we'll see how it actually works out once my assembler sends me a quote. 144 00:14:26,540 --> 00:14:32,260 In my experience, the compiler does not help all that much with vectorization. 145 00:14:32,260 --> 00:14:36,700 And it may just be that I'm not writing code that it sees as being vectorizable. 146 00:14:36,700 --> 00:14:51,080 I know that there are some C tricks around trying to tell the compiler that there are no potential overlaps in pointers, so that it can make some assumptions about the pointers not having any overlap. 147 00:14:51,580 --> 00:14:57,520 But I just drop straight to assembly because I know exactly what instructions I want to use. 148 00:14:57,520 --> 00:15:03,260 And moreover, there's no way to express in C like the ability to go and say, I want to do saturating arithmetic. 149 00:15:03,260 --> 00:15:10,760 Where when you multiply these two numbers together and they're too big for the resulting data type, that they saturate to a positive and negative extreme. 150 00:15:11,000 --> 00:15:14,060 So it is kind of nice to just drop into assembly at that point. 151 00:15:15,480 --> 00:15:16,800 Other questions? 152 00:15:18,640 --> 00:15:19,460 Yes? 153 00:15:22,160 --> 00:15:23,440 Oh yeah. 154 00:15:23,440 --> 00:15:25,180 So, silly me. 155 00:15:25,700 --> 00:15:29,280 If you don't mind me roodling in my bag for five seconds. 156 00:15:36,640 --> 00:15:39,540 This book made the port-a-pack possible. 157 00:15:39,900 --> 00:15:50,140 There is a chapter 13, which is about a third of the book, which describes practically all the signal processing tricks I use to get speed out of the ARM processor. 158 00:15:50,140 --> 00:15:54,880 It's called, Understanding Digital Signal Processing and it's by Richard Lyons. 159 00:15:54,880 --> 00:16:01,740 It's now in its third edition and I think it's $90 retail, obviously cheaper at Amazon. 160 00:16:02,740 --> 00:16:07,740 So if any of you guys are looking to do some tight SDR coding, get the book. 161 00:16:08,540 --> 00:16:09,360 Yes? 162 00:16:13,860 --> 00:16:15,540 It's pretty high. 163 00:16:15,540 --> 00:16:28,320 I did have a bug where I had my CPU clock rate set wrong and so the statistics I recall off the top of my head are probably incorrect because I only noticed the stats before I fixed the clock issue. 164 00:16:28,320 --> 00:16:32,000 But I feel like it's probably in the 70 or 80 range, 80% range. 165 00:16:32,060 --> 00:16:35,580 Now that said, I haven't spent a lot of time optimizing that stuff. 166 00:16:35,580 --> 00:16:41,380 So I've got like an arc tangent function which does the FMD mod and I think it could be significantly faster. 167 00:16:41,380 --> 00:16:43,140 And that's where a lot of the cycles are going. 168 00:16:45,960 --> 00:16:46,780 Anyone else?