How to Assemble and Program the FabISP

Fab ISP

The FabISP programmer (created by David Mellis) was updated by Neil Gershenfeld. The Electronics Production assignment is to mill the board, stuff it with components and program it. We will be using these programmers through the semester to program the other boards we create.

Review the FabISP Documentation

  1. Go to the Fab Academy page for Electronics Production and review Neil Gershenfeld's notes.
  2. Read through the FabISP page documentation. This is a previous design that uses slightly different components.

Install the Fab Modules

Follow this guide to install / update the Fab Modules.

If the Fab Modules are already installed at your lab, skip this step. The Fab Modules do not need to be installed on indivual student computers.

Download the Board Files and Mill the Board

Milled Fab ISP

  1. Download the traces png. Mill the board traces using the Fab Modules and a 1/64" bit.



  2. Download the png to mill out the board. Mill the board outline using the Fab Modules and a 1/32" bit.

    fab isp board outline

Stuff the Board

Stuffed FabISP

Component Marking Notes:

"Smoke Test"

  1. Plug the FabISP into your computer via the mini USB cable.
    -- If you get an error message from your computer that the board is drawing too much power and that the computer is shutting down the USB port
    - You have a short somewhere on your board. See (Troubleshooting Short Circuits).


  2. If you do not recieve any messges, proceed to "Install the necessary software for AVR programming."

Troubleshooting Short Circuits:

  1. First, do a visual inspection of the board and reflow any solder joints that look cold (not shiny and smooth).

  2. Then, get out your multimeter and check all the connections to make sure that:
    - power and ground are not connected
    - there is not a short on the power line.

  3. Common problem areas on the FabISP are:
    - the pins on the 6-pin programming header are connected to each other.
    - the tiny pins on the front of the mini USB header are connected to each other.
    - none of these pins should be connected.
    - use your meter to determine which pins are connected.
    - use flux and desoldering braid to remove the excess solder and disconnect the pins.

Install the Necessary Software for AVR Programming:

For the electronics units in the Fab Academy, you will need:

  1. Avrdude (for programming)
  2. GCC (to compile C code)

Ubuntu:

To get GCC and avrdude on Ubuntu:

Open Terminal and type:

sudo apt-get install flex byacc bison gcc libusb-dev avrdude   
Then type:
sudo apt-get install gcc-avr 
- type "y" when asked to do so by your system

Then type:
sudo apt-get install avr-libc 
Then type (may already be installed):
sudo apt-get install libc6-dev

Mac:

To get avrdude and GCC on Mac OS:

  1. Set up your Paths
    - Follow this tutorial: http://www.ladyada.net/learn/avr/setup-mac.html
    Begin at "Mac Setup - Paths" heading and stop at the heading "Option 1. AvrMacPack".

  2. Download and Install Crosspack AVR - Has an installer.

  3. Get Make (via XCode) - If you do not already have XCode installed - Get the install disks that came with your mac and install the developer tools. If you are running Lion - you can download XCode here. http://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12

Download and Unzip the Firmware:

Ubuntu:

  1. Move to the desktop
     cd ~/Desktop         
  2. Download the firmware from the Fab Academy Electronics Production page.
    wget http://academy.cba.mit.edu/classes/embedded_programming/firmware.zip 
  3. Unzip the firmware
    unzip firmware.zip 

Mac:

  1. Download the firmware (right click on the link below and save it to your desktop): http://academy.cba.mit.edu/classes/embedded_programming/firmware.zip

  2. Open terminal navigate to the desktop:
      cd ~/Desktop/
  3. Unzip the firmware.zip directory:
     unzip firmware.zip
  4. Move into the newly created firmware directory on your desktop
    cd ~/Desktop/firmware

Power the FabISP Board

The board needs power: make sure that the mini USB connector for the FabISP you are trying to program is plugged into your computer AND that a separate pogramer is plugged in to the 6-pin programming header. (this could be another working FabISP or the ATAVRISP2 mentioned above, a USBtiny, an AVR Dragon, etc.)

programming Fab ISP with USBtiny
Shown with a USBtiny programmer

If you are using the ATAVRISP2 programmer, you can skip step 7, you do not need to edit the Makefile, it is already set up to work with the ATAVRISP2 If you are using another programmer you will need to edit the Makefile.

Helpful ATAVRISP2 Programmer Light Indicator Messages

If you are using the ATAVRISP2 programmer only. If you connect the programmer to the 6-pin programming header on your FabISP board and you get:

Edit the Makefile (Non-ATAVRISP2 programmer only, FabISP, USBtiny).

Ubuntu:

 gedit Makefile     

Mac: Just click on the file called "Makefile" in the firmware folder to open / edit it.

Ubuntu and Mac:

A window will open containing the Makefile. Go to the line that says:
#AVRDUDE = avrdude -c usbtiny -p $(DEVICE) # edit this line for your programmer
AVRDUDE = avrdude -c avrisp2 -P usb -p $(DEVICE) # edit this line for your programmer

- If using the USBtiny programmer or another FabISP
- Remove the "#" in front of the line with "usbtiny" in it
- Add a "#" to beginning the line with the "avrisp2" in it to comment it out.
- save the Makefile

Program the FabISP (Ubuntu and Mac):

Type:
make clean    
If you are successful - you will see this response from the system:
akaziuna@Titan:~/Desktop/firmware$ make clean
rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex
main.elf *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s
Type:
make hex

If you are successful - you will see this response from the system:

akaziuna@Titan:~/Desktop/firmware$ make hex
avr-gcc -Wall -Os -DF_CPU=20000000	 -Iusbdrv -I. -DDEBUG_LEVEL=0 
-mmcu=attiny44 -c usbdrv/usbdrv.c -o usbdrv/usbdrv.o
avr-gcc -Wall -Os -DF_CPU=20000000	 -Iusbdrv -I. -DDEBUG_LEVEL=0 
-mmcu=attiny44 -x assembler-with-cpp -c usbdrv/usbdrvasm.S -o usbdrv/usbdrvasm.o
avr-gcc -Wall -Os -DF_CPU=20000000	 -Iusbdrv -I. -DDEBUG_LEVEL=0 
-mmcu=attiny44 -c usbdrv/oddebug.c -o usbdrv/oddebug.o
avr-gcc -Wall -Os -DF_CPU=20000000	 -Iusbdrv -I. -DDEBUG_LEVEL=0 
-mmcu=attiny44 -c main.c -o main.o
avr-gcc -Wall -Os -DF_CPU=20000000	 -Iusbdrv -I. -DDEBUG_LEVEL=0 
-mmcu=attiny44 -o main.elf usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o 
main.o
rm -f main.hex main.eep.hex
avr-objcopy -j .text -j .data -O ihex main.elf main.hex
avr-size main.hex
   text	   data	    bss	    dec	    hex	filename
      0	   2020	      0	   2020	    7e4	main.hex 
Type:

sudo make fuse
If you are successful - you will see the following response from the system:
akaziuna@Titan:~/Desktop/firmware$ sudo make fuse
avrdude -c usbtiny -p attiny44  -U hfuse:w:0xDF:m -U lfuse:w:0xFF:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9207
avrdude: reading input file "0xDF"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xDF:
avrdude: load data hfuse data from input file 0xDF:
avrdude: input file 0xDF contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.
Then type:
sudo make program
If you are successful - you will see the following response from the system.
akaziuna@Titan:~/Desktop/firmware$ sudo make program
[sudo] password for akaziuna: 
avrdude -c usbtiny -p attiny44  -U flash:w:main.hex:i

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9207
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "main.hex"
avrdude: writing flash (2020 bytes):

Writing | ################################################## | 100% 5.68s



avrdude: 2020 bytes of flash written
avrdude: verifying flash memory against main.hex:
avrdude: load data flash data from input file main.hex:
avrdude: input file main.hex contains 2020 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 3.36s



avrdude: verifying ...
avrdude: 2020 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

avrdude -c usbtiny -p attiny44  -U hfuse:w:0xDF:m -U lfuse:w:0xFF:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9207
avrdude: reading input file "0xDF"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xDF:
avrdude: load data hfuse data from input file 0xDF:
avrdude: input file 0xDF contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Errors

To Verify That Your ISP is working correctly:

Ubuntu 11.10:

Type:

lsusb 
If your FabISP has been successfully programmed, you should see a list of the USB devices plugged into your computer. The FabISP will be listed in a line like the following:
Bus 002 Device 004: ID 1781:0c9f Multiple Vendors USBtiny
Note: Ubuntu 10.10 lists the device as something like:
Bus 002 Device 004: ID 1781:0c9f Multiple Vendors

Mac:

go to the System Profiler >> Hardware >> USB >> Hub:

Step - By - Step:

  1. Click the "apple" menu in your main toolbar
  2. Select "about this mac"
  3. Select "more info"
  4. Under the "Contents" menu in the left hand navigation
    - Click "Hardware" to expand the hardware menu (if not already expanded)
    - Click "USB"
    - Under the "USB Device Tree"
    - Click "Hub" to expand the hub menu (if not already expanded)
    - "FabISP" should be listed in the hub menu
  5. Your FabISP device has been successfully programmed and is recognized by your computer.

After You Have Programmed the Board:

  1. Remove the 0 ohm resistor and solder bridge as shown in the picture below.
Fab ISP without jumpers

Tutorial by Anna Kaziunas France - Fab Academy AS220 Providence, RI - March 2012