Making Boards

Bad Assumption

When I first started the F18A project I figured getting a minimal FPGA board to run it on would be easy.  After all, I bought my fully loaded devboard for about $150, and the only thing I needed was the FPGA and a few connectors.

Well, I’m here to tell you it did not work out that way at all.  I spent two or three weeks (literally) searching for a suitable board.  All I needed was a 250K Spartan-3 on a small foot-print board (about the size of a 40-pin DIP) with enough configurable I/O.  I was hoping for something in the range of $40 to $50.  I could not find *anything*.  Boards were either too big, too expensive, too much extra junk, etc.  What I discovered, really, is that most FPGA boards out there are specifically “development boards”.  That’s great when you are doing development, but I was done with that part and needed a board for the final product.  I guess most companies doing FPGA design also have the capability to do board design, build and test prototypes, then manufacture thousands of units.

Reality Check

At this point I began to wonder if I could actually design a working board!  I have dabbled with making circuit boards in the past, but never anything like this.  Not one to be daunted by what needs to be done, I decided I would have to do it myself and started my check list:

1. Circuit board software

2. Prototype House

3. Part Selection

4. Parts Suppliers

5. Packaging

6. Product manuals and installation instructions

Wow!  That is a lot of stuff, and “board design” is not even on the list!  You know, sometimes being a DIY person sucks!  I’ve come to the conclusion that I’m not really good at any one thing because everything I do is always the first and last time I *need* to do something.

As a DIYer you spend a ton of time researching, reading, shopping around, etc. so you have some idea what needs to be done and so you don’t make some bad mistake; and also so you don’t feel like you are getting ripped off when you have to buy or rent tools, materials, etc.  Then you do the job, learn a lot, probably could have done a little better a second time, and took about 3 times longer than someone who does it for a living…  For example, I’m *really* good at fixing huge cracks in poured foundation walls.  But, my foundation is fixed now and I don’t have any other cracks.  Water problems, electrical upgrade for the house, bathroom remodel, cutting openings in concrete, editing home movies to DVD, making a dynamic website, running your own DNS and email server, roofing the garage, replacing an engine… etc, etc.  I won’t be doing any of that stuff again!  It is too big a pain in the ass and easier to pay someone else who does it for a living.

The problem is, it just takes too much time to get enough information and knowledge to do a job that you only need to do once, and doing my own circuit board was looking like that same kind of problem.  But, I didn’t have a choice…  well, I did (do) have a choice, which was to just not make the F18A available as a finished plug-and-play product.  I still don’t know what is driving me to do a finished product, but I’ll contemplate that later.

Software

The first problem was circuit board layout software.  Without going in to grueling details, I started with, and ended up with Eagle CAD.  Eagle is one of those programs that has been around a long time and for some reason I simply knew it existed.  They have a free version with limitations on board size and number of layers, but I was going to be well within those limits on this project.

I did try a lot of other programs though.  I probably downloaded every “free” software from the various PCB Board Houses.  Heh.  Most were a joke.  Some were OK but had limitations.  Most simply did not have the features I needed to do my design.  Funny how you can just *tell* when a program is not going to be able to do what you need; the options don’t seem to be there, the menus are missing certain items, the interface is too simplistic, etc.

I’m sure there is software that I did not try, like the sites that won’t tell you the price (because if you have to ask then you can’t afford it anyway.)  Eagle is not really cheap either (for a hobbyist) if you need the bigger boards more layers, and I wish they had another level between the free and entry-level pay version.  But, like I mentioned, the free version was going to work this time, and if there is a “next time”, maybe I’ll be able to afford entry level version.

Eagle is not a walk in the park though.  It has an antiquated interface that is left over from many years of moving through the various versions of Windows, and some things simply take getting used to, like using “cut” to actually “copy”, and “copy” for something else (I can’t remember.)  It takes some getting used to for sure and has a bit of a learning curve, but it is solid and never gives you the feeling that it can’t do something, and I never had it crash on me.  There are a lot of 3rd party “scripts” available too, for doing things like making a Bill Of Materials (BOM), exporting Gerber files (the files board houses need to make your boards), certroid data for pick and place machines, etc.

Also, the ability to define your own parts and part foot prints is fully supported and was probably the single most important deciding factor.  When I was evaluating any PCB software, the first thing I did was try to make my own part.  Why?  Because no program that I tested had all the parts and foot prints I needed to make my board.  If I could not design my own foot prints then the program was useless to me.  Most of the programs really sucked in this area, but with Eagle it was not a problem, and eventually because quite natural (which is scary.)

Part Selection (sucks)

Nothing sucks more than doing an initial search for an “smd resistor” and being presented with “256,345 results”.  Check “in stock only” and the number drops to “120,324”…  Electronic part selecting is the worse case example of too many choices, and when you do narrow things down, you are left with obscure differences between parts like Temperature Coefficient or such.  I don’t know, I just want a 100-ohm resistor!  I have not worked out the thermal dynamics of my puny little board!!

I probably spent more time trying to choose input and output capacitors for the voltage regulators.  If you read the data sheet, you will find that it is actually impossible to get an appropriate capacitor (not really, but that’s what it feels like.)  There are so many warnings, cautions, do’s, do not’s, etc. that you wonder what the hell you are supposed to use.  “If you use an XR7 capacitor instead of an RX7, then the regulator will break in to oscillation if the capacitance threshold of the surrounding traces is below 2.78pf.”  What the … !@#$% … DAMIT!

It is hard to know what is important and when, and obviously there are people out there who have to pay much close attention to this stuff, probably because they are working in Gigahertz ranges or something like that.  Me?  I just want a capacitor for the regulator that works.

Side Note:

One of the really nice things about places like Spark Fun (aside from all the other cool stuff they offer, the tutorials, etc.) is that they have already done a lot of this kind of selection for you.  They sell “general” parts that will work in most situations and you don’t have to wade through thousands of parts to find one that might work.  JameCo is anther good source for low signal-to-noise when picking parts.

Probably the worse time I had was choosing the FPGA foot print.  I wanted the board to be small, and I figured since I was going to use a board house to have the boards made, and that I would (hopefully) not be building the boards either, I could use some of those fancy Ball Grid Array (BGA) packages that Xilinx seems to be so fond of.

What I quickly learned was, Xilinx also loves the “F” word, as in “Fine”, as in “Fine Pitch” spacing of their parts.  Not too long ago SMD chips had a managable leg spacing of like 1mm or something.  Now they have 0.5mm spacing and *smaller*, and that’s what the “fine pitch” means.  In the BGA packages you can’t actually run a trace between the balls, so you *must* use at least a 4-layer board and 3/3mil space/trace widths for the exit pattern of the traces!  If you don’t know what any of that means, don’t worry, you will if you are planning on doing your own board. 😉  If not, just realize that 3/3mil is damn small, and when I went looking, not many PCB houses were doing less than 6/6mil trace/space!!  Ouch.  Only the “big boys” can afford those kinds of features, like the stuff you will see on a modern computer motherboard with 6 to 12 layers.

I was not prepared to go to 4-layers (I could not either, since the free version of Eagle only supports 2 layers), nor have parts on both sides, and needing 3/3mil spacing was going to make it impossible to find a PCB house at a reasonable price.  So, my board size had to double.  Initially I wanted to have my board the same size as the original 9918A’s 40-pin DIP package, but that was not going to happen.  Bummer.

Ultimately what I did find is that among the various densities and packages for the Spartan-3E FPGA, three of the densities (100K, 250K, and 500K) are offered that share the same physical package: a 100-pin Quad Flat Pack (QFP)!  That is very cool since it means you can move up or down through those densities without having to change your circuit board!  The 100-pin FPGA has about 60 I/O pins which is plenty for the F18A.  I was a nice discovery, and I can deal with a QFP since all the pins stick out around the edge.  Also, my Digilent devboard uses the 500K Spartan-3E, so I could use that density for my own version of the F18A for development and use the 250K density FPGA, which is about half the price, for the production boards.  I could not use the 100K density since they don’t have enough block RAM and the F18A uses the FPGA’s block RAM for the 16K of VRAM, and I’m not using an external SRAM.

The other realization I came to quickly was the need to scale back the design.  Originally I wanted to have an external SRAM to support more VRAM, a full 24-bit color output with a triple-DAC, composite and S-Video output, etc.  Each of those was an additional external chip, and that was going to chew up board space and consume more power.  The original 9918A is rated at 250ma MAX, so I needed to make sure I stayed below that, and the SRAM alone would eat up half that requirement.  Scratch external chips…

PCB Pins.  The last real pain in the ass item.  Making a “pin compatible” board that will actually plug in to a socket is an issue!  Those nice 0.1″ square break-away headers that are easy to use, cheap, and abundant, well those are too fat to plug in to a DIP socket! (I learn everything the hard way it seems… and I even own calipers!!)  It took me a very long time to find some “PCB Pins”, as they are called, and they are not mass assembly friendly.  They are small and hard to handle and assemble, so even if I end up having the boards built somewhere, I’ll probably have to hand solder all the pins on all the boards!  That sucks.  At this point I’m giving some serious thought to doing the whole assembly myself using the reflow method described on Spark Fun’s website.  We’ll see, but it is still up in the air as of now.

An FPGA Needs HOW MANY VOLTAGES??

So I picked my FPGA foot print and it was time to start doing the actual schematic and board design.  Ok, let’s see, the host system is 5V and the FPGA needs…  [looks in the data sheet]….  WHAT?!?!  A 1.2V “core” voltage, a 2.5V “reference” voltage, AND a 3.3V “I/O” voltage…  Holy crap!  I never looked.  Again I just assumed they were probably 3.3V devices.  Actually the I/O voltage can vary depending on what kind of interface voltage you need, but 3.3V is the most common, and also the maximum, i.e. no 5V I/O option.

At this point I started to worry again if I could make a board that would actually work.  The more I read in the data sheet, the more I sank.  I needed an example, and one came from the guys over at Dangerous Prototypes.

I found the Dangerous Prototypes site while searching for minimal FPGA boards to use instead of making my own.  They are an open source project site with the idea of making a new project every month (and I think they are succeeding.)  One of their projects was a minimal FPGA board (Open Bench Logic Sniffer) to host the SUMP logic analyzer core made by Michael Poppitz (who was using the same devboard I have!)  I had looked in to the SUMP project before, but thought “if I’m running the logic analyzer on my devboard, how will I use it to help troubleshoot my FPGA projects?”  I thought “the SUMP needs a dedicated FPGA board so you can move it off of your devboard”, and that’s exactly what the Dangerous Prototypes guys did.

Not only do the Dangerous Prototypes guys make the boards, Eagle CAD files, and code available, they do a really nice job explaining the design of the hardware!  Here was my example!  It was also a good boost in moral since I figured if they can do it, so can I.

The Open Bench Logic Sniffer was *almost* the board I needed, but it was specifically designed for the SUMP project, and thus not usable “as is”.  But I used their idea and knowledge as a starting point and it let me get busy with my design.  Thanks guys!

Probably one of the most important discoveries I learned from the Dangerous Prototypes site was that my FPGA (the Spartan-3E) does *not* have 5V tolerant I/O!!  Way back when I started the F18A I did not understand some of the terminology correctly.  I thought the term “LVTTL” meant the I/O was “TTL” tolerant, and thus 5V tolerant.  Oops!  The “LV” means “Low Voltage”, as in 3.3V and is not 5V tolerant.  Also, I discovered this fact *after* I had hooked my devboard directly to the 99/4A via my ribbon-cable interface!!  I was very lucky I did not blow up the FPGA on my devboard.  The only thing that saved my butt was that 74LS logic does not swing to the full 5V rail on a logic ‘1’.  Luckily it only goes to about 3.4V which the FPGA’s clamping diode could deal with.  That was close!

All I Need is the FPGA!?

What started as just an FPGA on a board seemed to grow at a very fast rate.  I quickly learned that the FPGA, aside from 3 separate voltages, also needs a ton of decoupling!  There are 4 power pins on each side of the FPGA and they all need at least 1 capacitor minimum, so 16 total.  And they are right smack in the way of the I/O pins!  Then there is the level shifter (really a 16-bit version of the LS245) and it’s capacitor used to protect the FPGA from the 5V host computer, the serial flash ROM used to configure the FPGA at power up, the 2 voltage regulators (one of them is a dual reg) and their 5 filter capacitors, the 4-bit per color resistor DAC (so 12 resistors), the VGA header pins, a JTAG pinout, an LED for a “feel good” indicator, and on, and on.

My seemingly simple requirement for “just an FPGA” has some how grown in to a BOM of about 90 parts!  It is a Pandora’s Box really, so don’t open it if your are not ready for a long journey!

V1.0

After about 2 weeks of work I was ready to have V1.0 boards made up.  I spent a lot of time reading the Spark Fun tutorials on using Eagle CAD, getting things wrong, testing, checking, figuring out errors, etc.  One of the things that was really new to me was having to hand route the whole board!  I thought I was just going to lay out the parts, get a decent looking “rats nest”, and hit “auto route”.  It did not work out so well, the auto router never finished 100%, and what it did do was not very pretty.  What I found interesting was that hand routing was not as bad as I thought it would be, and you have a lot more pride in the board.  It is like solving a big puzzle, however sometimes it can be frustrating.

I decided to use BatchPCB (a Spark Fun company) to make my V1.0 boards.  They have a totally automated process and only charge you based on the size of your board.  Since my board is only 1.3×2.5 inches, it was $8.30 + $10 shipping and handling.  The only down side to BatchPCB is waiting about 3 weeks for the boards.  But that was OK since it gave me time to watch soldering videos and built up the courage to try and solder the fine pitch SMD parts (the FPGA and level shifter.)

When the boards finally came in I was blown away.  They were so cool! 🙂  I probably inspected them for like 3 hours before I actually started building one.  It really was not too bad once I started.  I did the FPGA first, and it only took me about 20 minutes, most of which was prep work, making sure it was lined up, going slow, being careful, etc.

The level shifter was next and was actually much harder!  It is a TSSOP-48 part (pins on two sides only, like a DIP), but I did the foot print design myself and made the pads a little too small to make hand soldering easy.  I did not have that problem with the FPGA because the foot print was obviously designed by someone who had assembled an SMD board before (remember what I said earlier about doing things only once!)  V1.1 would have a larger TSSOP-48 foot print! 🙂

F18A V1.0 during assembly, all main components done

Over all it took me about two and a half hours, and most of the time ended up being spent on the resistors and capacitors (there are just so many of them!)  So, it was done, ready to be plugged in… moment of truth, would it smoke??  Power on, and… nothing.  But that was good!  No smoke means I didn’t have a catastrophic mess up, and of course it did not work because the serial flash was empty, which meant the FPGA had nothing to configure with.  So, time to program that serial flash.

Programming SPI Flash

This was another problem that ended in a lot of frustration, mostly due to my lack of understanding (again with doing things for the first time.)

I knew I needed to program the SPI flash device on my board, and I knew there were essentially 3 ways to do it:

1. Program it prior to soldering it on the board.

2. Direct SPI programming via an SPI header on the board (which I included in my design).

3. Indirect programming *through* the FPGA via a JTAG header on the board (which I also included in my design).

Option 1 was not an option.  I don’t own and can not afford a chip programmer that can do serial flash devices.  Option 3 also meant spending a good deal of money on some programmer device that I was not really familiar with.  So, I went for option 2, and I did so via another Dangerous Prototypes product: the Bus Pirate.

The Bus Pirate is a board that lets you talk directly to serial devices which include SPI flash chips.  Also, at $40 the price was right and the website said you could program serial flash chips with it…  kind of.  When it was time to actually use the thing, I found out the serial flash programming was only supported through this other open source project that had just recently added Bus Pirate support, and then only because the Bus Pirate happens to use a USB chip supported by the other project.

Crap!  This was going down hill really fast.  Now I had to go learn everything I never wanted to know about programming serial flash devices, the SPI interface, etc.  Here I had my board done, built, and ready to test, and I could not program the stupid thing!

After a lot of posting and IRC chatting, I managed to get the open source project compiled and working on my Windows box (since I use Windows for the FPGA development, I wanted to use the same workflow), I started the erase and programming…  2.5 hours later…  done.  Finally!  Holy crap!  2.5 hours??  It seems that the “easy way” to use USB is via the virtual serial port, and a common practice is this process called “bit banging” where each *bit* is sent in its own USB packet!!  Ouch!

At this point I was going insane and just pulled the trigger on purchasing the Xilinx USB-II programmer for $250.  Ouch again!  But in the mean time, while I waited for it to ship, I still wanted to test my board.

Luckily the Bus Pirate board lets you communicate with it directly, so I fired up my C editor and started writing my own program to erase and program the serial flash.  After about 2 hours of hacking I had a program that would erase and program the serial flash (using the Bus Pirate) in about 2 minutes!  Now I was pissed again because in my rage I had spent $250 that now I didn’t really need.  However, I found out later that the Xilinx programmer was a good investment anyway.

So, I loaded up the code that worked on my devboard, plugged in my V1.0 board, power on, and…  didn’t work.  Crap.  Expected, but still crap.  Troubleshooting at this point was going to be hard since I didn’t have any of the devboard’s extras to help me (you would not believe how useful a few LEDs can be!)

After a day or so I found about 3 problems and I managed to correct them all and get the board working.  My biggest error was because I over looked a problem introduced by having to add the level shifter.  Originally the FPGA’s I/O was directly connected to the host computer and the FPGA would tri-state its outputs as necessary.  When I put the level shifter in between the FPGA and host computer I forgot that I would need to extend that tri-state control to the level shifter.  That problem had to be solved with the addition of a discrete AND gate, which meant *another* part added to the board.  The rest of the problems were corrected with cutting traces and some 28-gauge wire-wrap wire.  The working board was quite a sight with a full size 14-pin DIP hanging off of it, and white wires running all over.  But it worked and paved the way for V1.1.

4 comments to Making Boards

  • Leonardo

    Why you haven’t bought another development board… 🙂

    • John

      “FerChaner pseudo-tard smile”

      Tl;dr… Short answer – reread above Leonard. Too much junk, too expensive or poor quality.

      Long answer – an real engineer knows you can only pick 2 out of 3: Good. Fast. Cheap.

      If it’s good and fast, you going to be broke.
      Fast and cheap. It’s a piece of sh1t.
      Good and cheap. It’s not fast. Either you have to buy some old crap.
      OR build it yourself!

      Awesome blog entry Matt keep writing and building stuff!
      F that pseudo-intellectual retard and his ilk.

  • […] clock speeds I'm thinking about, to not require the full-blown techniques in this guide, since this guy seems to have been able to do it himself with no prior […]

  • Howard

    This is interesting stuff! I’m working on my first small SoC design at the moment, and oscillating between using an existing FPGA board with nothing but the chip, flash and header pins, and then stacking a ‘shield’ of my design for my I/O, or actually making a single PCB with it all on.

    With the Lattice MachXO2, you get the config flash and oscillator built-in and the chip is about $15 for 7000 LEs on a TQFP, so it really could be relatively few parts… Lattice and ebay/Altera both have these tiny (2×3″) boards for this kind of thing. I guess the XuLA is similar for Xilinx.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">