• Home
  • Products
    • Papilio FPGA
    • Arcade MegaWing
    • RetroCade MegaWing
    • LogicStart MegaWing
    • Logic Sniffer
    • Papilio Wings
  • Store
    • Gadget Factory Store
    • India Store
    • Distributers
  • Wikis
    • Papilio Wiki
    • Arcade Wiki
    • RetroCade Wiki
    • Logic Sniffer Wiki
  • Forum
  • Showcase
  • Downloads
  • Source Code
  • Home
  • Products
    • Papilio FPGA
    • Arcade MegaWing
    • RetroCade MegaWing
    • LogicStart MegaWing
    • Logic Sniffer
    • Papilio Wings
  • Store
    • Gadget Factory Store
    • India Store
    • Distributers
  • Wikis
    • Papilio Wiki
    • Arcade Wiki
    • RetroCade Wiki
    • Logic Sniffer Wiki
  • Forum
  • Showcase
  • Downloads
  • Source Code
Previous Next

DesignLab Quickstart – DUO AVR

Posted by: Jack Gassett , January 15, 2015

This QuickStart Guide will get you up and running with the Papilio DUO software and focuses on using the AVR side of the Papilio DUO.

This Guide will cover:

  • Determining which serial port your Papilio DUO is connected to. (AVR Side)
  • Loading a sketch to the AVR using the USB port.
  • Loading a sketch to the AVR using the FPGA as a ISP programmer.
  • Restoring the Arduino bootloader.

Please take a look at these additional guides (coming soon):

  • Loading a sketch to the Papilio DUO – FPGA Side
  • Loading a circuit to the Papilio DUO FPGA side and a sketch to the AVR side
  • DesignLab – Editing a Circuit

Connect AVR USB Port

First of all you want to make sure you are plugging in the correct USB port in order to use the AVR chip on the Papilio DUO.

PWRSEL

The Papilio DUO has two options for receiving power – from the FPGA USB port or the AVR USB port. If you will be plugging in the AVR side and not the FPG side then you need to ensure that you have the PWRSEL jumper on the AVR side. The AVR power option is selected when you have the jumper connected to the top of the three pin header.

Power Select

Connect Micro-USB Port

There are two USB ports on the Papilio DUO – one for the FPGA (Mini-USB) and one for the AVR (Micro-USB). Be sure you are plugging in the Micro-USB port that is labeled AVR USB.

Be sure that the power indicator light comes on. If it does not then double check your PWRSEL jumper.

AVR USB

Open the Blink Sketch

Go to, “File/Examples/Arduino_Examples/Basics/Blink”

Blink Sketch

Determine Serial Port

The next step is to figure out which serial port the Papilio DUO is being assigned to. There are two ways to do this:

  • The easiest is to plug in the Papilio DUO and look at the connected serial ports. Then disconnect the Papilio DUO and see which serial port has disappeared, this should be the Papilio DUO serial port. This is a very quick way to tell which serial port is being assigned.
  • The more accurate way of determining your serial port is to look at the device manager. You can hit CTRL-X under Windows 8 to find the device manager.

Video Clip of disconnecting and reconnecting Papilio (For FPGA side but still applies for AVR Side)

(Press fullscreen button in Youtube video and select HD 720p  for best quality.)

Video Clip of using device manager (For FPGA side but still applies for AVR Side)

(Press fullscreen button in Youtube video and select HD 720p  for best quality.)

Select the Board

Next you need to make sure you are setting your board type for the Papilio DUO FPGA.

Select, “Tools/Board/Papilio DUO – AVR/Papilio DUO – AVR – USB”

Board Type

 

There are two board types available for the AVR side of the Papilio DUO. The first option behaves just like the Arduino Leonardo which allows you to program sketches over the USB port. The second option, “Papilio DUO – AVR – No USB – ISP” uses the FPGA as an ISP programmer. This option wipes out the bootloader and allows you to use the full program space available on the AVR chip.

Load a Blank Circuit to FPGA

Pins 0-16 of the Papilio DUO are connected to both the FPGA and the AVR chip. This allows us to do exciting things such as using the FPGA as a Logic Analyzer or connecting to custom circuits from the AVR chip. It also means that we need to take care when we run sketches on the AVR. Any circuit running on the FPGA could interfere with the pins used in a sketch and cause unexpected results. It is a good idea to load a blank circuit to the FPGA before running a sketch. Fortunately, its very easy to load a blank circuit from any AVR sketch.

Connect your sketch to a blank circuit

It’s very easy to connect your AVR sketch to a blank FPGA circuit. Every sketch in DesignLab is meant to have a circuit associated with it. There is a library of circuits available in the Libraries directory of DesignLab. One of the available circuit libraries is called, “blank”. This circuit library has nothing but a circuit that connects the user switch on the DUO to the reset pin of the AVR chip. When you load this circuit to the FPGA it will wipe out any other circuit and allow you to turn the AVR chip off or on using the user switch. Putting the user switch in the up position allows the AVR chip to run, and down position turns it off.

To associate the “blank” circuit with your sketch type the following at the top of your sketch.

#define circuit blank

Blank circuit

View and Load the Circuit

Once you have the “blank” circuit associated with your sketch you can click the “View Circuit” icon to view the contents of the circuit.

Make sure you plug in the FPGA USB port before loading the “blank” circuit to the FPGA.

 

Finally, to make the circuit live on your DUO you need to click the “Load Circuit” icon.

Video clip of viewing and loading the circuit

(Press fullscreen button in Youtube video and select HD 720p  for best quality.)

Load Sketch Using USB Port

Now that we know what circuit is running on the FPGA side of things and that it will not interfere with our sketch, we can proceed with loading the sketch!

Make sure that the serial port is still on the AVR serial port that you determined earlier.

Serial Port Selection

To upload the sketch, simply press the “Upload” icon.

Upload

If the sketch uploaded successfully you should see this:

Done Uploading

You should also see the User LED on pin 13 blinking:

Blinking LED

Video clip of uploading sketch

(Press fullscreen button in Youtube video and select HD 720p  for best quality.)

Load Sketch Using ISP

DesignLab lets you upload sketches to the AVR chip using the FPGA as an ISP programmer. The benefit of this is that it lets you use all of the code space available on the AVR chip. The Arduino bootloader eats up a couple kilobytes of code space and some sketches for the Arduino need that extra space. The Gameduino examples are a good case of this, some of the demos will not fit unless you use this method. The down side is that this method will completely wipe out the Arduino bootloader which means you will no longer be able to load sketches over the USB port. It is easy to replace the bootloader but it is a bit of a hassle. We don’t recommend using this method unless you run into a situation that requires it.

Change Board Type

The first thing you need to do is change your board type to, “Papilio DUO – AVR – No USB – ISP”:

ISP Board Type

Connect FPGA USB Port

In order to use this method you need to make sure the FPGA USB Port is connected. DesignLab will temporarily load a circuit to the FPGA that turns it into an ISP programmer. Once the sketch is loaded DesignLab will reset the FPGA back to the circuit you had loaded.

Plug in FPGA

Select the FPGA Serial Port

We need to select the FPGA serial port since the FPGA is going to act as the ISP programmer.

FPGA Serial Port 2

To upload the sketch, simply press the “Upload” icon.

Upload

If the sketch uploaded successfully you should see this:

Done Uploading

You should also see the User LED on pin 13 blinking.

Video clip of uploading sketch using ISP Programmer

(Press fullscreen button in Youtube video and select HD 720p  for best quality.)

Restore Bootloader

If you want to go back to the default behavior of loading sketches over the AVR USB port then you will first need to restore the bootloader to the board.

Select the FPGA Serial Port

We need to select the FPGA serial port since the FPGA is going to act as the ISP programmer while the bootloader is restored.

FPGA Serial Port 2

Burn Bootloader

Select, “Tools/Burn Bootloader”

Burn Bootloader

 

You should see, “Done burning bootloader”

Done Burning Bootloader

Load a Sketch

After you load the bootloader you need to load a sketch to the board to get back to normal operation. Otherwise you will only see the temporary bootloader com port show up which can become confusing.

So first of all select the temporary bootloader com port:

Bootloader Port

 

Then press upload to load a sketch.

Upload

 

Once it is complete your board should be working normally.

Video clip of restoring the bootloader

(Press fullscreen button in Youtube video and select HD 720p  for best quality.)

Full Video Walkthrough

(Press fullscreen button in Youtube video and select HD 720p  for best quality.)

Comments

comments

About Gadget Factory

We make Open Source Hardware that is extremely Hackable, what we call Hack|Ware. Founded in 2009 by Aspiring Inventor Jack Gassett, we are hardware suppliers and inventors with a community focused approach. Home of the Papilio FPGA board and other open source hardware designs.

Located in Denver, Colorado just minutes away from beautiful Boulder, Colorado.

Gadget Factory Learning Site

Inspired by the excellent learning sites at Adafruit and Sparkfun we made our own learning site with tutorials about FPGA's, Electronics, and Making Open Source Hardware. If you have tutorials you would like to contribute please contact us at support@gadgetfactory.net.

If you have a project or code that you would like to share please post to the Showcase website.
© Gadget Factory 2013