EECS 373 Lab 1: Introduction to the Core Lab Equipment and SmartFusion FPGA Hardware Development Tools

9/13/2012

Schedule

See posted lab schedule for due dates, in-lab, and post-lab due dates.

Objectives

In this lab you will learn to:

  1. Use Microsemi's integrated design environment (Libero) to implementing a simple logic function in the FPGA hardware.
  2. Make basic signal observations and measurements with the Logic Analyzer, Oscilloscope and Multimeter.

This lab reference guide "Libero Project Flow Reference Guide" is quite lengthy because of the many screen shots and detailed procedures. This is a necessary introductory phase to get you acquainted with this application. While the document is long, you should be able to finish the In-lab section within the lab period. You may also get a good start on the Post Lab assignment, but will likely have to finish outside the lab period. You will be given 24 hours access to the lab the first lab period via keypad entry so that you may use the lab at your convenience. There will also be additional supported open hours that will be posted on the course web page.

Pre-Lab Assignment

There is no Pre-Lab assignment for this lab. The lab requires no preparation; however, consider:

  1. Reading through this lab document.
  2. Watch SmartFusion Intro Video (see SmartFusion link in references at the end of this document).
  3. Installing SmartFusion Development Tools on your PC (see SmartFusion link in references at the end of this document).

In-Lab Part 1: Implementing Simple Hardware

This part of the In-Lab consists of a reference design. It is a simple example that will give you an opportunity to see how the tools fundamentally work. The Post lab assignment is a simple variation on this example to reinforce your understanding and is due by the following lab.

Follow the EECS 373: Libero Project Flow Reference Guide's detailed flow section (located left column of the lab web page below lab assignments)  to create a Verilog module that drives two leds. LED1 is given a high signal (1) when the two switch inputs are ANDed. LED2 is given high signal (1) if the two switch inputs are ORed.

Do the following within the guide (don't do the crossed out sections):

  1. Quick Flow
  2. Detailed Flow

You will notice something odd. The two LEDs behave exactly opposite! This is because both the switchs and the LEDs are active low. That is, the switch sends a high (1) signal by default and goes low (0) when pressed. Similarly, the LED is OFF when it receives a high (1) signal and ON when it receives a low (0) signal.

For the post lab, be prepared the answer the following question. What is the simplified logic expression with both the inputs and outputs inverted? (Hint: Consider DeMorgan's Laws)

In-Lab Part 2: Modify AndOr Verilog

Rewrite the AND and OR logic inside the module using a combinational logic always@* and if/else blocks. Assign statements are simple and nice. However, it's hard to express complex logic with them. You will need to know always@* blocks for postlab.

regs ...

always@* begin

defaults...

if() begin

end

if() begin

end

end

In-Lab Part 3: Basic Lab Instrument Operation

Each work station is equipped with a set of basic lab instruments that you will use in conjunction with the microprocessor development system tools.   Each station has an MSO (mixed signal oscilloscope), signal generator, digital multimeter and triple output power supply. The lab also has several portable USB based 8 channel logic analyzers that you can check out of the lab for project work at home or other purposes.

In-Lab Part 3: The Mixed Signal Oscilloscope

Each work station is equipped with a Agilent MSO-X 3012A mixed signal oscilloscope. This is probably the most useful and complete instrument on the workstation. The MSO-X is capable of observing 2 analog signals and 16 digital signals simultaneously. So it can behave like a basic analog signal scope and 8 channel logic analyzer. It also has a fairly good signal generator and digital voltmeter built in too. 

For starters, we will just use the scope to observe some simple analog signals. In the following section we will observe a basic sine wave generated from the signal generator so you can get a quick introduction to each instrument.

For more detail on the scopes operation, you should try the following exercises in the Agilent's training guide manual at  Training Guide.


It is not necessary to do this in the lab today, but you should consider coming into lab when you have some free time to run through them. Of course, reference the manual as need be. The scope also has an excellent help function. Simply push the help key (lower left) and you will be provided instructions.

In-Lab Part 4: Observing a Sine Wave with the Oscilloscope

Step 1: Agilent 33220A Waveform Generator Setup

Next we will use the Waveform generator to generate a sine wave and view it on the scope. First turn on the Waveform generator with the power button. Next, select Utility, then System Output using the blue buttons. Select High Z for load and hit Done.

1.1) Next, hit the Graph button. Then tap the Ampl button twice until it changes to HiLevel.

1.2) Next, select 3 V using the number pad on the right and the blue button.

1.3) Finally, set the LoLevel to 0 V using the number pad. Don't turn on the output yet.

Step 2: Settuing up the Scope


2.1) Connect a three way BNC adapter to the function generator. Connect one BNC cable to the scope's channel one. Connect another one to the Red/Black pin adapter, which will be used with the Logic Analyzer later. Now turn on the Function Generator's output.  Then hit Auto-Scale. You should see the following trace.



2.2) This is a screen shot  from the scope. If you have a USB flash drive, you might want to try saving. For this post lab and others you are asked to provide screen shots.

2.3) Try Some Basic Triggering

Auto Scale will put the scope in Auto trigger mode or will cause the scope to constantly trigger or display what is applied to the input. Turn off the signal by toggling the signal generator OUTPUT button. You should notice that the scope shows a flat line at the zero volts or ground level.

Sometimes it is desirable to capture a single event. For the post lab will observe the electrical signal that occurs as a consequence of mechanical switch bounce. This a transient condition and will only be available for short time. If we were to use Auto trigger mode the display would soon replace transient condition with a steady state signal. We can capture the transient with the normal trigger mode. In the trigger functions box, select Mode/Coupling. On the lower left you will see the menu Mode Auto menu appear. Select with the soft key below. You can choose the setting by rotating the Push to Selet Knob (center with grey background) pushing to select.



Try turning the signal on and off again. You will see the sine wave stays on the screen. This is because in normal  trigger mode the screen is not refreshed automatically. It is only refreshed when a signal is present. In this way you can capture transients like the switch bounce we will observe in the post lab assignment.

In-Lab Part 5: Observing Logic Function with the Logic Analyzer

What is a Logic Analyzer?

Logic analyzers are used to verify logic functions by observing logical signals as we did with the oscilloscope. The big difference is that you can observe many more signals with a logic analyzer then you can with a basic 2 channel scope.  The problem is you cannot observe the signals with the same vertical (voltage amplitude) or horizontal resolution (time). The logic analyzer classifies and then stores the input signal's amplitude as either a high or low.  The Saleae's maximum sample rate is 24MHz providing a time measurement resolution of about 0.1us. Remember, with the scope we could resolve propagation delays to about 1ns. Depending on the application, these measurement resolutions are tolerable when observing basic logic function and when time measurements are much greater than 0.1us.

Saleae Kit Installation

The Saleae DLA is powered via the USB connection, so simply plug it in. Note: the analyzer does not work thru the display USB port. The analyzer is quite compact with one USB connection and a probe pod consisting of 8 signal wires and a reference or GND connection. Each probe has a socket connector on the probe end that be connected into common circuit board headers or grabber clips supplied with the kit. 

probes

Saleae Application Program

The Saleae application program can be evoked from the following start menu ICON or from the program list.

A following window should appear.

;lkj

If the USB connection was successful, you should see a "Connected" message in the upper window border. The first user drop down window allows you to set the sample buffer size. Generally, 1 M samples will do. The next window allows you to set the sample rate. For this lab we will use the maximum rate providing a time resolution of about 01.us. The  "Start" button starts a measurement. Note, each channel is color coded to follow the probe color.

Simple Sampling
Give the analyzer a try by connecting it to the Signal Generator. Provide a nice simple digital signal by changing the sine wave to a square wave  1kHz, 3Vpp signal. Making sure that the signal is 0V at it's lowest and 3V at it's highest rather than +/- 1.5V. Connect channel zero to the source output and don't forget the ground reference. With the above setting take a sample by hitting the "Start" button. You  should see something like this.

;lkj

You can adjust the horizontal time scale by holding the mouse over the waveform display area and scrolling up or down. Holding the mouse over the waveform will provide a period, frequency and pulse width measurement if they are enabled in the measurements window. 

Notice that there is no vertical scale or voltage input gain adjustment. The DLA displays the input signal as either a logical 0 or 1 in much the same manner as typical digital logic would interpret an input signal.  If the input value is -0.5V to 0.8V the value is displayed as logical 0. If it is in the range 2.0V to 5.25V it is displayed as logical 1. Values in between 0.8V and 2.0V can either be 0 or 1.  Note you should take care not to exceed the input range -0.5V to 5.5V when making measurements or you may damage the DLA input circuitry.

Triggering the DLA

You will notice that if you take multiple samples of the scopes 1kHz signal, the waveform will appear to shift or start at different points in time. When you hit the start button, sampling starts at different points along the waveform. Quite often we want to trigger on a specific signal event much like we did with the oscilloscope. A particular channel can be triggered for either rising edge, falling edge, logical low or logical high level. The conditions are set with the 4 button set for each channel. To trigger the  channel 0 for rising edge, select the rising edge and hit the start button with the scopes 1kHz ref signal attached.  The display will look something like this.

;lkj


Notice that the display time base is now roughly centered at 0.0ms with time decreasing before and increasing after the 0.0ms time marker. The 0.0ms marks the trigger point. The signal is sample before and after the trigger and stored in the sample buffer for observation about the trigger point.  You can adjust the display to see more waveform cycles.

Selecting the negative edge likewise causes the trigger to occur accordingly.

;klj

Likewise, triggering can be logical level 0 or 1 sensitive. This is the display for a positive level trigger.

;klj

Triggering on Multiple Conditions

Sometimes we wish to trigger on more than one condition. For example, consider triggering on channel 0 with a rising edge and channel 1 at a logical 1. You can attach channel 1 to the 3.3V test pin (near push button switch 2) on the SmartFusion Kit. The display will look something like this after a start measurement.

;lkj

However, if we attach the channel 1 to the gnd pin next to the 3.3 volt pin and we attempt to sample, the DLA will continue to monitor, but wait for the trigger condition to come true before recording. The following message will appear.

;lkj


Move the probe to the 3.3 volt pin and you will see the DLA trigger. Note, once you lift the probe from the gnd pin the input will be interpreted as logical one and the DLA will trigger.

Note, if you let the analyzer run long enough at 24 MHz it may stall. It will report that the analyzer cannot sustain the current sample rate.  Simply hit the "Start" button again.

Observing a Sine wave with Logic Analyzer?

Connect the logic analyzer to the signal generator like so:



Switch the signal generator back to sine wave and observe the signal on the logic analyzer.  Be prepared to answer the following question for the post lab: How does the sine wave look on the LA compare to the square wave?  Why if at all are they different?

More on the Saleae DLA

The Saleae DLA also has the ability to monitor and decode serial IO protocols such as RS232 (UARTs), I2C and SPI. We will explore these capabilities in later labs. Go to the Saleae website and read the manual for more detail. We will not use the Agilient 16600A in the lab sets and it will not be covered at this time.

The MSO has all the digital functionality of the Saleae DLA, but we will not cover that for present.

In-Lab Part 6: Measurements with the Digital Multimeter

Each workstation is equipped with an Agilent digital multi-meter (DMM). The DMM is used for general measurements including: voltage, current, resistance and capacitance. These should be relatively familiar to you from introductory lab courses.

For a simple application, let's measure the power drawn by the kit. We can model the kit as a load resistor for this measurement. By measuring the voltage across the kit and the current supplied we can determine the power load. Voltage to the kit is provided through the USB cable. We could cut the USB cable to measure the power, but that would be just a tad messy. Instead, let's use the lab power supply.

Set the Power Supply Output

Before hooking anything up, adjust the power supplies 6V output to be 5.00 volts. Note you have to have the Output turned on.

Connect the Kit to the Power Supply

Disconnect the USB cables from your kit. Get a BNC cable, BNC grabber adapter and BNC to banana adapter.

TURN OFF THE POWER SUPPLY OUTPUT

TAKE CARE TO CONNECT THE BANANA TO BNC CONNECTOR WITH THE GND TAB ON THE GROUND TERMINAL OF THE POWER SUPPLY. FAILING TO DO THIS WILL APPLY NEGATIVE VOLTAGE AND FRY THE KIT!!

Next, connect the red clip to the kits 5 volt supply test pin and the black clip to a GND test pin.

Turn the power supply kit output on and you should be able to observe the current supplied to the kit. The power supply current meter is accurate for currents >10ma. Let's check it. Get another cable like the one you used to hook the power supply to the kit. Attach the cable to the DMM's current terminals.

The adapter ground ref tab orientation is not critical. It will only effect the current flow reading direction (+/-). Next place this cable in the ground path of the power supply cable like this.

Observe the difference. At this current level the power supply meter should be very accurate. In most cases the power supply meter is adequate.

Post-Lab Assignment

Assignment: Sequential Logic counter

For post lab you will create a 2 bit counter that inverts the LED output every time count hits zero. Follow the diagram. The blanks are for you to figure out. The complete code is not provided. Just some hints are provided. SW1 will be the source of the clk and the LED will output to LED8. Also output the the value of the 2 bit counter to LED1 and LED2. Demo it to staff and ask them kindly to provide a signature.


You will notice that the counter  may seem to count erratically. Push button switches do not provide a single transition like you might assume. Instead they mechanically bounce before settling provide several edges. So your counter counts in a burst of several edges rather then a single transition. There are methods to "debounce" the switches that we will learn later. In fact the Altera kits we use in EECS270 have special external circuits to handle debouncing.

There is another way you provide a predictable set of edges for now with the signal generator. Set the generator to provide a square wave 0v to 3v at 1 Hz. Be sure to set the high z mode or the output voltage will be to high and you will smoke the kit. Provide and input thru one of the user input pins and connect to your counter clock. You should see an assuring 1Hz count sequence.

The user IO header is a 5 pin connector next to the Actel label (white lettering). The connector is labeled J22. Don't confuse this with the FPGA pins. To see what pins correspond to the FPGA pins, go to the top of the LIbero Project Guide. You can also find the pins in the SmartFusion Kit Users Manual linked at the end of the lab. Pin 1 of the User IO header is labeled on the board with a small 1 in white lettering.  Pins 2 thru 5 follow.

Assignment: View switch bouncing

You may have noticed that sometimes one press or release on the switch results in two count increments! This occurs due to switch bouncing. The problem is that the switch itself does not provide a clean high-low transition, but flips back and forth several times. Lets catch this in action.

Follow the above figure's setup to view the switch bounces. Setup both the logic analyzer and the scope to trigger on the falling edge on channel 1. Use the In-lab guides to achieve this. Use normal sweep trigger for the MSO. No Function Generator or Multi-meter is used in this part of the lab. The Red/Black pin connectors are connected via BNC cable to the Oscilloscope.

Deliverables

You may work with a partner for this assignment even if you flew solo for the In-Lab. If you don't have a partner after this lab, consider finding one by 2nd lab. The labs will become increasingly difficult and you will appreciate the help and the company. Create a cover sheet and include the names and unique names of those who worked on this part.

Submit the following for the Post Lab Assignment:

  1. Submit your Verilog code for the counter.
  2. Staff signature for demo on your Verilog code printout.
  3. Submit a phone camera picture (no extra credit)  or MSO screen capture (extra credit) of the switch transient on the Oscilloscope. 
  4. Submit a screen shot of logic analyzer displaying the bounce.
    Also include answers to the following questions.
  1. What is the simplified logic expression with both the inputs and outputs inverted for In-Lab part 1?
  2. What kid of wavepattern do you see on the LA when observing the sine wave? Why?
  3. What does the small black tab on the banana to BNC connector signify? Why is it important?
  4. Why can't you use Auto trigger on the MSO to capture the switch transient?

Accessing the Lab and Support

You will be given a keypad entry code to the lab so you can use the lab any time other lab sections are not meeting. Be sure and read the unsupported lab policy before using the lab. There are important lab safety issues documented in the policy. There will also be some supported lab open hours if you need additional help. See the course web page for times.

References