| AVR Z-LINKŪ |

# Requirements to run the Evaluation Application

Steps:

1. Setup of the ATAVRRZ502 Accessory Kit
2. Setup of the STK541 Kit (Not available in current version)
3. EEPROM File Generation
4. Programming the ATmega1281

## Setup of the ATAVRRZ502 Accessory Kit

The following steps walk the reader through how to assemble and prepare the STK500 board and the STK501 top module to be used with the RZ502. Then finally how to mount the RZ502 board and configure it to run the evaluation application.

Note:
  The following steps must be completed successfully to ensure correct operation of the hardware.

### Step A. Assemble and configure the STK500 board

The jumpers and operating voltage of the STK500 board must be set up correct in advance of mounting the STK501 and radio board.

1. Carefully remove any AVRs from the target sockets on the STK500.
2. Place jumpers on the following headers:
   - VTARGET
   - AREF
   - RESET
   - BSEL2
3. Connect a serial cable to the connector marked RS232CTRL on the STK500 to a COM port on the PC.
4. Apply power to the STK500 by moving the power switch toward the edge of the board.
5. Start AVR Studio and press "Cancel" in the Welcome dialog window.
6. From the Tools menu, select "Program AVR" and "Connect...".
7. Select "STK500 or AVRISP" as platform and then press "Connect". Verify that a window named "STK500" appears.
8. Open the Board tab. Adjust the VTarget voltage and ARef voltage to 3 Volts. Press the Write Voltages button. Close the STK500 window.

### Step B. Assemble and configure the STK500 board

The jumpers are now set correctly and the target voltage is set to 3 volts. This ensures that the AT86RF230 radio transceiver is not damaged and the ATmega1281 will run at 8MHz. The next steps describes how to mount the STK501 top module.

1. Insert an ATmega1281 into the Zero Insertion Force (ZIF) socket on the STK501. Press the spring-loaded top frame of the ZIF down and gently aligning the device underneath the fine-pitched wires. Verify that pin 1 on the TQFP package (dot in one of its corners) points towards the notched corner of the ZIF.
2. Ensure that power is turned off on the STK500 board.
3. Connect the STK501 to the STK500 by using expansion header 0 and 1. Ensure that the EXPAND0 written on the STK501 top module aligns with the EXPAND0 written beside the expansion header on the STK500 board.
4. Connect PINE1 and PINE2 to the RXD and TXD pins respectively. This can be done using one of the 2-wire cables included in the STK500 starter kit. The RXD and TXD pins are found close to the 9-pins RS-232 connector on the STK501.
5. To enable the In-System Programmer (ISP) interface, connect a 6-wire cable between the ISP6PIN connector on the STK500 board and the SPROG connector on the STK501 top module.

### Step C. Mount the Radio Board

The RZ502 radio board is added to the STK501 by using its EXPAND1 header.

1. Find pin 1 on the radio board (Only square pad and with the digit 1 printed to its right). This is pin must align with pin 1 on STK501's EXPAND1 header.
2. Insert the radio board.

## Setup of the STK541 Kit

To be written. The current focus for this documentation is the ATAVRRZ502 Accessory Kit. However, files to control the FTDI chip of this platform is included in the src/avr folder.

## Programming the ATmega1281

The precompiled firmware used in the following subsection can be found in the "bin" folder of the .zip file accompanying this document.

1. Connect a serial cable to the connector marked RS232CTRL on the STK500 to a COM port on the PC.
2. Apply power to the STK500 by moving the power switch toward the edge of the board.
3. Start AVR Studio and press the "Cancel" button in the Welcome dialog window.
4. From the Tools menu, select "Program AVR" and "Connect...".
5. Select STK500 or AVRISP as platform and then press "Connect". Verify that a dialog named "STK500 with STK501 top module" appears.
6. Open the "Program" tab. Select ATmega1281 from the Device pull down menu.
7. Select the "Fuses" tab and ensure that the following Fuses are checked/not checked:
   - Checked: Brown-out detection disabled
   - Checked: Preserve EEPROM
   - Checked: Boot Flash section size=4096 words
   - Checked: Int. RC Osc.;Start-up time: 6CK + 65 ms
   - Not checked: Divide clock by 8 internally
8. Go back to the "Program" tab. Program the flash of the ATmega1281 with the "bin\AVR414_evaluation_application.hex" file found in the "bin" folder.
9. Program the EEPROM of the ATmega1281 with the .hex file generated in EEPROM File Generation.
10. Close the STK500 window.

## EEPROM File Generation

The IEEE 802.15.4 stack from Atmel uses the EEPROM of the AVR microcontroller to store the unique 64-bit MAC address. An EEPROM file that contains this address must be generated since the ATmega1281 is not preprogrammed with this information.

1. Locate the MAC address on the RZ502 board. The address is a 16-byte string printed on a small white label (Ex. 00-04-25-FF-FF-17-03-E9).
2. Then start the HEXMaker command line tool found in the "bin" folder. This tool takes two inputs; filename of the .hex file and the MAC address in 16-byte string representation. Ex.:

    >HEXMaker nodeA.hex 000425FFFF1703E9
       Filename      : nodeA.hex
       MAC address   : 00 04 25 FF FF 17 03 E9 (Byte order reversed in HEX file)
    nodeA.hex created!

@DOC_TITLE@