Where has Chris been?

I have to apologize for being away from blogging for an extended period of time. Unfortunately, other priorities in life have gotten in the way of my Idle time.

Much of my time has been divided between preparing for my Wedding which is coming up next month, and working on my house, most of which isn’t great subject matter for Idle-Logic.com.

One accomplishment completed in the last month that I’m particularly proud of is finishing the Colorado Half Marathon with my fiancé Katie… 13.1 miles!

I’ve also started up the Integrated Circuit Design and Techniques online Professional Certificate program from UC Berkeley. Starting with the first class Fundamentals of Integrated Circuit Design. I think this will be a great way to keep my mind sharp and progress my career. I’ll share more thoughts and details about this in later postings.

At the end of this month I’ll be presenting a paper/poster on Power Electronics Control to Reduce HDD Acoustics Pure Tones at the IEEE COMPEL Conference, so if by some chance you are going, please stop by and say hi.

Now, back to business…

I’ve been working on getting the Cyclone II to work with a 16×2 LCD. I have a nice demo prepared, but I managed to blow up the LCD’s backlight. It turns out that, despite the silkscreen saying “5V”, the spin was supposed to be connected to a 3.3V supply only. Whoops. I’ll post the demo here soon, whether on a new LCD, or on my current one, sans backlight.

Also, I’ve been playing with the FT232RL (with a nice breakout board from SF) to add USB connectivity to the Cyclone II. More to come on that soon.

That’s all for now. See you back here shortly.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Configuring the Cyclone II

Here is a quick tutorial to demonstrate how to create a new Quartus II HDL project, compile it, then download it to your device.

Before we start there are a couple of prerequisites you’ll have to take care of first if you wish to follow along.

  • Obviously, you will need to get your hands on a Cyclone II. If you’ve been reading some of my other blog posts you’ll know I’m using this setup. Your results will vary with different setups.
  • Download and install Quartus II FPGA design software here. The Web Edition is $free. (The main drawback is the free edition only works with Windows). Feature Comparison
  • If you’ve never worked with an FPGA, or any HDL language, go start working your way through the Altera training courses. They have an entire curriculum with all the information you’ll need to know to work with the Quartus II software. Once you get about 50% through the The Quartus II Software Design Series: Foundation class (and its “prerequisite” classes), then you’ll understand pretty much everything in this post.
  • (As a heads up, take the Verilog course instead of the VHDL one, since that is what I’ll be using ;-) )

Quick disclaimer: the following directions are based on using Quartus II 9.1sp1 software.

Okay, to start off, lets open Quartus II and create the software for our “Hello World” demo. Next, we’ll setup our hardware, and then download the configuration file.

The project we will be creating is the same shown in my previous demo. Essentially we’ll divide down our input clock, which is running at 48MHz, to something like 1Hz. We’ll connect a multimeter to the FPGA’s output and watch it toggle between High (3.3V) and Low (0V). I know it’s not the most exciting project, but sometimes you have to Shave a Yak before you can make something awesome.

Software Setup:

1. Open Quartus II, and create a new project. (File > New Project Wizard...)

2. Enter the path and name information for your project, and click Next:

3. Skip the Add Files [page 2 of 5] step, we’ll create our own files in a few steps.

4. Select the device we are targeting, we are using the EP2C8Q208C8, and click Finish (we’ll also skip the “EDA Tools and Settings” setup page):

5. Now you should have something like the following:

6. Quartus requires there to be some top level file for which your entire project is derived from. I prefer to use a Schematic document as the top level, this serves as a nice block level overview of the project and its contents. Plus I feel it is a lot easier to connect the wires an buses between the blocks and I/O pins.

So create a new Block Diagram/Schematic File. (File > New)

Now you’ll have an open document called Block1.bdf. Were not going to play with this document quite yet, so go ahead and save it to disk. We’ll come back to it in a little while. (File > Save As...). I recommend saving it with the same name as you chose in step 2. This will automatically select it as the top level file for your project.

If you save it with a different name, you will need to assign it as the project’s top level document by clicking the Files tab in the Project Navigator, then right-click on your Schematic file and click Set as Top-Level Entity, like so:

7. Now we need to add some meat and potato to this project, lets write some HDL to divide down the input clock (48MHz) down to something we can actually observe with our eyes (~1Hz).

Create a new Verilog file (File > New... > Verilog HDL File), and save it as SlowClock.v (File > Save As...)

8. Copy and paste the following code into your newly created SlockClock.v file:
SlowClock.v

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//Generate a very slow clock from the 24MHz input clock
module SlowClock(clock_in,clock_out,hi_out);
	//Input Ports
	input clock_in;
 
	//Output Ports
	output clock_out;
	output hi_out;
	//Port Definitions
	wire clock_out;
	wire hi_out;
 
	reg [26:0] counter; //Clock Divider
 
	//Set the output pin to the MSb of the counter.
 
	assign clock_out = counter[26]; 
	assign hi_out = 1'b1;
	//Essentially the counter counts up to 2^27, 
	//	then clock_out flips polarity	
	always @ (posedge clock_in) begin 
		counter <=  counter + 1;
	end
 
 
 
 
endmodule // End of Module counter

Now you should have something like this:

9. Okay, now that we created the SlowClock.v code, we will need to generate a Symbol File from the code, so that we can drop it into our top-level Schematic

In the Project Navigator, click the Files tab. Then Right-Click the SlowClock.v file, and click on the Create Symbol Files for Current File. Quartus will churn through the Verilog file for awhile and return a message box indicating success, or a failure if there was an error during symbol creation.

10. Now that the symbol file has been created let’s drop it into the top-level schematic. Re-Open the Hello_World.bdf file. Right-Click anywhere on the schematic and click (Insert > Symbol...). Open the Project folder and highlight the SlowClock item, then click OK. Then in the schematic file, click anywhere to place the SlowClock block:

You should have something like this:

11a. Next we need to place some I/O pins into the schematic. Again right click on the schematic and click (Insert > Symbol...). Navigate to the (primitives > pin) and select and place an input pin:

11b. Repeat step 11 but place an output pin, you should now have something like the following:

12. Next we need to connect the pins to the block. When you put your mouse next to the pin or block, the mouse will change to the node tool.

Connect the input pin to the clock_in, and the output pin to the clock_out.

13. Double click on the “pin_name” and “pin_name1” in order to rename them to something more useful. Try clk, and clk_out:

14. Now that we have the pins placed, we need to assign those pins to actual physical pins on the hardware (on the Cyclone II FPGA). The tool for this is the Pin Planner. But before we use that tool, we need to tell Quartus to analyze the files in order to make our input/output pins we placed available in said Pin Planner tool.

Click on the Start Analysis & Synthesis tool in the toolbar:

Quartus will churn for awhile, then report it’s success or failure.

15. Next, open the Pin Planner tool. (Assignments > Pins...):

16a. For the clk node, double click the Location text box, and assign it to Pin 77:

16b. Next, set the clk_out node to Pin_59:

17. One last step left for the software setup. Close out of the Pin Planner. Now we can do a Full Compile of the project to generate the configuration file. The configuration file is what we download to the FPGA.

Click the Start Compilation button in the toolbar:

Quartus should grind for awhile and eventually give a popup declaring success.

Hardware Setup:

18. Connect the 48MHz clock to Pin 77.

19. Connect your multimeter to Pin 59.

20. Connect your Altera Programmer to the FPGA breakout board’s JTAG port, then connect it to your computers parallel port.

21. Turn the power on. (3.3V VCCIO, 1.2V VCCINT)

Easy as that, now we can download the configuration file and were done.

Programming the Cyclone II:

22. Back in the Quartus II software, run the Programming tool (Tools > Programmer).

23. Make sure you are configured to use the ByteBlaster configuration hardware.

(I ran into some problems with this step. Turns out my Parallel port was disabled in the Bios. Once I enabled the port in the Bios, I had to uninstall and re-install the Parallel port in my Windows Device Manager.

24. Click the Start button to download the configuration file to hardware.

You should now have project running and hopefully it looks like this:

(If it does, feel free to give off an evil-mad scientist laugh at this point. Good work!).

Hopefully that helps you get up and running with the Cyclone II FPGA. Feel free to leave some feedback in the comments section about how this process went for you. Let me know if you run into any problems along the way. Good Luck!!

You can download the Quartus II Project I created for this demo here:

Download
Hello World Quartus II Project
(Hello World Quartus II Project.zip)

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Cyclone II – Bill of Materials

Three months ago I was staring at the Cyclone II FPGA Breakout board from SparkFun wondering what in the world I needed to do to make it work. If you’re wondering the same thing right now, well then you’ve come to the right place.

In this post I’m going to put together a list of all the materials you’ll need to purchase in order to take the helpless Breakout Board from SparkFun, and turn it into a useful working device.

Enough blabbing, time for the Bill of Materials. I’ve put together all the items, with links and prices along with a nice image to show you the layout:

Cyclone II break out board materials

Materials Assembled

Bill of materials:

Part# Name Price
BOB-08596 Altera Cyclone II Breakout Board $79.95
PRT-00114 5V Breadboard Power Supply $9.95
PGM-08705 Altera FPGA Compatible Programmer $14.95
TOL-00298 Wall Adapter Power Supply – 9VDC 650mA $5.95
CAB-00064 Parallel Cable DB25 M/F – 6 Foot $4.95
PRT-08535 2×5 Pin IDC Ribbon Cable $1.50
PRT-00444 Standoffs – Plastic Short $1.95
PRT-00447 Screws 4-40 Thread $0.95
ECS-2200B-240 24 MHz Clock $2.63
LT1084CT-3.3#PBF 3.3V Linear Regulator $8.00
LT3080ET#PBF Adjustable Linear Regulator (1.2V) $4.38
PRT-09140 Jumper Wires Premium 6″ M/F Pack of 10 $3.95
PRT-00116 Break Away Headers – Straight $2.50
*Resistors and Capacitors:

1uF, 2.2uF, 10uF, 22uF

120kΩ, 100Ω
~$2?
Total $143.61

The Cyclone II breakout board comes pre-soldered down so you don’t have to worry about that, the 5V Breadboard power supply requires about 10 minutes of simple soldering, and everything else can be used on a breadboard/protoboard.

Overall it’s a pretty small component count. The price is a little high at this time, but there is plenty of room for optimizing, and cheapifying. I’m currently working on building a cheap USB solution that, if everything works out, will also be able to configure the FPGA, therefore you shouldn’t need the programmer/DB-25 cable. The regulators I picked out are pretty expensive, and we could probably cut that price in half.

The eventual goal is to build a custom PCB, very much like the Arduino “Shields”, that will mate with the Breakout Board. I’ll then be building secondary shields for my different projects, all which will be used in combination with a primary power/usb/clock shield. This will give the maximum amount of flexibility that the off-the-shelf FPGA demo boards can’t offer. Maybe I can even spin a few boards for fellow hobbyists. I doubt my FGPA Shields will ever get as much traction as the Arduino, due to the relative complexity between Wiring and Verilog/VHDL.

Be sure to check out my previous posts where I discuss why these parts have been picked out, or why they are required to make the system work. Plus, be sure to check back in for an upcoming blog post about how to generate and configure a “Hello World” example.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Cyclone II Breakout Board – “Hello World”

I threw together a quick demo to prove to myself that my FPGA was powered and working. It was important that the demonstration used some form of sequential logic, so that I could be sure the clock was alive and running as well.

The ideal quick and easy first project would be to just output the clock signal into a pin and drive an LED. Unfortunately, my eyeballs can’t register a 24MHz signal and I didn’t want to waste time messing around with an LED. (It’s important to ensure we don’t over draw current from the FPGA’s logic pins, so directly driving an LED, even with a current limiting resistor, is not a great idea).

I ended up with the slightly less exciting compromise of using a counter to divide the clock down to ~1Hz, and a multimeter to display that the logic level is changing. Exciting? Not so much, but suitable for a nice “Hello World” program. Besides, I picked up a Serial Enabled LCD display for the next demo, and then I’ll be able to actually display “Hello World”, that should be slightly more flashy :-)

And now for the demo… Watch the multimeter switch from a High Logic Level (~3.3V), to a low logic level (~0V):

Here is a look at the Verilog HDL source code driving this demo:
SlowClock.v

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//Generate a very slow clock from the 24MHz input clock
module SlowClock(clock_in,clock_out);
	//Input Ports
	input clock_in;
 
	//Output Ports
	output clock_out;
 
	//Port Definitions
	wire clock_out;
 
 
	reg [26:0] counter; //Clock Divider
 
	//Set the output pin to the MSb of the counter.
	assign clock_out = counter[26]; 
 
	//Essentially the counter counts up to 2^27, 
	//	then clock_out flips polarity	
	always @ (posedge clock_in) begin 
		counter <=  counter + 1;
	end
 
endmodule // End of Module counter

There is a lot more details on how to go about setting up the code, getting it compiled, assigning the pins and finally programing the FPGA. Upcoming blog posts will cover all those juicy details. Also, I’ll put together the full Bill of Materials (BOM) that I promised previously.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Cyclone II FPGA Clock Selection

Time to take a look at clocks, and what exactly we need for the Cyclone II FPGA.

I’ve spent considerable time digging around in different corners of the internet trying to find good advice on selecting a clock for my FPGA without much luck. So, I decided to get my hands dirty and figure it out on my own.

Like my regulator design, the goal was to keep the component count and number of wires to a minimum. I want to make sure the core FPGA system simply works always. Keeping the base FPGA design simple lets me spend more time worrying about the new circuits I’m designing, rather than worrying about if some wire got dislodged in my setup.

The idea is to keep improving on the design in small steps; get a simple solution working, then in an iterative process, continue to improve on it. This sort of incremental design technique will help save a lot of time debugging, and headaches in the future.

Perhaps I’m a little OCD, but I’m pretty sure the following picture is what nightmares are made of, good luck trying to diagnose and fix the problem if one of those small wires falls out:

Breadboard Horror

Breadboard Horror

Okay, now take some time to recover from the cold sweats and uncurl from a ball, and we’ll move on….

FPGA clock selection is very similar to selecting a clock for a microcontroller. If you hunt the internet for tips on selecting a clock for an FPGA you won’t find much information. However, if you search for microcontroller clocks you’ll have more luck.

To summarize some information found in a Maxim Application Note, there are two major types of clocks for Microcontrollers/FPGAs: mechanical resonators (crystal & ceramic) and electrical phase-shift circuits such as RC oscillators.

The mechanical resonators offer high initial accuracy, and small variations based on changes in temperature, while the oscillator circuits suffer from poor accuracy related to temperature and supply voltage variations. In either case, complex circuits must be designed and tuned, including resistor/capacitor or op-amp selection.

Instead of trying to design my own clock circuit, I decided to opt for a clock module. These modules incorporate all the complexities of the clock design into a single integrated package. They come in both flavors, mechanical resonator, and integrated circuit oscillators. One of the major trade offs for using a module is they generally are higher in cost, but since I’m not doing any mass production at this point, I don’t mind paying a little bit more.

Clock Module

The next important decision for selecting a clock is picking the frequency. The max allowable frequency for the FPGA is bound by the I/O Standard you use for the clock’s input pin. I’m going to use 3.3V TTL level I/O, so the max frequency I can input is 340Mhz. (See page 5-47 of the Altera Cyclone II Handbook). In order to avoid generating a lot of high frequency noise on my Breadboard, I want to use a much lower frequency input clock, then use one of the Cyclone II’s PLLs to kick up the clock frequency internally.

Since I plan to get a USB interface working for the FPGA, I decided to pick a 24MHz clock, since 24Mhz, multiplied by two (using the second PLL) will give me the USB standard 48MHz clock I need. Once I create a PCB for my Saturn Project, which should be much more immune to noise, I will probably use a 48MHz clock in order to free up one of the PLL’s.

After much hunting, I ended on the 24MHz ECS-2200, 3.3V Clock Oscillator Module from ECS Inc. Here is the datasheet. It is a fat, ugly looking little DIP, but it only cost $2.63, so it will suffice. It has four pins: supply voltage, ground, output, and a disable signal, no external components required.

Currently, I do not own a scope so I can’t display any pretty waveforms of the clock in action, so I guess I’ll have to put together some sequential logic demonstration to show that it is working.

Here are some links that might be useful, related to clocks:
Crystal oscillators
Ceramic resonator
RC oscillator
Advanced Clocks Tutorial

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Cyclone II Voltage Regulators

Saturn Project Logo (Beta)
I decided to interrupt my Cyclone II Handbook dissection series in order to build the voltage regulators needed for the Saturn Project.

The EP2C8 Cyclone II FPGA we have on our breakout board requires nine voltage supplies:

Voltage Supply Name Description Voltage Level
VCCINT These are internal logic array voltage supply pins. VCCINT also supplies power to some of the input buffers 1.2V
VCCIO[1:4] These are I/O supply voltage pins for banks 1 through 4. Each bank can support a different voltage
level. VCCIO supplies power to the output buffers for all I/O standards.
1.5V, 2.5V, or 3.3V
VCCA_PLL[1:2] Analog Power for the PLL’s.

Connect these pins to 1.2 V, even if the PLL is not used. Power on the PLLs should be decoupled.

1.2V
VCCD_PLL[1:2] Digital Power for the PLL’s.

Connect these pins to the quietest digital supply on board (1.2 V), which is also supplied to the
VCCINT, even if the PLL is not used. Power on the PLLs should be decoupled.

1.2V

Fortunately we can minimize the overall number of voltage regulators required by using a single regulator for the 1.2V supplies, and another regulator for the I/O supplies. I have some concern about noise coupling between the different analog and digital supplies, though our breakout board does have some decoupling capacitors. I’m thinking this should be adequate for our prototyping setup.

Breakout Board Supplies

Breakout Board Voltage Supplies Schematic

For future reference, the Altera Cyclone II Handbook has some guidelines for isolating the PLL power supplies at the PCB level:

Isolate the power connected to VCCA from the power to the rest of the Cyclone II device or any other digital device on the board. You can use one of three different methods of isolating the VCCA pin:

  • Use separate VCCA power planes
  • Use a partitioned VCCA island within the VCCINT plane
  • Use thick VCCA traces

I decided to pick up a SMPS wall-wart to step down and rectify the mains (120VAC) to 9VDC. The clock I picked out happens to need a 5V supply, so the 9V wall-wart is then connected to a 5V Breadboard power supply from SparkFun. (Plus, having a 5V rail will no doubt come in handy some day).

After selecting the components mentioned above, I moved on to select two linear regulators to supply the 1.2V and 3.3V, both of which are powered from the 5V Breadboard Power Supply. My main design goal for these regulators was to minimize the component count for simplicity sake. Have a look at the schematic below, and you can see I only needed 4 caps and a resistor.

Saturn Project - Regulator Schematic

Saturn Project - Regulator Schematic

I used a LT1084-3.3, and a LT3080.

The 1.2V regulator can draw up to 1.1A, and it doesn’t require a heat sink (Although, I might add one depending on how hot it gets). It has less than 1mV load regulation and <0.001%/V line regulation. One important thing to note is that this regulator has a minimum of 500uA output current required for proper operation. If you don’t meet this constraint, the output will swing to ~3.3V and possibly damage the FPGA. For the time being I decided to stick a 1kohm resistor on the output to sink 1.2mA just to be safe. Since I’m still in the prototyping phase I can’t be certain of the regulator start-up sequence, or what the quiescent current consumption of the VCCINT rail will be.

There isn’t anything too exciting about the 3.3V regulator, Linear Technology claims “higher efficiency” than other products on the market. It can supply up to 5A, which should be more than enough juice to power our FPGA and other fun circuits down the line.

Using LTSpice (a free, awesome, circuit simulator tool), I put together the schematic shown above, and I’ve made it available for download. I recommend playing around with it, try removing the load on the 1.2V regulator and watch what happens to the output. You will probably need to “install” the LM317 spice model which I’ve included (check out the readme.txt file for instructions).

Download the LTSpice Power Supply Schematic:
Download
SaturnProject – Power Supply Schematic
(SaturnProject_PowerSupply.zip)
Includes the LM317 SPICE model.

Now that we’ve covered all the details, let’s get some satisfaction and check out the regulators in action!

Once I get to the point where I put together a custom PCBA, I’m sure I will revisit the regulator design and put together a more robust solution with surface mount components. Including some circuits to protect against over/under voltage situations, spikes, and accidental shorts, but in the mean time… we’re in business!

Next week I’ll show you the system clock I selected, and return to my handbook dissection and see what it takes to download a configuration file to the Cyclone II and start putting it to work. I’ll also put together a full bill of materials (BOM) so you can pick up all the components I’ve been talking about.

Another note for future reference…. Each of the CII supplies use more than one pin, here is a list of the those pins (so I don’t try to use them for I/O later and blow up the FPGA :-) )

  • VCCINT – Pin 32, 66, 79, 120, 178, 190,
  • VCCIO1 – Pin 7, 29, 42
  • VCCIO2 – Pin 166, 172, 183, 194, 202
  • VCCIO3 – Pin 109, 122, 136, 148
  • VCCIO4 – Pin 62, 71, 83, 91, 98
  • VCCA_PLL1 – Pin 53, (54 – GND_A)
  • VCCD_PLL1 – Pin 51, (50, 52 – GND_D)
  • VCCA_PLL2 – Pin 157, (158 – GND_A)
  • VCCD_PLL2 – Pin 155, (154, 156 – GND_D)
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Dissecting the Altera Cyclone II Handbook – Part 2

Welcome back to the second part of the series dissecting the Altera Cyclone II Handbook. I’m ripping out all of the important information you need to know from the 470 page tome, and condensing it down to a couple of blog posts. This week I’m going to take a look at the clocks and PLL blocks.

One of the major problems you run into when designing sequential logic, is clock skew. Essentially you can have a situation where one clock signal is driving multiple Flip-Flops across the breadth of the IC, because of delays inherent to the routing circuits as well as the laws of physics, some delay (skew) can be introduced between the signals. You might think that two Flip-Flops are clocking in data at the exact same time, when in reality they are not. Check out the links I sprinkled into this paragraph for more details.

Cyclone II - Clock Resources

The Cyclone II (like most, if not all FPGAs) comes with dedicated global clock networks which give us a more even distribution of clock signals. This can help us to overcome the issues mentioned above, but it is important to note that while they help alleviate timing violations, they won’t completely eliminate the problem. It is up to the user to analyze the design, with the help of the software tools, to ensure it will be robust and hardened against these timing problems.

The global clock networks can be used not only for clocks, but also for asynchronous clears, presets, and clock enables signals. Each of the CII global clock networks has its own clock control block, which is in charge of multiplexing the selected clock onto the network (or disabling the clock, for power-saving modes).

The CII has both dedicated, and dual-purpose clock pins. Both of these types of clock pins can drive the global clock network, or be used for general purpose I/O. It is also possible to drive the global clock networks with internally generated signals (think reset or clear signals), or be driven by the PLLs.

The high level block diagram I presented last week shows 4 PLLs, but in actuality we get two with our EP2C8:

Cyclone II - Clocks

Some of you might be wondering what in the heck are PLLs? A PLL or a phased-locked loop is, in general, a “control system that generates a signal that has a fixed relation to the phase of a ‘reference’ signal”. To be more specific to our FPGA, the PLL is a logic block that will take an input clock (or signal) that we provide to the circuit, and can manipulate it in order to obtain a new clock signal which is scaled or phase shifted.

For example, you could connect a 24 MHz clock to the FPGA, and have the PLL’s kick it up to a 48 MHz clock. Here is a table showing the CII PLL features, take note of the m and n scale range, this lets you know what clocks frequencies you can generate:
CycloneII - PLL Features

Well, that will about do it for this week. Check back next time, where I’ll go over how to generate the FPGA’s configuration (Quartus II) and show you what you need to know to download the configuration file into the FPGA.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Dissecting the Altera Cyclone II Handbook – Part 1

The Cyclone II Handbook, Volume 1 has 470 pages. There is a ton of great information in that document, but in an effort to make it more digestible, I’m going to try to break it apart and present some of the more vital information it contains.

The Handbook is a general guide to the full line of Cyclone II products, which come in a variety of “flavors”. Each with a confusing serial number to distinguish them from their siblings.

(For the sake of brevity I’m going to start referring to the Cyclone II, as the CII.)

Here is a breakdown of the different flavors we have. (I highlighted the particular CII that comes with our breakout board)

Not only are there different versions with different feature sets, but we also have different speed grades, and package selections:

You can see we have one of the smallest and slowest FPGAs available in the family, but at this point it will take us a long time to max out its capabilities. Probably the most important part for us to worry about is the package type, our 208 pin QPF package is manageable, albeit tedious, to hand solder. Once we start thinking about the larger Ball Grid Array (BGA) packages we will need to investigate different soldering techniques. (In fact, the reflow soldering method it really the way to go even with the QFP, so I’ll mark that down on my list of things to learn how to do.)

Back to the Handbook… The second section describes the overall architecture of the Cyclone II:

Cyclone® II devices contain a two-dimensional row- and column-based architecture to implement custom logic. Column and row interconnects of varying speeds provide signal interconnects between logic array blocks (LABs), embedded memory blocks, and embedded multipliers.

Here we have a high level block diagram of the core components of the CII:

Within the Logic Arrays are the Logic Elements (LEs), which are the basic building blocks for the core logic, the “atom” of the FPGA if you will.
Each Logic Element provides the following functionality:

  • A four-input look-up table (LUT), which is a function generator that can implement any function of four variables
  • A programmable register
  • A carry chain connection
  • A register chain connection
  • The ability to drive all types of interconnects: local, row, column, register chain, and direct link interconnects
  • Support for register packing
  • Support for register feedback

Let’s have a look at the internal structure of the Logic Elements, but don’t worry we won’t even have to think about the internal workings of the LE, rest assured the software we will be using takes care of all the complexities, we just have to specify what Flip-Flops and Gates we want.

Cyclone II - Logic Element

The CII comes with embedded memory and multiplier blocks. Each of the multiplier blocks allow us to create up to two 9 × 9-bit multipliers, or one 18 × 18-bit multiplier.

The memory blocks (M4K), are true dual port memories, meaning you can read and write at different addresses simultaneously if you want. Each block allows 4K + parity totaling 4,608 bits of memory. (Our particular CII contains 32 M4K blocks).

The next component of our FPGA is the I/O Elements (IOEs), which are actually quite complex. They support multiple different Input/Output standards, 3.3/2.5/1.8/1.5 TTL, differential I/O, and bunch of other standards I’ve never heard of. The IOEs have different advanced options like slew rate control, drive strength selection, programmable pull up resistors, bus-hold and open-drain output.

One of the coolest things about the IOEs is that they are grouped into four different banks (eight banks on the larger CIIs), and each bank can be powered by a separate supply voltage. This is great if you want to interface with one IC running at 3.3V and connect to another at 1.8V with no need for level-shifting hardware! Each bank has its own VCCIO pin for the appropriate supply voltage, while the core FPGA logic is driven by an additional VCCINT supply (1.2V).

All of these different components inside the FPGA are connected by a “fabric” of interconnections and routing assets, which are described in detail in the handbook. Fortunately for us, we can just allow the software to take care of all the signal routing.

That wraps up this week’s dissection. Tune in next week for Part 2, where we will take a look at the PLLs and the clock tree structure.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Introducing: The Saturn Project

Saturn Project Logo (Beta)

First Draft: Saturn Project Logo

I’ve always been amazed at the power and most importantly the flexibility of an FPGA (Field-Programmable gate array). I first learned about the FPGA after spending uncountable hours connecting jumper wires between several 74xx series IC’s in my undergrad digital logic course.

One giant pile of reconfigurable logic. Brilliant! Goodbye hours of tedious, mind-numbing wire jumpers and handfuls of discrete IC’s. Hello satisfyingly fast, rapid development!

My first thought was how do I get my hands on one of these FPGA widgets? It turns out that the easiest way is to shell out anywhere from $100 to $10,000 (I kid you not) for an evaluation/development board.

These development kits are great for getting you up and running: Plug in the power, the USB programming cable and type out some Verilog code and you have a sweet blinky light! However, the main problem with the development board is that it encapsulates all the details of the FPGA behind the curtain. These dev boards leave a large gap between learning the basics, and actually developing a standalone project.

Enter the Saturn Project.

A few months back I came across an excellent breakout board for the Altera Cyclone II FPGA over at SparkFun. Coming in at just $79.95, this will be a great starting point to prototype standalone FPGA projects. Down the line when you want to buy the FPGA by itself, it will cost you about $20 and comes in a QFP package, which means it’s hand solderable!Altera Cyclone II Breakout Board

The goal of the Saturn Project is to create a core FPGA architecture that will allow me to quickly develop derivative projects. The focus of the Project is to get an FPGA workhorse, with all the proper voltage regulators, clocks and a USB interface to my PC, with fast data transfer rates. Some additional possibilities include on-board FPGA configuration, wireless connectivity and ARM/PIC interoperability. (Don’t want to have a separate ARM/PIC IC? You can drop a RISC soft-processor into the FPGA!)

Once this main project is completed, I can move onto some of my more ambitions ideas.

It has taken me awhile to get all this going, but now the Adventure begins…

Just to give you a taste, some of the project ideas I have floating in and around my brain:

  • Real Time Video and Image capture and processing.
  • Playing around with Analog-to-Digital Converters… hopefully culminating in a waveform capture tool (Read: cheap mixed signal oscilloscope).
  • LED/LCD Drivers.
  • Wireless Mote Data Logging
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Happy Holidays!!

smile_santa
The blog is getting to the point where it’s ready to go. As the New Year rolls in I will get to work on updating the site more frequently. The first order of business is to start blogging about my Saturn Project.

Come back soon, until then, enjoy the Holidays!!

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)