Parsing GPS with FPGA


Anyone who plays around with embedded electronics has probably explored (or at least thought about exploring) the power of GPS. From autonomous vehicles, to wayfinding, to creating a 12-foot clock, GPS is an incredible useful, robust technology. Today we have a nice, simple project from SparkFun customer Jon Carrier.

Jon created a project that uses a Spartan FPGA board to parse the data from a Locosys LS20031 GPS Module. The data is then sent to a basic 16x2 serial LCD, which displays the latitude and longitude coordinates. By itself, this is a fairly-straightforward project - but it has a lot of potential - and it is also a great example of how to get started in GPS data parsing and display. Nice work, Jon!


Comments 38 comments

  • FPGA’s Rock my world! Imagine the ability to run bits of your code in either parallel or series.. mixing it up however you please. No longer must you run every function in your code one-at-a-time. FPGA’s allow you to, for example, read 20 different sensors, and dynamically control 10 different actuators, at the same time. Buah-hahaha! Love it. [insidious smile, heart races, crazy eyes] Can you feel the POWER? Can you?

    • Yep, I enjoy this same power with the Parallax Propeller; 8 cores to play with in a single chip. True parallel processing for $8.

      • The Propeller is a pretty awesome chip, there’s no doubt. But if you’d like a good example of the kind of power and versatility you can get from an FPGA, take a look at the Gameduino. Another cool example is this one, where Jeri Ellsworth uses a Papilio FPGA dev board to reverse engineer and replace a burned out chip on a pinball machine.

        Speaking of the Papilio, it’s a really cool, inexpensive FPGA dev board. I picked one up a couple weeks ago and have been slowly playing with it. I really wish SparkFun would carry them. I also wish they’d carry the Propeller. :-(

    • FPGA’s suck because their netlist specification is not open.

      • I know, right? I hate having to write in a higher level specification, such VHDL, Verilog, or something even higher like Bluespec. I also like to program my GPU in Cuda bytecode, and the fact that I can’t get a reference specification of the implementation of the cache in a modern CPU means that CPUs suck, too. What I hate the most, though, is having to google “netlist specification” and look at the first result, a so-called Xilinx Netlist Format (XNF) Specification. These FPGAs are practically worthless!

    • yes, i can.

  • It’s good to see FPGAs getting some love. :)

    To Jon: What Xilinx version software you using, and how are you programming it?

    • This was built while using ISE11 Webpack but any version should work, there really wasn’t any special IP cores that I needed, everything was coded from the ground up.

      My FPGA board has an 8051 Cypress chip on it that has an ISP which allows for JTAG programming through USB (there is also an external jtag for cases where this solution does not work, such as chipscope). I can use either the traditional method of using iMPACT or I can use a tool that came with my FPGA board that is very streamlined (FPGAconf). Both methods allow me to write to either the FPGA RAM or the boot PROM.

  • anyone ever try doing anything with Xilinx System Generator in Matlab/simulink? They get rid of all (most) of the VHDL and make it all graphical/simulink-ish. Although this sounds like a boatload of fun, it made my senior year living hell because of compiler issues, not design issues. +1 for coding this by yourself and not relying on Xilinx System Generator to take out the grunt work. ALTHOUGH, it could do some hardcore filtering once it worked and I eventually got a 50 MHz QPSK communication system up and running. :D happy coding

    • Funny you mention QPSK communication that is exactly what I used system generator for back in my senior year when I was taking a VLSI with Signal Processing course. Glad I am not the only one that had those issues with it =)

      Man…when we started getting into QAM16 (and I think we barely touched QAM64) I had nightmares about IQ impairments for weeks. Those DSP designs got really ugly. But I guess it would be more manageable in comparison to Verilog or VHDL code.

    • I have tried the gui wusiswug ISE tool for xilinx. It works, to a point. For instance, I fed several signals I was interested into a multiplexer and fed the multiplexer’s output signal to an I/O pin for inspection on a scope. That allowed me to build the design in stages while troubleshooting things that did not work as expected. The problem I ran into is that at a certain point in the design, changing which signal I was routing to the scope output changed how some other part of the design worked. Not cool.

      I recommend using VHDL or Verilog as well because you may want to re-use a part of a design using another manufacturer’s FPGA. If you are using a gui to synthesize the FPGA design, you are locked in to that vendor’s parts.

      FPGA’s are a good tool to have in one’s toolbox, but they are not a solution to all problems.

      One reason they are used in many designs is that the requirements for a particular design often go through many phases of change. A well thought out design with a FPGA as its center can often “future proof” the design without the need for circuit modification.

      They do have a steep learning curve, however.

      A common mistake I see when people first start using FPGAs is they run slow signals into various inputs of the FPGA, and get unexpected results from the FPGA. What they fail to consider is that if the FPGA is capable of operating at 200 Mhz, it is looking for transitions at that speed. Small delays in how one slow signal arrives in reference to another can cause race conditions that would otherwise not be seen in other designs.

      FPGAs used to be very power hungry, but parts that are intended to be used in battery powered devices are now commonplace.

      Xilinx also has released radiation hardened parts intended for use in safety critical applications that otherwise could be affected by radiation in aerospace applications. Given that we are now seeing increasing solar storm activity, these may find their way into some critical Earth based designs as well.

    • I stayed away from the gui wusiwug stuff in xilinx. It never worked well. But then again, I’d always rather code then using visual editors.

  • I wouldn’t call any project with an FPGA “simple”.

    • I use the term ‘simple’ because of the project itself - meaning displaying latitude and longitude data parsed from GPS. That, in and of itself, is relatively simple. I would agree with you that using FPGA is not simple - and that’s actually the reason I posted this particular project. If this project only entailed taking the data from a GPS unit and displaying it on a 16x2 screen, I probably wouldn’t post it at all. But because Jon used an FPGA, it made it worth posting.

      Thanks for your catch - that should be fixed now!

    • For someone who has never heard of them before. In reality, they are easy to learn, because they are really just a vessel for your design.

      If you really want to learn how to use an FPGA, learn digital logic and HDL (hardware descriptive language). Most industry professionals prefer Verilog to VHDL (especially when SystemVerilog is slowly gaining ground). Then learn the software on how to use them. My recommendation for software is Xilinx ISE, and it is free.

      • Are FPGAs as easy to use as a simple microcontroller such as an ATtiny85 or ATmega328?

        • Not exactly since you have to work with an FPGA environment which can be a bit confusing and hard to learn, but once you get the hang of how they work it goes fairly smoothly.

  • Thought someone finally parsed the baseband data from a MAX2769 on an FPGA to make a $10 RTK GPS solution. Still waiting.

  • Pretty cool, dude.

    On an unrelated topic: my Lenovo S10 has broked on me ;_; I’ve tried the hardware reset, and I’ve removed the expansion RAM [probs with the RAM have temporarily bricked my lappy before, and it’s got hardwired RAM] and tried hooking it up to an external display. It still doesn’t work (WHA!). So I won’t be here too often :[

  • Uhhh, I am a little confused. FPGAs are rarely called “easy” or “simple”, yet are almost always called powerful. Why is such a simple project like this being done with an FPGA? I know it is simple, because I have done the same exact thing with a BASIC Stamp. The “potential” is mentioned, but that is really what needs to be written up. Where is the keypad to enter a desired location so that the FPGA can show off doing some Great Circle math? Bearing calculations? Jon has done a good job documenting this use of an FPGA, so don’t get me wrong in thinking his work is not worth mentioning. My beef, I guess, is that I can do this same project with the Parallax Propeller for about a tenth of the cost (the FPGA board he used is $249 and a Propeller Proto USB Board is $29) and with a significantly smaller learning curve. (Propeller SPIN objects are available for everything in the block diagram)

    • the current consumption of FPGA is still very high, usually a few times higher than a comparable uC-based solution. What is the total power consumption of the project hardware?

  • I also built something like this using the Sparkfun Venus module. Check it out: http://youtu.be/Irvi9_ShTAk

  • I also built something like this using the Sparkfun Venus module. Check it out: http://youtu.be/Irvi9_ShTAk

  • I think it’s Jon Carrier. Dan is a guy posting in the comments on Jon’s blog.

    That FPGA is a beast! Are you sure it can handle that task? Heh.

    • Right you are! Dan Carrier was the name of a buddy I had in college…guess I had that in my head. Post is fixed. Sorry Jon!

      • Uhh, the post is 67% fixed :)

      • No worries. Dan’s my good friend. I will give him a friendly punch for unknowingly trying to take credit for this project. =)

        Truth be told I am surprised this project was worthy enough for a news item; I was hoping to have built something on top of this project but I got distracted with other projects that I have been working on.

  • It’d be interesting and educational to see what the source code for the FPGA looks like; how about posting it?

    Also I’m sure a few people are curious as to why you’d choose a FPGA instead a microprocessor for this application since FPGAs are much more expensive, consume a lot more power, and have way too many extra pins than a microprocessor would.

    • In a Microcontroller system, can you parallelize your code to handle multiple tasks? What if you need data to be on the output at a certain frequency different from the input?

      Don’t get me wrong, microcontrollers are very powerful and do a lot, but lacks the ability to handle time sensitive data appropriately. This is why a lot of major communication equipment and standards are based off of FPGA development.

      For this project, it is a stepping stone to more RTOS based ideas. He can take in real-time GPS data and be able to send it where it needs to go at the time he wants. This means he can have the FPGA run as fast, or faster than a microcontroller.

      I work in the FPGA field, so I am a bit biased towards them. ;)

      • Not to mention you can always build a microcontroller on the FPGA if you want some of both.

      • Yeah, well when it becomes a RTOS it’ll be something different, won’t it? Meanwhile I thought maybe it was more of a classroom exercise or something.

        I’m biased towards the best solution to a problem, which includes all technologies that are available.

        I still think it would be educational to see the FPGA source code for those of us that aren’t already FPGA experts like you.

    • I have had plans to post my code a while ago, and seeing this article gives me renewed interest in discussing my code. My plan is first to just discuss my LCD controller code and then go from there. I have an article that is partly written up but I got distracted with other projects. I will try to get this posted in the next couple days.

      As I mentioned above, it is for educational purposes and I have had this FPGA for several years so it was only an investment in time for me.

    • FPGAs are definitely more expensive on a per-unit basis, but for many applications they are the best choice for performance / dollar and total energy consumed, better than equivalent DSPs (which, for those sorts of applications, are far better than any general purpose microcontroller would be). For this application … maybe not :)

  • What advantage does this project gain by using an FPGA? 57600 baud NMEA messages and a serial LCD seem much better suited to a microcontroller.

    I could understand, though, if it was an embedded host for the raw sampling tool at http://www.sparkfun.com/products/10981. That would be sweet!

    • I mentioned the benefits of an FPGA for a microcontroller in this reply.

      But I will tailor this one to your inquiry.

      FPGAs are analogous to clay. You can shape the clay to what you want, and with an FPGA you can build any system you want on it. For most cases, an FPGA is overkill, but if you get enough subsystems developed (GPS receiver, display, motor control, etc) you can basically turn a handful of microcontrollers into an FPGA (figuratively speaking). Lastly, in FPGA development, you don’t count the lines of code (it isn’t stored that way on the FPGA), you determine the LUT (Look-up Table) and SLICE counts that are being utilized on the chip. I bet you the LCD driver probably took up maybe 10% of the Spartan3.

    • I think Jon use a FPGA for the educational purpose of learning. It took 600 lines of code to write the LCD driver!

      I totally agree that a simple arduino would do the same job in less time.

      That would probably be the type of project I would do with a FPGA to get back in FPGA programming.

      • Yep, really nothing special, it is purely educational. I could have done this same thing on my Arduino in 2minutes instead of on the FPGA which took me a couple days to design on the FPGA. An important part of designing big projects is to tackle the small ones first and modularize the results. This project got me a sweet LCD controller module and a data parsing module.


This Week

This Month

Heartbleed

Happy Arduino Day!

SXSW Create 2014