wiki:Programming

Programming of INGA

There are several ways to flash/program INGA. If a bootloader is already present, flashing via USB is recommended. As no bootloader is installed on shipped ATmega microcontrollers, probably flashing the Bootloader and setting the correct fuses is the first thing to do. Setting fuses and flashing the Bootloader can either be done via ISP or via JTAG, whereas JTAG is preferred because of being easier to handle. Nevertheless, if you by some reason disabled JTAG, ISP provides another chance for recovery.

Programming via USB, using the Bootloader

AVRDUDE (Linux)

avrdude -pm1284p -cavr109 -P/dev/ttyUSB{x} -b230400 -U flash:w:<*>.hex:a -U eeprom:w:<*>.hex:a
  • Insert the correct number of your ttyUSB for {x}, e.g. 1.
  • <*>.hex has to be the hexfile to be programmed.

AVRDUDE (Windows)

avrdude	-pm1284p -cavr109 -P com{x} -b230400 -U flash:w:<*>.hex:a -U eeprom:w:<*>.hex:a
  • Insert the correct number of your com-port for {x}, e.g. 2.
  • <*>.hex has to be the hexfile to be programmed.

JTAG connection for programming and setting Fuses

To program INGA without a Bootloader, a JTAG (or ISP, see below) cable and programmer (e.g. the Atmel AVR Dragon) is needed.

Assembling the cable

INGA_front_JP3.pngOn JP3 the JTAG interface of the microcontroller is lead through. The leftmost pin is No.1 (front view). The pin assignment for JTAG is listed in the following table. The JTAG connector is a 2x5-pin standard connector, we tested sucessfully with the AVR Dragon programmer.

10-pin JP3 connector Function 10-pin JTAG connector
1 +3.3 V 4
2 AREF not connected
3 TDI (JTAG) 9
4 TDO (JTAG) 3
5 TMS (JTAG) 5
6 TCK (JTAG) 1
7 SDA (I2C) not connected
8 SCL (I2C) not connected
9 Reset 6
10 GND 2

Now that you have a JTAG-cable, connect it to JP3, respectively your JTAG-programmer. If you only intend to flash the Bootloader, there is no need to solder the pins: Just plug them in the correct holes and slightly push the connector down or up to establish contact.

Setting the Fuses

AVRstudio_fuses.png To enable INGA's Bootloader, first of all the correct fuses have to be set. This can either be done with AVRDUDE or Atmel AVR Studio.

AVRDUDE

Atmel AVR Studio (Windows)

  • Go to Tools -> AVR Programming.
  • Select your programmer (Tool) (e.g. AVR Dragon).
  • Select your microcontroller (Device) (for INGA: ATMega1284p)
  • Click Apply.
  • Read Device ID and/or Voltage to verify the correct function of your cable.
  • Click on the Fuses-tab on the left.
    • Select BOOTRST
    • Deselect CKDIV8
    • Click on Program

Flashing the Bootloader

To flash the bootloader (1284p_bootloader.hex)(or any other program) using JTAG (or ISP, see below), you can either use AVRdude or AVR Studio.

AVR-Dude (with AVR-Dragon, Linux)

 sudo avrdude -pm1284p -cdragon_jtag -Pusb -U flash:w:bootloader.hex:a

Atmel AVR Studio (Windows)

  • Go to Tools -> AVR Programming.
  • Select your programmer (Tool) (e.g. AVR Dragon).
  • Select your microcontroller (Device) (for INGA: ATMega1284p)
  • Click Apply.
  • Read Device ID and/or Voltage to verify the correct function of your cable.
  • Click on the Memories-tab on the left

ISP recovery

When you by some reason disabled JTAG, ISP is the second chance to recover your device, unless you disabled the ISP fuses as well. Never, under no circumstandes, disable the SPIEN-Fuse - there is no reasonable motive for doing so! INGA_back_ISP.png INGA provides three soldering points on the backside between the ATmega 1284p microcontroller and AT86RF231 radio transciever. Combiend with three additional pins from JP3a, an ISP-recovery cable can be assembled.

PCB-pad Function 6-pin ISP header
1 (PB5) MOSI (ISP) 4
2 (PB6) MISO (ISP) 1
3 (PB7) SCK (ISP) 3

Additionally you will need pins from JP3:

JP3-pin Function 6-pin ISP header
1 +3.3 V 2
9 Reset 5
10 GND 6

Programming and setting the Fuses via ISP works like JTAG. You just have to select ISP instead of JTAG in AVR Studio.

Last modified 8 years ago Last modified on 22.11.2011 22:18:13