Is this thing on? Are you sure? I don't know why I keep having to give everybody intros, but hi, my name is Zero Chaos. Welcome very much to the Wireless Village. I'm so happy to have you here. This man has designed something that appears to be an EKG or what's that thing in Ghostbusters? He's got one of those things from Ghostbusters. Did you just throw a throwing star at me? I'm keeping this. 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. Howdy. So yeah, my name is Jared Boone. I've been doing open source hardware for a couple of years, three years now, working with Mike Osman on the HackRF design. And I want to talk today about, you still can't hear me? Okay. I don't want to sound like a skinny puppy here. 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. So I set about actually figuring that out. 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. And that's all cool. In fact, this is really the right way to do things most of the time. 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. And that's pretty much what the PortaPak is all about. So let me show you quickly what the architecture of the PortaPak is like. We got the HackRF board, you know, this is a HackRF one. 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. An audio interface so you can plug in like an Android or iOS headset and have headphones and a microphone. So if you wanted to transmit audio for some reason, you could do that. A 240 by 320 RGB LCD. It's only 2.4 inches large but seems to work out pretty well. Resistive touch screen. 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. And then a bunch of mechanical controls. So you've got a four way navigation switch so you can move up, down, left, right. 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. And then a select button that I still haven't figured out what to do with yet. But, you know, the user interface is still evolving. There's a CPLD, a really small one, a Max 5 from Altera which ties all this stuff together. So don't get your hopes up that you might be able to do some signal processing inside the CPLD. There's not much there. Just basically glue logic. 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. Here are your typical specs for a laptop or desktop PC nowadays. And here is the performance characteristics of the processor in the HackRF. You can see we're talking, you know, a couple orders of magnitude difference in a lot of cases. 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. And you can also power it off of USB because it doesn't suck 50 watts. So in essence we're going back to 1996. Although actually a Pentium Pro I think is even faster than this ARM by just a little bit. 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. But I realized there's no way I'm going to be able to do it in 20 or 30 minutes. 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. 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. One's an M0. It doesn't have any DSP capability to speak of. It's just not very well suited for doing all the signal processing you might want to do for software radio. And then we've got four different very small chunks of RAM. I think the top one's maybe 64K and then there's like a 20K block and 16K here. Not very much RAM. But the nice thing is they're completely distinct and they're all hooked together through a bus matrix. 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. 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. So you can have all this stuff going on simultaneously and not have to worry much about contention for RAM resources. So this is how it wound up working out. 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. The HackerRef works with 8-bit samples, so we're talking pretty low signal-to-noise ratio compared to floating point. Floating point is overkill from a numerical representation standpoint. 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. 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. And so I wound up writing a lot of integer code. 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. So you can see here if we're just multiplying integers, the obvious thing happens. 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. Here are some of the typical signal processing tasks you might do in a radio receiver. And I'm going to brush through this really quickly so that I can get on to the demo. Basically, as you receive a signal, you want to be able to go and shift the signal of interest down to around zero hertz. 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. So it looks kind of like this. 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. 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. But as I mentioned, the hardware floating point on this processor is okay, and doing cosine and sine, not okay. There is no hardware sine and cosine function, so you'd have to do a lookup table or something else. 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. 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. Filtering is the same way. 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. 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. 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. 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. Post-it note. Hey! All right. I don't know how closely this thing focuses, but hopefully you can see here. Terrible. Oh, okay. Not great. Yeah, or something. I'm mostly getting glare off the screen, so that may just be solved by turning it down. Okay. Anyone getting sick yet? Okay. This is not great. Okay. 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, 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. 850 megahertz roughly. I can switch it over, and this will also be an interesting demo if I can actually get it to work. I'm going to shift down to just say FM radio band. And we'll maybe listen to some good tunes. Let's see. Wide band FM. I don't think I'm tuned on frequency yet here. It could be. Yeah, so at this point it will do narrow band AM, so like aviation radio. Actually that's about the only people who use AM anymore, right? Well, yeah, aviation radio, that's like everything else they've got with the frequency modulation bandwagon. So narrow band FM, so you could listen to all of the various walkie-talkies running around here. You can FM demodulate pager signals. Then you have to actually go and decode the baseband data, the modulation of the data. 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. 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. That was a lot of fun. If anyone wants to hang out, play in the street, I'm happy to walk out there and do it. So yeah, that's pretty much it. I think maybe I've even managed to get us back on time here. And any questions? Oh, yeah, that's not a very good sight. Where's my post-it note? Oh, I've lost it. My security device. That solves it. All right. Any questions? Yes, go ahead. Can you buy one and how much will it cost? 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. And if all goes well, these should be out in a month. I am a little concerned that with the amount of interest I've seen so far, that they may not be around for long. But I do have, my intent is to sell through retailers. So I've talked with a couple of the retailers that you would find out in the main vendor area. And they should be carrying them and maybe even pre-ordering them. We still have to work out the details. 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. In my experience, the compiler does not help all that much with vectorization. And it may just be that I'm not writing code that it sees as being vectorizable. 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. But I just drop straight to assembly because I know exactly what instructions I want to use. And moreover, there's no way to express in C like the ability to go and say, I want to do saturating arithmetic. 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. So it is kind of nice to just drop into assembly at that point. Other questions? Yes? Oh yeah. So, silly me. If you don't mind me roodling in my bag for five seconds. This book made the port-a-pack possible. 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. It's called, Understanding Digital Signal Processing and it's by Richard Lyons. It's now in its third edition and I think it's $90 retail, obviously cheaper at Amazon. So if any of you guys are looking to do some tight SDR coding, get the book. Yes? It's pretty high. 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. But I feel like it's probably in the 70 or 80 range, 80% range. Now that said, I haven't spent a lot of time optimizing that stuff. So I've got like an arc tangent function which does the FMD mod and I think it could be significantly faster. And that's where a lot of the cycles are going. Anyone else?