ATmega2564/1284/644RFR2 Features * * * * * * * * * * * * * * * * * * Network support by hardware assisted Multiple PAN Address Filtering Advanced Hardware assisted Reduced Power Consumption (R) High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture - 135 Powerful Instructions - Most Single Clock Cycle Execution - 32x8 General Purpose Working Registers / On-Chip 2-cycle Multiplier - Up to 16 MIPS Throughput at 16 MHz and 1.8V - Fully Static Operation Non-volatile Program and Data Memories - 256K/128K/64K Bytes of In-System Self-Programmable Flash * Endurance: 10'000 Write/Erase Cycles @ 125C (25'000 Cycles @ 85C) - 8K/4K/2K Bytes EEPROM * Endurance: 20'000 Write/Erase Cycles @ 125C (100'000 Cycles @ 25C) - 32K/16K/8K Bytes Internal SRAM JTAG (IEEE std. 1149.1 compliant) Interface - Boundary-scan Capabilities According to the JTAG Standard - Extensive On-chip Debug Support - Programming of Flash EEPROM, Fuses and Lock Bits through the JTAG interface Peripheral Features - Multiple Timer/Counter & PWM channels - Real Time Counter with Separate Oscillator - 10-bit, 330 ks/s A/D Converter; Analog Comparator; On-chip Temperature Sensor - Master/Slave SPI Serial Interface - Two Programmable Serial USART - Byte Oriented 2-wire Serial Interface Advanced Interrupt Handler and Power Save Modes Watchdog Timer with Separate On-Chip Oscillator Power-on Reset and Low Current Brown-Out Detector Fully integrated Low Power Transceiver for 2.4 GHz ISM Band - High Power Amplifier support by TX spectrum side lobe suppression - Supported Data Rates: 250 kb/s and 500 kb/s, 1 Mb/s, 2 Mb/s - -100 dBm RX Sensitivity; TX Output Power up to 3.5 dBm - Hardware Assisted MAC (Auto-Acknowledge, Auto-Retry) - 32 Bit IEEE 802.15.4 Symbol Counter - SFD-Detection, Spreading; De-Spreading; Framing ; CRC-16 Computation - Antenna Diversity and TX/RX control / TX/RX 128 Byte Frame Buffer PLL synthesizer with 5 MHz and 500 kHz channel spacing for 2.4 GHz ISM Band Hardware Security (AES, True Random Generator) Integrated Crystal Oscillators (32.768 kHz & 16 MHz, external crystal needed) I/O and Package - 33 Programmable I/O Lines - 48-pad QFN (RoHS/Fully Green) Temperature Range: -40C to 125C Industrial Ultra Low Power consumption (1.8 to 3.6V) for AVR & Rx/Tx: 10.1mA/18.6 mA - CPU Active Mode (16MHz): 4.1 mA - 2.4GHz Transceiver: RX_ON 6.0 mA / TX 14.5 mA (maximum TX output power) - Deep Sleep Mode: <700nA @ 25C Speed Grade: 0 - 16 MHz @ 1.8 - 3.6V range with integrated voltage regulators 8-bit Microcontroller with Low Power 2.4GHz Transceiver for ZigBee and IEEE 802.15.4 ATmega2564RFR2 ATmega1284RFR2 ATmega644RFR2 Applications (R) * ZigBee / IEEE 802.15.4-2011/2006/2003TM - Full and Reduced Function Device * General Purpose 2.4GHz ISM Band Transceiver with Microcontroller * RF4CE, SP100, WirelessHARTTM, ISM Applications and IPv6 / 6LoWPAN 42073B-MCU Wireless-09/14 1 42073B-MCU Wireless-09/14 1 Pin Configurations PF2:ADC2:DIG2 PF1:ADC1 PF0:ADC0 AVDD EVDD AVSS:ASVSS XTAL1 XTAL2 PE7:ICP3:INT7:CLKO PE5:OC3C:INT5 PE4:OC3B:INT4 PE3:OC3A:AIN1 Figure 1-1. Pinout ATmega2564/1284/644RFR2 48 47 46 45 44 43 42 41 40 39 38 37 PF3/4:ADC3/4:TCK:DIG4 1 36 PE2:XCK0:AIN0 PF5:ADC5:TMS 2 35 PE1:TXD0 PF6:ADC6:TDO 3 34 PE0:RXD0:PCINT8 PF7:ADC7:TDI 4 33 PB7:OC0A:OC1C:PCINT7 AVSS_RFP 5 32 PB6:OC1B:PCINT6 RFP 6 31 PB5:OC1A:PCINT5 RFN 7 30 PB4:OC2A:PCINT4 AVSS_RFN 8 29 PB3:MISO:PDO:PCINT3 TST 9 28 PB2:MOSI:PDI:PCINT2 RSTN 10 27 PB1:SCK:PCINT1 PG1:DIG1 11 26 PB0:SSN:PCINT0 PG3:TOSC2 12 25 CLKI Note: ATmega2564/1284/644RFR2 QFN 48 14 15 16 17 18 19 20 21 22 23 24 DVSS:DSVSS DVDD DEVDD PD0:SCL:INT0 PD1:SDA:INT1 PD3:TXD1:INT3 PD4:ICP1 PD5:XCK1 PD6:T1 PD7:T0 PD2:RXD1:INT2 13 PG4:TOSC1 7x7 mm The large center pad underneath the QFN/MLF package is made of metal and internally connected to AVSS. It should be soldered or glued to the board to ensure good mechanical stability. If the center pad is left unconnected, the package might loosen from the board. It is not recommended to use the exposed paddle as a replacement of the regular AVSS pins. 2 Disclaimer Typical values contained in this datasheet are based on simulation and characterization results of other AVR microcontrollers and radio transceivers manufactured in a similar process technology. Minimum and Maximum values will be available after the device is characterized. 2 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 3 Overview The ATmega2564/1284/644RFR2 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture combined with a high data rate transceiver for the 2.4 GHz ISM band. By executing powerful instructions in a single clock cycle, the device achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power consumption versus processing speed. The radio transceiver provides high data rates from 250 kb/s up to 2 Mb/s, frame handling, outstanding receiver sensitivity and high transmit output power enabling a very robust wireless communication. 3.1 Block Diagram Figure 3-1 Block Diagram The AVR core combines a rich instruction set with 32 general purpose working registers. All 32 registers are directly connected to the Arithmetic Logic Unit (ALU). Two independent registers can be accessed with one single instruction executed in one clock cycle. The resulting architecture is very code efficient while achieving throughputs up to ten times faster than conventional CISC microcontrollers. The system includes internal voltage regulation and an advanced power management. Distinguished by the small leakage current it allows an extended operation time from battery. The radio transceiver is a fully integrated ZigBee solution using a minimum number of external components. It combines excellent RF performance with low cost, small size and low current consumption. The radio transceiver includes a crystal stabilized fractional-N synthesizer, transmitter and receiver, and full Direct Sequence Spread 3 42073B-MCU Wireless-09/14 Spectrum Signal (DSSS) processing with spreading and despreading. The device is fully compatible with IEEE802.15.4-2011/2006/2003 and ZigBee standards. The ATmega2564/1284/644RFR2 provides the following features: 256K/128K/64K Bytes of In-System Programmable (ISP) Flash with read-while-write capabilities, 8K/4K/2K Bytes EEPROM, 32K/16K/8K Bytes SRAM, up to 35 general purpose I/O lines, 32 general purpose working registers, Real Time Counter (RTC), 6 flexible Timer/Counters with compare modes and PWM, a 32 bit Timer/Counter, 2 USART, a byte oriented 2-wire Serial Interface, a 8 channel, 10 bit analog to digital converter (ADC) with an optional differential input stage with programmable gain, programmable Watchdog Timer with Internal Oscillator, a SPI serial port, IEEE std. 1149.1 compliant JTAG test interface, also used for accessing the On-chip Debug system and programming and 6 software selectable power saving modes. The Idle mode stops the CPU while allowing the SRAM, Timer/Counters, SPI port, and interrupt system to continue functioning. The Power-down mode saves the register contents but freezes the Oscillator, disabling all other chip functions until the next interrupt or hardware reset. In Power-save mode, the asynchronous timer continues to run, allowing the user to maintain a timer base while the rest of the device is sleeping. The ADC Noise Reduction mode stops the CPU and all I/O modules except asynchronous timer and ADC, to minimize switching noise during ADC conversions. In Standby mode, the RC oscillator is running while the rest of the device is sleeping. This allows very fast start-up combined with low power consumption. In Extended Standby mode, both the main RC oscillator and the asynchronous timer continue to run. Typical supply current of the microcontroller with CPU clock set to 16MHz and the radio transceiver for the most important states is shown in the Figure 3-2 below. Figure 3-2 Radio transceiver and microcontroller (16MHz) supply current 20 18,6mA I(DEVDD,EVDD) [mA] 1.8V 3.0V 3.6V RPC disabled 16,6mA 15 RPC enabled 10 4,1mA 5 0 10.1mA 4,7mA 250nA 700nA Deep Sleep SLEEP TRX_OFF RX_ON BUSY_TX Radio transceiver and microcontroller (16MHz) supply current The transmit output power is set to maximum. If the radio transceiver is in SLEEP mode the current is dissipated by the AVR microcontroller only. In Deep Sleep mode all major digital blocks with no data retention requirements are disconnected from main supply providing a very small leakage current. Watchdog timer, MAC symbol counter and 32.768kHz oscillator can be configured to continue to run. 4 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 The device is manufactured using Atmel's high-density nonvolatile memory technology. The On-chip ISP Flash allows the program memory to be reprogrammed in-system trough an SPI serial interface, by a conventional nonvolatile memory programmer, or by on on-chip boot program running on the AVR core. The boot program can use any interface to download the application program in the application Flash memory. Software in the boot Flash section will continue to run while the application Flash section is updated, providing true Read-While-Write operation. By combining an 8 bit RISC CPU with In-System Self-Programmable Flash on a monolithic chip, the Atmel ATmega2564/1284/644RFR2 is a powerful microcontroller that provides a highly flexible and cost effective solution to many embedded control applications. The ATmega2564/1284/644RFR2 AVR is supported with a full suite of program and system development tools including: C compiler, macro assemblers, program debugger/simulators, in-circuit emulators, and evaluation kits. 3.2 Pin Descriptions 3.2.1 EVDD External analog supply voltage. 3.2.2 DEVDD External digital supply voltage. 3.2.3 AVDD Regulated analog supply voltage (internally generated). 3.2.4 DVDD Regulated digital supply voltage (internally generated). 3.2.5 DVSS Digital ground. 3.2.6 AVSS Analog ground. 3.2.7 Port B (PB7...PB0) Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port B also provides functions ATmega2564/1284/644RFR2. of various special features of the 3.2.8 Port D (PD7...PD0) Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port D also provides functions ATmega2564/1284/644RFR2. of various special features of the 3.2.9 Port E (PE7,PE5...PE0) Internally Port E is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port E output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port E pins that are externally pulled low will 5 42073B-MCU Wireless-09/14 source current if the pull-up resistors are activated. The Port E pins are tri-stated when a reset condition becomes active, even if the clock is not running. Due to the low pin count of the QFN48 package port E6 is not connected to a pin. Port E also provides functions ATmega2564/1284/644RFR2. of various special features of the 3.2.10 Port F (PF7..PF5,PF4/3,PF2...PF0) Internally Port F is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port F output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port F pins that are externally pulled low will source current if the pull-up resistors are activated. The Port F pins are tri-stated when a reset condition becomes active, even if the clock is not running. Due to the low pin count of the QFN48 package port F3 and F4 are connected to the same pin. The I/O configuration should be done carefully in order to avoid excessive power dissipation. Port F also provides functions ATmega2564/1284/644RFR2. of various special features of the 3.2.11 Port G (PG4,PG3,PG1) Internally Port G is a 6-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port G output buffers have symmetrical drive characteristics with both high sink and source capability. However the driver strength of PG3 and PG4 is reduced compared to the other port pins. The output voltage drop (VOH, VOL) is higher while the leakage current is smaller. As inputs, Port G pins that are externally pulled low will source current if the pull-up resistors are activated. The Port G pins are tri-stated when a reset condition becomes active, even if the clock is not running. Due to the low pin count of the QFN48 package port G0, G2 and G5 are not connected to a pin. Port G also provides functions ATmega2564/1284/644RFR2. of various special features of the 3.2.12 AVSS_RFP AVSS_RFP is a dedicated ground pin for the bi-directional, differential RF I/O port. 3.2.13 AVSS_RFN AVSS_RFN is a dedicated ground pin for the bi-directional, differential RF I/O port. 3.2.14 RFP RFP is the positive terminal for the bi-directional, differential RF I/O port. 3.2.15 RFN RFN is the negative terminal for the bi-directional, differential RF I/O port. 3.2.16 RSTN Reset input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running. Shorter pulses are not guaranteed to generate a reset. 3.2.17 XTAL1 Input to the inverting 16MHz crystal oscillator amplifier. In general a crystal between XTAL1 and XTAL2 provides the 16MHz reference clock of the radio transceiver. 3.2.18 XTAL2 Output of the inverting 16MHz crystal oscillator amplifier. 6 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 3.2.19 TST Programming and test mode enable pin. If pin TST is not used pull it to low. 3.2.20 CLKI Input to the clock system. If selected, it provides the operating clock of the microcontroller. 3.3 Unused Pins Floating pins can cause power dissipation in the digital input stage. They should be connected to an appropriate source. In normal operation modes the internal pull-up resistors can be enabled (in Reset all GPIO are configured as input and the pull-up resistors are still not enabled). Bi-directional I/O pins shall not be connected to ground or power supply directly. The digital input pins TST and CLKI must be connected. If unused pin TST can be connected to AVSS while CLKI should be connected to DVSS. Output pins are driven by the device and do not float. Power supply pins respective ground supply pins are connected together internally. XTAL1 and XTAL2 shall never be forced to supply voltage at the same time. 3.4 Compatibility and Feature Limitations of QFN-48 Package 3.4.1 AREF The reference voltage output of the A/D converter is not connected to a pin in the ATmega2564/1284/644RFR2. 3.4.2 Port E6 The port E6 is not connected to a pin in the ATmega2564/1284/644RFR2. The alternate pin functions as clock input to timer 3 and external interrupt 6 are not available. 3.4.3 Port F3 and F4 The port F3 and F4 are connected to the same pin in the ATmega2564/1284/644RFR2. The output configuration should be done carefully in order to avoid excessive current consumption. The alternate pin function of port F4 is used by the JTAG interface. If the JTAG interface is used the port F3 must be configured as input and the alternate pin function output DIG4 (RX/TX indicator) must be disabled. Otherwise the JTAG interface will not work. The SPIEN Fuse should be programmed in order to be able to erase a program that accidentally drive port F3. There are just 7 single-ended input channel to the ADC available. 3.4.4 Port G0 The port G0 is not connected to a pin in the ATmega2564/1284/644RFR2. The alternate pin function DIG3 (inverted RX/TX indicator) is not available. If the JTAG interface is not used the DIG4 alternate pin function output of port F3 can still be used as RX/TX indicator. 7 42073B-MCU Wireless-09/14 3.4.5 Port G2 The port G2 is not connected to a pin in the ATmega2564/1284/644RFR2. The alternate pin function AMR (asynchronous automated meter reading input to timer 2) is not available. 3.4.6 Port G5 The port G5 is not connected to a pin in the ATmega2564/1284/644RFR2. The alternate pin function OC0B (output compare channel of 8-Bit timer 0) is not available. 3.4.7 RSTON The RSTON reset output signaling the internal reset state is not connected to a pin in the ATmega2564/1284/644RFR2. 4 Resources A comprehensive set of development tools and application notes, and datasheets are available for download on http://www.atmel.com. 5 About Code Examples This documentation contains simple code examples that briefly show how to use various parts of the device. Be aware that not all C compiler vendors include bit definitions in the header files and interrupt handling in C is compiler dependent. Please confirm with the C compiler documentation for more details. These code examples assume that the part specific header file is included before compilation. For I/O registers located in extended I/O map, "IN", "OUT", "SBIS", "SBIC", "CBI", and "SBI" instructions must be replaced with instructions that allow access to extended I/O. Typically "LDS" and "STS" combined with "SBRS", "SBRC", "SBR", and "CBR". 6 Data Retention and Endurance 6.1 Data Retention The data retention of the non-volatile memories is * over 10 years at 125C * over 100 years at 25C 6.2 Endurance of the Code Memory (FLASH) The endurance of the code memory (FLASH) is * 125C - 10,000 Write/Erase cycles * 85C - 25,000 Write/Erase cycles 6.3 Endurance of the Data Memory (EEPROM) The endurance of the entire data memory (EEPROM) is * 125C - 20,000 Write/Erase cycles * 85C - 50,000 Write/Erase cycles * 25C - 100,000 Write/Erase cycles 8 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 7 AVR CPU Core 7.1 Introduction This section discusses the AVR core architecture in general. The main function of the CPU core is to ensure correct program execution. The CPU must therefore be able to access memories, perform calculation, control peripherals, and handle interrupts. 7.2 Architectural Overview Figure 7-1.Block Diagram of the AVR Architecture Data Bus 8-bit Flash Program Memory Program Counter Status and Control 32 x 8 General Purpose Registers Control Lines Direct Addressing Instruction Decoder Indirect Addressing Instruction Register Interrupt Unit SPI Unit Watchdog Timer ALU Analog Comparator I/O Module1 Data SRAM I/O Module 2 I/O Module n EEPROM I/O Lines In order to maximize performance and parallelism, the AVR uses a Harvard architecture - with separate memories and buses for program and data. Instructions in the program memory are executed with a single level pipelining. While one instruction is being executed, the next instruction is pre-fetched from the program memory. This concept enables instructions to be executed in every clock cycle. The program memory is In-System Reprogrammable Flash memory. 9 42073B-MCU Wireless-09/14 The fast-access Register File contains 32 x 8-bit general purpose working registers with a single clock cycle access time. This allows single-cycle Arithmetic Logic Unit (ALU) operation. In a typical ALU operation, two operands are output from the Register File, the operation is executed, and the result is stored back in the Register File - in one clock cycle. Six of the 32 registers can be used as three 16-bit indirect address register pointers for Data Space addressing - enabling efficient address calculations. One of these address pointers can also be used as an address pointer for look up tables in Flash program memory. These added function registers are the 16-bit X-, Y-, and Z-register, described later in this section. The ALU supports arithmetic and logic operations between registers or between a constant and a register. Single register operations can also be executed in the ALU. After an arithmetic operation, the Status Register is updated to reflect information about the result of the operation. Program flow is provided by conditional and unconditional jump and call instructions, able to directly address the whole address space. Most AVR instructions have a single 16-bit word format. Every program memory address contains a 16- or 32-bit instruction. Program Flash memory space is divided in two sections, the Boot Program section and the Application Program section. Both sections have dedicated Lock bits for write and read/write protection. The SPM instruction that writes into the Application Flash memory section must reside in the Boot Program section. During interrupts and subroutine calls, the return address Program Counter (PC) is stored on the Stack. The Stack is effectively allocated in the general data SRAM, and consequently the Stack size is only limited by the total SRAM size and the usage of the SRAM. All user programs must initialize the SP in the Reset routine (before subroutines or interrupts are executed). The Stack Pointer (SP) is read/write accessible in the I/O space. The data SRAM can easily be accessed through the five different addressing modes supported in the AVR architecture. The memory spaces in the AVR architecture are all linear and regular memory maps. A flexible interrupt module has its control registers in the I/O space with an additional Global Interrupt Enable bit in the Status Register. All interrupts have a separate Interrupt Vector in the Interrupt Vector table. The interrupts have priority in accordance with their Interrupt Vector position. The lower the Interrupt Vector address, the higher the priority. The I/O memory space contains 64 addresses for CPU peripheral functions as Control Registers, SPI, and other I/O functions. The I/O Memory can be accessed directly, or as the Data Space locations following those of the Register File, 0x20 - 0x5F. In addition, the ATmega2564/1284/644RFR2 has Extended I/O space from 0x60 - 0x1FF in SRAM where only the ST/STS/STD and LD/LDS/LDD instructions can be used. 7.3 ALU - Arithmetic Logic Unit The high-performance AVR ALU operates in direct connection with all the 32 general purpose working registers. Within a single clock cycle, arithmetic operations between general purpose registers or between a register and an immediate are executed. The ALU operations are divided into three main categories - arithmetic, logical, and bit functions. Some implementations of the architecture also provide a powerful multiplier supporting both signed/unsigned multiplication and fractional format. See the "Instruction Set" section for a detailed description. 10 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 7.4 Status Register The Status Register contains information about the result of the most recently executed arithmetic instruction. This information can be used for altering program flow in order to perform conditional operations. Note that the Status Register is updated after all ALU operations, as specified in the Instruction Set Reference. This will in many cases remove the need for using the dedicated compare instructions, resulting in faster and more compact code. The Status Register is not automatically stored when entering an interrupt routine and restored when returning from an interrupt. This must be handled by software. 7.4.1 SREG - Status Register Bit 7 6 5 4 3 2 1 0 $3F ($5F) I T H S V N Z C RW 0 RW 0 RW 0 RW 0 RW 0 RW 0 RW 0 RW 0 Read/Write Initial Value SREG * Bit 7 - I - Global Interrupt Enable The global interrupt enable bit must be set (one) for the interrupts to be enabled. The individual interrupt enable control is then performed in separate control registers. If the global interrupt enable bit is cleared (zero), none of the interrupts are enabled independent of the individual interrupt enable settings. The I-bit is cleared by hardware after an interrupt has occurred, and is set by the RETI instruction to enable subsequent interrupts. * Bit 6 - T - Bit Copy Storage The bit copy instructions BLD (Bit LoaD) and BST (Bit STore) use the T bit as source and destination for the operated bit. A bit from a register in the register file can be copied into T by the BST instruction, and a bit in T can be copied into a bit in a register in the register file by the BLD instruction. * Bit 5 - H - Half Carry Flag The half carry flag H indicates a half carry in some arithmetic operations. See the Instruction Set Description for detailed information. * Bit 4 - S - Sign Bit The S-bit is always an exclusive or between the negative flag N and the two's complement overflow flag V. See the Instruction Set Description for detailed information. * Bit 3 - V - Two's Complement Overflow Flag The two's complement overflow flag V supports two's complement arithmetics. See the Instruction Set Description for detailed information. * Bit 2 - N - Negative Flag The negative flag N indicates a negative result after the different arithmetic and logic operations. See the Instruction Set Description for detailed information. * Bit 1 - Z - Zero Flag The zero flag Z indicates a zero result after the different arithmetic and logic operations. See the Instruction Set Description for detailed information. * Bit 0 - C - Carry Flag The carry flag C indicates a carry in an arithmetic or logic operation. See the Instruction Set Description for detailed information. Note that the status register is not automatically 11 42073B-MCU Wireless-09/14 stored when entering an interrupt routine and restored when returning from an interrupt routine. This must be handled by software. 7.5 General Purpose Register File The Register File is optimized for the AVR Enhanced RISC instruction set. In order to achieve the required performance and flexibility, the following input/output schemes are supported by the Register File: * One 8-bit output operand and one 8-bit result input * Two 8-bit output operands and one 8-bit result input * Two 8-bit output operands and one 16-bit result input * One 16-bit output operand and one 16-bit result input Figure 7-1 below shows the structure of the 32 general purpose working registers in the CPU. Figure 7-1. AVR CPU General Purpose Working Registers Most of the instructions operating on the Register File have direct access to all registers, and most of them are single cycle instructions. As shown in Figure 7-1 above each register is also assigned a data memory address, mapping them directly into the first 32 locations of the user Data Space. Although not being physically implemented as SRAM locations, this memory organization provides great flexibility in access of the registers, as the X-, Y- and Z-pointer registers can be set to index any register in the file. 7.5.1 The X-register, Y-register, and Z-register The registers R26...R31 have some added functions to their general purpose usage. These registers are 16-bit address pointers for indirect addressing of the data space. The three indirect address registers X, Y, and Z are defined as described in Figure 7-2 on page 13. 12 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Figure 7-2. The X-, Y-, Z-registers In the different addressing modes these address registers have functions as fixed displacement, automatic increment, and automatic decrement (see the instruction set reference for details). 7.6 Stack Pointer The Stack is mainly used for storing temporary data, for storing local variables and for storing return addresses after interrupts and subroutine calls. The Stack Pointer Register always points to the top of the Stack. Note that the Stack is implemented as growing from higher memory locations to lower memory locations. This implies that a Stack PUSH command decreases the Stack Pointer. The Stack Pointer points to the data SRAM Stack area where the Subroutine and Interrupt Stacks are located. This Stack space in the data SRAM must be defined by the program before any subroutine calls are executed or interrupts are enabled. The Stack Pointer must be set to point above 0x0200. The initial value of the stack pointer is the last address of the internal SRAM. The Stack Pointer is decremented by one when data is pushed onto the Stack with the PUSH instruction, and it is decremented by two when the return address is pushed onto the Stack with subroutine call or interrupt. The Stack Pointer is incremented by one when data is popped from the Stack with the POP instruction, and it is incremented by two when data is popped from the Stack with return from subroutine RET or return from interrupt RETI. When the FLASH memory exceeds 128Kbyte one additional cycle is required. In this case the Stack Pointer is decremented by three when the return address is pushed onto the Stack with subroutine call or interrupt and is incremented by three when data is popped from the Stack with return from subroutine RET or return from interrupt RETI. Note: 1. If the Stack Pointer is zero and then decremented the new Stack Pointer value will be different within the device family: 0xffff (256K Byte FLASH memory), 0x7fff (128 K Byte FLASH memory) and 0x03fff (64 K Byte FLASH memory), respectively. Useful upper values of the Stack Pointer are defined by the SRAM size. 7.6.1 SPH - Stack Pointer High Bit 7 6 5 4 3 2 1 0 $3E ($5E) SP15 SP14 SP13 SP12 SP11 SP10 SP9 SP8 Read/Write Initial Value RW 0 RW 0 RW 1 RW 0 RW 0 RW 0 RW 0 RW 1 SPH 13 42073B-MCU Wireless-09/14 The AVR Stack Pointer is implemented as two 8-bit registers SPL and SPH in the I/O space. The number of bits actually used is implementation dependent. Note that the data space in some implementations of the AVR architecture is so small that only SPL is needed. In this case, the SPH Register will not be present. * Bit 7:0 - SP15:8 - Stack Pointer High Byte 7.6.2 SPL - Stack Pointer Low Bit 7 6 5 4 3 2 1 0 $3D ($5D) SP7 SP6 SP5 SP4 SP3 SP2 SP1 SP0 Read/Write Initial Value RW 1 RW 1 RW 1 RW 1 RW 1 RW 1 RW 1 RW 1 SPL The AVR Stack Pointer is implemented as two 8-bit registers SPL and SPH in the I/O space. The number of bits actually used is implementation dependent. Note that the data space in some implementations of the AVR architecture is so small that only SPL is needed. In this case, the SPH Register will not be present. * Bit 7:0 - SP7:0 - Stack Pointer Low Byte 7.6.3 RAMPZ - Extended Z-pointer Register for ELPM/SPM Bit $3B ($5B) 7 6 5 4 3 2 Res5 Res4 Res3 Res2 Res1 Res0 R 0 R 0 R 0 R 0 R 0 R 0 Read/Write Initial Value 1 0 RAMPZ1 RAMPZ0 RW 0 RAMPZ RW 0 For ELPM/SPM instructions, the Z-pointer is a concatenation of RAMPZ, ZH, and ZL. Note that LPM is not affected by the RAMPZ setting. * Bit 7:2 - Res5:0 - Reserved For compatibility with future devices, be sure to write these bits to zero. * Bit 1:0 - RAMPZ1:0 - Extended Z-Pointer Value Represent the MSB's of the Z-Pointer. Table 7-2 RAMPZ Register Bits Register Bits RAMPZ1:0 Value 0 Description Default value of Z-pointer MSB's. For ELPM/SPM instructions, the Z-pointer is a concatenation of RAMPZ, ZH, and ZL, as shown in Figure 7-3 below. Note that LPM is not affected by the RAMPZ setting. Figure 7-3. The Z-pointer used by ELPM and SPM 14 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 The actual number of bits is implementation dependent. Unused bits in an implementation will always read as zero. For compatibility with future devices, be sure to write these bits to zero. 7.6.4 EIND - Extended Indirect Register Bit 7 6 5 4 3 2 1 0 $3C ($5C) EIND0 Read/Write Initial Value RW 0 EIND * Bit 0 - EIND0 - Bit 0 For EICALL/EIJMP instructions. 7.7 Instruction Execution Timing Figure 7-4. The Parallel Instruction Fetches and Instruction Executions T1 T2 T3 T4 clkCPU 1st Instruction Fetch 1st Instruction Execute 2nd Instruction Fetch 2nd Instruction Execute 3rd Instruction Fetch 3rd Instruction Execute 4th Instruction Fetch Figure 7-5 below shows the internal timing concept for the Register File. In a single clock cycle an ALU operation using two register operands is executed, and the result is stored back to the destination register. Figure 7-5. Single Cycle ALU operation T1 T2 T3 T4 clkCPU Total Execution Time Register Operands Fetch ALU Operation Execute Result Write Back 7.8 Reset and Interrupt Handling The AVR provides several different interrupt sources. These interrupts and the separate Reset Vector each have a separate program vector in the program memory space. All 15 42073B-MCU Wireless-09/14 interrupts are assigned individual enable bits which must be written logic one together with the Global Interrupt Enable bit in the Status Register in order to enable the interrupt. Depending on the Program Counter value, interrupts may be automatically disabled when Boot Lock bits BLB02 or BLB12 are programmed. This feature improves software security. See the section "Memory Programming" on page 502 for details. The lowest addresses in the program memory space are by default defined as the Reset and Interrupt Vectors. The complete list of vectors is shown in "Interrupts" on page 241. The list also determines the priority levels of the different interrupts. The lower the address the higher is the priority level. RESET has the highest priority, and next is INT0 - the External Interrupt Request 0. The Interrupt Vectors can be moved to the start of the Boot Flash section by setting the IVSEL bit in the MCU Control Register (MCUCR). Refer to "Interrupts" on page 241 for more information. The Reset Vector can also be moved to the start of the Boot Flash section by programming the BOOTRST Fuse, see "Memory Programming" on page 502. When an interrupt occurs, the Global Interrupt Enable I-bit is cleared and all interrupts are disabled. The user software can write logic one to the I-bit to enable nested interrupts. All enabled interrupts can then interrupt the current interrupt routine. The I-bit is automatically set when a Return from Interrupt instruction - RETI - is executed. There are basically two types of interrupts. The first type is triggered by an event that sets the Interrupt Flag. For these interrupts, the Program Counter is vectored to the actual Interrupt Vector in order to execute the interrupt handling routine, and hardware clears the corresponding Interrupt Flag. Interrupt Flags can also be cleared by writing a logic one to the flag bit position(s) to be cleared. If an interrupt condition occurs while the corresponding interrupt enable bit is cleared, the Interrupt Flag will be set and remembered until the interrupt is enabled, or the flag is cleared by software. Similarly, if one or more interrupt conditions occur while the Global Interrupt Enable bit is cleared, the corresponding Interrupt Flag(s) will be set and remembered until the Global Interrupt Enable bit is set, and will then be executed by order of priority. The second type of interrupts will trigger as long as the interrupt condition is present. These interrupts do not necessarily have Interrupt Flags. If the interrupt condition disappears before the interrupt is enabled, the interrupt will not be triggered. When the AVR exits from an interrupt, it will always return to the main program and execute one more instruction before any pending interrupt is served. Note that the Status Register is not automatically stored when entering an interrupt routine, nor restored when returning from an interrupt routine. This must be handled by software. When using the CLI instruction to disable interrupts, the interrupts will be immediately disabled. No interrupt will be executed after the CLI instruction, even if it occurs simultaneously with the CLI instruction. The following example shows how this can be used to avoid interrupts during the timed EEPROM write sequence. Assembly Code Example in r16, SREG ; store SREG value cli ; disable interrupts during timed sequence sbi EECR, EEMPE ; start EEPROM write sbi EECR, EEPE out SREG, r16 ; restore SREG value (I-bit) 16 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Assembly Code Example C Code Example char cSREG; cSREG = SREG; /* store SREG value */ /* disable interrupts during timed sequence */ __disable_interrupt(); EECR |= (1< t1 1 3 x A V R c lo c k tTR13 1. Timing parameter tTR13 = 37 s refers to Table 9-4 on page 46; t11 refers to "Digital Interface Timing Characteristics" on page 560. 2. If TRXRST is set during radio transceiver SLEEP state, the XOSC startup delay is extended by the XOSC startup time. TRXRST = "1" resets all radio transceiver registers to their default values. The radio transceiver reset is released automatically after 3 AVR clock cycles and the wake-up sequence without restarting XOSC and DVREG, nevertheless an FTN calibration cycle is performed, refer to "Automatic Filter Tuning (FTN)" on page 90. After that the TRX_OFF state is entered. Figure 9-18 above illustrates the radio transceiver reset procedure if the radio transceiver is in any state but not in SLEEP state. If the radio transceiver was in SLEEP state, the SLPTR bit in the TRXPR register must be cleared prior to clearing the TRXRST bit in order to enter the TRX_OFF state. Otherwise the radio transceiver enters the SLEEP state immediately. If the radio transceiver was in SLEEP state and the Transceiver Clock is not selected as the microcontroller clock source, the XOSC is enabled before entering TRX_OFF state. If register TRX_STATUS indicates STATE_TRANSITION_IN_PROGRESS during system initialization until the radio transceiver reaches TRX_OFF, do not try to initiate a further state change while the radio transceiver is in this state. Note that before accessing the radio transceiver module the TRX24_AWAKE event should be checked. 45 42073B-MCU Wireless-09/14 9.4.1.4.5 State Transition Timing Summary The transition numbers correspond to Table 9-4 below. See measurement setup in "Basic Application Schematic" on page 538. Table 9-4. Radio Transceiver State Transition Timing No Symbol Transition Time [s], (typ) 1 tTR2 SLEEP TRX_OFF 2 tTR3 TRX_OFF SLEEP 3 tTR4 TRX_OFF PLL_ON 4 tTR5 PLL_ON TRX_OFF 5 tTR6 TRX_OFF RX_ON 6 tTR7 RX_ON TRX_OFF 1 7 tTR8 PLL_ON RX_ON 1 8 tTR9 RX_ON PLL_ON 1 Transition time is also valid for TX_ARET_ON, RX_AACK_ON 240 35 * 1 / fCLKM 110 Comments Depends on crystal oscillator setup (CL = 10 pf) TRX_OFF state indicated by TRX24_AWAKE interrupt For fCLKM > 250 kHz Depends on external capacitor at AVDD (1 F nom) 1 110 Depends on external capacitor at AVDD (1 F nom) 9 tTR10 PLL_ON BUSY_TX 16 When setting bit SLPTR or TRX_CMD = TX_START, the first symbol transmission is delayed by 16 s (PLL settling and PA ramp up). 10 tTR11 BUSY_TX PLL_ON 32 PLL settling time from TX_BUSY to PLL_ON state 11 tTR12 All modes TRX_OFF 1 Using TRX_CMD = FORCE_TRX_OFF (see register TRX_STATE), Not valid for SLEEP state 12 tTR13 RESET TRX_OFF 37 Not valid for SLEEP state 13 tTR14 Various states PLL_ON 1 Using TRX_CMD = FORCE_PLL_ON (see register TRX_STATE), Not valid for SLEEP, RESET and TRX_OFF The state transition timing is calculated based on the timing of the individual blocks shown in Table 9-9 on page 55. The worst case values include maximum operating temperature, minimum supply voltage, and device parameter variations. Table 9-9. Analog Block Initialization and Settling Time No Symbol Block Time [s], (typ) Time [s], (max) Comments tTR15 XOSC 16 tTR16 FTN 17 tTR17 DVREG 60 1000 Depends on external bypass capacitor at DVDD (CB3 = 1 F nom., 10 F worst case), depends on VDEVDD 18 tTR18 AVREG 60 1000 Depends on external bypass capacitor at AVDD (CB1 = 1 F nom., 10 F worst case) , depends on VEVDD 19 tTR19 PLL, initial 110 155 PLL settling time TRX_OFF AVREG settling time 20 tTR20 PLL, settling 11 24 Settling time between channel switch 21 tTR21 PLL, CF cal 35 22 tTR22 PLL, DCU cal 6 PLL DCU calibration, refer to "Calibration Loops" on page 89 23 tTR23 PLL, RX 16 Maximum PLL settling time RX 46 215 1000 Leaving SLEEP state, depends on crystal Q factor and load capacitor 15 25 TX FTN tuning time, fixed PLL_ON, including 60 s PLL center frequency calibration, refer to "Calibration Loops" on page 89 TX ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 No Symbol Block Time [s], (typ) 24 tTR24 PLL, TX RX 25 tTR25 RSSI, update 26 tTR26 ED 27 tTR27 SHR, sync 28 tTR28 CCA 29 tTR29 Random value Time [s], (max) Comments 32 Maximum PLL settling time TX RX 2 RSSI update period in receive states, refer to "Reading RSSI" on page 74 140 ED measurement period, refer to "Measurement Description" on page 75 Typical SHR synchronization period, "Measurement Description" on page 75 96 refer to 140 CCA measurement period, refer to "Configuration and CCA Request" on page 77 1 Random value update period, refer to "Random Number Generator" on page 92 9.4.2 Extended Operating Mode The Extended Operating Mode is a hardware MAC accelerator and goes beyond the basic radio transceiver functionality provided by the Basic Operating Mode. It handles time critical MAC tasks requested by the IEEE 802.15.4 standard or by hardware such as automatic acknowledgement, automatic CSMA-CA and retransmission. This results in a more efficient IEEE 802.15.4 software MAC implementation including reduced code size and may allow operating at lower microcontroller clock rates. The Extended Operating Mode is designed to support IEEE 802.15.4-2006 compliant frames; the mode is backward compatible to IEEE 802.15.4-2003 and supports non IEEE 802.15.4 compliant frames. This mode comprises the following procedures: Automatic acknowledgement (RX_AACK) divides into the tasks: * Frame reception and automatic FCS check; * Configurable addressing fields check; * Interrupt indicating address match; * Interrupt indicating frame reception, if it passes address filtering and FCS check; * Automatic ACK frame transmission (if the received frame passed the address filter and FCS check and if an ACK is required by the frame type and ACK request); * Support of slotted acknowledgment using SLPTR bit for frame start. Automatic CSMA-CA and Retransmission (TX_ARET) divides into the tasks: * CSMA-CA including automatic CCA retry and random back-off; * Frame transmission and automatic FCS field generation; * Reception of ACK frame (if an ACK was requested); * Automatic frame retry if ACK was expected but not received; * Interrupt signaling with transaction status. Automatic FCS check and generation (refer to "Frame Check Sequence (FCS)" on page 72) is used by the RX_AACK and TX_ARET modes. In RX_AACK mode an automatic FCS check is always performed for incoming frames. An ACK received in TX_ARET mode within the time required by IEEE 802.15.4 is accepted if the FCS is valid and if the sequence number of the ACK matches the sequence number of the previously transmitted frame. Dependent on the value of the 47 42073B-MCU Wireless-09/14 frame pending subfield in the received acknowledgement frame the transaction status is set according to Table 9-19 on page 64. The state diagram including the Extended Operating Mode states is shown in Figure 919 below. Yellow marked states represent the Basic Operating Mode; blue marked states represent the Extended Operating Mode. Figure 9-19. Extended Operating Mode State Diagram SLEEP (S le e p S ta te ) 0 XOSC=OFF (fro m a ll s ta te s ) TRXRST = 1 LP S T R LP = 1 TR = 3 S 2 FORCE_TRX_OFF TRX_O FF 12 13 (C lo c k S ta te ) ( a ll m o d e s e x c e p t S L E E P ) TRXRST = 0 RESET 7 FF _O R X TR X (R x L is te n S ta te ) N F ra m e End 8 RX_O N O (R e c e iv e S ta te ) FF _O B U SY_R X SHR D e te c te d 5 X TR 6 _ LL P _O N XO SC =ON RX_ON PLL_ON 4 SLPTR = 1 or TX_START PLL_O N 11 B U SY_TX (P L L S ta te ) 10 (T r a n s m it S ta te ) 9 F ro m / T o TR X_O FF RE T_ TR ON X_ OF F TX_ARET_ON s e e n o te s SHR D e te c te d R X_A A C K _O N B U S Y_R X _A A C K T ra n s a c tio n F in is h e d F ra m e End FORCE_PLL_ON TX _A PLL_ON N AA CK _O TR X RX _A AC K_ ON _O FF F ro m / T o T R X _O F F RX _ PL L_ O N 14 SLPTR = 1 or T X _S TA R T TX_A R E T_O N BU SY_TX_ARET F ra m e End Legend: B lu e : R e g is te r W rite to T R X _ S T A T E Red: C o n tro l s ig n a ls v ia R e g is te r T R X P R G re e n : E ve n t B a s ic O p e ra tin g M o d e S ta te s E x te n d e d O p e ra tin g M o d e S ta te s Note: 48 1. State transition numbers correspond to Table 9-4 on page 46. ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 9.4.2.1 State Control The Extended Operating Mode states RX_AACK and TX_ARET are controlled via the bits TRX_CMD of register TRX_STATE, which receives the state transition commands. The states are entered from TRX_OFF or PLL_ON state as illustrated in Figure 9-19 on page 48. The completion of each state change command shall always be confirmed by reading the TRX_STATUS register. RX_AACK - Receive with Automatic ACK A state transition to RX_AACK_ON from PLL_ON or TRX_OFF is initiated by writing the command RX_AACK_ON to the register bits TRX_CMD. The state change can be confirmed by reading register TRX_STATUS, those changes to RX_AACK_ON or BUSY_RX_AACK on success. BUSY_RX_AACK is returned if a frame is currently being received. The RX_AACK state is left by writing command TRX_OFF or PLL_ON to the register bits TRX_CMD. If the radio transceiver is within a frame receive or acknowledgment procedure (BUSY_RX_AACK) the state change is executed after finish. Alternatively, the commands FORCE_TRX_OFF or FORCE_PLL_ON can be used to cancel the RX_AACK transaction and change into radio transceiver state TRX_OFF or PLL_ON respectively. TX_ARET - Transmit with Automatic Retry and CSMA-CA Retry Similarly, a state transition to TX_ARET_ON from PLL_ON or TRX_OFF is initiated by writing command TX_ARET_ON to register bits TRX_CMD. The radio transceiver is in the TX_ARET_ON state after TRX_STATUS register changes to TX_ARET_ON. The TX_ARET transaction is started with writing `1' to the SLPTR bit of the TRXPR register or writing the command TX_START to register bits TRX_CMD. TX_ARET state is left by writing the command TRX_OFF or PLL_ON to the register bits TRX_CMD. If the radio transceiver is within a CSMA-CA, a frame-transmit or an acknowledgment procedure (BUSY_TX_ARET) the state change is executed after finish. Alternatively, the command FORCE_TRX_OFF or FORCE_PLL_ON can be used to instantly terminate the TX_ARET transaction and change into radio transceiver states TRX_OFF or PLL_ON, respectively. Note that a state change request from TRX_OFF to RX_AACK_ON or TX_ARET_ON internally passes the state PLL_ON to initiate the radio transceiver. Thus the readiness to receive or transmit data is delayed accordingly. It is recommended to use interrupt TRX24_PLL_LOCK as an indicator. 9.4.2.2 Configuration The use of the Extended Operating Mode is based on Basic Operating Mode functionality. Only features beyond the basic radio transceiver functionality are described in the following sections. For details on the Basic Operating Mode refer to section "Basic Operating Mode" on page 38. When using the RX_AACK or TX_ARET modes, the following registers needs to be configured. RX_AACK configuration steps: * Short address, PAN-ID and IEEE address (register SHORT_AADR_0, SHORT_ADDR_1, PAN_ID_0, PAN_ID_1, IEEE_ADDR_0 ... IEEE_ADDR_7) * Configure RX_AACK properties (register XAH_CTRL_0, CSMA_SEED_1) o Handling of Frame Version Subfield 49 42073B-MCU Wireless-09/14 o Handling of Pending Data Indicator o Characterize as PAN coordinator o Handling of Slotted Acknowledgement * Additional Frame Filtering Properties (register XAH_CTRL_1, CSMA_SEED_1) o Promiscuous Mode o Enable or disable automatic ACK generation o Handling of reserved frame types The addresses for the address match algorithm are to be stored in the appropriate address registers. Additional control of the RX_AACK mode is done with registers XAH_CTRL_1 and CSMA_SEED_1. As long as a short address has not been set, only broadcast frames and frames matching the IEEE address can be received. Configuration examples for different device operating modes and handling of various frame types can be found in section "Description of RX_AACK Configuration Bits" on page 53. TX_ARET configuration steps: * Leave register bit TX_AUTO_CRC_ON = 1 register TRX_CTRL_1 * Configure CSMA-CA o MAX_FRAME_RETRIES register XAH_CTRL_0 o MAX_CSMA_RETRIES register XAH_CTRL_0 o CSMA_SEED registers CSMA_SEED_0, CSMA_SEED_1 o MAX_BE, MIN_BE register CSMA_BE * Configure CCA (see section "Configuration and CCA Request" on page 77) MAX_FRAME_RETRIES (register XAH_CTRL_0) defines the maximum number of frame retransmissions. The register bits MAX_CSMA_RETRIES (register XAH_CTRL_0) configure the number of CSMA-CA retries after a busy channel is detected. The CSMA_SEED_0 and CSMA_SEED_1 registers define a random seed for the backoff-time random-number generator of the radio transceiver. The MAX_BE and MIN_BE register bits (register CSMA_BE) set the maximum and minimum CSMA back-off exponent (according to [1] on page 110). 9.4.2.3 RX_AACK_ON - Receive with Automatic ACK The general functionality of the RX_AACK procedure is shown in Figure 9-20 on page 52. The gray shaded area is the standard flow of a RX_AACK transaction for IEEE 802.15.4 compliant frames (refer to section "Configuration of IEEE Scenarios" on page 54). All other procedures are exceptions for specific operating modes or frame formats (refer to section "Configuration of non IEEE 802.15.4 Compliant Scenarios" on page 56). The frame filtering operation is described in detail in section "Frame Filtering" on page 58. In RX_AACK_ON state, the radio transceiver listens for incoming frames. After detecting SHR and a valid PHR, the radio transceiver parses the frame content of the MAC header (MHR) as described in section "PHY Header (PHR)" on page 67. 50 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Generally, at nodes, configured as a normal device or PAN coordinator, a frame is not indicated if the frame filter does not match and the FCS is invalid. Otherwise, the TRX_24_RX_END interrupt is issued after the completion of the frame reception. The microcontroller can then read the frame. An exception applies if promiscuous mode is enabled (see section "Configuration of IEEE Scenarios" on page 54). In that case a TRX_24_RX_END interrupt is issued even if the FCS fails. If the content of the MAC addressing fields of the received frame (refer to IEEE 802.15.4 section 7.2.1) matches one of the configured addresses, dependent on the addressing mode, an address match interrupt (TRX24_XAH_AMI) is issued (refer to section "Frame Filtering" on page 58). The expected address values are to be stored in registers Short-address, PAN-ID and IEEE-address. Frame filtering as described in section "Frame Filtering" on page 58 is also valid for Basic Operating Mode. During reception the radio transceiver parses bit[5] (ACK Request) of the frame control field of the received data or the MAC command frame to check if an ACK reply is expected. In that case and if the frame passes the third level of filtering (see IEEE 802.15.4-2006, section 7.5.6.2), the radio transceiver automatically generates and transmits an ACK frame. After the ACK transmission is finished, a TRX24_TX_END interrupt is generated. The content of the frame pending subfield of the ACK response is set by bit AACK_SET_PD of register CSMA_SEED_1 when the ACK frame is sent in response to a data request MAC command frame, otherwise this subfield is set to "0". The sequence number is copied from the received frame. Optionally, the start of the transmission of the acknowledgement frame can be influenced by register bit AACK_ACK_TIME. Default value (according to standard IEEE 802.15.4, page 54) is 12 symbol times after the reception of the last symbol of a data or MAC command frame. If the bit AACK_DIS_ACK of register CSMA_SEED_1 is set, no acknowledgement frame is sent even if an acknowledgment frame was requested. This is useful for operating the MAC hardware accelerator in promiscuous mode (see section "Configuration of non IEEE 802.15.4 Compliant Scenarios" on page 56). The status of the RX_AACK operation is indicated by the bits TRAC_STATUS of register TRAC_STATUS. During the operations BUSY_RX_AACK state. described above the radio transceiver remains in 51 42073B-MCU Wireless-09/14 Figure 9-20. Flow Diagram of RX_AACK TRX_STATE = RX_AACK_ON SHR detected N Y TRX_STATE = BUSY_RX_AACK Generate TRX24_RX_START interrupt Scanning MHR (see Note 1) Y Reserved Frames N Frame Filtering Note 1: Fram e Filtering, Prom iscuous Mode and Reserved Fram es: - A radio transceiver in Prom iscuous M ode, or configured to receive Reserved Fram es handles received fram es passing the third level of filtering - For details refer to the description of Promiscuous M ode and Reserved Fram e Types Promiscuous Mode Frame reception Generate TRX24_XAH_AMI interrupt AACK_PROM_MODE == 1 Frame reception N Y N FCS valid N (see Note 2) Note 2: FCS check is omitted for Promiscous M ode FCF[2:0] >3 Y Generate TRX24_RX_END interrupt Y N N ACK requested AACK_UPLD_RES_FT == 1 (see Note 3) Note 3: Additional conditions: - ACK requested & - ACK_DIS_ACK==0 & - fram e_version<=AACK_FVN_M ODE Y Y N FCS valid N Slotted Operation == 0 Y Y N AACK_ACK_TIME == 0 AACK_ACK_TIME == 0 W ait 6 symbol periods SLPTR bit =1 Generate TRX24_RX_END interrupt Y Y W ait 2 symbol periods Generate TRX24_RX_END interrupt N W ait 12 symbol periods W ait 2 symbol periods N Y Transmit ACK GenerateTRX24_TX_END interrupt TRX_STATE = RX_AACK_ON 52 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 9.4.2.3.1 Description of RX_AACK Configuration Bits Overview The following table summarizes all register bits which affect the behavior of a RX_AACK transaction. For address filtering it is further required to setup address registers to match to the expected address. Configuration and address bits are to be set in TRX_OFF or PLL_ON state prior to switching to RX_AACK mode. A graphical representation of various operating modes is illustrated in Figure 9-20 on page 52. Table 9-6. Overview of RX_AACK Configuration Bits Register Name Register Bits SHORT_ADDR_0/1 PAN_ADDR_0/1 IEEE_ADDR_0 ... IEEE_ADDR_7 Description Set node addresses RX_SAFE_MODE 7 Protect buffer after frame receive AACK_PROM_MODE 1 Support promiscuous mode AACK_ACK_TIME 2 Change auto acknowledge start time AACK_UPLD_RES_FT 4 Enable reserved frame type reception, needed to receive non-standard compliant frames AACK_FLTR_RES_FT 5 Filter reserved frame types like data frame type, needed for filtering of non-standard compliant frames SLOTTED_OPERATION 0 If set, acknowledgment transmission has to be triggered by register bit SLPTR AACK_I_AM_COORD 3 If set, the device is a PAN coordinator AACK_DIS_ACK 4 Disable generation of acknowledgment AACK_SET_PD 5 Set frame pending subfield in Frame Control Field (FCF), refer to section "Overview" on page 72 AACK_FVN_MODE 7:6 Controls the ACK behavior, depending on FCF frame version number The usage of the RX_AACK configuration bits for various operating modes of a node is explained in the following sections. Configuration bits not mentioned in the following two sections should be set to their reset values. All registers mentioned in Table 9-6 above are described in section "Register Summary" on page 66. Note, that the general behavior of the Extended Feature Set settings: * OQPSK_DATA_RATE (PSDU data rate) * SFD_VALUE (alternative SFD value) * ANT_DIV (Antenna Diversity) * RX_PDT_LEVEL (blocking frame reception of lower power signals) are completely independent from RX_AACK mode (see "Radio Transceiver Extended Feature Set" on page 92). Each of these operating modes can be combined with the RX_AACK mode. 53 42073B-MCU Wireless-09/14 9.4.2.3.2 Configuration of IEEE Scenarios Normal Device The Table 9-7 below shows a typical RX_AACK configuration of an IEEE 802.15.4 device operated as a normal device rather than a PAN coordinator or router. Table 9-7. Configuration of IEEE 802.15.4 Devices Register Name Register Bits SHORT_ADDR_0/1 PAN_ADDR_0/1 IEEE_ADDR_0 ... IEEE_ADDR_7 Description Set node addresses RX_SAFE_MODE 7 0: disable frame protection 1: enable frame protection SLOTTED_OPERATION 0 0: if transceiver works in unslotted mode 1: if transceiver works in slotted mode AACK_FVN_MODE 7:6 Notes: Controls the ACK behavior, depending on FCF frame version number 0x00 : acknowledges only frames with version number 0, i.e. according to IEEE 802.15.4-2003 frames 0x01 : acknowledges only frames with version number 0 or 1, i.e. frames according to IEEE 802.15.4-2006 0x10 : acknowledges only frames with version number 0 or 1 or 2 0x11 : acknowledges all frames, independent of the FCF frame version number 1. If no short address has been configured before the device has been assigned one by the PAN-coordinator, only frames directed to either the broadcast address or the IEEE address are received. 2. In IEEE 802.15.4-2003 standard the frame version subfield did not yet exist but was marked as reserved. According to this standard, reserved fields have to be set to zero. On the other hand, IEEE 802.15.4-2003 standard requires ignoring reserved bits upon reception. Thus, there is a contradiction in the standard which can be interpreted in two ways: a) If a network should only allow access to nodes which IEEE 802.15.4-2003, then AACK_FVN_MODE should be set to 0. use the b) If a device should acknowledge all frames independent of its frame version, AACK_FVN_MODE should be set to 3. However, this can result in conflicts with co-existing IEEE 802.15.4-2006 standard compliant networks. The same holds for PAN coordinators as described below. PAN-Coordinator Table 9-8 on page 55 shows the RX_AACK configuration for a PAN coordinator. 54 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Table 9-8. Configuration of a PAN Coordinator Register Name Register Bits SHORT_ADDR_0/1 PAN_ADDR_0/1 IEEE_ADDR_0 ... IEEE_ADDR_7 Description Set node addresses RX_SAFE_MODE 7 0: disable frame protection 1: enable frame protection SLOTTED_OPERATION 0 0: if transceiver works in unslotted mode 1: if transceiver works in slotted mode AACK_I_AM_COORD 3 1: device is PAN coordinator AACK_SET_PD 5 0: frame pending subfield is not set in FCF 1: frame pending subfield is set in FCF AACK_FVN_MODE 7:6 Controls the ACK behavior, depends on FCF frame version number 0x00 : acknowledges only frames with version number 0, i.e. according to IEEE 802.15.4-2003 frames 0x01 : acknowledges only frames with version number 0 or 1, i.e. frames according to IEEE 802.15.4-2006 0x10 : acknowledges only frames with version number 0 or 1 or 2 0x11 : acknowledges all frames, independent of the FCF frame version number Promiscuous Mode The promiscuous mode is described in IEEE 802.15.4-2006, section 7.5.6.5. This mode is further illustrated in Radio Transceiver Extended Feature Set on page 92. According to IEEE 802.15.4-2006 when in promiscuous mode, the MAC sub layer shall pass received frames with correct FCS to the next higher layer without further processing. That implies that frames should never be acknowledged. Only second level filter rules as defined by IEEE 802.15.4-2006, section 7.5.6.2, are applied to the received frame. Table 9-9 below shows the typical configuration of a device operating in promiscuous mode. Table 9-9. Configuration of Promiscuous Mode Register Name Register Bits SHORT_ADDR_0/1 PAN_ADDR_0/1 IEEE_ADDR_0 ... IEEE_ADDR_7 Description Each address shall be set: 0x00 AACK_PROM_MODE 1 1: Enable promiscuous mode AACK_DIS_ACK 4 1: Disable generation of acknowledgment 55 42073B-MCU Wireless-09/14 Register Name Register Bits AACK_FVN_MODE 7:6 Description Controls the ACK behavior, depends on FCF frame version number 0x00 : acknowledges only frames with version number 0, i.e. according to IEEE 802.15.4-2003 frames 0x01 : acknowledges only frames with version number 0 or 1, i.e. frames according to IEEE 802.15.4-2006 0x10 : acknowledges only frames with version number 0 or 1 or 2 0x11 : acknowledges all frames, independent of the FCF frame version number Second level of filtering according to IEEE 802.15.4-2006, section 7.5.6.2, is applied a received frame if the radio transceiver is in promiscuous mode. However, TRX24_RX_END interrupt is issued even if the FCS is invalid. Thus it is necessary read bit RX_CRC_VALID of register PHY_RSSI after the TRX24_RX_END interrupt order to verify the reception of a frame with a valid FCS. to a to in If a device, operating in promiscuous mode, receives a frame with a valid FCS which in addition passed the third level filtering according to IEEE 802.15.4-2006, section 7.5.6.2, an acknowledgement frame would be transmitted. According to the definition of the promiscuous mode a received frame shall not be acknowledged even if it is requested. Thus bit AACK_DIS_ACK of register CSMA_SEED_1 has to be set to 1. In all receive modes a TRX24_AMI interrupt is issued, when the received frame matches the node's address according to the filter rules described in section "Frame Filtering" on page 58. Alternatively, in RX_ON state of the Basic Operating Mode when a valid PHR is detected a TRX24_RX_START interrupt is generated and the frame is received. The end of the frame reception is signalized with a TRX24_RX_END interrupt. At the same time the bit RX_CRC_VALID of register PHY_RSSI is updated with the result of the FCS check (see "Overview" on page 72). The RX_CRC_VALID bit must be checked in order to dismiss corrupted frames according to the definition of the promiscuous mode. 9.4.2.3.3 Configuration of non IEEE 802.15.4 Compliant Scenarios Sniffer Table 9-10 below shows a RX_AACK configuration to setup a sniffer device. Other RX_AACK configuration bits should be set to their reset values (see Table 9-6 on page 53). All frames received are indicated by a TRX24_RX_START and TRX24_RX_END interrupt. Bit RX_CRC_VALID of register PHY_RSSI is updated after frame reception with the result of the FCS check (see "Overview" on page 72). The RX_CRC_VALID bit needs to be checked in order to dismiss corrupted frames. Table 9-10. Configuration of a Sniffer Device Register Name Register Bits Description AACK_PROM_MODE 1 1: Enable promiscuous mode AACK_DIS_ACK 4 1: Disable generation of acknowledgment This operating mode is similar to the promiscuous mode. 56 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Reception of Reserved Frames Frames with reserved frame types (see section Table 9-19 on page 69) can also be handled in RX_AACK mode. This might be required when implementing proprietary, non-standard compliant protocols. It is an extension of the address filtering in RX_AACK mode. Received frames are either handled similar to data frames or may be allowed to completely bypass the address filter. Table 9-11 below shows the required configuration for a node to receive reserved frames and Figure 9-20 on page 52 shows the corresponding flow chart. Table 9-11. RX_AACK Configuration to Receive Reserved Frame Types Register Name Register Bits SHORT_ADDR_0/1 PAN_ADDR_0/1 IEEE_ADDR_0 ... IEEE_ADDR_7 Description Set node addresses RX_SAFE_MODE 7 0: disable frame protection 1: enable frame protection AACK_UPLD_RES_FT 4 1 : Enable reserved frame type reception AACK_FLTR_RES_FT 5 Filter reserved frame types like data frame type, see note below 0 : disable 1 : enable SLOTTED_OPERATION 0 0: if transceiver works in un-slotted mode 1: if transceiver works in slotted mode AACK_I_AM_COORD 3 0: device is not PAN coordinator 1: device is PAN coordinator AACK_DIS_ACK 4 0: Enable generation of acknowledgment 1: Disable generation of acknowledgment AACK_FVN_MODE 7:6 Controls the ACK behavior, depends on FCF frame version number 0x00 : acknowledges only frames with version number 0, i.e. according to IEEE 802.15.4-2003 frames 0x01 : acknowledges only frames with version number 0 or 1, i.e. frames according to IEEE 802.15.4-2006 0x10 : acknowledges only frames with version number 0 or 1 or 2 0x11 : acknowledges all frames, independent of the FCF frame version number There are two different options for handling reserved frame types. 1. AACK_UPLD_RES_FT = 1, AACK_FLT_RES_FT = 0: Any non-corrupted frame with a reserved frame type is indicated by a TRX24_RX_END interrupt. No further address filtering is applied on those frames. A TRX24_AMI interrupt is never generated and the acknowledgment subfield is ignored. 2. AACK_UPLD_RES_FT = 1, AACK_FLT_RES_FT = 1: 57 42073B-MCU Wireless-09/14 If AACK_FLT_RES_FT = 1 any frame with a reserved frame type is filtered by the address filter similar to a data frame as described in the standard. Consequently, a TRX24_AMI interrupt is generated upon address match. A TRX24_RX_END interrupt is only generated if the address matched and the frame was not corrupted. An acknowledgment is only send, when the ACK request subfield was set in the received frame and a TRX24_RX_END interrupt occurred. Note that It is not allowed to set AACK_FLTR_RES_FT = 1 and have register bit AACK_FLTR_RES_FT set to 0. Short Acknowledgment Frame (ACK) Start Timing The bit AACK_ACK_TIME of register XAH_CTRL_1 defines the symbol time between frame reception and transmission of an acknowledgment frame. Table 9-12. Overview of RX_AACK Configuration Bits Register Name Register Bit AACK_ACK_TIME 2 Description 0: Standard compliant acknowledgement timing of 12 symbol periods. In slotted acknowledgement operation mode, the acknowledgment frame transmission can be triggered 6 symbol periods after reception of the frame earliest. 1: Reduced acknowledgment timing of 2 symbol periods (32 s). Note that this feature can be used in all scenarios, independent of other configurations. However, shorter acknowledgment timing is especially useful when using High Data Rate Modes to increase battery lifetime and to improve the overall data throughput; see "High Data Rate Modes" on page 93 for details. 9.4.2.4 Frame Filtering Frame Filtering is an evaluation whether or not a received frame is dedicated for this node. To accept a received frame and to generate an address match interrupt (TRX24_AMI) a filtering procedure as described in IEEE 802.15.4-2006 chapter 7.5.6.2. (Third level of filtering) is applied to the frame. The radio transceiver's RX_AACK mode accepts only frames that satisfy all of the following requirements (quote from IEEE 802.15.4-2006, 7.5.6.2): 1. The Frame Type subfield shall not contain a reserved frame type. 2. The Frame Version subfield shall not contain a reserved value. 3. If a destination PAN identifier is included in the frame, it shall match macPANId or shall be the broadcast PAN identifier (0xFFFF). 4. If a short destination address is included in the frame, it shall match either macShortAddress or the broadcast address (0xFFFF). Otherwise, if an extended destination address is included in the frame, it shall match aExtendedAddress. 5. If the frame type indicates that the frame is a beacon frame, the source PAN identifier shall match macPANId unless macPANId is equal to 0xFFFF, in which case the beacon frame shall be accepted regardless of the source PAN identifier. 6. If only source addressing fields are included in a data or MAC command frame, the frame shall be accepted only if the device is the PAN coordinator and the source PAN identifier matches macPANId. The radio transceiver requires two additional rules: 1. The frame type indicates that the frame is not an ACK frame (refer toTable 9-7 on page 54). 58 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 2. At least one address field must be configured. Address match, indicated by the TRX24_AMI interrupt is further controlled by the content of subfields of the frame control field of a received frame according to the following rule: If (Destination Addressing Mode = 0 OR 1) AND (Source Addressing Mode = 0) no TRX24_AMI interrupt is generated, refer to Figure 9-27 on page 69. This effectively causes all acknowledgement frames not to be announced which otherwise always pass the filter regardless of whether they are intended for this device or not. For backward compatibility to IEEE 802.15.4-2003 third level filter rule 2 (Frame Version) can be disabled by the bits AACK_FVN_MODE of register CSMA_SEED_1. Frame filtering is available in Extended and Basic Operating Mode (see section "Basic Operating Mode" on page 38); a frame passing the frame filtering generates an TRX24_AMI interrupt, if enabled. Note: 1. Filter rule 1 is affected by register bits AACK_FLTR_RES_FT and AACK_UPLD_RES_FT (see register "XAH_CTRL_1 - Transceiver Acknowledgment Frame Control Register 1" on page 132). 2. Filter rule 2 is affected by register bits AACK_FVN_MODE (see register "CSMA_SEED_1 - Transceiver Acknowledgment Frame Control Register 2" on page 144). 9.4.2.4.1 RX_AACK Slotted Operation - Slotted Acknowledgement The radio transceiver supports slotted acknowledgement operation according to IEEE 802.15.4-2006, section 5.5.4.1. In RX_AACK mode with bit SLOTTED_OPERATION of register XAH_CTRL_0 set, the transmission of an acknowledgement frame has to be controlled by the microcontroller. If an ACK frame has to be transmitted the radio transceiver expects writing SLPTR=1 to actually start the transmission. This waiting state is signaled 6 symbol periods after the reception of the last symbol of a data or MAC command frame by bits TRAC_STATUS of register XAH_CTRL_0, which are set to SUCCESS_WAIT_FOR_ACK in that case. In networks using slotted operation the start of the acknowledgment frame and thus the exact timing must be provided by the microcontroller. A timing example of an RX_AACK transaction with bit SLOTTED_OPERATION of register XAH_CTRL_0 set is shown in the next figure. The acknowledgement frame is ready to transmit 6 symbol times after the reception of the last symbol of a data or MAC command frame. The transmission of the acknowledgement frame is initiated by the microcontroller by writing SLPTR=1 and starts 16s (tTR10) later. The interrupt latency tIRQ is specified in section "Digital Interface Timing Characteristics" on page 560. 59 42073B-MCU Wireless-09/14 Figure 9-11. Example Timing of an RX_AACK Transaction for Slotted Operation F ram e T ype SFD T R X_ ST AT E 7 04 D ata Fram e (Length = 10, A C K = 1) 1 026 A C K F ram e R X _A A C K _O N B U S Y _R X _AA C K R X _A AC K_O N RX R X/TX TTX X IR Q RX T R X 24_T X _E N D T R X 24_R X _E N D t IR Q T yp . Processing D elay tim e [ s] Frame on Air 51 2 64 t IR Q 96 s (6 sym bols) RX/TX 0 A C K transm ission initiated by m icrocontroller S LP T R w aiting period signaled by register bits T R A C _S T A T U S S LP TR tT R 1 0 If bit AACK_ACK_TIME of register XAH_CTRL_1 is set, an acknowledgment frame can be sent already 2 symbol times after the reception of the last symbol of a data or MAC command frame. 9.4.2.4.2 RX_AACK Mode Timing A timing example of an RX_AACK transaction is shown in the next figure. In this example a data frame of length 10 with an ACK request is received. The radio transceiver changes to state BUSY_RX_AACK after SFD detection. The completion of the frame reception is indicated by a TRX24_RX_END interrupt. Interrupts TRX24_RX_START and TRX24_AMI are disabled in this example. The ACK frame is automatically transmitted after a default wait period of 12 symbols (192 s), bit AACK_ACK_TIME = 0 (reset value). The interrupt latency tIRQ is specified in section "Digital Interface Timing Characteristics" on page 560. Figure 9-12. Example Timing of an RX_AACK Transaction F ram e T ype 512 D ata F ram e (Length = 10, A C K = 1) SFD T R X _S T A T E 1 088 B U S Y _R X _A A C K RX R X _A A C K _O N TX IR Q RX TR X 24_ TX _E N D TR X 24 _R X _E N D t IR Q T yp. P rocessing D elay tim e [ s] A C K F ram e R X _A A C K _O N R X /T X 7 04 Frame on Air 64 RX/TX 0 t IR Q 192 s (12 sym bols) If bit AACK_ACK_TIME of register XAH_CTRL_1 is set, an acknowledgment frame is sent already 2 symbol times after the reception of the last symbol of a data or MAC command frame. 9.4.2.5 MAF - Multiple Address Filter Certain scenarios, like different PANs, may require to extend the address filter to multiple PANs. The address filter was extended to support four PANs. The address filter unit consists of four independent filter blocks. The incoming signal is analyzed in parallel by all filter blocks. Each block can be enabled separately and is 60 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 configured by a short address and pan ID. The IEEE 64 bit address is the same for every filter block. There are some separate configuration bits for every filter block (see Table 9-13 below). Table 9-13. Additional register set for Multiple Address Filter Register Name Description {MAFSA0H,MAFSA0L} short address for filter #0 both register are mirror register of {SHORT_ADDR_1,SHORT_ADDR_0} {MAFSA1H,MAFSA1L} short address for filter #1 {MAFSA2H,MAFSA2L} short address for filter #2 {MAFSA3H,MAFSA3L} short address for filter #3 {MAFPA0H,MAFPA0L} Pan ID for filter #0 both register are mirror register of {PAN_ID_1,PAN_ID_0} {MAFPA1H,MAFPA1L} Pan ID for filter #1 {MAFPA2H,MAFPA2L} Pan ID for filter #2 {MAFPA3H,MAFPA3L} Pan ID for filter #3 MAFCR0 bits MAFxEN to enable filter #x MAFCR1 bits AACK_I_AM_COORDx to enable filter #x as coordinator bits AACK_SET_PDx to enable pending data bit of filter #x TRX24_AMIx each address filter #x generates the respective TRX24_AMIx interrupt Note: There are some register which are mirrored. * MAFSA0H <--> SHORT_ADDR_0 * MAFSA1H <--> SHORT_ADDR_1 * MAFPA0H <--> PAN_ID_0 * MAFPA1H <--> PAN_ID_1 * bit AACK_I_AM_COORD (register CSMA_SEED_1) <--> bit AACK_I_AM_COORD0 (register MAFCR1) * bit AACK_SET_PD (register CSMA_SEED_1) <--> bit AACK_SET_PD (register MAFCR1) That means access to the registers is equal, the internal function can be written or read by both registers. Bit MAF0EN is set by reset to provide backward compatibility. The four address filter blocks generate four address match interrupts. Table 9-14. Additional AMI Interrupts for Multiple Address Filter Interrupt Name Description TRX24_AMI0 address match interrupt from address filter #0, enabled bit AMI0 in register IRQ_MASK1 is set TRX24_AMI1 address match interrupt from address filter #1, enabled bit AMI1 in register IRQ_MASK1 is set TRX24_AMI2 address match interrupt from address filter #2, enabled bit AMI2 in register IRQ_MASK1 is set 61 42073B-MCU Wireless-09/14 Interrupt Name TRX24_AMI3 Description address match interrupt from address filter #3, enabled bit AMI3 in register IRQ_MASK1 is set Note: If bit AMI_EN is set in register IRQ_MASK, interrupt TRX24_XAH_AMI occures if any of the four filter detects an address match. It is not allowed to configure two enabled address filter to the same short address and PAN. 62 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 9.4.2.6 TX_ARET_ON - Transmit with Automatic Retry and CSMA-CA Retry Figure 9-13. Flow Diagram of TX_ARET TRX_STATE = TX_AR ET_O N fra m e _ rctr = 0 N S ta rt T X Y TR X _S TA TE = B U S Y _TX _A R E T T R A C _ S T A T U S = IN V A L ID (s e e N o te 1 ) N N o te 1 : If M A X _ C S M A _ R E T R IE S = 7 n o re try is p e rfo rm e d MAX_CSM A_RETRIES <7 Y cs m a _ rctr = 0 R a n d o m B a c k -O ff c sm a _ rc tr = c sm a _ rctr + 1 CCA N CCA R e su lt F a ilu re c sm a _ rctr > MAX_CSMA_RETRIES Y S u c ce ss T ra n s m it F ra m e fra m e _ rc tr = fra m e _ rctr + 1 A C K re q u e ste d N Y N R e c e iv e A C K u n til tim e o u t Y A C K va lid Y N N fra m e _ rc tr > M A X _ F R A M E _ R E T R IE S Y TR A C _S TA TU S = N O _AC K D a ta P e n d in g N Y TRAC_STATU S = S U C C E S S _ D A T A _ P E N D IN G TR A C _S TA TU S = SUCCESS TR AC _STATU S = C H A N N E L _ A C C E S S _ F A IL U R E Is su e T R X 2 4 _ T X _ E N D in te rru p t TRX_STATE = TX_AR ET_O N 63 42073B-MCU Wireless-09/14 Overview The implemented TX_ARET algorithm is shown in Figure 9-13 on page 63. In TX_ARET mode, the radio transceiver first executes the CSMA-CA algorithm, as defined by IEEE 802.15.4-2006, section 7.5.1.4, initiated by a transmit start event. If the channel is IDLE a frame is transmitted from the Frame Buffer. If the acknowledgement frame is requested the radio transceiver additionally checks for an ACK reply. A TRX24_TX_END interrupt indicates the completion of the TX_ARET transmit transaction. Description Configuration and address bits are to be set in TRX_OFF or PLL_ON state prior to switching to TX_ARET mode. It is further recommended to transfer the PSDU data to the Frame Buffer in advance. The transaction is started by either writing SLPTR=1 as described in section "Transceiver Pin Register TRXPR" on page 35 or writing a TX_START command to register TRX_STATE. If the CSMA-CA detects a busy channel, it is retried as specified by bits MAX_CSMA_RETRIES of register XAH_CTRL_0. In case that CSMA-CA does not detect a clear channel after MAX_CSMA_RETRIES it aborts the TX_ARET transaction, issues a TRX24_TX_END interrupt and sets the value of the TRAC_STATUS register bits to CHANNEL_ACCESS_FAILURE. During transmission of a frame the radio transceiver parses bit 5 (ACK Request) of the MAC header (MHR) frame control field of the PSDU data (PSDU octet #1) to be transmitted to check if an ACK reply is expected. If an ACK is expected the radio transceiver automatically switches into receive mode to wait for a valid ACK reply. After receiving an ACK frame the Frame Pending subfield of that frame is parsed and the status register bits TRAC_STATUS are updated accordingly (see Table 9-19 below). This receive procedure does not overwrite the Frame Buffer content. Transmit data in the Frame Buffer is not changed during the entire TX_ARET transaction. Received frames other than the expected ACK frame are discarded. If no valid ACK is received or after timeout of 54 symbol periods (864 s), the radio transceiver retries the entire transaction (including CSMA-CA) until the maximum number of retransmissions as set by the bits MAX_FRAME_RETRIES in register XAH_CTRL_0 is exceeded. After that, the microcontroller may read the value of the bits TRAC_STATUS of register TRX_STATE to verify whether the transaction was successful or not. The register bits are set according to the following cases: Table 9-19. Interpretation of the TRAC_STATUS register bits Value 64 Name Description 0 SUCCESS The transaction was responded by a valid ACK, or, if no ACK is requested, after a successful frame transmission 1 SUCCESS_DATA_PENDING Equivalent to SUCCESS; indicates pending frame data according to the MHR frame control field of the received ACK response 3 CHANNEL_ACCESS_FAILURE Channel is still busy after MAX_CSMA_RETRIES of CSMA-CA ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Value Name Description 5 NO_ACK No acknowledgement frames were received during all retry attempts 7 INVALID Entering TX_ARET mode sets TRAC_STATUS = 7 Note that if no ACK is expected (according to the content of the received frame in the Frame Buffer), the radio transceiver issues a TRX24_TX_END interrupt directly after the frame transmission has been completed. The value of the bits TRAC_STATUS of register TRX_STATE is set to SUCCESS. A value of MAX_CSMA_RETRIES = 7 initiates an immediate TX_ARET transaction without performing CSMA-CA. This is required to support slotted acknowledgement operation. Further the value MAX_FRAME_RETRIES is ignored and the TX_ARET transaction is performed only once. A timing example of a TX_ARET transaction is shown in Figure 9-14 below . Figure 9-14. Example Timing of a TX_ARET Transaction 128 FrameType x Data Frame (Length = 10, ACK=1) TX_ARET_ON RX/TX ACK Frame BUSY_TX_ARET TX_ARET_ON RX TX CSMA-CA time [s] x+352 RX/TX TRX_STATE 672 Frame on Air 0 SLPTR IRQ Typ. Processing Delay RX_END tCSM A-CA 16 s Note: 32 s tIRQ 1. tCSMA-CA defines the random CSMA-CA processing time. Here an example data frame of length 10 with an ACK request is transmitted, see Table 9-16 on page 66. After the transmission the radio transceiver switches to receive mode and expects an acknowledgement response. During the whole transaction including frame transmit, wait for ACK and ACK receive the radio transceiver status register TRX_STATUS signals BUSY_TX_ARET. A successful reception of the acknowledgment frame is indicated by the TRX24_TX_END interrupt. The status register TRX_STATUS changes back to TX_ARET_ON. The TX_ARET status register TRAC_STATUS changes as well to TRAC_STATUS = SUCCESS or TRAC_STATUS = SUCCESS_DATA_PENDING if the frame pending subfield of the received ACK frame was set to 1. 9.4.2.7 Interrupt Handling The interrupt handling in the Extended Operating Mode is similar to the Basic Operating Mode (see section "Interrupt Handling" on page 42). The microcontroller enables interrupts by setting the appropriate bit in register IRQ_MASK. For RX_AACK and TX_ARET the following interrupts (Table 9-16 on page 66) inform about the status of a frame reception and transmission: 65 42073B-MCU Wireless-09/14 Table 9-16. Interrupt Handling in Extended Operating Mode Mode Interrupt Description RX_AACK TRX24_RX_START Indicates a PHR reception TRX24_AMI Issued at address match TRX24_RX_END Signals completion of RX_AACK transaction if successful - A received frame must pass the address filter; - The FCS is valid TX_ARET TRX24_TX_END Signals completion of TX_ARET transaction Both TRX24_PLL_LOCK Entering RX_AACK_ON or TX_ARET_ON state from TRX_OFF state, the TRX24_PLL_LOCK interrupt signals that the transaction can be started RX_AACK For RX_AACK it is recommended to enable the TRX24_RX_END interrupt. This interrupt is issued only if a frame passes the frame filtering (see section "Frame Filtering" on page 58) and has a valid FCS. This is different to Basic Operating Mode (see section "Basic Operating Mode" on page 38). The use of the other interrupts is optional. On reception of a valid PHR a TRX24_RX_START interrupt is issued. The TRX24_AMI interrupt indicates an address match (see filter rules in section "Frame Filtering" on page 58). The completion of a frame reception with a valid FCS is indicated by the TRX24_RX_END interrupt. Thus it can happen that a TRX24_RX_START and/or a TRX24_AMI interrupt are issued, but no TRX24_RX_END interrupt. The end of an acknowledgment transmission is confirmed by a TRX24_TX_END interrupt. TX_ARET In TX_ARET interrupt TRX24_TX_END is only issued after completing the entire TX_ARET transaction. Acknowledgement frames do not issue a TRX24_RX_START, TRX24_AMI or a TRX24_RX_END interrupt. All other interrupts as described in section Table 9-2 on page 37 are also available in Extended Operating Mode. 9.4.2.8 Register Summary The following registers (Table 9-17 below) are to be configured to control the Extended Operating Mode: Table 9-17. Register Summary 66 Register Name Description TRX_STATUS Radio transceiver status, CCA result TRX_STATE Radio transceiver state control, TX_ARET status TRX_CTRL_1 TX_AUTO_CRC_ON PHY_CC_CCA CCA mode control, Table 9-24 on page 76 CCA_THRES CCA threshold settings, see "Overview" on page 76 XAH_CTRL_1 RX_AACK control ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Register Name Description IEEE_ADDR_7 .... IEEE_ADDR_0 PAN_ID_1 PAN_ID_0 SHORT_ADDR_1 SHORT_ADDR_0 Address filter configuration Short address, PAN-ID and IEEE address XAH_CTRL_0 TX_ARET control, retries value control CSMA_SEED_0 CSMA-CA seed value CSMA_SEED_1 CSMA-CA seed value, RX_AACK control CSMA_BE CSMA-CA back-off exponent control 9.5 Functional Description 9.5.1 Introduction - IEEE 802.15.4-2006 Frame Format Figure 9-15 below provides an overview of the physical layer (PHY) frame structure as defined by IEEE 802.15.4. Figure 9-16 on page 68 shows the frame structure of the medium access control (MAC) layer. Figure 9-15. IEEE 802.15.4 Frame Format - PHY-Layer Frame Structure (PPDU) 9.5.1.1 PHY Protocol Layer Data Unit (PPDU) 9.5.1.1.1 Synchronization Header (SHR) The SHR consists of a four-octet preamble field (all zero), followed by a single byte start-of-frame delimiter (SFD) which has the predefined value 0xA7. During transmit, the SHR is automatically generated by the radio transceiver, thus the Frame Buffer shall contain PHR and PSDU only. The transmission of the SHR requires 160 s (10 symbols). As the frame buffer access is normally faster than the over-air data rate, this allows the application software to initiate a transmission without having transferred the full frame data already. Instead it is possible to subsequently write the frame content. During frame reception, the SHR is used for synchronization purposes. The matching SFD determines the beginning of the PHR and the following PSDU payload data. 9.5.1.1.2 PHY Header (PHR) The PHY header is a single octet following the SHR. The least significant 7 bits denote the frame length of the following PSDU, while the most significant bit of that octet is reserved, and shall be set to 0 for IEEE 802.15.4 compliant frames. 67 42073B-MCU Wireless-09/14 On receive the PHR is returned as the first octet during Frame Buffer read access, the most significant bit always set to 0. For IEEE 802.15.4 compliant operation bit 8 has to be masked by software. The reception of a valid PHR is signaled by a TRX24_RX_START interrupt. On transmit the PHR has to be written first to the Frame Buffer. 9.5.1.1.3 PHY Payload (PHY Service Data Unit, PSDU) The PSDU has a variable length between 0 and aMaxPHYPacketSize (127, maximum PSDU size in octets) whereas the last two octets are used for the Frame Check Sequence (FCS). The length of the PSDU is signaled by the frame length field (PHR) as described in Table 9-18 below. The PSDU contains the MAC Protocol Layer Data Unit (MPDU). Received frames with a frame length field set to 0x00 (invalid PHR) are not by an interrupt. Table 9-18 below summarizes the type of payload versus the frame length value. Table 9-18. Frame Length Field - PHR Frame Length Value Payload 0-4 Reserved 5 6-8 9 - aMaxPHYPacketSize MPDU (Acknowledgement) Reserved MPDU 9.5.1.2 MAC Protocol Layer Data Unit (MPDU) Figure 9-16 below shows the frame structure of the MAC layer. Figure 9-16. IEEE 802.15.4 Frame Format - MAC-Layer Frame Structure (MPDU) 9.5.1.2.1 MAC Header (MHR) Fields The MAC header consists of the Frame Control Field (FCF), a sequence number, and the addressing fields (which are of variable length and can even be empty in certain situations). 68 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 9.5.1.2.2 Frame Control Field (FCF) The FCF consists of 16 bits, and occupies the first two octets of either the MPDU or the PSDU, respectively. Figure 9-27. IEEE 802.15.4-2006 Frame Control Field (FCF) Bit [2:0]: describe the frame type. Table 9-19 below summarizes frame types defined by IEEE 802.15.4, section 7.2.1.1.1. Table 9-19. Frame Control Field - Frame Type Subfield Frame Control Field Bit Assignments Description Frame Type Value b2 b1 b0 Value 000 0 Beacon 001 1 Data 010 2 Acknowledge 011 3 MAC command 100 - 111 4-7 Reserved This subfield is used for address filtering by the third level filter rules. Only frame types 0 - 3 pass the third level filter rules (refer to section "Frame Filtering" on page 58). Automatic address filtering of the radio transceiver is enabled when using the RX_AACK mode (refer to "RX_AACK_ON - Receive with Automatic ACK" on page 50). A reserved frame (frame type value > 3) can be received if bit AACK_UPLD_RES_FT of register XAH_CTRL_1 is set. For details refer to chapter "Configuration of non IEEE 802.15.4 Compliant Scenarios" on page 56. Address filtering is also provided in Basic Operating Mode as explained in "Basic Operating Mode" on page 38. Bit 3: indicates whether security processing applies to this frame. Bit 4: is the "Frame Pending" subfield. This field can be set in an acknowledgment frame (ACK) in response to a data request MAC command frame. This bit indicates that the node, which transmitted the ACK, has more data to send to the node receiving the ACK. For acknowledgment frames automatically generated by the radio transceiver, this bit is set according to the content of bit AACK_SET_PD of register CSMA_SEED_1 if the received frame was a data request MAC command frame. Bit 5: forms the "Acknowledgment Request" subfield. If this bit is set within a data or MAC command frame that is not broadcast, the recipient shall acknowledge the reception of the frame within the time specified by IEEE 802.15.4 (i.e. within 192 s for non beacon-enabled networks). The radio transceiver parses this bit during RX_AACK mode and transmits an acknowledgment frame if necessary. In TX_ARET mode this bit indicates if an acknowledgement frame is expected after transmitting a frame. If this is the case, the receiver waits for the acknowledgment frame, otherwise the TX_ARET transaction is finished. 69 42073B-MCU Wireless-09/14 Bit 6: the "Intra-PAN" subfield indicates that in a frame, where both, the destination and source addresses are present, the PAN-ID of the source address filed is omitted. In RX_AACK mode this bit is evaluated by the address filter logic of the radio transceiver. Bit [11:10]: the "Destination Addressing Mode" subfield describes the format of the destination address of the frame. The values of the address modes are summarized in Table 9-20 below according to IEEE 802.15.4: Table 9-20. Frame Control Field - Destination and Source Addressing Mode Frame Control Field Bit Assignments Description Addressing Mode b11 b10 b15 b14 Value 00 0 PAN identifier and address fields are not present 01 1 Reserved 10 2 Address field contains a 16-bit short address 11 3 Address field contains a 64-bit extended address If the destination address mode is either 2 or 3 (i.e. if the destination address is present), it always consists of a 16-bit PAN-ID first followed by either the 16-bit or 64-bit address as defined by the mode. Bit [13:12]: the "Frame Version" subfield specifies the version number corresponding to the frame. These register bits are reserved in IEEE-802.15.4-2003. This subfield shall be set to 0 to indicate a frame compatible with IEEE 802.15.4-2003 and 1 to indicate an IEEE 802.15.4-2006 frame. All other subfield values shall be reserved for future use. The bit AACK_FVN_MODE of register CSMA_SEED_1 controls the RX_AACK behavior of frame acknowledgements. This register determines if, depending on the Frame Version Number, a frame is acknowledged or not. This is necessary for backward compatibility to IEEE 802.15.4-2003 and for future use. Even if frame version numbers 2 and 3 are reserved, it can be handled by the radio transceiver. For details refer to "CSMA_SEED_1 - Transceiver Acknowledgment Frame Control Register 2" on page 144. See IEEE 802.15.4-2006, section 7.2.3 for details on frame compatibility. Table 9-21. Frame Control Field - Frame Version Subfield Frame Control Field Bit Assignments Description Frame Version b13 b12 Value 00 0 Frames are compatible with IEEE 802.15.4-2003 01 1 Frames are compatible with IEEE 802.15.4-2006 10 2 Reserved 11 3 Reserved Bit [15:14]: the "Source Addressing Mode" subfield, with similar meaning as "Destination Addressing Mode" (refer to Table 9-20 above). The subfields of the FCF (Bits 0-2, 3, 6, 10-15) affect the address filter logic of the radio transceiver while executing a RX_AACK operation (see "RX_AACK_ON - Receive with Automatic ACK" on page 50). 70 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 9.5.1.2.3 Frame Compatibility between IEEE 802.15.4-2003 and IEEE 802.15.4-2006 All unsecured frames according to IEEE 802.15.4-2006 are compatible with unsecured frames compliant with IEEE 802.15.4-2003 with two exceptions: a coordinator realignment command frame with the "Channel Page" field present (see IEEE 802.15.42006 7.3.8) and any frame with a MAC Payload field larger than aMaxMACSafePayloadSize octets. Compatibility for secured frames is shown in the following table, which identifies the security operating modes for IEEE 802.15.4-2006. Table 9-22. Frame Control Field - Security and Frame Version Frame Control Field Bit Assignments Description Security Enabled b3 Frame Version b13 b12 0 00 No security. Frames are compatible between IEEE 802.15.4-2003 and IEEE 802.15.4-2006. 0 01 No security. Frames are not compatible between IEEE 802.15.4-2003 and IEEE 802.15.4-2006. 1 00 Secured frame formatted according to IEEE 802.15.4-2003. This frame type is not supported in IEEE 802.15.4-2006. 1 01 Secured frame formatted according to IEEE 802.15.4-2006 9.5.1.2.4 Sequence Number The one-octet sequence number following the FCF identifies a particular frame, so that duplicated frame transmissions can be detected. While operating in RX_AACK mode, the content of this field is copied from the frame to be acknowledged into the acknowledgment frame. 9.5.1.2.5 Addressing Fields The addressing fields of the MPDU are used by the radio transceiver for address matching indication. The destination address (if present) is always first, followed by the source address (if present). Each address field consists of the Intra PAN-ID and a device address. If both addresses are present and the "Intra PAN-ID compression" subfield in the FCF is set to one, the source Intra PAN-ID is omitted. Note that in addition to these general rules IEEE 802.15.4 further restricts the valid address combinations for the individual possible MAC frame types. For example the situation where both addresses are omitted (source addressing mode = 0 and destination addressing mode = 0) is only allowed for acknowledgment frames. The address filter in the radio transceiver has been designed to apply to IEEE 802.15.4 compliant frames. It can be configured to handle other frame formats and exceptions. 9.5.1.2.6 Auxiliary Security Header Field The Auxiliary Security Header specifies information required for security processing and has a variable length. This field determines how the frame is actually protected (security level) and which keying material from the MAC security PIB is used (see IEEE 802.15.4-2006, 7.6.1). This field shall be present only if the Security Enabled 71 42073B-MCU Wireless-09/14 subfield b3 is set to one (see section "Frame Compatibility between IEEE 802.15.42003 and IEEE 802.15.4-2006" on page 71). For details of its structure see IEEE 802.15.4-2006, 7.6.2 Auxiliary security header. 9.5.1.2.7 MAC Service Data Unit (MSDU) This is the actual MAC payload. It is usually structured according to the individual frame type. A description can be found in IEEE 802.15.4-2006, chapter 5.5.3.2. 9.5.1.2.8 MAC Footer (MFR) Fields The MAC footer consists of a two-octet Frame Checksum (FCS). For details refer to the following section "Frame Check Sequence (FCS)" below. 9.5.2 Frame Check Sequence (FCS) The Frame Check Sequence (FCS) is characterized by: * Indicate bit errors based on a cyclic redundancy check (CRC) of 16 bit length; * Uses International Telecommunication Union (ITU) CRC polynomial; * Automatically evaluated during reception; * Can be automatically generated during transmission. 9.5.2.1 Overview The FCS is intended for use at the MAC layer to detect corrupted frames at a first level of filtering. It is computed by applying an ITU CRC polynomial to all transferred bytes following the length field (MHR and MSDU fields). The frame check sequence has a length of 16 bit and is located in the last two bytes of a frame (MAC footer, see Figure 9-16 on page 68). The radio transceiver applies an FCS check on each received frame. The result of the FCS check is stored in bit RX_CRC_VALID of register PHY_RSSI. On transmit the radio transceiver generates and appends the FCS bytes during the frame transmission. This behavior can be disabled by setting the bit TX_AUTO_CRC_ON = 0 in register TRX_CTRL_1. 9.5.2.2 CRC calculation The CRC polynomial used in IEEE 802.15.4 networks is defined by G16 ( x ) = x 16 + x 12 + x 5 + 1 The FCS shall be calculated for transmission using the following algorithm: Let M ( x) = b0 x k -1 + b1 x k - 2 + K + bk - 2 x + bk -1 be the polynomial representing the sequence of bits for which the checksum is to be 16 computed. Multiply M(x) by x giving the polynomial N ( x) = M ( x) x16 Divide N (x ) modulo 2 by the generator polynomial G16(x) to obtain the remainder polynomial R ( x ) = r0 x 15 + r1 x 14 + ... + r14 x + r15 The FCS field is given by the coefficients of the remainder polynomial, R(x). 72 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Example: Consider a 5 octet ACK frame. The MHR field consists of 0100 0000 0000 0000 0101 0110. The leftmost bit (b0) is transmitted first in time. The FCS is in this case 0010 0111 1001 1110. The leftmost bit (r0) is transmitted first in time. 9.5.2.3 Automatic FCS generation The automatic FCS generation is performed with register bit TX_AUTO_CRC_ON = 1 (reset value). This allows the radio transceiver to autonomously compute the FCS. For a frame with a frame length specified as N (3 N 127), the FCS is calculated on the first N-2 octets in the Frame Buffer and the resulting FCS field is transmitted in place of the last two octets from the Frame Buffer. If the automatic FCS generation of the radio transceivers is enabled, the Frame Buffer write access can be stopped right after MAC payload. There is no need to write FCS dummy bytes. In RX_AACK mode, when a received frame needs to be acknowledged, the FCS of the ACK frame is always automatically generated by the radio transceiver, independent of the TX_AUTO_CRC_ON setting. Example: A frame transmission of length five with TX_AUTO_CRC_ON set, is started with a Frame Buffer write access of five bytes (the last two bytes can be omitted). The first three bytes are used for FCS generation; the last two bytes are replaced by the internally calculated FCS. 9.5.2.4 Automatic FCS check An automatic FCS check is applied on each received frame with a frame length N 2. The bit RX_CRC_VALID of register PHY_RSSI is set if the FCS of a received frame is valid. The register bit is updated when issuing a TRX24_RX_END interrupt and remains valid until a new frame reception causes the next TRX24_RX_END interrupt. In RX_AACK mode, the radio transceiver rejects the frame and the TRX24_RX_END interrupt is not issued if the FCS of the received frame is not valid. In TX_ARET mode, the FCS and the sequence number of an ACK are automatically checked. The ACK is not accepted if one of those is not correct. 9.5.3 Received Signal Strength Indicator (RSSI) The Received Signal Strength Indicator is characterized by: * Minimum RSSI level is -90 dBm (RSSI_BASE_VAL); * Dynamic range is 81 dB; * Minimum RSSI value is 0; * Maximum RSSI value is 28. 9.5.3.1 Overview The RSSI is a 5-bit value indicating the receive power in the selected channel in steps of 3 dB. No attempt is made to distinguish IEEE 802.15.4 signals from others. Only the 73 42073B-MCU Wireless-09/14 received signal strength is evaluated. The RSSI provides the basis for an ED measurement. See section "Energy Detection (ED)" below for details. 9.5.3.2 Reading RSSI In Basic Operating Mode the RSSI value is valid in any receive state, and is updated every tTR25 = 2 s to register PHY_RSSI. It is not recommended to read the RSSI value when using the Extended Operating Mode. The automatically generated ED value should then be used (see section "Energy Detection (ED)" below). 9.5.3.3 Data Interpretation The RSSI value is a 5-bit value indicating the receive power in steps of 3 dB and with a range of 0- 28. An RSSI value of 0 indicates a receiver RF input power of PRF < -90 dBm. For an RSSI value in the range of 1 to 28, the RF input power can be calculated as follows: PRF = RSSI_BASE_VAL + 3 * (RSSI - 1) [dBm] Figure 9-18. Mapping between RSSI Value and Received Input Power 10 Receiver Input Power P RF [dBm] 0 Measured -10 Ideal -20 -30 -40 -50 -60 -70 -80 -90 -100 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 RSSI 9.5.4 Energy Detection (ED) The Energy Detection (ED) module is characterized by: * 85 unique energy levels defined; * 1 dB resolution. 9.5.4.1 Overview The receiver ED measurement is used by the network layer as part of a channel selection algorithm. It is an estimation of the received signal power within the bandwidth of an IEEE 802.15.4 channel. No attempt is made to identify or decode signals on the channel. The ED value is calculated by averaging RSSI values over eight symbols (128 s). 74 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 For High Data Rate Modes the automated ED measurement duration is reduced to 32 s as described in "High Data Rate Modes" on page 93. The measurement period in these modes is still 128 s for manually initiated ED measurements as long as the receiver is in RX_ON state. 9.5.4.2 Measurement Description There are two ways to initiate an ED measurement: * Manually, by writing an arbitrary value to register PHY_ED_LEVEL, or * Automatically, after detection of a valid SHR of an incoming frame. For manually initiated ED measurements the radio transceiver needs to be in one of the states RX_ON or BUSY_RX. The end of the ED measurement is indicated by a TRX24_CCA_ED_DONE interrupt. The automatic ED measurement is started if a SHR is detected. The end of the automatic measurement is not signaled by an interrupt. The measurement result is stored after tTR26 = 140 s (128 s measurement duration and processing delay) in register PHY_ED_LEVEL. Thus by using Basic Operating Mode a valid ED value from the currently received frame is accessible 108 s after the TRX24_RX_START interrupt and remains valid until the next incoming frame generates a new TRX24_RX_START interrupt or until another ED measurement is initiated. When using the Extended Operating Mode it is recommended to mask the TRX24_RX_START interrupt. Hence the interrupt cannot be used as timing reference. A successful frame reception is signalized by the TRX24_RX_END interrupt. The minimum time span between a TRX24_RX_END interrupt and a following SFD detection is tTR27 = 96 s due to the length of the SHR. The ED value needs to be read within 224 s including the ED measurement time after the TRX24_RX_END interrupt. Otherwise it could be overwritten by the result of the next measurement cycle. This is important for time critical applications or if the TRX24_RX_START interrupt is not used to indicate the reception of a frame. The values of the register PHY_ED_LEVEL are: Table 9-23. Register Bit PHY_ED_LEVEL Interpretation PHY_ED_LEVEL Description 0xFF Reset value 0x00 ... 0x53 Note: ED measurement result of the last ED measurement 1. It is not recommended to manually initiate an ED measurement when using the Extended Operating Mode. 9.5.4.3 Data Interpretation The PHY_ED_LEVEL is an 8-bit register. The ED value of the radio transceiver has a valid range from 0x00 to 0x53 with a resolution of 1 dB. All other values do not occur. A value of 0xFF indicates the reset value. A value of PHY_ED_LEVEL = 0 indicates that the measured energy is less than -90 dBm (see parameter RSSI_BASE_VAL in section "Receiver Characteristics" on page 562). Due to environmental conditions (temperature, voltage, semiconductor parameters etc.) the calculated ED value has a maximum tolerance of 5 dB, this is to be considered as constant offset over the measurement range. An ED value of 0 indicates an RF input power of PRF -90 dBm. For an ED value in the range of 0 to 83, the RF input power can be calculated as follows: 75 42073B-MCU Wireless-09/14 PRF = -90 + ED [dBm] Figure 9-19. Mapping between values in PHY_ED_LEVEL and Received Input Power 10 Measured -10 Ideal -20 Receiver Input Power P RF [dBm] 0 -30 -40 -50 -60 -70 -80 -90 -100 0 10 20 30 40 50 60 70 80 90 Register PHY_ED_LEVEL Value 9.5.4.4 Interrupt Handling The TRX24_CCA_ED_DONE interrupt is issued at the end of a manually initiated ED measurement. Note that an ED request should only be initiated in one of the receive states. Otherwise the radio transceiver generates a TRX24_CCA_ED_DONE interrupt but no ED measurement was performed. 9.5.5 Clear Channel Assessment (CCA) The main features of the Clear Channel Assessment (CCA) module are: * All 4 modes are available as defined by IEEE 802.15.4-2006 in section 6.9.9; * Adjustable threshold for energy detection algorithm. 9.5.5.1 Overview A CCA measurement is used to detect a clear channel. Four modes are specified by IEEE 802.15.4-2006: Table 9-24. CCA Mode Overview CCA Mode 76 Description 1 Energy above threshold. CCA shall report a busy medium upon detecting any energy above the ED threshold. 2 Carrier sense only. CCA shall report a busy medium only upon the detection of a signal with the modulation and spreading characteristics of an IEEE 802.15.4 compliant signal. The signal strength may be above or below the ED threshold. ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 CCA Mode 0, 3 Description Carrier sense with energy above threshold. CCA shall report a busy medium using a logical combination of - Detection of a signal with the modulation and spreading characteristics of this standard and - Energy above the ED threshold. Where the logical operator may be configured as either OR (mode 0) or AND (mode 3). 9.5.5.2 Configuration and CCA Request The CCA modes are configurable via register PHY_CC_CCA. Usimg the Basic Operating Mode, a CCA request can be initiated manually by setting CCA_REQUEST = 1 of register PHY_CC_CCA, if the radio transceiver is in any RX state. The current channel status (CCA_STATUS) and the CCA completion status (CCA_DONE) are accessible in register TRX_STATUS. The CCA evaluation is done over eight symbol periods and the result is accessible tTR28 = 140 s (128 s measurement duration and processing delay) after the request. The end of a manually initiated CCA measurement is indicated by a TRX24_CCA_ED_DONE interrupt. The sub-register CCA_ED_THRES of register CCA_THRES defines the received power threshold of the "energy above threshold" algorithm. The threshold is calculated by RSSI_BASE_VAL + 2 * CCA_ED_THRES [dBm]. Any received power above this level is interpreted as a busy channel. Note that it is not recommended to manually initiate a CCA measurement when using the Extended Operating Mode. 9.5.5.3 Data Interpretation The current channel status (CCA_STATUS) and the CCA completion status (CCA_DONE) are accessible in register TRX_STATUS. Note, register bits CCA_DONE and CCA_STATUS are cleared in response to a CCA_REQUEST. The completion of a measurement cycle is indicated by CCA_DONE = 1. If the radio transceiver detected no signal (idle channel) during the measurement cycle, the CCA_STATUS bit is set to 1. When using the "energy above threshold" algorithm, any received power above CCA_ED_THRES level is interpreted as a busy channel. The "carrier sense" algorithm reports a busy channel when detecting an IEEE 802.15.4 signal above the RSSI_BASE_VAL (see parameter RSSI_BASE_VAL in "Transceiver Electrical Characteristics" on page 560). The radio transceiver is also able to detect signals below this value, but the detection probability decreases with the signal power. 9.5.5.4 Interrupt Handling The TRX24_CCA_ED_DONE interrupt is issued at the end of a manually initiated CCA measurement. Note: A CCA request should only be initiated in the receive states of Basic Operating Mode. Otherwise the radio transceiver generates a TRX24_CCA_ED_DONE interrupt and sets the register bit CCA_DONE = 1 even if no CCA measurement was performed. 77 42073B-MCU Wireless-09/14 9.5.5.5 Measurement Time The response time for a manually initiated CCA measurement depends on the receiver state. In RX_ON state the CCA measurement is done over eight symbol periods and the result is accessible 140 s after the request (see section "Configuration and CCA Request" on page 77). In BUSY_RX state the CCA measurement duration depends on the CCA Mode and the CCA request relative to the reception of an SHR. The end of the CCA measurement is indicated by a TRX24_CCA_ED_DONE interrupt. The variation of a CCA measurement period in BUSY_RX state is described in Table 9-25 below. Table 9-25. CCA Measurement Period and Access in BUSY_RX state CCA Mode 1 Request within ED measurement (1) Energy above threshold. CCA result is available after finishing automated ED measurement period. 2 Request after ED measurement CCA result is immediately available after request. Carrier sense only. CCA result is immediately available after request. 3 Carrier sense with Energy above threshold (AND). CCA result is available after finishing automated ED measurement period. 0 Carrier sense with Energy above threshold (OR). CCA result is available after finishing automated ED measurement period. Note: CCA result is immediately available after request. CCA result is immediately available after request. 1. After receiving the SHR an automated ED measurement is started with a length of 8 symbol periods (PSDU rate 250 kb/s), refer to section "Energy Detection (ED)" on page 74. This automated ED measurement must be finished to provide a result for the CCA measurement. Only one automated ED measurement per frame is performed. It is recommended to perform CCA measurements in RX_ON state only. To avoid accidental switching to BUSY_RX state the SHR detection can be disabled by setting bit RX_PDT_DIS of register RX_SYN. Refer to section "Receiver (RX)" on page 80 for details. The receiver remains in RX_ON state to perform a CCA measurement until the register bit RX_PDT_DIS is set back to continue the frame reception. In this case the CCA measurement duration is 8 symbol periods. 9.5.6 Link Quality Indication (LQI) According to IEEE 802.15.4 the LQI measurement is a characterization of the strength and/or quality of a received packet. The measurement may be implemented using receiver ED, a signal-to-noise ratio estimation or a combination of these methods. The use of the LQI result by the network or application layers is not specified in this standard. LQI values shall be an integer ranging from 0x00 to 0xFF. The minimum and maximum LQI values (0x00 and 0xFF) should be associated with the lowest and highest quality compliant signals, respectively, and LQI values in between should be uniformly distributed between these two limits. 9.5.6.1 Overview The LQI measurement of the radio transceiver is implemented as a measure of the link quality which can be described with the packet error rate (PER) of this link. A LQI value 78 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 can be associated with an expected packet error rate. The PER is the ratio of erroneous received frames to the total number of received frames. A PER of zero indicates no frame error whereas at a PER of one no frame was received correctly. The radio transceiver uses correlation results of multiple symbols within a frame to determine the LQI value. This is done for each received frame. The minimum frame length for a valid LQI value is two octets PSDU. LQI values are integers ranging from 0 to 255. The following figure shows an example of a conditional packet error rate when receiving a certain LQI value. Figure 9-20. Conditional Packet Error Rate versus LQI 1 0.9 0.8 0.7 PER 0.6 0.5 0.4 0.3 0.2 0.1 0 0 50 100 150 200 250 LQI The values are taken from received frames of PSDU length of 20 octets on transmission channels with reasonable low multipath delay spreads. If the transmission channel characteristic has a higher multipath delay spread than assumed in the example, the PER is slightly higher for a certain LQI value. Since the packet error rate is a statistical value, the PER shown in Figure 9-20 above is based on a huge number of transactions. A reliable estimation of the packet error rate cannot be based on a single or a small number of LQI values. 9.5.6.2 Request a LQI Measurement The LQI byte can be obtained after a frame has been received by the radio transceiver. One additional byte is automatically attached to the received frame containing the LQI value. This information can also be read via Frame Buffer read access, see "User accessible Frame Content" on page 84. The LQI byte can be read after the TRX24_RX_END interrupt. 9.5.6.3 Data Interpretation According to IEEE 802.15.4 a low LQI value is associated with low signal strength and/or high signal distortions. Signal distortions are mainly caused by interference signals and/or multipath propagation. High LQI values indicate a sufficient high signal power and low signal distortions. 79 42073B-MCU Wireless-09/14 Note that the received signal power as indicated by the received signal strength indication (RSSI) value or energy detection (ED) value of the radio transceiver do not characterize the signal quality and the ability to decode a signal. As an example, a received signal with an input power of about 6 dB above the receiver sensitivity likely results in a LQI value close to 255 for radio channels with very low signal distortions. For higher signal power the LQI value becomes independent of the actual signal strength. This is because the packet error rate for these scenarios tends towards zero and further increased signal strength i.e. increasing the transmission power does not decrease the error rate any further. In this case RSSI or ED can be used to evaluate the signal strength and the link margin. ZigBee networks often require the identification of the "best" routing between two nodes. Both the LQI and the RSSI/ED can be used for this, dependent on the optimization criteria. If a low packet error rate (corresponding to high throughput) is the optimization criteria then the LQI value should be taken into consideration. If a low transmission power or the link margin is the optimization criteria then the RSSI/ED value is also helpful. Combinations of LQI, RSSI and ED are possible for routing decisions. As a rule of thumb RSSI and ED values are useful to differentiate between links with high LQI values. Transmission links with low LQI values should be discarded for routing decisions even if the RSSI/ED values are high. This is because RSSI and ED do not say anything about the possibility to decode a signal. It is only an information about the received signal strength whereas the source can be an interferer. 9.6 Module Description 9.6.1 Receiver (RX) 9.6.1.1 Overview The receiver is split into an analog radio front-end and a digital base band processor (RX BBP) according to the following figure. The digital base band processor and the control engine are connected to the Frame Buffer and control registers which are located in the microcontroller I/O memory space (see "I/O Memory" on page 28 and "Transceiver to Microcontroller Interface" on page 34 ). Figure 9-21. Receiver Block Diagram Analog D om ain LO D igital D om ain I/O M em ory Space R FP LN A PPF BPF Lim iter RX ADC C I/F $01FF RX BBP R FN Fram e Buffer $0180 $017F AG C R SSI C ontrol Registers $0140 The differential RF signal is amplified by a low noise amplifier (LNA), filtered (PPF) and down converted to an intermediate frequency by a mixer. Channel selectivity is performed using an integrated band pass filter (BPF). A limiting amplifier (Limiter) provides sufficient gain to overcome the DC offset of the succeeding analog-to-digital 80 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 converter (RX ADC) and generates a digital RSSI signal. The ADC output signal is sampled and processed further by the digital base band receiver (RX BBP). The RX BBP performs additional signal filtering and signal synchronization. The frequency offset of each frame is calculated by the synchronization unit and is used during the remaining receive process to correct the offset. The receiver is designed to handle frequency and symbol rate deviations up to 120 ppm caused by combined receiver and transmitter deviations. For details refer to chapter "General RF Specifications" on page 561. Finally the signal is demodulated and the data are stored in the Frame Buffer. In Basic Operating Mode (see "Basic Operating Mode" on page 38), the reception of a frame is indicated by a TRX24_RX_START interrupt. Accordingly its end is signalized by a TRX24_RX_END interrupt. Based on the quality of the received signal a link quality indicator (LQI) is calculated and appended to the frame. For details refer to. Additional signal processing is applied to the frame data to provide further status information like ED value (register PHY_ED_LEVEL) and FCS correctness (register PHY_RSSI). Beyond these features the Extended Operating Mode of the radio transceiver supports address filtering and pending data indication. For details refer to "Extended Operating Mode" on page 47. 9.6.1.2 Frame Receive Procedure The frame receive procedure including the radio s setup for reception and reading PSDU data from the Frame Buffer is described in "Frame Receive Procedure" on page 90. 9.6.1.3 Configuration In Basic Operating Mode the receiver is enabled by writing command RX_ON to the TRX_CMD bits of register TRX_STATE in the states TRX_OFF or PLL_ON. Similarly in Extended Operating Mode the receiver is enabled for RX_AACK operation from the states TRX_OFF or PLL_ON by writing the command RX_AACK_ON. There is no additional configuration required to receive IEEE 802.15.4 compliant frames when using the Basic Operating Mode. However, the frame reception in the Extended Operating Mode requires further register configurations. For details refer to "Extended Operating Mode" on page 47. The receiver has an outstanding sensitivity performance of -100 dBm. At certain environmental conditions or for High Data Rate Modes (see "High Data Rate Modes" on page 93) it may be useful to manually decrease this sensitivity. This is achieved by adjusting the detector threshold of the synchronization header using the RX_PDT_LEVEL bits of register RX_SYN. Received signals with a RSSI value below the threshold do not activate the demodulation process. Furthermore, it may be useful to protect a received frame against overwriting by subsequent received frames. A Dynamic Frame Buffer Protection is enabled with register bit RX_SAFE_MODE (TRX_CTRL_2) set (refer to "Dynamic Frame Buffer Protection" on page 99). After a frame has been received, the buffer is protected for new incoming frames and the receiver remains in RX_ON or RX_AACK_ON state until the RX_SAFE_MODE bit is cleared by the controller. The Frame Buffer content is only protected if the FCS is valid. A Static Frame Buffer Protection is enabled with bit RX_PDT_DIS of register RX_SYN set. The receiver remains in RX_ON or RX_AACK_ON state and no further SHR is detected until the register bit RX_PDT_DIS is set back. 81 42073B-MCU Wireless-09/14 9.6.2 Transmitter (TX) 9.6.2.1 Overview The transmitter consists of a digital base band processor (TX BBP) and an analog front end as shown in the following figure. Figure 9-22. Transmitter Block Diagram $0140 Ext. R F front-end and Output Power C ontrol D IG3/4 Control R egisters $017F $0180 R FP PA Buf PLL - TX M odulation R FN TX D ata Analog D om ain TX BBP Fram e Buffer D igital Dom ain I/O M em ory Space $01FF C I/F The TX BBP reads the frame data from the Frame Buffer and performs the bit-tosymbol and symbol-to-chip mapping as specified by IEEE 802.15.4 in section 6.5.2. The O-QPSK modulation signal is generated and fed into the analog radio front end. The fractional-N frequency synthesizer (PLL) converts the baseband transmit signal to the RF signal which is amplified by the power amplifier (PA). The PA output is internally connected to bidirectional differential antenna pins (RFP, RFN) so that no external antenna switch is needed. 9.6.2.2 Frame Transmit Procedure The frame transmit procedure including writing PSDU data in the Frame Buffer and initiating a transmission is described in section "Frame Transmit Procedure" on page 91. The controller must ensure to provide valid frame data before starting the frame transmission. For save operation, it is recommended to write the complete frame into the Frame Buffer before starting the frame transmission. 9.6.2.3 Configuration The maximum output power of the transmitter is typically +3.5 dBm. The output power can be configured via the TX_PWR bits of register PHY_TX_PWR. The output power of the transmitter can be controlled over a 20 dB range. A transmission can be started from PLL_ON or TX_ARET_ON state by writing `1' to bit SLPTR of the TRXPR register or by writing TX_START command to the TRX_CMD bits of register TRX_STATE. 9.6.2.4 TX Power Ramping To optimize the TX output power spectral density (PSD) the TX may be controlled by register PHY_TX_PWR and PARCR. The PA ramps up prior to TX data sent and ramps down after the TX data are completed. The signal sent during PA ramp up/down process is not modulated. The PLL frequency (+500kHz or -500kHz relative to carrier frequency) may be selected, separate for the PA ramp up and down process. A timing example using default settings illustrates the sequence in the next figure. In this example the transmission is initiated with the rising edge of the SLPTR bit. The modulation starts 16 s after SLPTR. 82 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Figure 9-23. TX Power Ramping When using en external RF front-end (refer to "RX/TX Indicator" on page 97) it may be required to adjust the startup time of the external PA relative to the internal building blocks to optimize the overall PSD. This can be achieved by PARCR register in the bits PALTU/PALTD. 9.6.2.5 TX Spectrum side lobe suppression The output signal TX may be filtered to suppress spectral side lobes. This might be necessary if an external PA is used. By setting bit PLL_TX_FLT of register TRX_CTRL_1, the TX signal will be filtered. Filtering has influence to signal quality, thus EVM of the transmit signal slightly degrades (refer to Transmitter Characteristics on page 561). 9.6.3 Frame Buffer The radio transceiver contains a 128 byte dual port SRAM. One port of the frame buffer is directly connected to the controller I/O space. Therefore random access to single frame bytes is possible. The other port connects to the internal transmitter and receiver modules. Both ports are independent and simultaneously accessible for data communication. The Frame Buffer uses the controller I/O address space 0x180 to 0x1FF for RX and TX operation of the radio transceiver and can keep one IEEE 802.15.4 RX or one TX frame of maximum length at a time. Frame Buffer access is only possible if the radio transceiver is enabled (PRTRX24 bit in the Power Reduction Register PRR1 is not set) and not in SLEEP state. 9.6.3.1 Data Management Data in the Frame Buffer (received data or data to be transmitted) remain valid as long as: * No new frame or other data are written into the buffer; * No new frame is received (in any BUSY_RX state); * No state change into radio transceiver SLEEP state is made; * No radio transceiver RESET (see bit TRXRST in "TRXPR - Transceiver Pin Register" on page 197) or system reset took place; 83 42073B-MCU Wireless-09/14 * Bit PRTRX24 in register "PRR1 - Power Reduction Register 1" on page 196 is not set; By default there is no protection of the Frame Buffer against overwriting. If a frame is received during a Frame Buffer read access of a previously received frame, the stored data might be overwritten. Finally the application software should check the transferred frame data integrity by a FCS check. The state of the radio transceiver should be changed to PLL_ON state after reception to protect the Frame Buffer content against overwriting with new, incoming frames. This can be achieved by writing immediately the command PLL_ON to the TRX_CMD bits of register TRX_STATE after receiving the frame indicated by a TRX24_RX_END interrupt. Alternatively Dynamic Frame Buffer Protection can be used to protect received frames against overwriting. For details refer to "Dynamic Frame Buffer Protection" on page 99. Both procedures do not protect the Frame Buffer from overwriting by the application software. In Extended Operating Mode during TX_ARET operation (see "TX_ARET_ON - Transmit with Automatic Retry and CSMA-CA Retry" on page 63) the radio transceiver switches to receive if an acknowledgement of a previously transmitted frame was requested. During this period received frames are evaluated but not stored in the Frame Buffer. This allows the radio transceiver to wait for an acknowledgement frame and retry the frame transmission without writing the frame data to the Frame Buffer again. A radio transceiver state change except a transition to radio transceiver SLEEP state or a radio transceiver RESET does not affect the Frame Buffer content. The Frame Buffer is powered off and the stored data gets lost if the radio transceiver is forced into radio transceiver SLEEP state. Access conflicts may occur when reading and writing data simultaneously at the two independent ports of the Frame Buffer TX/RX BBP and Controller interface. 9.6.3.2 User accessible Frame Content The radio transceiver supports an IEEE 802.15.4 compliant frame format as shown in the following figure. Figure 9-32. Transceiver Frame Structure 0 Frame Duration Access Length [octets] 4 5 Preamble Sequence SFD 4 octets / 128 s 1 6 PHR (1) y+3 Payload y+5 FCS y octets / y * 32 s (y <= 128) y+6 LQI(2) 1 TX: Frame Buffer content SHR not accesible PHY generated RX: Frame Buffer content Notes: 1. Stored into Frame Buffer for TX operation 2. Stored into Frame Buffer during frame reception. A frame comprises two sections. The radio transceiver internally generated SHR field and the user accessible part are stored in the Frame Buffer. The SHR contains the 84 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 preamble and the SFD field. The variable frame section contains the PHR and the PSDU including the FCS (see "Overview" on page 72). The Frame Buffer content differs depending on the direction of the communication (receive or transmit). To access the data follow the procedures described in "Radio Transceiver Usage" on page 90. During frame reception, the payload and the link quality indicator (LQI) value of a successfully received frame are stored in the Frame Buffer. The radio transceiver appends the LQI value to the frame data after the last received octet. Information of the frame length is not stored in the Frame Buffer. The frame length information is located in register TST_RX_LENGTH. The SHR (except the SFD used to generate the last octet of the SHR) can generally not be read by the application software. The PHR and the PSDU need to be stored in the Frame Buffer for frame transmission. The PHR byte is the first byte in the Frame Buffer (address 0x180) and must be calculated based on the PHR and the PSDU. The maximum frame size supported by the radio transceiver is 128 bytes. If the TX_AUTO_CRC_ON bit is set in the register TRX_CTRL_1 - Transceiver Control Register 1, the FCS field of the PSDU is replaced by the automatically calculated FCS during frame transmission. There is no need to write the FCS field when using the automatic FCS generation. Manipulating individual bytes of the Frame Buffer is simply possible by accessing the appropriate buffer address. The minimum frame length supported by the radio transceiver for non IEEE 802.15.4 compliant frames is one byte (Frame Length Field + 1 byte of data). 9.6.4 Battery Monitor (BATMON) The main features of the battery monitor are: * Configurable voltage threshold range from 1.7V to 3.675V * Generates an interrupt when supply voltage drops below the threshold 9.6.4.1 Overview The battery monitor (BATMON) detects and indicates a low supply voltage of EVDD. This is done by comparing the voltage of EVDD with a configurable, internal threshold voltage. A simplified schematic of the BATMON with the most important input and output signals is shown in the following figure. Figure 9-25. Simplified Schematic of BATMON EVDD BATMON_HR + DAC 4 BATMON_VTH Threshold Voltage For input-to-output mapping see BATMON register BATMON_OK - 1" clear D Q BATMON_IRQ 85 42073B-MCU Wireless-09/14 9.6.4.2 Configuration The Battery Monitor can be configured using the BATMON register. Register subfield BATMON_VTH sets the threshold voltage. It is configurable with a resolution of 75 mV in the upper voltage range (BATMON_HR = 1) and with a resolution of 50 mV in the lower voltage range (BATMON_HR = 0). 9.6.4.3 Data Interpretation The bit BATMON_OK of register BATMON monitors the current value of the battery voltage: * If BATMON_OK = 0 then the battery voltage is lower than the threshold voltage; * If BATMON_OK = 1 then the battery voltage is higher than the threshold voltage; The value BATMON_OK should be read out to verify the current supply voltage value after setting a new threshold. Note: The battery monitor is inactive during SLEEP states. Refer to status register TRX_STATUS for details. 9.6.4.4 Interrupt Handling A supply voltage drop below the configured threshold value is indicated by the BAT_LOW interrupt. The BAT_LOW status bit as well as the BATLOW_EN bit is located in the BATMON register. If BATLOW_EN =0, no IRQ is issued, but the status flag is set if the battery low event occurs. The interrupt is only issued if BATMON_OK changes from 1 to 0 and the event is stored until the IRQ handler is called or the BAT_LOW IRQ is cleared manually by writing `1' to the BAT_LOW status flag. No interrupt is generated when: * The battery voltage is below the default 1.8V threshold at power up (BATMON_OK was never 1) or * A new threshold is set which is still above the current supply voltage (BATMON_OK remains 0). Noise or temporary voltage drops may generate unwanted interrupts when the battery voltage is close to the programmed threshold voltage. To avoid this: * Disable the BAT_LOW interrupt with the BATLOW_EN Bit in the BATMON register and treat the battery as empty or * Set a lower threshold value. 9.6.5 Crystal Oscillator (XOSC) The main features of the crystal oscillator are: * Amplitude controlled 16 MHz generation; * 215 s typical settling time after leaving SLEEP state; * Configurable trimming with a capacitance array; 9.6.5.1 Overview The crystal oscillator generates the reference frequency for the radio transceiver. All other internally generated frequencies of the radio transceiver are derived from this unique frequency. The overall system performance is therefore critically determined by the accuracy of the crystal reference frequency. The external components of the crystal 86 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 oscillator should be selected carefully and the related board layout should be done with caution as described in section "Application Circuits" on page 538. The register XOSC_CTRL provides access to the control signals of the oscillator. Two operating modes are supported. It is recommended to use the integrated oscillator setup as described in Figure 9-26 below. Nevertheless a reference frequency can be fed to the internal circuitry by using an external clock reference as shown in Figure 9-27 on page 88. 9.6.5.2 Integrated Oscillator Setup The output frequency of the internal oscillator depends on the load capacitance between the crystal pins XTAL1 and XTAL2. The total load capacitance CL must be equal to the specified load capacitance of the crystal itself. It consists of the external capacitors CX and parasitic capacitances connected to the XTAL nodes. The following figure shows all parasitic capacitances, such as PCB stray capacitances and the pin input capacitance summarized to CPAR. Figure 9-26. Simplified XOSC Schematic with External Components CPAR CX CX CPAR V EVDD XTAL1 EVDD 16MHz XTAL2 PCB IC internal CTRIM CTRIM XTAL_TRIM[3:0] XTAL_TRIM[3:0] EVDD Additional internal trimming capacitors CTRIM are available. Any value in the range from 0 pF to 4.5 pF with a 0.3 pF resolution is selectable using XTAL_TRIM of register XOSC_CTRL. To calculate the total load capacitance, the following formula can be used CL = 0.5 * (CX + CTRIM + CPAR). The trimming capacitors provide the possibility to reduce frequency deviations caused by variations of the production process or by tolerances of external components. Note that the oscillation frequency can only be reduced by increasing the trimming capacitance. The frequency deviation caused by one step of CTRIM decreases with increasing values of the crystal load capacitor. An amplitude control circuit is included to ensure stable operation under different operating conditions and for different crystal types. Enabling the crystal oscillator after leaving SLEEP state causes a slightly higher current during the amplitude build-up phase to guarantee a short start-up time. The current is reduced to the amount 87 42073B-MCU Wireless-09/14 necessary for a robust oscillation during stable operation. This also keeps the drive level of the crystal low. Crystals with a higher load capacitance are generally less sensitive to parasitic pulling effects caused by variations of external components or board and circuit parasitics. On the other hand a larger crystal load capacitance results in a longer start-up time and a higher steady state current consumption. 9.6.5.3 External Reference Frequency Setup When using an external reference frequency, the signal must be connected to pin XTAL1 as indicated in Figure 9-27 below and the bits XTAL_MODE of register XOSC_CTRL need to be set to the external oscillator mode. The oscillation peak-topeak amplitude shall between 100 mV and 500 mV, the optimum range is between 400 mV and 500 mV. Pin XTAL2 should not be wired Figure 9-27. Setup for Using an External Frequency Reference 16 MHz XTAL1 XTAL2 PCB IC internal 9.6.6 Frequency Synthesizer (PLL) The main features of the phase-locked loop are: * Generate RX/TX frequencies for all 2.4 GHz channels of IEEE 802.15.4; * Autonomous calibration loops for stable operation within the operating range; * Two PLL-interrupts for status indication; * Fast PLL settling to support frequency hopping; 9.6.6.1 Overview The PLL generates the RF frequencies for the radio transceiver. During receive operation the frequency synthesizer works as a local oscillator for the receive frequency of the radio transceiver. During transmit operation the voltage-controlled oscillator (VCO) is directly modulated to generate the RF transmit signal. The frequency synthesizer is implemented as a fractional-N PLL. Two calibration loops ensure correct PLL functionality within the specified operating limits. 9.6.6.2 Frequency Agility When the PLL is enabled during state transition from TRX_OFF to PLL_ON the settling time is typically tTR4 = 110 s including the settling time of the analog voltage regulator (AVREG) and the PLL self calibration (refer to Table 9-9 on page 46Table 9-9). A lock of the PLL is indicated with a TRX24_PLL_LOCK interrupt. Switching between 2.4 GHz ISM band channels in PLL_ON or RX_ON states is typically done within tTR20 = 11 s. This makes the radio transceiver highly suitable for frequency hopping applications. 88 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 The PLL frequency is changed to the transmit frequency within tTR23 = 16 s after starting the transmit procedure and before starting the transmission. After the transmission the PLL settles back to the receive frequency within tTR24 = 32 s. This frequency step does not generate a TRX24_PLL_LOCK or TRX24_PLL_UNLOCK interrupt within these time spans. 9.6.6.3 Calibration Loops Due to temperature, supply voltage and part-to-part variations of the radio transceiver the VCO characteristics diverge. Two automated control loops are implemented to ensure a stable operation: center frequency (CF) tuning and delay cell (DCU) calibration. Both calibration loops are initiated automatically when the PLL is enabled during state transition from TRX_OFF to PLL_ON. The center frequency calibration is additionally initiated when the PLL changes to a center frequency of another channel. It is recommended to initiate the calibration loops manually if the PLL operates for a long time on the same channel e.g. more than 5 min or the operating temperature changes significantly. Both calibration loops can be initiated manually by setting PLL_CF_START = 1 of register PLL_CF and PLL_DCU_START = 1 of register PLL_DCU. The device must be in PLL_ON or RX_ON state to start the calibration. The completion of the center frequency tuning is indicated by a TRX24_PLL_LOCK interrupt. Both calibration loops may be run simultaneously. 9.6.6.4 Interrupt Handling Two different interrupts indicate the PLL status. The TRX24_PLL_LOCK interrupt indicates that the PLL has locked. The TRX24_PLL_UNLOCK interrupt indicates an unexpected unlock condition. A TRX24_PLL_LOCK interrupt is supposed to occur in the following situations: * State change from TRX_OFF to PLL_ON / RX_ON/ RX_AACK_ON/ TX_ARET_ON; * Channel change in states PLL_ON / RX_ON/ RX_AACK_ON/ TX_ARET_ON; Any other occurrences of PLL interrupts indicate erroneous behavior and require checking of the actual device status. The state transition from BUSY_TX to PLL_ON after successful transmission does not generate a TRX24_PLL_LOCK interrupt within the settling period. If a TRX24_PLL_UNLOCK interrupt occurs while the device is receiving/transmitting a frame the associated interrupts (TRX24_RX_END, TRX24_TX_END) will no happen. 9.6.6.5 RF Channel Selection The PLL is designed to support 16 channels in the 2.4 GHz ISM band with channel spacing of 5 MHz according to IEEE 802.15.4. The center frequency of these channels is defined as follows: Fc = 2405 + 5 (k - 11) in [MHz], for k = 11, 12 ... 26 where k is the channel number. The channel k is selected by the CHANNEL bits of register PHY_CC_CCA (see "PHY_CC_CCA - Transceiver Clear Channel Assessment (CCA) Control Register" on page 120). 89 42073B-MCU Wireless-09/14 Additionally, the PLL supports all frequencies from 2322 MHz to 2527 MHz with 500 kHz frequency spacing. The frequency is selected by CC_BAND (see "CC_CTRL_1 - Channel Control Register 1" on page 135) and CC_NUMBER (see "CC_CTRL_0 - Channel Control Register 0" on page 135). Table 9-26 shows the settings of the register bits CC_BAND and CC_NUMBER. Table 9-26. Frequency Bands and Numbers (1) CC_BAND CC_NUMBER Description 0x0 Not used Channels according to IEEE 802.15.4; frequency selected by register bits CHANNEL (register 0x08, PHY_CC_CCA). 0x1, ... , 0x7 0x00 - 0xFF reserved 0x8 0x00 - 0x1F reserved 0x8 0x20 - 0xFF 2322 MHz - 2433.5 MHz Fc [MHz] = 2306 + 0.5 * CC_NUMBER 0x9 0x00 - 0xBA 2434 MHz - 2527 MHz. Fc [MHz] = 2434 + 0.5 * CC_NUMBER 0x9 0xBB - 0xFF reserved 0xA, ... , 0xF 0x00 - 0xFF reserved Notes: 1. CC_CTRL_0 and CCTRL_1 form a combined16 bit register. Changed CC_BAND values in register CC_CTRL_1 are effective after writing to register CC_CTRL_0. 9.6.7 Automatic Filter Tuning (FTN) The FTN is incorporated to compensate device tolerances for temperature, supply voltage variations as well as part-to-part variations of the radio transceiver. The filtertuning result is used to correct the transfer function of the analog baseband filter and the time constant of the PLL loop-filter (refer to "General Circuit Description" on page 33). An FTN calibration cycle is initiated automatically when entering the radio transceiver TRX_OFF state from the SLEEP or RESET state. Although receiver and transmitter are very robust against these variations, it is recommended to initiate the FTN manually if the radio transceiver does not use the SLEEP state. A calibration cycle is to be initiated in states TRX_OFF, PLL_ON or RX_ON if necessary. This applies in particular to the High Data Rate Modes with a much higher sensitivity to variations of the BPF transfer function. The recommended calibration interval is 5 min or less. 9.7 Radio Transceiver Usage This section describes the basic procedures to receive and transmit frames with the radio transceiver. 9.7.1 Frame Receive Procedure A frame reception comprises of two actions: The PHY listens for a frame, receives and demodulates the frame to the Frame Buffer and signalizes its reception to the application software. The application software reads the available frame data from the Frame Buffer after or during the progress of the frame reception. While in state RX_ON or RX_AACK_ON the radio transceiver searches for incoming frames on the selected channel. First a TRX24_RX_START interrupt indicates the detection of an IEEE 802.15.4 compliant frame assuming the appropriate interrupts are 90 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 enabled. The frame reception is completed when issuing the TRX24_RX_END interrupt. Different Frame Buffer read access scenarios are recommended for: * Non-time critical applications: read access starts after the TRX24_RX_END interrupt; * Time-critical applications: read access starts after the TRX24_RX_START interrupt; The controller must ensure to read valid Frame Buffer contents. Reading frame data before frame reception is finished can lead to invalid data, if buffer regions are accessed which are not yet updated with the new frame. While receiving a frame the data needs to be primarily stored in the Frame Buffer before reading it. This is ensured by accessing the first Frame Buffer byte at least 32 s after the TRX24_RX_START interrupt. It is recommended for operations considered to be not time-critical to wait for the TRX24_RX_END interrupt before starting a Frame Buffer read access. The following figure illustrates the frame receive procedure using the TRX24_RX_END interrupt. Figure 9-28. Transactions between radio transceiver and microcontroller during receive IRQ issued (TRX 24_RX_END) Read TST_RX_LENG TH register (Register access) Microcontroller Transceiver IRQ issued (TRX24_RX_START) Read fram e data (Fram e Buffer access) Critical protocol timing could require starting the Frame Buffer read access after the TRX24_RX_START interrupt. The first byte of the frame data can be read 32 s after the TRX24_RX_START interrupt. The application software must ensure to read slower than the frame is received. Otherwise a Frame Buffer under-run occurs and the frame data may be not valid. 9.7.2 Frame Transmit Procedure A frame transmission comprises of the two actions Frame Buffer write access and transmission of the Frame Buffer content. Both actions can be run in parallel if required by critical protocol timing. Figure 9-29 on page 92 illustrates the frame transmit procedure by consecutively writing and transmitting the frame. The frame transmission is initiated writing SLPTR or writing command TX_START to register TRX_STATE after a Frame Buffer write access and while the radio transceiver is in state PLL_ON or TX_ARET_ON. The TRX24_TX_END interrupt indicates the completion of the transaction. 91 42073B-MCU Wireless-09/14 Figure 9-29. Transaction between radio transceiver and microcontroller during transmit Write TRX_CMD = TX_START, or write SLPTR (Register access) Microcontroller Transceiver Write frame data (Frame Buffer access) IRQ issued (TX_END) Alternatively a frame transmission can be started first, followed by the Frame Buffer write access (PSDU data) as shown in Figure 9-30 below. This is applicable for time critical applications. A transmission is initiated either by writing SLPTR or by writing the TX_START command to the TRX_CMD bits of register TRX_STATE. The radio transceiver then starts transmitting the SHR which is internally generated. This first phase requires 16 s for PLL settling and 160 s for SHR transmission. The PHR must be available in the Frame Buffer before this time elapses. Furthermore the Frame Buffer must be filled faster than the frame is transmitted to prevent a buffer under-run. Figure 9-30. Time Optimized Frame Transmit Procedure Write frame data (Frame Buffer access) Microcontroller Transceiver Write TRX_CMD = TX_START, or write SLPTR (Register access) IRQ issued (TX_END) 9.8 Radio Transceiver Extended Feature Set 9.8.1 Random Number Generator The radio transceiver incorporates a 2-bit, noise observing, true random number generator to be used to: * Generate random seeds for CSMA-CA algorithm (see"Extended Operating Mode" on page 47); * Generate random values for AES key generation (see "Security Module (AES)" on page 99); The values are stored in bits RND_VALUE of register PHY_RSSI. The random number is updated every tTR29 = 1 s in Basic Operation Mode receive states with locked PLL. 92 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Note, if the PLL is not locked or unlocks in receive states or either antenna diversity or RPC mode is enabled, the RND_VALUE is zero. 9.8.2 High Data Rate Modes The main features of the High Data Rate Modes are: * High Data Rate Communication up to 2 Mb/s; * Support of Basic and Extended Operating Mode; * Support of other features of the Extended Feature Set; 9.8.2.1 Overview The radio transceiver also supports alternative data rates higher than 250 kb/s for applications beyond IEEE 802.15.4 compliant networks. The selection of a data rate does not affect the remaining functionality. Thus it is possible to run all features and operating modes of the radio transceiver in various combinations. The data rate can be selected by writing bits OQPSK_DATA_RATE of register TRX_CTRL_2. The High Data Rate Modes occupy the same RF channel bandwidth as the IEEE 802.15.4 - 2.4 GHz 250 kb/s standard mode. The sensitivity of the receiver is reduced due to the decreased spreading factor. The following table shows typical values of the sensitivity for different data rates. Table 9-27. High Data Rate Sensitivity High Data Rate Sensitivity Comment 250 kb/s -100 dBm PER 1%, PSDU length of 20 octets 500 kb/s -96 dBm PER 1%, PSDU length of 20 octets 1000 kb/s -94 dBm PER 1%, PSDU length of 20 octets 2000 kb/s -86 dBm PER 1%, PSDU length of 20 octets By default there is no header based signaling of the data rate within a transmitted frame. Thus nodes using a data rate other than the default IEEE 802.15.4 data rate of 250 kb/s are to be consistently configured in advance. The configurable start of frame delimiter (SFD) could be alternatively used as an indicator of the PHY data rate (see "Configurable Start-Of-Frame Delimiter (SFD)" on page 98). 9.8.2.2 High Data Rate Packet Structure Higher data rate modulation is restricted to only the payload octets in order to allow appropriate frame synchronization. The SHR and the PHR field are transmitted with the IEEE 802.15.4 compliant data rate of 250 kb/s (refer to "Introduction - IEEE 802.15.42006 Frame Format" on page 67). A comparison of the general packet structure for different data rates with an example PSDU length of 80 octets is shown in Figure 9-31 on page 94. 93 42073B-MCU Wireless-09/14 Figure 9-31. High Data Rate Frame Structure 500 kb/s PSDU: 80 octets 1000 kb/s PSDU: 80 octets 2000 kb/s PSDU: 80 octets 1472 2752 time [s] FCS SFD PHR PSDU: 80 octets 832 FCS 250 kb/s SFD PHR 512 SFD PHR 192 SFD PHR 0 The effective data rate is smaller than the selected data rate due to the overhead caused by the SHR, the PHR and the FCS. The overhead depends further on the length of the PSDU. A graphical representation of the effective data rate is shown in the following figure: Figure 9-32. Effective Data Rate "B" for High Data Rate Mode 1600 2000 1000 500 250 1400 1200 B [kbps] 1000 2000 kbps 800 1000 kbps 600 500 kbps 400 250 kbps 200 0 0 20 40 60 80 100 120 PSDU length in octets Therefore High Data Rate transmission and reception is useful for large PSDU lengths due to the higher effective data rate or to reduce the power consumption of the system. Furthermore the active on-air time using High Data Rate Modes is significantly reduced. 9.8.2.3 High Data Rate Frame Buffer Access The Frame Buffer access to read or write frames for High Data Rate communication is similar to the procedure described in "Frame Buffer" on page 83. However the last byte in the Frame Buffer after the PSDU data is the ED value rather than the LQI value. 9.8.2.4 High Data Rate Energy Detection According to IEEE 802.15.4 the ED measurement duration is 8 symbol periods. For frames operated at higher data rates the automated ED measurement duration is reduced to 32 s to take the reduced frame length into account ("Energy Detection (ED)" on page 74). 94 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 9.8.2.5 High Data Rate Mode Options Receiver Sensitivity Control The different data rates between PPDU header (SHR and PHR) and PHY payload (PSDU) cause a different sensitivity between header and payload. This can be adjusted by defining sensitivity threshold levels of the receiver. The receiver does not receive frames with an RSSI level below the defined sensitivity threshold level (register bits RX_PDT_LEVEL > 0). Under these operating conditions the receiver current consumption is reduced by 500 A (refer to chapter "Current Consumption Specifications" on page 563). A description of the settings to control the sensitivity threshold with register RX_SYN can be found in section "RX_SYN - Transceiver Receiver Sensitivity Control Register" on page 131. Reduced Acknowledgment Timing On higher data rates the IEEE 802.15.4 compliant acknowledgment frame response time of 192 s significantly reduces the effective data rate of the network. To minimize this influence in Extended Operating Mode RX_AACK (see section "RX_AACK_ON - Receive with Automatic ACK" on page 50), the acknowledgment frame response time can be reduced to 32 s. Figure 9-33 below illustrates an example for a reception and acknowledgement of a frame with a data rate of 2000 kb/s and a PSDU length of 80 symbols. The PSDU length of the acknowledgment frame is 5 octets according to IEEE 802.15.4. Figure 9-33. High Data Rate AACK Timing 704 916 SFD 192 s PHR 544 SFD PSDU: 80 octets 512 PHR SFD PHR AACK_ACK_TIME = 1 PSDU: 80 octets SFD AACK_ACK_TIME = 0 192 PHR 0 time [s] ACK ACK 32 s The acknowledgment time is reduced from 192 s to 32 s if bit AACK_ACK_TIME of register XAH_CTRL_1 is set. 9.8.3 Antenna Diversity The main features of the Antenna Diversity implementation are: * Improves signal path robustness between nodes; * Self-contained antenna diversity algorithm of the radio transceiver; * Direct register based antenna selection; 9.8.3.1 Overview The receive signal strength may vary and affect the link quality even for small changes of the antenna location due to multipath propagation effects between network nodes. These fading effects can result in an increased error floor or loss of the connection between devices. Antenna Diversity can be applied to reduce the effects of multipath propagation and fading hence improving the reliability of a RF connection between network nodes. 95 42073B-MCU Wireless-09/14 Antenna Diversity uses two antennas to switch to the most reliable RF signal path. This is done by the radio transceiver during RX_ON and RX_AACK_ON state without interaction of the application software. Both antennas should be carefully separated from each other to ensure highly independent receive signals. Antenna Diversity can be used in Basic and Extended Operating Modes and can also be combined with other features and operating modes like High Data Rate Mode and RX/TX Indication. 9.8.3.2 Antenna Diversity Application Example A block diagram for an application using an antenna switch is shown in the following figure. Figure 9-34. External Antenna Diversity - Block Diagram ANT0 1 DIG2 2 DIG4 7 AVSS 8 RFP 9 RFN 10 AVSS ... DIG1 B1 DIG3 RFSwitch SW 1 Balun ... 14 15 ANT1 Generally, the Antenna Diversity algorithm is enabled with bit ANT_DIV_EN=1 in register ANT_DIV. For the External Antenna Diversity the control of the antenna switch (SW1) must be enabled by bit ANT_EXT_SW_EN of register ANT_DIV. Under this condition the control pins DIG1 and DIG2 are configured as outputs. DIG1 and DIG2 are used to feed the antenna switch signal and its inverse to the differential inputs of the RF Switch (SW1). See also "Alternate Functions of Port F" on page 230 and "Alternate Functions of Port G" on page 232. The selected antenna is indicated by bit ANT_SEL of register ANT_DIV. The antenna selection continues searching for new frames on both antennas after the frame reception is completed. However the register bit ANT_SEL maintains its previous value (from the last received frame) until a new SHR has been found and the selection algorithm locked into one antenna again. Then the register bit ANT_SEL is updated. The antenna defined by the ANT_CTRL bits of register ANT_DIV is selected for transmission. If for example the same antenna as selected for reception is to be used for transmission, the antenna must be set using the ANT_CTRL bits based on the value read from the ANT_SEL bit. It is recommended to read bit ANT_SEL after the TRX24_RX_START interrupt. The autonomous search and selection allows the use of Antenna Diversity during reception even if the application software currently does not control the radio transceiver for instance in Extended Operating Mode. 96 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 An application software defined selection of a certain antenna can be done by disabling the automatic Antenna Diversity algorithm (ANT_DIV_EN = 0) and selecting one antenna using register bit ANT_CTRL. If the radio transceiver is not in a receive or transmit state, it is recommended to disable register bit ANT_EXT_SW_EN and to set the port pins DIG1 and DIG2 to output low via the I/O port control register (DDG1 = 1, PORTG1 = 0, DDF2 = 1, PORTF2 = 0). In this way the power consumption of the external RF switch is reduced and leakage currents are avoided especially during sleep modes. 9.8.3.3 Antenna Diversity with Extended Operation Modes A combination of Extended Operation Mode and antenna diversity is allowed. While the radio transceiver is in RX_AACK_ON state, it switches to an antenna with a reliable signal. The receive antenna selection is also used for transmission of an automatic acknowledge frame. While the radio transceiver is in TX_ARET state, the selected antenna is automatically changed for every frame transmission retry. 9.8.3.4 Antenna Diversity Sensitivity Control The detection threshold of the receiver has to be adjusted due to a different receive algorithm used by the Antenna Diversity algorithm. It is recommended to set bits PDT_THRES of register RX_CTRL to 3. 9.8.4 RX/TX Indicator The main features are: * RX/TX Indicator to control an external RF Front-End; * Application software independent RF Front-End Control; * Provide TX Timing Information; 9.8.4.1 Overview While IEEE 802.15.4 is a low-cost, low-power standard, solutions supporting higher transmit output power are occasionally desirable. A differential control pin pair can indicate that the radio transceiver is currently in transmit mode to simplify the control of an optional external RF front-end. The control of an external RF front-end is done via the digital control pins DIG3/DIG4. The function of this pin pair is enabled with bit PA_EXT_EN of register TRX_CTRL_1. Pin DIG3 is set to low level and DIG4 to high level while the transmitter is turned off. The two pins change the polarity when the radio transceiver starts transmitting. This differential pin pair can be used to control PA, LNA and RF switches. See also "Alternate Functions of Port F" on page 230 and "Alternate Functions of Port G" on page 232. If the radio transceiver is not in a receive or transmit state, it is recommended to disable register bit PA_EXT_EN and to set the port pins DIG3 and DIG4 to output low via the I/O port control register (DDG0 = 1, PORTG0 = 0, DDF3 = 1, PORTF3 = 0). In this way the power consumption of external RF switches and other building blocks is reduced and leakage currents are avoided especially during sleep modes. 97 42073B-MCU Wireless-09/14 9.8.4.2 External RF-Front End Control The setup time of the external power amplifier (PA) relative to the internal building blocks should be adjusted when using an external RF front-end including a power amplifier to optimize the overall power spectral density (PSD) mask. Figure 9-35. TX Power Ramping Control for RF Front-Ends 0 TRX_STATE 2 4 6 PLL_O N 8 10 12 14 16 18 Length [s] BU SY_TX SLPTR PA_BUF_LT PA buffer PA_LT PA 1 M odulation 1 0 1 1 0 0 1 1 DIG 3 DIG 4 The start-up sequence of the individual building blocks of the internal transmitter is shown in the previous figure. The transmission is actually initiated by writing `1' to SLPTR. The radio transceiver state changes from PLL_ON to BUSY_TX and the PLL settles to the transmit frequency within 16 s (parameter tTR23 at page 46). The modulation starts 16 s (parameter tTR10 at page 46) after the SLPTR=1. The PA buffer and the internal PA are enabled during this time. The control of an external PA is done via the differential pin pair DIG3 and DIG4. DIG3 = H / DIG4 = L indicates that the transmission starts and can be used to enable an external PA. The timing of pins DIG3/DIG4 can be adjusted relative to the start of the frame and the activation of the internal PA buffer. This is controlled using the register bits PA_BUF_LT and PA_LT. For details refer to Figure 9-23 on page 83 and chapter "Transmitter (TX)" on page 82. 9.8.5 RX Frame Time Stamping To determine the exact timing of an incoming frame e.g. for beaconing networks, the Symbol Counter should be used. SFD Time Stamping is enabled by setting bit SCTSE of the Symbol Counter Control Register SCCR0. The actual 32 Bit Symbol Counter value is captured in the SFD Time Stamp register SCTSR at the time, the SFD has been received. For details see section "SFD and Beacon Timestamp Generation" on page 158. 9.8.6 Configurable Start-Of-Frame Delimiter (SFD) The SFD is a field indicating the end of the SHR and the start of the packet data. The length of the SFD is 1 octet (2 symbols). This octet is used for byte synchronization only and is not included in the Frame Buffer. The value of the SFD could be changed if it is needed to operate non IEEE 802.15.4 compliant networks. An IEEE 802.15.4 compliant network node does not synchronize to frames with a different SFD value. 98 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 The register SFD_VALUE contains the one octet start-of-frame delimiter (SFD) to synchronize to a received frame. It is not recommended to set the low-order 4 bits to 0 due to the way the SHR is formed. 9.8.7 Dynamic Frame Buffer Protection The ATmega2564/1284/644RFR2 continues the reception of incoming frames as long as it is in any receive state. When a frame was successfully received and stored into the Frame Buffer, the following frame will overwrite the Frame Buffer content again. To relax the timing requirements for a Frame Buffer read access the Dynamic Frame Buffer Protection prevents that a new valid frame passes to the Frame Buffer until the buffer protection bit is cleared (RX_SAFE_MODE = 0). A received frame is automatically protected against overwriting: * in Basic Operating Mode, if its FCS is valid * in Extended Operating Mode, if an TRX24_RX_END interrupt is generated The Dynamic Frame Buffer Protection is enabled, if register bit RX_SAFE_MODE (register TRX_CTRL_2, see "TRX_CTRL_2 - Transceiver Control Register 2" on page 123) is set and the radio transceiver state is RX_ON or RX_AACK_ON. Notes: 3. Dynamic Frame Buffer Protection only prevents write accesses from the air interface not from the application software. The application software may still modify the Frame Buffer content. 4. Dynamic Frame Buffer Protection influences SRT (see "SRT - Smart Receiving Technology" on page 104) when a frame has been received successfully. 9.8.8 Security Module (AES) The security module (AES) is characterized by: * Hardware accelerated encryption and decryption; * Compatible with AES-128 standard (128 bit key and data block size); * ECB (encryption/decryption) mode and CBC (encryption) mode support; * Stand-alone operation, independent of other blocks; * Uses 16MHz crystal clock of the transceiver; 9.8.8.1 Overview The security module is based on an AES-128 core according to the FIPS197 standard [6]. and provides two modes, the Electronic Code Book (ECB) and the Cipher Block Chaining (CBC). The security module works independent of other building blocks of the radio transceiver. Encryption and decryption can be performed in parallel to a frame transmission or reception. During radio transceiver SLEEP the registers of the security engine (AES) are cleared (see section "SLEEP - Sleep State" on page 40). The ECB and CBC modules including the AES core are clocked with the 16 MHz Radio Transceiver Crystal Oscillator. Controlling the security block is possible over 5 Registers within AVR I/O space: Table 9-28. Security Module Address Space Overview Register Name Description AES_STATUS AES status register 99 42073B-MCU Wireless-09/14 Register Name Description AES_CTRL AES control register AES_KEY Access to 16 Byte key buffer AES_STATE Access to 16 Byte data buffer 9.8.8.2 Security Module Preparation The use of the security module requires a configuration of the security engine before starting a security operation. The following steps are required: Table 9-29. AES Engine Configuration Steps Step Description Description 1 Key Setup Write encryption or decryption key to KEY buffer (16 consecutive byte writes to AES_KEY) 2 AES configuration Select AES mode: ECB or CBC Select encryption or decryption Enable the AES Encryption Ready Interrupt AES_READY 3 Write Data Write plain text or cipher text to DATA buffer (16 consecutive byte writes to AES_STATE) 4 Start operation Start AES operation 5 Wait for AES finished: 1. AES_READY IRQ or 2. polling AES_DONE bit (register AES_STATUS) or 3. wait for 24 s Wait until AES encryption/decryption is finished successfully 6 Read Data Read cipher text or plain text from DATA buffer (16 consecutive byte reads from AES_STATE) Before starting any security operation a 16 Byte key must be written to the security engine (refer to section "Security Key Setup" on page 101). This can be done by 16 consecutive write accesses to the I/O register AES_KEY. An internal address counter is incremented automatically with every read/ write operation. An AES encryption/ decryption run resets the internal byte counter. If the key and data buffer has not been read or written completely (all 16 Bytes), the following encryption/ decryption operation will finish with an error. The following step selects either Electronic Code Book (ECB) or Cipher Block Chaining (CBC) as the AES_MODE. These modes are explained in more detail in section "Security Operation Modes" on page 101. Encryption or decryption must be further selected with bit AES_DIR of register AES_CTRL. If the AES Error or AES Ready IRQ is used, the interrupt must be enabled with bit AES_IM. Next the 128-bit plain text or cipher text data has to be provided to the AES hardware engine. The 16 data bytes must be consecutively written to the AES_STATE register. The AES_STATE register can be accessed in the same way as the key register (refer to "Security Key Setup" on page 101). The encryption or decryption is initiated with bit AES_REQUEST = 1. 100 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 The operation takes 24 s and the completed encryption/ decryption is indicated by the AES_READY IRQ and the AES_DONE bit. The internal byte counter of the key and data buffer is cleared and the resulting data can be read out. For additional information about the key and data buffer please refer to section "AES_KEY - AES Encryption and Decryption Key Buffer Register" on page 112 and "AES_STATE - AES Plain and Cipher Text Buffer Register" on page 112. Notes: 1. Access to the security block is not possible while the radio transceiver is in state SLEEP. 2. All configurations of the security module, the SRAM content and keys are reset during SLEEP or RESET states. 9.8.8.3 Security Key Setup The key is stored in a 16 Byte sequential buffer. To read or write the contents of the buffer, 16 consecutive read or write operations to the AES_KEY register are required. A 16-folded read access to registers AES_KEY returns the last round key of the preceding security operation. This is the key required for the corresponding ECB decryption operation after an ECB encryption operation. However the initial AES key written to the security module in advance of an AES run (see step 1 in Table 9-29 on page 100) is not modified during an AES operation. This initial key is used for the next AES run although it cannot be read from AES_KEY. Before accessing the Key Buffer it must be ensured, that the internal address counter is initialized correctly. This is the cases after Radio Transceiver Reset (see TRXPR - Transceiver Pin Register on page 197) or a completed AES Encryption/ Decryption operation. After an interrupted buffer read or write access, Address pointer reinitialization is recommended by a simple read access to the AES_CTRL register. Note: 1. ECB decryption is not required for IEEE 802.15.4 or ZigBee security processing. The radio transceiver provides this functionality as an additional feature. 9.8.8.4 Security Operation Modes 9.8.8.4.1 Electronic Code Book (ECB) ECB is the basic operating mode of the security module and is configured by the AES_CTRL register. The bit AES_MODE = 0 defines the ECB mode and bit AES_DIR selects the direction to either encryption or decryption. The data to be processed has to be written to registers AES_STATE. A security operation can be started by writing the start command AES_REQUEST = 1 (AES_CTRL register). The ECB encryption operation is illustrated in Figure 9-36 on page 102. Figure 9-37 on page 102 shows the ECB decryption mode which is supported in a similar way. 101 42073B-MCU Wireless-09/14 Figure 9-36. ECB Mode - Encryption Plaintext Encryption Key Plaintext Encryption Key Block Cipher Encryption Ciphertext Block Cipher Encryption Ciphertext Figure 9-37. ECB Mode - Decryption Ciphertext Decryption Key Block Cipher Decryption Plaintext Ciphertext Decryption Key Block Cipher Decryption Plaintext Due to the nature of AES algorithm the initial key to be used when decrypting is not the same as the one used for encryption. Instead it is the last round key. This last round key is the content of the key address space stored after running one full encryption cycle and must be saved for decryption. If the decryption key has not been saved, it has to be recomputed by first running a dummy encryption (of an arbitrary plain text) using the original encryption key. Then the resulting round key must be fetched from the key memory and written back into the key memory as the decryption key. ECB decryption is not used by either IEEE 802.15.4 or ZigBee frame security. Both of these standards do not directly encrypt the payload. Instead they protect the payload by applying a XOR operation between the original payload and the resulting (AES-) cipher text with a nonce (number used once). As the nonce is the same for encryption and decryption only ECB encryption is required. Decryption is performed by a XOR operation between the received cipher text and its own encryption result concluding in the original plain text payload upon success. 9.8.8.4.2 Cipher Block Chaining (CBC) In CBC mode the result of a previous AES operation is XOR-combined with the new incoming vector forming the new plain text to encrypt as shown in the next figure. This mode is used for the computation of a cryptographic checksum (message integrity code, MIC). 102 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Figure 9-38. CBC Mode - Encryption Plaintext Encryption Key Initialization Vector (IV) Block Cipher Encryption Encryption Key Plaintext Block Cipher Encryption Ciphertext Ciphertext ECB mode CBC mode After preparing the AES key and defining the AES operation direction register bit AES_DIR, the data has to be provided to the AES engine and the CBC operation can be started. The first CBC run has to be configured as ECB to process the initial data (plain text XOR with an initialization vector provided by the application software). All succeeding AES runs are to be configured as CBC by setting bit AES_MODE = 1 (AES_CTRL register). Bit AES_DIR (AES_CTRL register) must be set to AES_DIR = 0 to enable AES encryption. The data to be processed has to be transferred to the AES_STATE register. Setting bit AES_REQUEST = 1 (AES_CTRL register) as described in section "Security Operation Modes" on page 101 starts the first encryption. This causes the next 128 bits of plain text data to be XORed with the previous cipher text data, see Figure 9-38 above. According to IEEE 802.15.4 the input for the prepared by a XOR operation of the plain text value of the initialization vector is 0. However applied for non-compliant usage. This operation software. very first CBC operation has to be with the initialization vector (IV). The any other initialization vector can be has to be prepared by the application Note that the MIC algorithm of the IEEE 802.15.4-2006 standard requires CBC mode encryption only because it implements a one-way hash function. The status of the security processing is indicated by register AES_STATUS. After a AES processing time of 24 s the register bit AES_DONE changes to 1 (register AES_STATUS) indicating that the security operation has finished (see "Digital Interface Timing Characteristics" on page 560). The end of the AES processing can also be indicated by the AES_READY Interrupt. The bit AES_ER of register AES_STATUS is set if the operation has finished with an error. Otherwise this bit is zero but AES_DONE is `1'. 9.8.8.5 AES Interrupt Handling The AES Interrupt handling is slightly different from all other IRQ's. If the AES_IM Bit (AES_CTRL Register) and the global interrupt enable flag is set, the AES core can generate an AES Ready Interrupt (AES_READY). If the IRQ is issued, the AES_STATUS register must be read to check the finish status of the last operation. If AES_DONE is set, the last AES operation finished successfully. If AES_ER is set, an error occurred during the last operation. The AES_ER flag is cleared automatically during the read access to the AES_STATUS register. The AES_DONE flag is cleared during the next read or write access to the AES_STATE (AES data) register. The two status flags must be cleared before a new Interrupt can be issued. 103 42073B-MCU Wireless-09/14 If AES_IM is not set, the processing status can be polled by software (AES_STATUS register), but no Interrupt occurs. 9.8.9 Receiver Override The RX Override feature improves the network throughput under busy conditions. When an incoming received frame is overlayed by a later starting stronger signal, the overlayed signal would surely destroy the received frame. With an enabled RX Override feature, the receiver breakes the reception and restarts synchronisation to the stronger signal. The IRQs are set like after reception of a wrong FCS. The feature RX Override is enabled if the bit RX_OVERRIDE in register RX_SYN is set. 9.8.10 Reduced Power Consumption Mode (RPC) 9.8.10.1 Overview The Reduced Power Consumption mode is characterized by: * Significant power reduction for several transceiver operating modes * Self-contained, self-calibrating and adaptive power reduction schemes The RPC mode of the ATmega2564/1284/644RFR2 offers a variety of independent techniques and methods to significantly reduce the power consumption of the radio transceiver. RPC is applicable to selected operating modes and is transparent to most other extended features. In this context an RPC state change (disable or enable) needs to be understood as a major state change within all transceiver sections (TX, RX, PLL, state machines) and has to respect the associated settling time as specified in "State Transition Timing Summary" on page 46. In case of RX_ON / RX_AACK_ON / PLL_ON the PLL needs time to settle (tTR20=11s). To achieve the lowest possible power consumption set register TRX_RPC to 0xFF. For disabling the Reduced Power Consumption modes set register TRX_RPC to 0xC1 or 0x01. See "TRX_RPC - Transceiver Reduced Power Consumption Control" on page 136 for detailed description of the TRX_RPC register bits. 9.8.10.2 RPC Methods and Elements 9.8.10.2.1 PES - PLL Energy Saving The PES mode is activated with bit PLL_RPC_EN of register TRX_RPC set to one. Applicable to states: PLL_ON and TX_ARET_ON A state change towards PLL_ON or TX_ARET_ON causes an initial PLL calibration run, immediately followed by entering the PES mode. A state change towards RX or TX states, a channel switch or PLL calibration causes a PLL wake-up. After finishing such an operation, the PLL automatically enters the PES mode. 9.8.10.2.2 SRT - Smart Receiving Technology The SRT mode is activated with bit RX_RPC_EN of register TRX_RPC set to one. 104 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Applicable to states: RX_ON, RX_AACK_ON and TX_ARET_ON SRT reduces the average power consumption during RX listening periods. In typical environment situations SRT reduces the average current consumption of the transceiver in the RX_ON state by up to 50%. The configuration of SRT is done with the RX_RPC_CTRL bits of register TRX_RPC. Notes: 1. It's recommended to disable SRT during RSSI measurements or RND generation. 2. During CCA or/and ED scan the SRT is disabled automatically. 3. If autonomous antenna diversity is enabled, SRT cannot achieve the maximum effect. 4. The effective reduction of the current consumption may vary depending on operating conditions (wireless traffic, temperature, channel noise, frequency settings). 5. SRT shall be disabled when using the Random Number Generator. The total access time to the random value in PHY_RSSI - Receiver Signal Strength Indicator Register after SRT-disable is 2*tTR29+tTR20. 6. When a frame is received successfully while SRT and Dynamic Frame Buffer Protection are enabled the SRT is blocked until RX_SAFE_MODE bit in the register TRX_CTRL_2 is set to 0 to release the protection. 9.8.10.2.3 ERD - Extended Receiver Desensitizing ATmega2564/1284/644RFR2 ERD is activated with bit PDT_RPC_EN of register TRX_RPC set to one. Applicable to states: RX_ON, RX_AACK_ON and TX_ARET_ON In combination with RX_PDT_LEVEL settings, the average RX current is further significantly reduced, for details refer to "Current Consumption Specifications" on page 563. Setting RX_PDT_LEVEL = 0x08 requires special attention. In contrast to definitions in section "RX_SYN - Transceiver Receiver Sensitivity Control Register" on page 131, the sensitivity is reduced to -80 dBm only. However the average RX_ON current is much lower than for comparable register settings. Notes: 1. With RX_PDT_LEVEL 0x08, RSSI/ED can not resolve receiver input levels from -80 dBm to -67 dBm. 2. During CCA or/and ED scan the ERD is disabled automatically. 9.8.10.2.4 PAM - PAN Address Match Recognition ATmega2564/1284/644RFR2 PAM is activated with bit IPAN_RPC_EN of register TRX_RPC set to one. PAM is automatically deactivated if RX override is enabled (see "Receiver Override" on page 104 and "RX_SYN - Transceiver Receiver Sensitivity Control Register" on page 131 for details). Applicable to states: RX_AACK_ON The indication of an address match fail of the IEEE 802.15.4 frame filtering (see "Frame Filtering" on page 58) stops the receive procedure in two ways: 1. If the PAN address does not match, a new listen period starts immediately, 105 42073B-MCU Wireless-09/14 2. If the PAN address matches (but not the short destination address), the radio transceiver enters power saving mode for the remaining frame. If acknowledgement is also requested, power saving continues through the acknowledgement period. . Notes: 1. PAM is applicable to short acknowledgement times and reserved frame types as set by the bits AACK_ACK_TIME and AACK_FLTR_RES_FT of register XAH_CTRL_1, respectively (see "XAH_CTRL_1 - Transceiver Acknowledgment Frame Control Register 1" on page 132). 2. PAM is disabled automatically if promiscuous mode is enabled with bit AACK_PROM_MODE in register XAH_CTRL_1) set to one.. 9.8.10.2.5 Miscellaneous Power Reduction Functions Applicable to states: RX_ON and RX_AACK_ON In addition to Dynamic Frame Buffer Protection, refer to section "Dynamic Frame Buffer Protection" on page 99. During Dynamic Frame Buffer Protection, the radio transceiver automatically enters the power save mode. Applicable to states: TX_ARET_ON In addition to CSMA-CA retry, refer to section "TX_ARET_ON - Transmit with Automatic Retry and CSMA-CA Retry" on page 63. After starting the TX_ARET transaction, a random back-off period is performed. Within this back-off period the radio transceiver automatically enters power saving mode. Applicable to states: TX_ARET_ON and RX_AACK_ON In addition to the TX/RX turnaround time, refer to section "Extended Operating Mode" on page 47. The radio transceiver automatically enters power saving mode in: * TX_ARET: during the time waiting for an ACK frame, or * RX_AACK: during the time waiting for ACK transmission. Note: 1. To handle nodes configured with a RX/TX turnaround time less than 12 symbols, set RX_RPC_CTRL = 0 within TX_ARET state or set bit AACK_ACK_TIME of register XAH_CTRL_1 to one. 9.9 Continuous Transmission Test Mode 9.9.1 Overview The 2.4GHz transceiver offers a Continuous Transmission Test Mode to support final application / production tests as well as certification tests. In this test mode the radio transceiver transmits continuously a previously transferred frame (PRBS mode) or a continuous wave signal (CW mode). In CW mode two different signal frequencies per channel can be transmitted: * f1 = fCH + 0.5 MHz * f2 = fCH - 0.5 MHz Here fCH is the channel center frequency programmed by register PHY_CC_CCA. Note that in CW mode it is not possible to transmit a RF signal directly on the channel center frequency. PSDU data in the Frame Buffer must contain at least a valid PHR (see section "Introduction - IEEE 802.15.4-2006 Frame Format" on page 67). It is recommended to use a frame of maximum length (127 bytes) and arbitrary PSDU data 106 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 for the PRBS mode. The SHR and the PHR are not transmitted. The transmission starts with the PSDU data and is repeated continuously. 9.9.2 Configuration All register configurations shall be setup as follows before enabling Continuous Transmission Test Mode: * TX channel setting (optional); * TX output power setting (optional); * Mode selection (PRBS / CW); An access to the registers TST_CTRL_DIGI and PART_NUM enables the Continuous Transmission Test Mode. The transmission is started by enabling the PLL (TRX_CMD = PLL_ON) and writing the TX_START command to register TRX_STATE. Even for CW signal transmission it is required to write valid PSDU data (see chapter "Frame Buffer Access " on page 35) to the Frame Buffer. The first byte defines the frame length information. The frame length has to match to the length of the pattern stored in the frame buffer. For PRBS mode it is recommended to use a frame of maximum length. The detailed programming sequence is shown in Table 9-30 below. The column R/W informs about writing (W) or reading (R) a register or the Frame Buffer. Table 9-30. Continuous Transmission Programming Sequence Step Action 1 RESET 2 Register Access IRQ_MASK W 0x01 Set IRQ mask register, enable PLL_LOCK interrupt and set global AVR IRQ enable 3 Register Access TRX_CTRL_1 W 0x00 Disable TX_AUTO_CRC_ON 4 Register Access TRX_STATE W 0x03 Set radio transceiver state TRX_OFF 5 Register Access PHY_CC_CCA W 0x33 Set IEEE 802.15.4 CHANNEL, e.g. 19 6 Register Access PHY_TX_PWR W 0x00 Set TX output power, e.g. to Pmax 7 Register Access TRX_STATUS R 0x08 Verify TRX_OFF state 8 Register Access TST_CTRL_DIGI W 0x0F Enable Continuous Transmission Test Mode - step # 1 (1) Register Access TRX_CTRL_2 W 0x03 Enable High Data Rate Mode, 2 Mb/s RX_CTRL W 0xA7 Configure High Data Rate Mode 9 10 (1) Register Access 11 (2) Frame Buffer Write Access Register R/ W Value Description Reset the transceiver W Write PSDU data (even for CW mode), refer to Table 9-31 on page 108 12 Register Access PART_NUM W 0x54 Enable Continuous Transmission Test Mode - step # 2 13 Register Access PART_NUM W 0x46 Enable Continuous Transmission Test Mode - step # 3 14 Register Access TRX_STATE W 0x09 Enable PLL_ON state 107 42073B-MCU Wireless-09/14 Step Action Register 15 Interrupt event 16 Register Access 17 Measurement 18 Register Access 19 RESET Notes: TRX_STATE R/ W Value Description R 0x01 Wait for PLL_LOCK interrupt W 0x02 Initiate Transmission, enter BUSY_TX state Perform measurement PART_NUM W 0x00 Disable Continuous Transmission Test Mode Reset the transceiver 1. Only required for CW mode, do not configure for PRBS mode. 2. Frame Buffer content varies for different modulation schemes. The content of the Frame Buffer has to be defined for Continuous Transmission PRBS mode or CW mode. To measure the power spectral density (PSD) mask of the transmitter it is recommended to use a random sequence of maximum length for the PSDU data. To measure CW signals it is necessary to write either 0x00 or 0xFF to each byte of the Frame Buffer according to the given frame length. For details refer to Table 9-31 below. Table 9-31. Frame Buffer Content (after frame length information) for various Continuous Transmission Modulation Schemes Step Action Frame Content Comment 11 Frame Buffer Write Access Random Sequence modulated RF signal 0x00 (each byte) fCH - 0.5 MHz, CW signal 0xFF (each byte) fCH + 0.5 MHz, CW signal 9.10 Abbreviations 108 AACK - Automatic acknowledgement ACK - Acknowledgement ADC - Analog-to-digital converter AD - Antenna diversity AGC - Automated gain control AES - Advanced encryption standard ARET - Automatic retransmission AVREG - Voltage regulator for analog building blocks AWGN - Additive White Gaussian Noise BATMON - Battery monitor BBP - Base band processor BPF - Band pass filter CBC - Cipher block chaining CRC - Cyclic redundancy check CCA - Clear channel assessment ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 CSMA-CA - Carrier sense multiple access/Collision avoidance CW - Continuous wave DVREG - Voltage regulator for digital building blocks ECB - Electronic code book ED - Energy detection ESD - Electro static discharge EVM - Error vector magnitude FCF - Frame control field FCS - Frame check sequence FIFO - First in first out FTN - Filter tuning network GPIO - General purpose input output ISM - Industrial, scientific, and medical LDO - Low-drop output LNA - Low-noise amplifier LO - Local oscillator LQI - Link quality indicator LSB - Least significant bit MAC - Medium access control MFR - MAC footer MHR - MAC header MSB - Most significant bit MSDU - MAC service data unit MPDU - MAC protocol data unit MSK - Minimum shift keying O-QPSK - Offset - quadrature phase shift keying PA - Power amplifier PAN - Personal area network PCB - Printed circuit board PER - Packet error rate PHR - PHY header PHY - Physical layer PLL - Phase locked loop POR - Power-on reset PPF - Poly-phase filter PRBS - Pseudo random bit sequence 109 42073B-MCU Wireless-09/14 PSDU - PHY service data unit PSD - Power spectral mask QFN - Quad flat no-lead package RF - Radio frequency RSSI - Received signal strength indicator RX - Receiver SFD - Start-of-frame delimiter SHR - Synchronization header SPI - Serial peripheral interface SRAM - Static random access memory SSBF - Single side band filter TX - Transmitter VCO - Voltage controlled oscillator VREG - Voltage regulator XOSC - Crystal oscillator 9.11 Reference Documents 110 [1] IEEE Std 802.15.4TM-2006: Wireless Medium Access Control (MAC) and Physical Layer (PHY) Specifications for Low-Rate Wireless Personal Area Networks (LR-WPANs) [2] IEEE Std 802.15.4TM-2003: Wireless Medium Access Control (MAC) and Physical Layer (PHY) Specifications for Low-Rate Wireless Personal Area Networks (LR-WPANs) [3] IEEE Std 802.15.4TM-2011: Low-Rate Wireless Personal Area Networks (WPANs) [4] ANSI / ESD-STM5.1-2001: ESD Association Standard Test Method for electrostatic discharge sensitivity testing - Human Body Model (HBM). [5] ESD-STM5.3.1-1999: ESD Association Standard Test Method for electrostatic discharge sensitivity testing - Charged Device Model (CDM). [6] NIST FIPS PUB 197: Advanced Encryption Standard (AES), Federal Information Processing Standards Publication 197, US Department of Commerce/NIST, November 26, 2001 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 9.12 Register Description 9.12.1 AES_CTRL - AES Control Register Bit 7 6 5 4 3 NA ($13C) AES_REQUEST Res AES_MODE Res Read/Write Initial Value RW 0 R 0 RW 0 R 0 2 AES_DIR AES_IM RW 0 RW 0 1 0 Res1 Res0 R 0 R 0 AES_CTRL This register controls the operation of the security module. Do not access this register during AES operation to read the AES core status. A read or write access to the register stops the ongoing processing. To read the AES status use bit AES_DONE of register AES_STATUS. Note that the AES_CTRL register is cleared when entering the radio transceiver SLEEP state. * Bit 7 - AES_REQUEST - Request AES Operation. A write access with AES_REQUEST = 1 initiates the AES operation. * Bit 6 - Res - Reserved Bit This bit is reserved for future use. The result of a read access is undefined. The register bit must always be written with the reset value. * Bit 5 - AES_MODE - Set AES Operation Mode This register bit sets the AES operation mode (ECB/CBC Mode). Table 9-32 AES_MODE Register Bits Register Bits Value AES_MODE Description 0 AES Mode is ECB (Electronic Code Book). 1 AES Mode is CBC (Cipher Block Chaining). * Bit 4 - Res - Reserved Bit This bit is reserved for future use. The result of a read access is undefined. The register bit must always be written with the reset value. * Bit 3 - AES_DIR - Set AES Operation Direction This register bit sets the AES operation direction to either encryption or decryption. Table 9-33 AES_DIR Register Bits Register Bits Value AES_DIR Description 0 AES operation is encryption. 1 AES operation is decryption. * Bit 2 - AES_IM - AES Interrupt Enable This register bit is used to enable the AES interrupt. * Bit 1:0 - Res1:0 - Reserved Bit These bits are reserved for future use. The result of a read access is undefined. The register bits must always be written with the reset value. 111 42073B-MCU Wireless-09/14 9.12.2 AES_STATUS - AES Status Register Bit 7 6 5 4 3 2 1 NA ($13D) AES_ER Res5 Res4 Res3 Res2 Res1 Res0 Read/Write Initial Value R 0 R 0 R 0 R 0 R 0 R 0 R 0 0 AES_DONE AES_STATUS R 0 This read-only register signals the status of the security module and operation. Note that the AES_STATUS register is cleared when entering the radio transceiver SLEEP state. * Bit 7 - AES_ER - AES Operation Finished with Error This register bit indicates an error during AES module run. An error occurs if accessing AES_CTRL while an AES operation is running or if AES_KEY or AES_STATE Memory is not loaded completely or less than 16 Byte read from AES_STATE. * Bit 6:1 - Res5:0 - Reserved These bits are reserved for future use. * Bit 0 - AES_DONE - AES Operation Finished with Success This register bit indicates a successfully finished operation of the AES module. 9.12.3 AES_STATE - AES Plain and Cipher Text Buffer Register Bit 7 6 5 RW 0 RW 0 RW 0 NA ($13E) Read/Write Initial Value 4 3 2 1 0 RW 0 RW 0 RW 0 AES_STATE7:0 RW 0 RW 0 AES_STATE The AES_STATE register accesses a 16 byte internal data buffer. The buffer is accessed by reading or writing 16 times to the same address location (AES_STATE). If the buffer is not completely read or written an error occurs when an AES operation is started. Note that the AES_STATE register is cleared when entering the radio transceiver SLEEP state. * Bit 7:0 - AES_STATE7:0 - AES Plain and Cipher Text Buffer These bits represent the data buffer for the AES operation. 9.12.4 AES_KEY - AES Encryption and Decryption Key Buffer Register Bit 7 6 5 4 RW 0 RW 0 RW 0 RW 0 NA ($13F) Read/Write Initial Value 3 2 1 0 RW 0 RW 0 RW 0 AES_KEY7:0 RW 0 AES_KEY The AES key register accesses a 128 Bit internal buffer that holds the Encryption or Decryption Key. The AES_KEY buffer is a 16 Byte buffer. The buffer is accessed by reading or writing 16 fold to the same address location (AES_KEY). A read access to registers AES_KEY returns the last round key of the preceding security operation. This is the key that is required for the corresponding ECB decryption operation after an ECB 112 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 encryption operation. However, the initial AES key written to the security module in advance of an AES run is not modified during an AES operation. This initial key is used for the next AES run even if it cannot be read from AES_KEY register. Note that the AES_KEY register is cleared when entering the radio transceiver SLEEP state. * Bit 7:0 - AES_KEY7:0 - AES Encryption/Decryption Key Buffer These bits represent the data buffer for the AES Encryption/Decryption key. 9.12.5 TRX_STATUS - Transceiver Status Register Bit 7 6 5 4 CCA_DONE CCA_STATUS TST_STATUS TRX_STATUS4 Read/Write Initial Value R 0 R 0 R 0 R 0 Bit 3 2 1 0 TRX_STATUS3 TRX_STATUS2 TRX_STATUS1 TRX_STATUS0 R 0 R 0 R 0 R 0 NA ($141) NA ($141) Read/Write Initial Value TRX_STATUS TRX_STATUS This read-only register signals the present state of the radio transceiver as well as the status of the CCA operation. A state change is initiated by writing a state transition command to the TRX_CMD bits of register TRX_STATE. The register is not accessible in SLEEP state. * Bit 7 - CCA_DONE - CCA Algorithm Status This bit indicates if a CCA request is completed. This is also indicated by a TRX24_CCA_ED_DONE interrupt. Note that register bit CCA_DONE is cleared in response to a CCA_REQUEST. Table 9-34 CCA_DONE Register Bits Register Bits CCA_DONE Value Description 0 CCA calculation not finished 1 CCA calculation finished * Bit 6 - CCA_STATUS - CCA Status Result The result of the CCA measurement is available in register bit CCA_STATUS after a CCA request is completed. Note that register bit CCA_STATUS is cleared in response to a CCA_REQUEST. Table 9-35 CCA_STATUS Register Bits Register Bits Value Description CCA_STATUS 0 Channel indicated as busy. 1 Channel indicated as idle. * Bit 5 - TST_STATUS - Test mode status This bit is reserved for internal use. It indicates the status of the test mode. Table 9-36 TST_STATUS Register Bits Register Bits Value Description TST_STATUS 0 Test mode is disabled. 1 Test mode is active. 113 42073B-MCU Wireless-09/14 * Bit 4:0 - TRX_STATUS4:0 - Transceiver Main Status The register bits TRX_STATUS signal the current radio transceiver status. Do not try to initiate a further state change while the radio transceiver is in STATE_TRANSITION_IN_PROGRESS state. Values not listed in the following table are reserved. Table 9-37 TRX_STATUS Register Bits Register Bits Value Description TRX_STATUS4:0 0x01 BUSY_RX 0x02 BUSY_TX 0x06 RX_ON 0x08 TRX_OFF 0x09 PLL_ON 0x0F SLEEP 0x11 BUSY_RX_AACK 0x12 BUSY_TX_ARET 0x16 RX_AACK_ON 0x19 TX_ARET_ON 0x1F STATE_TRANSITION_IN_PROGRESS 9.12.6 TRX_STATE - Transceiver State Control Register Bit NA ($142) 7 6 5 TRAC_STATUS2 TRAC_STATUS1 TRAC_STATUS0 4 TRX_CMD4 Read/Write Initial Value R 0 R 0 R 0 RW 0 Bit 3 2 1 0 TRX_CMD3 TRX_CMD2 TRX_CMD1 TRX_CMD0 RW 0 RW 0 RW 0 RW 0 NA ($142) Read/Write Initial Value TRX_STATE TRX_STATE The states of the radio transceiver are controlled via register TRX_STATE using register bits TRX_CMD. The read-only register bits TRAC_STATUS indicate the status or result of an Extended Operating Mode transaction. A successful state transition shall be confirmed by reading register bits TRX_STATUS. This register is used for both Basic and Extended Operating Mode. * Bit 7:5 - TRAC_STATUS2:0 - Transaction Status The status of the RX_AACK and TX_ARET procedure is indicated by register bits TRAC_STATUS. TRAC_STATUS is only valid in Extended Operating Modes (note, TRAC_STATUS is valid 2us after the respective procedure is finished by TX_END or RX_END IRQ). Details of the algorithm and a description of the status information are given in the RX_AACK_ON and TX_ARET_ON sections of the data-sheet. Even though the reset value for register bits TRAC_STATUS is 0, the RX_AACK and TX_ARET procedures set the register bits to TRAC_STATUS = 7 (INVALID) when it is started. Not 114 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 all status values are used in both RX_AACK and TX_ARET transactions. In TX_ARET the status SUCCESS_DATA_PENDING indicates a successful reception of an ACK frame with frame pending bit set to 1. In RX_AACK the status SUCCESS_WAIT_FOR_ACK indicates an ACK frame is about to sent in RX_AACK slotted acknowledgment. Slotted acknowledgment operation must be enabled with the SLOTTED_OPERATION bit of register XAH_CTRL_0. The application software must set the SLPTR bit of register TRXPWR at the next back-off slot boundary in order to initiate a transmission of the ACK frame. For details refer to IEEE 802.15.4-2006, chapter 5.5.4.1. Values not listed in the following table are reserved. Table 9-38 TRAC_STATUS Register Bits Register Bits Value TRAC_STATUS2:0 Description 0 SUCCESS (RX_AACK, TX_ARET) 1 SUCCESS_DATA_PENDING (TX_ARET) 2 SUCCESS_WAIT_FOR_ACK (RX_AACK) 3 CHANNEL_ACCESS_FAILURE (TX_ARET) 5 NO_ACK (TX_ARET) 7 INVALID (RX_AACK, TX_ARET) * Bit 4:0 - TRX_CMD4:0 - State Control Command A write access to register bits TRX_CMD initiates a state transition of the radio transceiver towards the new state as defined by the write access. Do not try to initiate a further state change while the radio transceiver is in STATE_TRANSITION_IN_PROGRESS state (see TRX_STATUS register). FORCE_PLL_ON is not valid for the SLEEP state as well as during STATE_TRANSITION_IN_PROGRESS towards the SLEEP state. Values not listed in the following table are reserved and mapped to NOP. Table 9-39 TRX_CMD Register Bits Register Bits Value Description TRX_CMD4:0 0x00 NOP 0x02 TX_START 0x03 FORCE_TRX_OFF 0x04 FORCE_PLL_ON 0x06 RX_ON 0x08 TRX_OFF 0x09 PLL_ON (TX_ON) 0x16 RX_AACK_ON 0x19 TX_ARET_ON 9.12.7 TRX_CTRL_0 - Reserved Bit 7 6 5 4 3 2 1 0 NA ($143) Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 Read/Write Initial Value RW 0 RW 0 RW 0 RW 1 RW 1 RW 0 RW 0 RW 1 TRX_CTRL_0 This register is reserved for future use. * Bit 7:0 - Res7:0 - Reserved 115 42073B-MCU Wireless-09/14 These bits are reserved for future use. 9.12.8 TRX_CTRL_1 - Transceiver Control Register 1 Bit NA ($144) Read/Write Initial Value Bit NA ($144) Read/Write Initial Value 7 6 5 4 PA_EXT_EN IRQ_2_EXT_EN TX_AUTO_CRC_ON PLL_TX_FLT RW 0 RW 0 RW 1 RW 0 3 2 1 0 Res3 Res2 Res1 Res0 R 0 R 0 R 0 R 0 TRX_CTRL_1 TRX_CTRL_1 The TRX_CTRL_1 register is a multi purpose register to control various operating modes and settings of the radio transceiver. * Bit 7 - PA_EXT_EN - External PA support enable This register bit enables pin DIG3 and pin DIG4 to indicate the transmit state of the radio transceiver. The control of the external RF front-end is disabled when this bit is 0. Both pins DIG3 and DIG4 are then defined by the register of I/O ports F and G (PORTF, DDRF, PORTG, DDRG). The control of the external front-end is enabled when this bit is 1. DIG3 and DIG4 then indicate the state of the radio transceiver. Pin DIG3 is high and pin DIG4 is low in the state TX_BUSY. In all other states pin DIG3 is low and pin DIG4 is high. It is recommended to set PA_EXT_EN=1 only in receive or transmit states to reduce the power consumption or avoid leakage current of external RF switches or other building blocks especially during SLEEP state. * Bit 6 - IRQ_2_EXT_EN - Connect Frame Start IRQ to TC1 When this bit is set to one the capture input of Timer/Counter 1 is connected to the RX frame start signal and pin DIG2 becomes an output, driving the RX frame start signal. Antenna Diversity RF switch control (ANT_EXT_SW_EN=1) shall not be used at the same time, because it shares the same device pin. The function IRQ_2_EXT_EN is available for alternate frame time stamping using Timer/Counter 1. In general the preferred method for frame time stamping is using the symbol counter. * Bit 5 - TX_AUTO_CRC_ON - Enable Automatic CRC Calculation This register bit controls the automatic FCS generation for TX operations. The automatic FCS algorithm is performed autonomously by the radio transceiver if register bit TX_AUTO_CRC_ON=1. * Bit 4 - PLL_TX_FLT - Enable PLL TX Filter PLL TX filtering controls the output spectrum of the transmitted signal to decrease sidelobes. This is required for systems with an external power amplifier. TX filtering influences the signal quality. The EVM of the transmitted signal slightly degrades. * Bit 3:0 - Res3:0 - Reserved 116 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 9.12.9 PHY_TX_PWR - Transceiver Transmit Power Control Register Bit NA ($145) 7 6 5 4 Res3 Res2 Res1 Res0 R 0 R 0 R 0 R 0 Read/Write Initial Value 3 2 1 0 TX_PWR3 TX_PWR2 TX_PWR1 TX_PWR0 PHY_TX_PWR RW 0 RW 0 RW 0 RW 0 This register controls the output power of the transmitter. * Bit 7:4 - Res3:0 - Reserved * Bit 3:0 - TX_PWR3:0 - Transmit Power Setting These register bits determine the TX output power of the radio transceiver. Table 9-40 TX_PWR Register Bits Register Bits Value TX_PWR3:0 Description 0 3.5 dBm 1 3.3 dBm 2 2.8 dBm 3 2.3 dBm 4 1.8 dBm 5 1.2 dBm 6 0.5 dBm 7 -0.5 dBm 8 -1.5 dBm 9 -2.5 dBm 10 -3.5 dBm 11 -4.5 dBm 12 -6.5 dBm 13 -8.5 dBm 14 -11.5 dBm 15 -16.5 dBm 9.12.10 PARCR - Power Amplifier Ramp up/down Control Register Bit NA ($138) 7 6 PALTD2 PALTD1 Read/Write Initial Value RW 0 RW 1 5 4 PALTD0 3 PALTU2 PALTU1 RW 1 RW 0 RW 1 2 1 0 PALTU0 PARDFI PARUFI RW 1 RW 0 RW 0 PARCR This Register controls the power up and power down behavior of the Power Amplifier. * Bit 7:5 - PALTD2:0 - ext. PA Ramp Down Lead Time These bits control the ramp down lead time for the external power amplifier. Table 9-41 PALTD Register Bits Register Bits PALTD2:0 Value 0 Description -3s 117 42073B-MCU Wireless-09/14 Register Bits Value Description 1 -2s 2 -1s 3 0s 4 1s 5 2s 6 3s 7 4s * Bit 4:2 - PALTU2:0 - ext. PA Ramp Up Lead Time These bits control the ramp up lead time for the external power amplifier. Table 9-42 PALTU Register Bits Register Bits Value PALTU2:0 Description 0 -3s 1 -2s 2 -1s 3 0s 4 1s 5 2s 6 3s 7 4s * Bit 1 - PARDFI - Power Amplifier Ramp Down Frequency Inversion If this bit is clear, the PLL frequency is +500kHz (relative to carrier) while PA is ramping down and -500kHz otherwise. * Bit 0 - PARUFI - Power Amplifier Ramp Up Frequency Inversion If this bit is clear, the PLL frequency is -500kHz (relative to carrier) while PA is ramping up and +500kHz otherwise. 9.12.11 PHY_RSSI - Receiver Signal Strength Indicator Register Bit NA ($146) 7 6 5 4 RX_CRC_VALID RND_VALUE1 RND_VALUE0 RSSI4 Read/Write Initial Value R 0 R 0 R 0 R 0 Bit 3 2 1 0 RSSI3 RSSI2 RSSI1 RSSI0 R 0 R 0 R 0 R 0 NA ($146) Read/Write Initial Value PHY_RSSI PHY_RSSI The PHY_RSSI register is a multi purpose register that indicates FCS validity, provides random numbers and shows the current RSSI value. * Bit 7 - RX_CRC_VALID - Received Frame CRC Status Reading this register bit indicates whether the last received frame has a valid FCS or not. The register bit is updated when issuing a TRX24_RX_END interrupt and remains 118 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 valid until the next TRX24_RX_END interrupt is issued, caused by a new frame reception. Table 9-43 RX_CRC_VALID Register Bits Register Bits Value RX_CRC_VALID Description 0 CRC (FCS) not valid 1 CRC (FCS) valid * Bit 6:5 - RND_VALUE1:0 - Random Value A 2-bit random value can be retrieved by reading register bits RND_VALUE. The value can be used for random numbers for security applications. Note that the radio transceiver shall be in Basic Operating Mode receive state. The values are updated every 1 s. Ensure that register bit RX_PDT_DIS (register RX_SYN) is set to 0 at least 1 s before reading a random value. * Bit 4:0 - RSSI4:0 - Receiver Signal Strength Indicator The result of the automated RSSI measurement is stored in these register bits. The value is updated every 2s in receive states. The read value is a number between 0 and 28 indicating the received signal strength as a linear curve on a logarithmic input power scale (dBm) with a resolution of 3 dB. A RSSI value of 0 indicates a RF input power lower than RSSI_BASE_VAL (-90 dBm). A value of 28 marks a power higher or equal to -10 dBm. Table 9-44 RSSI Register Bits Register Bits Value RSSI4:0 Description 0 Minimum RSSI value: P(RF) < -90 dBm 1 P(RF) = RSSI_BASE_VAL+3 * (RSSI-1) [dBm] 2 ... 28 Maximum RSSI value: P(RF) -10 dBm 9.12.12 PHY_ED_LEVEL - Transceiver Energy Detection Level Register Bit 7 6 5 4 ED_LEVEL7 ED_LEVEL6 ED_LEVEL5 ED_LEVEL4 Read/Write Initial Value R 1 R 1 R 1 R 1 Bit 3 2 1 0 ED_LEVEL3 ED_LEVEL2 ED_LEVEL1 ED_LEVEL0 R 1 R 1 R 1 R 1 NA ($147) NA ($147) Read/Write Initial Value PHY_ED_LEVEL PHY_ED_LEVEL This register contains the result of an Energy Detection measurement. * Bit 7:0 - ED_LEVEL7:0 - Energy Detection Level The minimum ED value (ED_LEVEL = 0) indicates a receiver power less than or equal to RSSI_BASE_VAL. The range is 83 dB with a resolution of 1 dB and an absolute accuracy of 5 dB. A manual ED measurement can be initiated by a write access to this register. A value of 0xFF signals that no measurement has yet been started (reset value). The measurement duration is 8 symbol periods (128 s) for a data rate of 250 kb/s. For High Data Rate Modes the automated measurement duration is reduced to 32 s. For manually initiated ED measurements in these modes the measurement period is 119 42073B-MCU Wireless-09/14 still 128 s as long as the receiver is in RX_ON state. A value other than 0xFF indicates the result of the last ED measurement. Table 9-45 ED_LEVEL Register Bits Register Bits Value Description ED_LEVEL7:0 0x00 Minimum result of last ED measurement 0x01 P(RF) = RSSI_BASE_VAL+ED [dBm] 0x02 ... 0x53 Maximum result of last ED measurement 0xFF Reset value 9.12.13 PHY_CC_CCA - Transceiver Clear Channel Assessment (CCA) Control Register Bit NA ($148) 7 6 5 4 CCA_REQUEST CCA_MODE1 CCA_MODE0 CHANNEL4 RW 0 RW 0 RW 1 RW 0 3 2 1 0 CHANNEL3 CHANNEL2 CHANNEL1 CHANNEL0 RW 1 RW 0 RW 1 RW 1 Read/Write Initial Value Bit NA ($148) Read/Write Initial Value PHY_CC_CCA PHY_CC_CCA This register is provided to initiate and control a CCA measurement. * Bit 7 - CCA_REQUEST - Manual CCA Measurement Request A manual CCA measurement is initiated with setting CCA_REQUEST=1. The end of the CCA measurement is indicated by the TRX24_CCA_ED_DONE interrupt. Register bits CCA_DONE and CCA_STATUS of register TRX_STATUS are updated after a CCA_REQUEST. The register bit is automatically cleared after requesting a CCA measurement with CCA_REQUEST=1. * Bit 6:5 - CCA_MODE1:0 - Select CCA Measurement Mode The CCA mode can be selected using these register bits. Note that IEEE 802.15.42006 CCA Mode 3 defines the logical combination of CCA Mode 1 and 2 with the logical operators AND or OR. This can be selected with CCA_MODE=0 for logical operation OR and CCA_MODE=3 for logical operation AND. Table 9-46 CCA_MODE Register Bits Register Bits CCA_MODE1:0 Value Description 0 Mode 3a, Carrier sense OR energy above threshold 1 Mode 1, Energy above threshold 2 Mode 2, Carrier sense only 3 Mode 3b, Carrier sense AND energy above threshold * Bit 4:0 - CHANNEL4:0 - RX/TX Channel Selection These register bits define the RX/TX channel. The channel assignment is according to IEEE 802.15.4. 120 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Table 9-47 CHANNEL Register Bits Register Bits Value Description CHANNEL4:0 11 2405 MHz 12 2410 MHz 13 2415 MHz 14 2420 MHz 15 2425 MHz 16 2430 MHz 17 2435 MHz 18 2440 MHz 19 2445 MHz 20 2450 MHz 21 2455 MHz 22 2460 MHz 23 2465 MHz 24 2470 MHz 25 2475 MHz 26 2480 MHz 9.12.14 CCA_THRES - Transceiver CCA Threshold Setting Register Bit NA ($149) Read/Write Initial Value Bit NA ($149) Read/Write Initial Value Bit NA ($149) Read/Write Initial Value Bit NA ($149) Read/Write Initial Value 7 6 CCA_CS_THRES3 CCA_CS_THRES2 RW 1 RW 1 5 4 CCA_CS_THRES1 CCA_CS_THRES0 RW 0 RW 0 3 2 CCA_ED_THRES3 CCA_ED_THRES2 RW 0 RW 1 1 0 CCA_ED_THRES1 CCA_ED_THRES0 RW 1 RW 1 CCA_THRES CCA_THRES CCA_THRES CCA_THRES This register sets the threshold level for the Energy Detection (ED) of the Clear Channel Assessment (CCA). * Bit 7:4 - CCA_CS_THRES3:0 - CS Threshold Level for CCA Measurement These bits are reserved for internal use. * Bit 3:0 - CCA_ED_THRES3:0 - ED Threshold Level for CCA Measurement 121 42073B-MCU Wireless-09/14 These bits define the received power threshold of the Energy above threshold algorithm. The threshold is calculated by RSSI_BASE_VAL + 2CCA_ED_THRES [dBm]. Any received power above this level is interpreted as a busy channel. 9.12.15 RX_CTRL - Transceiver Receive Control Register Bit 7 6 5 4 NA ($14A) SDM_MODE1 SDM_MODE0 ACR_MODE SOFT_MODE Read/Write Initial Value RW 1 RW 0 RW 1 RW 1 3 2 1 0 NA ($14A) PDT_THRES3 PDT_THRES2 PDT_THRES1 PDT_THRES0 Read/Write Initial Value RW 0 RW 1 RW 1 RW 1 Bit RX_CTRL RX_CTRL The register controls the sensitivity of the Antenna Diversity Mode. Note that in High Data Rate modes the ACR module will always be disabled. * Bit 7:6 - SDM_MODE1:0 - Sigma-Delta Modulator Order and Delay Compensation These bits are reserved for internal use. They select the order of the sigma-delta modulator (SDM), turn on or off the delay compensation unit (DCU) and other internal functions. Table 9-48 SDM_MODE Register Bits Register Bits SDM_MODE1:0 Value Description 0 SDM mode 1 selected (Mash 1), DCU turned on 1 SDM mode 1 with random carry threshold 2 SDM mode 2 selected (Mash 1-1), DCU turned on 3 SDM mode 2 with random ACCU2 * Bit 5 - ACR_MODE - Adjacent Channel Rejection Mode This bit is reserved for internal use. It turns on or off the ACR module. For high rate modes the ACR module will be always disabled. * Bit 4 - SOFT_MODE - Correlator Soft Mode This bit is reserved for internal use. It controls the correlation function of the digital baseband processor. Furthermore the bit enables or disables the data scrambling in the high data rate modes. * Bit 3:0 - PDT_THRES3:0 - Receiver Sensitivity Control These register bits control the sensitivity of the receiver correlation unit. If the Antenna Diversity algorithm is enabled the value shall be set to PDT_THRES = 3. Otherwise it shall be set back to the reset value. Values not listed in the following table are reserved. Table 9-49 PDT_THRES Register Bits Register Bits PDT_THRES3:0 122 Value 0x7 Description Reset value, to be used if Antenna Diversity algorithm is disabled ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Register Bits Value Description 0x3 Recommended correlator threshold for Antenna Diversity operation 9.12.16 SFD_VALUE - Start of Frame Delimiter Value Register Bit 7 6 5 4 NA ($14B) Read/Write Initial Value 3 2 1 0 SFD_VALUE7:0 RW 1 RW 0 RW 1 RW 0 SFD_VALUE RW 0 RW 1 RW 1 RW 1 This register contains the one octet start-of-frame delimiter (SFD) to synchronize to a received frame. The lower 4 bits must not be all zero to avoid decoding conflicts. * Bit 7:0 - SFD_VALUE7:0 - Start of Frame Delimiter Value For compliant IEEE 802.15.4 networks set SFD_VALUE = 0xA7. This is the default value of the register. To establish non IEEE 802.15.4 compliant networks the SFD value can be changed to any other value. If enabled a RX_START interrupt is issued only if the received SFD matches the register content of SFD_VALUE and a valid PHR is received. Table 9-50 SFD_VALUE Register Bits Register Bits Value Description SFD_VALUE7:0 0xA7 IEEE 802.15.4 compliant value of the SFD 9.12.17 TRX_CTRL_2 - Transceiver Control Register 2 Bit 7 6 5 4 NA ($14C) RX_SAFE_MODE Res4 Res3 Res2 Read/Write Initial Value RW 0 R 0 R 0 R 0 Bit 3 2 NA ($14C) Res1 Res0 Read/Write Initial Value R 0 R 0 1 0 OQPSK_DATA_RATE1 OQPSK_DATA_RATE0 RW 0 TRX_CTRL_2 TRX_CTRL_2 RW 0 This register controls the data rate setting of the radio transceiver. * Bit 7 - RX_SAFE_MODE - RX Safe Mode If this bit is set, the next received frame will be protected and not overwritten by following frames. Set this bit to 0 to release the buffer (and set it again for further protection). * Bit 6:2 - Res4:0 - Reserved * Bit 1:0 - OQPSK_DATA_RATE1:0 - Data Rate Selection A write access to these register bits sets the OQPSK PSDU data rate used by the radio transceiver. The reset value OQPSK_DATA_RATE = 0 is the PSDU data rate according to IEEE 802.15.4. All other values are used in High Data Rate Modes. 123 42073B-MCU Wireless-09/14 Table 9-51 OQPSK_DATA_RATE Register Bits Register Bits Value OQPSK_DATA_RATE1:0 Description 0 250 kb/s (IEEE 802.15.4 compliant) 1 500 kb/s 2 1000 kb/s 3 2000 kb/s 9.12.18 ANT_DIV - Antenna Diversity Control Register Bit 7 6 5 4 NA ($14D) ANT_SEL Res2 Res1 Res0 Read/Write Initial Value R 0 R 0 R 0 R 0 Bit 3 2 1 0 NA ($14D) ANT_DIV_EN ANT_EXT_SW_EN ANT_CTRL1 ANT_CTRL0 Read/Write Initial Value RW 0 RW 0 RW 1 RW 1 ANT_DIV ANT_DIV This register controls the Antenna Diversity. * Bit 7 - ANT_SEL - Antenna Diversity Antenna Status This register bit signals the currently selected antenna path. The selection may be based either on the last antenna diversity cycle (ANT_DIV_EN = 1) or on the content of register bits ANT_CTRL. Table 9-52 ANT_SEL Register Bits Register Bits ANT_SEL Value Description 0 Antenna 0 1 Antenna 1 * Bit 6:4 - Res2:0 - Reserved * Bit 3 - ANT_DIV_EN - Enable Antenna Diversity If this register bit is set the Antenna Diversity algorithm is enabled. On reception of a frame the algorithm selects an antenna autonomously during SHR search. This selection is kept until 1. A new SHR search starts or 2. Receive states are left or 3. A manually programming of bits ANT_CTRL occurred. If ANT_DIV_EN = 1 the bit ANT_EXT_SW_EN shall also be set to 1. Table 9-53 ANT_DIV_EN Register Bits Register Bits Value Description ANT_DIV_EN 0 Antenna Diversity algorithm disabled 1 Antenna Diversity algorithm enabled * Bit 2 - ANT_EXT_SW_EN - Enable External Antenna Switch Control If enabled, pin DIG1 and pin DIG2 become output pins and provide a differential control signal for an external Antenna Diversity switch. The selection of a specific antenna is done either by the automatic Antenna Diversity algorithm (ANT_DIV_EN = 1) or 124 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 according to bits ANT_CTRL if the Antenna Diversity algorithm is disabled. Do not enable Antenna Diversity RF switch control (ANT_EXT_SW_EN = 1) and RX Frame Time Stamping (IRQ_2_EXT_EN = 1, see register TRX_CTRL_1) at the same time. If this bit is set the control pins DIG1/DIG2 are activated in all radio transceiver states as long as bit ANT_EXT_SW_EN is also set. If the radio transceiver is not in a receive or transmit state, it is recommended to disable bit ANT_EXT_SW_EN to reduce the power consumption or avoid leakage current of an external RF switch especially during SLEEP state. If bit ANT_EXT_SW_EN = 0, the output pins DIG1 and DIG2 are controlled by the register of I/O ports F and G (PORTF, DDRF, PORTG, DDRG). Table 9-54 ANT_EXT_SW_EN Register Bits Register Bits Value ANT_EXT_SW_EN Description 0 Antenna Diversity RF switch control disabled 1 Antenna Diversity RF switch control enabled * Bit 1:0 - ANT_CTRL1:0 - Static Antenna Diversity Switch Control These bits provide a static control of an Antenna Diversity switch. This register setting defines the selected antenna if ANT_DIV_EN is set to 0 (Antenna Diversity disabled). Register values 1 and 2 are valid for ANT_EXT_SW_EN = 1. Table 9-55 ANT_CTRL Register Bits Register Bits Value Description ANT_CTRL1:0 0 Reserved 1 Antenna 1: DIG1=L, DIG2=H 2 Antenna 0: DIG1=H, DIG2=L 3 Default value for ANT_EXT_SW_EN=0; Mandatory setting for applications not using Antenna Diversity 9.12.19 IRQ_MASK - Transceiver Interrupt Enable Register Bit 7 6 5 4 NA ($14E) AWAKE_EN TX_END_EN AMI_EN CCA_ED_DONE_EN Read/Write Initial Value RW 0 RW 0 RW 0 RW 0 3 2 1 0 NA ($14E) RX_END_EN RX_START_EN PLL_UNLOCK_EN PLL_LOCK_EN Read/Write Initial Value RW 0 RW 0 RW 0 RW 0 Bit IRQ_MASK IRQ_MASK This register is used to enable or disable individual interrupts of the radio transceiver. An interrupt is enabled if the corresponding bit is set to 1. All interrupts are disabled after the power up sequence or reset. If an interrupt is enabled it is recommended to read the interrupt status register IRQ_STATUS first to clear the history. * Bit 7 - AWAKE_EN - Awake Interrupt Enable * Bit 6 - TX_END_EN - TX_END Interrupt Enable * Bit 5 - AMI_EN - Address Match Interrupt Enable * Bit 4 - CCA_ED_DONE_EN - End of ED Measurement Interrupt Enable * Bit 3 - RX_END_EN - RX_END Interrupt Enable 125 42073B-MCU Wireless-09/14 * Bit 2 - RX_START_EN - RX_START Interrupt Enable * Bit 1 - PLL_UNLOCK_EN - PLL Unlock Interrupt Enable * Bit 0 - PLL_LOCK_EN - PLL Lock Interrupt Enable 9.12.20 IRQ_MASK1 - Transceiver Interrupt Enable Register 1 Bit NA ($BE) 7 6 Res2 Res1 Read/Write Initial Value R 0 R 0 Bit 5 4 NA ($BE) IRQ_MASK1 Res0 MAF_3_AMI_EN Read/Write Initial Value R 0 RW 0 Bit 3 2 MAF_2_AMI_EN MAF_1_AMI_EN RW 0 RW 0 1 0 MAF_0_AMI_EN TX_START_EN RW 0 RW 0 NA ($BE) Read/Write Initial Value Bit NA ($BE) Read/Write Initial Value IRQ_MASK1 IRQ_MASK1 IRQ_MASK1 This register is used to enable or disable additional interrupts of the radio transceiver. An interrupt is enabled if the corresponding bit is set to 1. All interrupts are disabled after the power up sequence or reset. If an interrupt is enabled it is recommended to read the interrupt status register IRQ_STATUS first to clear the history. * Bit 7:5 - Res2:0 - Reserved Bit * Bit 4 - MAF_3_AMI_EN - Address Match Interrupt enable Address filter 3 * Bit 3 - MAF_2_AMI_EN - Address Match Interrupt enable Address filter 2 * Bit 2 - MAF_1_AMI_EN - Address Match Interrupt enable Address filter 1 * Bit 1 - MAF_0_AMI_EN - Address Match Interrupt enable Address filter 0 * Bit 0 - TX_START_EN - Transmit Start Interrupt enable 9.12.21 IRQ_STATUS - Transceiver Interrupt Status Register Bit 7 6 5 4 NA ($14F) AWAKE TX_END AMI CCA_ED_DONE Read/Write Initial Value RW 0 RW 0 RW 0 RW 0 3 2 1 0 NA ($14F) RX_END RX_START PLL_UNLOCK PLL_LOCK Read/Write Initial Value RW 0 RW 0 RW 0 RW 0 Bit 126 IRQ_STATUS IRQ_STATUS ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 This register contains the status of the pending interrupt requests. An interrupt is pending if the associated bit has a value of one. Such a pending interrupts can be manually cleared by writing a 1 to that register bit. Interrupts are automatically cleared when the corresponding interrupt service routine is being executed. * Bit 7 - AWAKE - Awake Interrupt Status * Bit 6 - TX_END - TX_END Interrupt Status * Bit 5 - AMI - Address Match Interrupt Status * Bit 4 - CCA_ED_DONE - End of ED Measurement Interrupt Status * Bit 3 - RX_END - RX_END Interrupt Status * Bit 2 - RX_START - RX_START Interrupt Status * Bit 1 - PLL_UNLOCK - PLL Unlock Interrupt Status * Bit 0 - PLL_LOCK - PLL Lock Interrupt Status 9.12.22 IRQ_STATUS1 - Transceiver Interrupt Status Register 1 Bit NA ($BF) 7 6 5 4 Res2 Res1 Res0 MAF_3_AMI Read/Write Initial Value R 0 R 0 R 0 RW 0 Bit 3 2 1 0 MAF_2_AMI MAF_1_AMI MAF_0_AMI TX_START RW 0 RW 0 RW 0 RW 0 NA ($BF) Read/Write Initial Value IRQ_STATUS1 IRQ_STATUS1 This register contains the status of additional pending interrupt requests. An interrupt is pending if the associated bit has a value of one. Such a pending interrupts can be manually cleared by writing a 1 to that register bit. Interrupts are automatically cleared when the corresponding interrupt service routine is being executed. * Bit 7:5 - Res2:0 - Reserved Bit * Bit 4 - MAF_3_AMI - Address Match Interrupt Status Address filter 3 * Bit 3 - MAF_2_AMI - Address Match Interrupt Status Address filter 2 * Bit 2 - MAF_1_AMI - Address Match Interrupt Status Address filter 1 * Bit 1 - MAF_0_AMI - Address Match Interrupt Status Address filter 0 * Bit 0 - TX_START - Transmit Start Interrupt Status 9.12.23 VREG_CTRL - Voltage Regulator Control and Status Register Bit NA ($150) Read/Write Initial Value Bit NA ($150) Read/Write Initial Value 7 6 5 4 AVREG_EXT AVDD_OK AVREG_TRIM1 AVREG_TRIM0 RW 0 R 0 RW 0 RW 0 3 2 1 0 DVREG_EXT DVDD_OK DVREG_TRIM1 DVREG_TRIM0 RW 0 R 0 RW 0 RW 0 VREG_CTRL VREG_CTRL 127 42073B-MCU Wireless-09/14 This register controls the use of the voltage regulators and indicates their status. * Bit 7 - AVREG_EXT - Use External AVDD Regulator This bit is reserved for IC test and should not be modified by the application firmware. If set, this register bit disables the internal analog voltage regulator to apply an external regulated 1.8V supply for the analog building blocks. Table 9-56 AVREG_EXT Register Bits Register Bits Value Description AVREG_EXT 0 Internal AVDD voltage regulator for the analog section is enabled. 1 Internal AVDD voltage regulator is disabled. * Bit 6 - AVDD_OK - AVDD Supply Voltage Valid This register bit indicates if the internal 1.8V regulated voltage supply AVDD has settled. The bit is set to logic high if AVREG_EXT = 1. Table 9-57 AVDD_OK Register Bits Register Bits Value AVDD_OK Description 0 Analog voltage regulator disabled or supply voltage not stable 1 Analog supply voltage has settled * Bit 5:4 - AVREG_TRIM1:0 - Adjust AVDD Supply Voltage These bits are reserved for internal use. They allow adjusting the value of the analog supply voltage (AVDD). Table 9-58 AVREG_TRIM Register Bits Register Bits Value AVREG_TRIM1:0 Description 0 1.80V 1 1.75V 2 1.84V 3 1.88V * Bit 3 - DVREG_EXT - Use External DVDD Regulator This bit may be set in the Register, but is deactivated in the design. The DVREG_EXT functionality to deactivate the digital voltage regulator is no implemented anymore Table 9-59 DVREG_EXT Register Bits Register Bits Value Description DVREG_EXT 0 Internal DVDD voltage regulator for the digital section is enabled. 1 Internal DVDD voltage regulator is disabled; use external regulated 1.8V supply voltage for the digital section. * Bit 2 - DVDD_OK - DVDD Supply Voltage Valid This register bit indicates if the internal 1.8V regulated voltage supply DVDD has settled. The bit is set to logic high if DVREG_EXT = 1. Table 9-60 DVDD_OK Register Bits Register Bits DVDD_OK 128 Value 0 Description Digital voltage regulator disabled or supply voltage not stable ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Register Bits Value 1 Description Digital supply voltage has settled * Bit 1:0 - DVREG_TRIM1:0 - Adjust DVDD Supply Voltage These bits are reserved for internal use. They allow adjusting the value of the digital supply voltage (DVDD). Table 9-61 DVREG_TRIM Register Bits Register Bits Value DVREG_TRIM1:0 Description 0 1.80V 1 1.75V 2 1.84V 3 1.88V 9.12.24 BATMON - Battery Monitor Control and Status Register Bit 7 6 5 4 BAT_LOW BAT_LOW_EN BATMON_OK BATMON_HR RW 0 RW 0 R 0 RW 0 3 2 1 0 BATMON_VTH3 BATMON_VTH2 BATMON_VTH1 BATMON_VTH0 RW 0 RW 0 RW 1 RW 0 NA ($151) Read/Write Initial Value Bit NA ($151) Read/Write Initial Value BATMON BATMON This register configures the battery monitor to observe the supply voltage at EVDD. The status of the EVDD supply voltage is accessible by reading bit BATMON_OK with respect to the actual BATMON settings. Furthermore the Battery Monitor Interrupt can be controlled with the bits BAT_LOW and BAT_LOW_EN similar to the function of the IRQ_STATUS and IRQ_MASK register for other radio transceiver interrupts. * Bit 7 - BAT_LOW - Battery Monitor Interrupt Status A BATMON Interrupt is pending if this bit is set. Writing one to this bit if it has been at one will clear the interrupt. * Bit 6 - BAT_LOW_EN - Battery Monitor Interrupt Enable The Battery Monitor Interrupt is enabled if this bit is set to one. The Battery Monitor will not generate an interrupt if this bit is zero. * Bit 5 - BATMON_OK - Battery Monitor Status The register bit BATMON_OK indicates the level of the external supply voltage with respect to the programmed threshold BATMON_VTH. Table 9-62 BATMON_OK Register Bits Register Bits Value Description BATMON_OK 0 The battery voltage is below the threshold. 1 The battery voltage is above the threshold. * Bit 4 - BATMON_HR - Battery Monitor Voltage Range This bit sets the range and resolution of the battery monitor. 129 42073B-MCU Wireless-09/14 Table 9-63 BATMON_HR Register Bits Register Bits Value Description BATMON_HR 0 Enables the low range, see BATMON_VTH 1 Enables the high range, see BATMON_VTH * Bit 3:0 - BATMON_VTH3:0 - Battery Monitor Threshold Voltage The threshold values for the battery monitor are set by these register bits according to the following table. Table 9-64 BATMON_VTH Register Bits Register Bits Value BATMON_VTH3:0 Description 0x0 2.550V / 1.70V (BATMON_HR=1/0) 0x1 2.625V / 1.75V (BATMON_HR=1/0) 0x2 2.700V / 1.80V (BATMON_HR=1/0) 0x3 2.775V / 1.85V (BATMON_HR=1/0) 0x4 2.850V / 1.90V (BATMON_HR=1/0) 0x5 2.925V / 1.95V (BATMON_HR=1/0) 0x6 3.000V / 2.00V (BATMON_HR=1/0) 0x7 3.075V / 2.05V (BATMON_HR=1/0) 0x8 3.150V / 2.10V (BATMON_HR=1/0) 0x9 3.225V / 2.15V (BATMON_HR=1/0) 0xA 3.300V / 2.20V (BATMON_HR=1/0) 0xB 3.375V / 2.25V (BATMON_HR=1/0) 0xC 3.450V / 2.30V (BATMON_HR=1/0) 0xD 3.525V / 2.35V (BATMON_HR=1/0) 0xE 3.600V / 2.40V (BATMON_HR=1/0) 0xF 3.675V / 2.45V (BATMON_HR=1/0) 9.12.25 XOSC_CTRL - Crystal Oscillator Control Register Bit NA ($152) Read/Write Initial Value Bit NA ($152) Read/Write Initial Value 7 6 5 4 XTAL_MODE3 XTAL_MODE2 XTAL_MODE1 XTAL_MODE0 RW 1 RW 1 RW 1 RW 1 3 2 1 0 XTAL_TRIM3 XTAL_TRIM2 XTAL_TRIM1 XTAL_TRIM0 RW 0 RW 0 RW 0 RW 0 XOSC_CTRL XOSC_CTRL This register controls the operation of the 16MHz crystal oscillator. * Bit 7:4 - XTAL_MODE3:0 - Crystal Oscillator Operating Mode These register bits set the operating mode of the 16 MHz crystal oscillator. For normal operation the default value is set to XTAL_MODE = 0xF after reset. For use with an external clock source it is recommended to set XTAL_MODE = 0x4. 130 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Table 9-65 XTAL_MODE Register Bits Register Bits Value XTAL_MODE3:0 Description 0x4 Internal crystal oscillator disabled; use external reference frequency. 0xF Internal crystal oscillator enabled; amplitude regulation of oscillation enabled. * Bit 3:0 - XTAL_TRIM3:0 - Crystal Oscillator Load Capacitance Trimming These register bits control two internal capacitance arrays connected to pins XTAL1 and XTAL2. A capacitance value in the range from 0 pF to 4.5 pF is selectable with a resolution of 0.3 pF. Table 9-66 XTAL_TRIM Register Bits Register Bits Value XTAL_TRIM3:0 Description 0x0 0.0 pF, trimming capacitors disconnected 0x1 0.3 pF, trimming capacitor switched on 0x2 ... 0xF 4.5 pF, trimming capacitor switched on 9.12.26 RX_SYN - Transceiver Receiver Sensitivity Control Register Bit NA ($155) Read/Write Initial Value Bit NA ($155) Read/Write Initial Value Bit NA ($155) Read/Write Initial Value Bit NA ($155) Read/Write Initial Value 7 6 RX_PDT_DIS RX_OVERRIDE RW 0 RW 1 5 4 RXO_CFG1 RXO_CFG0 RW 0 RW 0 3 2 RX_PDT_LEVEL3 RX_PDT_LEVEL2 RW 0 RW 0 1 0 RX_PDT_LEVEL1 RX_PDT_LEVEL0 RW 0 RW 0 RX_SYN RX_SYN RX_SYN RX_SYN This register controls the sensitivity threshold of the receiver. * Bit 7 - RX_PDT_DIS - Prevent Frame Reception RX_PDT_DIS = 1 prevents the reception of a frame even if the radio transceiver is in receive modes. An ongoing frame reception is not affected. This operation mode is independent of the setting of register bits RX_PDT_LEVEL. * Bit 6 - RX_OVERRIDE - Receiver Override Function If this bit is set, the receiver restarts the reception if a co-channel interferer is detected. This function is not directly visible, but should lead to a better co-channel interference suppression. 131 42073B-MCU Wireless-09/14 * Bit 5 - RXO_CFG1 - RX_OVERRIDE Configuration Configures the different RX_OVERRIDE options. * Bit 4 - RXO_CFG0 - RX_OVERRIDE configuration Configures the different RX_OVERRIDE options. * Bit 3:0 - RX_PDT_LEVEL3:0 - Reduce Receiver Sensitivity These register bits reduce the receiver sensitivity such that frames with a RSSI level below the RX_PDT_LEVEL threshold level are not received (RX_PDT_LEVEL>0). The threshold level can be calculated according to the following formula: RX_THRES > RSSI_BASE_VAL+3*(RX_PDT_LEVEL-1), for RX_PDT_LEVEL>0. If register bits RX_PDT_LEVEL>0 the current consumption of the receiver in states RX_ON and RX_AACK_ON is reduced by 500 A. If register bits RX_PDT_LEVEL=0 (reset value) all frames with a valid SHR and PHR are received, independently of their signal strength. Examples for certain register settings are given in the following table. Table 9-67 RX_PDT_LEVEL Register Bits Register Bits Value RX_PDT_LEVEL3:0 Description 0x0 RX_THRES RSSI_BASE_VAL (Reset value); RSSI value not considered 0x1 RX_THRES > RSSI_BASE_VAL + 0 * 3; RSSI > -90 dBm 0x2 ... 0xE RX_THRES > RSSI_BASE_VAL + 13 * 3; RSSI > -51 dBm 0xF RX_THRES > RSSI_BASE_VAL + 14 * 3; RSSI > -48 dBm 9.12.27 XAH_CTRL_1 - Transceiver Acknowledgment Frame Control Register 1 Bit NA ($157) Read/Write Initial Value Bit NA ($157) Read/Write Initial Value 7 6 5 Res1 Res0 R 0 R 0 R 0 AACK_FLTR_RES_FT AACK_UPLD_RES_FT RW 0 3 Res 4 2 1 AACK_ACK_TIME AACK_PROM_MODE RW 0 XAH_CTRL_1 RW 0 RW 0 0 Res XAH_CTRL_1 R 0 This register is a multi-purpose control register for various RX_AACK settings. * Bit 7:6 - Res1:0 - Reserved Bit This bit is reserved for future use. The result of a read access is undefined. The register bit must always be written with the reset value. * Bit 5 - AACK_FLTR_RES_FT - Filter Reserved Frames This register bit shall only be set if AACK_UPLD_RES_FT = 1. If AACK_FLTR_RES_FT = 1 reserved frame types are filtered similar to data frames as specified in IEEE 802.15.4-2006. Reserved frame types are explained in IEEE 802.15.4 section 7.2.1.1.1. If AACK_FLTR_RES_FT = 0 a received, reserved frame is only checked for a valid FCS. 132 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 * Bit 4 - AACK_UPLD_RES_FT - Process Reserved Frames If AACK_UPLD_RES_FT = 1 received frames indicated as reserved are further processed. A RX_END interrupt is generated if the FCS of those frames is valid. In conjunction with the configuration bit AACK_FLTR_RES_FT set, these frames are handled like IEEE 802.15.4 compliant data frames during RX_AACK transaction. An AMI interrupt is issued if the address in the received frame matches the node address. That means if a reserved frame passes the third level filter rules, an acknowledgment frame is generated and transmitted if it was requested by the received frame. If this is not wanted bit AACK_DIS_ACK in register CSMA_SEED_1 has to be set. * Bit 3 - Res - Reserved Bit This bit is reserved for future use. The result of a read access is undefined. The register bit must always be written with the reset value. * Bit 2 - AACK_ACK_TIME - Reduce Acknowledgment Time According to IEEE 802.15.4, section 7.5.6.4.2 the transmission of an acknowledgment frame shall commence 12 symbols (aTurnaroundTime) after the reception of the last symbol of a data or MAC command frame. This is achieved with the reset value of the register bit AACK_ACK_TIME. If AACK_ACK_TIME = 1 an acknowledgment frame is alternatively sent already 2 symbol periods (32 s) after the reception of the last symbol of a data or MAC command frame. This may be applied to proprietary networks or networks using the High Data Rate Modes to increase battery lifetime and to improve the overall data throughput. This setting affects also to acknowledgment frame response time for slotted acknowledgment operation. Table 9-68 AACK_ACK_TIME Register Bits Register Bits Value AACK_ACK_TIME Description 0 12 symbols acknowledgment time 1 2 symbols acknowledgment time * Bit 1 - AACK_PROM_MODE - Enable Promiscuous Mode This register bit enables the promiscuous mode within the RX_AACK mode; refer to IEEE 802.15.4-2006 chapter 7.5.6.5. If this bit is set, every incoming frame with a valid PHR finishes with a RX_END interrupt even if the third level filter rules do not match or the FCS is not valid. The bit RX_CRC_VALID of register PHY_RSSI is set accordingly. If this bit is set and a frame passes the third level filter rules, an acknowledgment frame is generated and transmitted unless disabled by bit AACK_DIS_ACK of register CSMA_SEED_1. * Bit 0 - Res - Reserved Bit This bit is reserved for future use. The result of a read access is undefined. The register bit must always be written with the reset value. 9.12.28 FTN_CTRL - Transceiver Filter Tuning Control Register Bit NA ($158) Read/Write Initial Value Bit NA ($158) Read/Write Initial Value 7 6 5 4 FTN_START FTN_ROUND FTNV5 FTNV4 RW 0 RW 1 RW 0 RW 1 3 2 1 0 FTNV3 FTNV2 FTNV1 FTNV0 RW 1 RW 0 RW 0 RW 0 FTN_CTRL FTN_CTRL 133 42073B-MCU Wireless-09/14 This register controls the operation of the calibration loop of the filter tuning network. * Bit 7 - FTN_START - Start Calibration Loop of Filter Tuning Network FTN_START = 1 initiates the calibration of the filter tuning network. When the calibration cycle has finished after at most 25 s the register bit is automatically reset to 0. * Bit 6 - FTN_ROUND - Round Filter Tuning Calibration Result This bit is reserved for internal use. * Bit 5:0 - FTNV5:0 - Filter Tuning Calibration Result These bits are reserved for internal use. 9.12.29 PLL_CF - Transceiver Center Frequency Calibration Control Register Bit 7 6 NA ($15A) PLL_CF_START EN_PLL_CF Read/Write Initial Value RW 0 RW 1 5 4 NA ($15A) PLL_VMOD_TUNE1 PLL_VMOD_TUNE0 Read/Write Initial Value RW 0 RW 1 3 2 NA ($15A) PLL_CF3 PLL_CF2 Read/Write Initial Value RW 0 RW 1 1 0 NA ($15A) PLL_CF1 PLL_CF0 Read/Write Initial Value RW 1 RW 1 Bit Bit Bit PLL_CF PLL_CF PLL_CF PLL_CF This register controls the operation of the center frequency calibration loop. Consecutive read/write commands to this register must include a wait time of at least 500ns between each access. * Bit 7 - PLL_CF_START - Start Center Frequency Calibration PLL_CF_START = 1 initiates the center frequency calibration. The calibration cycle has finished after 35 s (typical). The register bit is cleared immediately after finishing the calibration. * Bit 6 - EN_PLL_CF - Enable Center Frequency Tuning This bit is reserved for internal use. * Bit 5:4 - PLL_VMOD_TUNE1:0 - VCO Modulation Tuning These bits are reserved for internal use. * Bit 3:0 - PLL_CF3:0 - Center Frequency Control Word These bits are reserved for internal use. 134 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 9.12.30 PLL_DCU - Transceiver Delay Cell Calibration Control Register Bit 7 6 5 4 NA ($15B) PLL_DCU_START Res PLL_DCUW5 PLL_DCUW4 Read/Write Initial Value RW 0 R 0 RW 1 RW 0 Bit 3 2 1 0 NA ($15B) PLL_DCUW3 PLL_DCUW2 PLL_DCUW1 PLL_DCUW0 Read/Write Initial Value RW 0 RW 0 RW 0 RW 0 PLL_DCU PLL_DCU This register controls the operation of the calibration loop of the delay cell. * Bit 7 - PLL_DCU_START - Start Delay Cell Calibration PLL_DCU_START = 1 initiates the delay cell calibration. The calibration cycle has finished after at most 6 s. The register bit is cleared immediately after finishing the calibration. * Bit 6 - Res - Reserved Bit This bit is reserved for future use. The result of a read access is undefined. The register bit must always be written with the reset value. * Bit 5:0 - PLL_DCUW5:0 - Delay Range Setting These bits are reserved for internal use. 9.12.31 CC_CTRL_0 - Channel Control Register 0 Bit NA ($153) 7 6 5 4 CC_NUMBER7 CC_NUMBER6 CC_NUMBER5 CC_NUMBER4 RW 0 RW 0 RW 0 RW 0 3 2 1 0 CC_NUMBER3 CC_NUMBER2 CC_NUMBER1 CC_NUMBER0 RW 0 RW 0 RW 0 RW 0 Read/Write Initial Value Bit NA ($153) Read/Write Initial Value CC_CTRL_0 CC_CTRL_0 This register controls the frequency of the transceiver PLL. CC_CTRL_0 and CC_CTRL_1 form a 16 bit register. Changed CC_CTRL_1 bits are updated only when writing to CC_CTRL_0. * Bit 7:0 - CC_NUMBER7:0 - Channel Number These register bits set the channel number 9.12.32 CC_CTRL_1 - Channel Control Register 1 Bit NA ($154) Read/Write Initial Value 7 6 5 4 3 2 1 0 CC_BAND3 CC_BAND2 CC_BAND1 CC_BAND0 CC_CTRL_1 RW 0 RW 0 RW 0 RW 0 135 42073B-MCU Wireless-09/14 This register controls the band of the transceiver PLL. CC_CTRL_0 and CC_CTRL_1 form a 16 bit register. Changed CC_BAND bits are updated only when writing to register CC_CTRL_0. * Bit 3:0 - CC_BAND3:0 - Channel Band These register bits set the channel band 9.12.33 TRX_RPC - Transceiver Reduced Power Consumption Control Bit NA ($156) 7 RX_RPC_CTRL1 RX_RPC_CTRL0 5 4 RX_RPC_EN PDT_RPC_EN RW 1 RW 1 RW 0 RW 0 3 2 1 0 PLL_RPC_EN Res0 IPAN_RPC_EN XAH_RPC_EN RW 0 R 0 RW 0 RW 1 Read/Write Initial Value Bit NA ($156) 6 Read/Write Initial Value TRX_RPC TRX_RPC The TRX_RPC register controls the Reduced Power Consumption / Smart Receiving Modes. * Bit 7:6 - RX_RPC_CTRL1:0 - Smart Receiving Mode Timing The register bits RX_RPC_CTRL[1:0] are used for timing calculation within smart receiving mode. Table 9-69 RX_RPC_CTRL Register Bits Register Bits RX_RPC_CTRL1:0 Value Description 0 Activates minimum power saving behaviour for smart receiving mode 1 Reserved 2 Reserved 3 Activates maximum power saving behaviour for smart receiving mode * Bit 5 - RX_RPC_EN - Receiver Smart Receiving Mode Enable If the bit RX_RPC_EN is set, the receiver is periodically in power-save during all RX states to reduce the current consumption while listening for incoming signals. Note: this feature causes a sensitivity loss of approximately 2 dB. * Bit 4 - PDT_RPC_EN - Smart Receiving Mode Reduced Sensitivity Enable If the bit PDT_RPC_EN is set, the RX sensitivity is reduced and the current consumption is decreased. Note that together with this setting the value of the register RX_PDT_LEVEL should be adapted. * Bit 3 - PLL_RPC_EN - PLL Smart Receiving Mode Enable If bit PLL_RPC_EN is set, the PLL is in power-save during the transceiver states PLL_ON or TX_ARET_ON while no frame transmission has been initiated. * Bit 2 - Res0 - Reserved * Bit 1 - IPAN_RPC_EN - Smart Receiving Mode IPAN Handling Enable 136 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 If the bit IPAN_RPC_EN is set, RPC for IPAN is enabled. This causes a transceiver power-save while receiving a frame with matching PAN but not matching address. Note that an enabled RX override feature will automatically disable the IPAN_RPC_EN function. * Bit 0 - XAH_RPC_EN - Smart Receiving in Extended Operating Modes Enable If the bit XAH_RPC_EN is set, RPC functionality for the Extended Operating Mode is enabled. This reduces the PLL power consumption during the CSMA/CA back-off time, a transmit/receive turnaround in TX_ARET state or an active frame protection (RX_SAFE_MODE). 9.12.34 PART_NUM - Device Identification Register (Part Number) Bit 7 6 5 NA ($15C) Read/Write Initial Value 4 3 2 1 0 PART_NUM7:0 R 1 R 0 R 0 R 1 PART_NUM R 0 R 1 R 0 R 0 This register contains the part number of the device. * Bit 7:0 - PART_NUM7:0 - Part Number These bits decode the part number of the device according to the following table. Table 9-70 PART_NUM Register Bits Register Bits Value Description PART_NUM7:0 0x94 RFR2 family 9.12.35 VERSION_NUM - Device Identification Register (Version Number) Bit 7 6 5 NA ($15D) Read/Write Initial Value 4 3 2 1 0 VERSION_NUM7:0 R 0 R 0 R 0 R 0 R 0 VERSION_NUM R 0 R 1 R 1 This register contains the version number of the device. The device identification overwrites the Reset value. * Bit 7:0 - VERSION_NUM7:0 - Version Number These bits decode the version number of the device according to the following table. Table 9-71 VERSION_NUM Register Bits Register Bits VERSION_NUM7:0 Value Description 12 Revision A 1 Revision B 3 Revision C 4 Revision D 137 42073B-MCU Wireless-09/14 9.12.36 MAN_ID_0 - Device Identification Register (Manufacture ID Low Byte) Bit 7 6 5 NA ($15E) 4 3 2 1 0 MAN_ID_07:00 Read/Write Initial Value R 0 R 0 R 0 R 1 MAN_ID_0 R 1 R 1 R 1 R 1 Bits [7:0] of the 32-bit JEDEC manufacturer ID are stored in this register. Bits [15:8] are stored in register MAN_ID_1. The highest 16 bits of the JEDEC ID are not stored in registers. * Bit 7:0 - MAN_ID_07:00 - Manufacturer ID (Low Byte) These bits contain bits [7:0] of the 32-bit JEDEC manufacturer ID. 9.12.37 MAN_ID_1 - Device Identification Register (Manufacture ID High Byte) Bit 7 6 5 NA ($15F) 4 3 2 1 0 MAN_ID_17:10 Read/Write Initial Value R 0 R 0 R 0 R 0 MAN_ID_1 R 0 R 0 R 0 R 0 Bits [15:8] of the 32-bit JEDEC manufacturer ID are stored in this register. Bits [7:0] are stored in register MAN_ID_0. The highest 16 bits of the JEDEC ID are not stored in registers. * Bit 7:0 - MAN_ID_17:10 - Manufacturer ID (High Byte) These bits contain bits [15:8] of the 32-bit JEDEC manufacturer ID. Table 9-72 MAN_ID_ Register Bits Register Bits Value Description MAN_ID_17:10 0x00 Atmel JEDEC manufacturer ID, bits [15:8] of 32 bit manufacturer ID: 00 00 00 1F 9.12.38 SHORT_ADDR_0 - Transceiver MAC Short Address Register (Low Byte) Bit 7 6 5 NA ($160) Read/Write Initial Value 4 3 2 1 0 SHORT_ADDR_07:00 RW 1 RW 1 RW 1 RW 1 RW 1 SHORT_ADDR_0 RW 1 RW 1 RW 1 This register contains the lower 8 bits of the MAC short address for Frame Filter address recognition. * Bit 7:0 - SHORT_ADDR_07:00 - MAC Short Address These bits contain the bits [7:0] of the MAC short address. 138 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 9.12.39 SHORT_ADDR_1 - Transceiver MAC Short Address Register (High Byte) Bit 7 6 5 NA ($161) Read/Write Initial Value 4 3 2 1 0 SHORT_ADDR_17:10 RW 1 RW 1 RW 1 RW 1 RW 1 SHORT_ADDR_1 RW 1 RW 1 RW 1 This register contains the upper 8 bits of the MAC short address for Frame Filter address recognition. * Bit 7:0 - SHORT_ADDR_17:10 - MAC Short Address These bits contain the bits [15:8] of the MAC short address. 9.12.40 PAN_ID_0 - Transceiver Personal Area Network ID Register (Low Byte) Bit 7 6 5 NA ($162) Read/Write Initial Value 4 3 2 1 0 PAN_ID_07:00 RW 1 RW 1 RW 1 RW 1 RW 1 PAN_ID_0 RW 1 RW 1 RW 1 This register contains the lower 8 bits of the MAC PAN ID for Frame Filter address recognition. * Bit 7:0 - PAN_ID_07:00 - MAC Personal Area Network ID These bits contain the bits [7:0] of the MAC PAN ID. 9.12.41 PAN_ID_1 - Transceiver Personal Area Network ID Register (High Byte) Bit 7 6 5 NA ($163) Read/Write Initial Value 4 3 2 1 0 PAN_ID_17:10 RW 1 RW 1 RW 1 RW 1 RW 1 PAN_ID_1 RW 1 RW 1 RW 1 This register contains the upper 8 bits of the MAC PAN ID for Frame Filter address recognition. * Bit 7:0 - PAN_ID_17:10 - MAC Personal Area Network ID These bits contain the bits [15:8] of the MAC PAN ID. 9.12.42 IEEE_ADDR_0 - Transceiver MAC IEEE Address Register 0 Bit 7 6 5 NA ($164) Read/Write Initial Value 4 3 2 1 0 IEEE_ADDR_07:00 RW 0 RW 0 RW 0 RW 0 RW 0 IEEE_ADDR_0 RW 0 RW 0 RW 0 This register contains the bits [7:0] of the MAC IEEE address for Frame Filter address recognition. 139 42073B-MCU Wireless-09/14 * Bit 7:0 - IEEE_ADDR_07:00 - MAC IEEE Address These bits map to the bits [7:0] of the 64 bit MAC IEEE address. 9.12.43 IEEE_ADDR_1 - Transceiver MAC IEEE Address Register 1 Bit 7 6 5 RW 0 RW 0 RW 0 NA ($165) Read/Write Initial Value 4 3 2 1 0 RW 0 RW 0 RW 0 IEEE_ADDR_17:10 RW 0 RW 0 IEEE_ADDR_1 This register contains the bits [15:8] of the MAC IEEE address for Frame Filter address recognition. * Bit 7:0 - IEEE_ADDR_17:10 - MAC IEEE Address These bits map to the bits [15:8] of the 64 bit MAC IEEE address. 9.12.44 IEEE_ADDR_2 - Transceiver MAC IEEE Address Register 2 Bit 7 6 5 NA ($166) Read/Write Initial Value 4 3 2 1 0 IEEE_ADDR_27:20 RW 0 RW 0 RW 0 RW 0 RW 0 IEEE_ADDR_2 RW 0 RW 0 RW 0 This register contains the bits [23:16] of the MAC IEEE address for Frame Filter address recognition. * Bit 7:0 - IEEE_ADDR_27:20 - MAC IEEE Address These bits map to the bits [23:16] of the 64 bit MAC IEEE address. 9.12.45 IEEE_ADDR_3 - Transceiver MAC IEEE Address Register 3 Bit 7 6 5 NA ($167) Read/Write Initial Value 4 3 2 1 0 IEEE_ADDR_37:30 RW 0 RW 0 RW 0 RW 0 RW 0 IEEE_ADDR_3 RW 0 RW 0 RW 0 This register contains the bits [31:24] of the MAC IEEE address for Frame Filter address recognition. * Bit 7:0 - IEEE_ADDR_37:30 - MAC IEEE Address These bits map to the bits [31:24] of the 64 bit MAC IEEE address. 140 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 9.12.46 IEEE_ADDR_4 - Transceiver MAC IEEE Address Register 4 Bit 7 6 5 NA ($168) Read/Write Initial Value 4 3 2 1 0 IEEE_ADDR_47:40 RW 0 RW 0 RW 0 RW 0 RW 0 IEEE_ADDR_4 RW 0 RW 0 RW 0 This register contains the bits [39:32] of the MAC IEEE address for Frame Filter address recognition. * Bit 7:0 - IEEE_ADDR_47:40 - MAC IEEE Address These bits map to the bits [39:32] of the 64 bit MAC IEEE address. 9.12.47 IEEE_ADDR_5 - Transceiver MAC IEEE Address Register 5 Bit 7 6 5 NA ($169) Read/Write Initial Value 4 3 2 1 0 IEEE_ADDR_57:50 RW 0 RW 0 RW 0 RW 0 RW 0 IEEE_ADDR_5 RW 0 RW 0 RW 0 This register contains the bits [47:40] of the MAC IEEE address for Frame Filter address recognition. * Bit 7:0 - IEEE_ADDR_57:50 - MAC IEEE Address These bits map to the bits [47:40] of the 64 bit MAC IEEE address. 9.12.48 IEEE_ADDR_6 - Transceiver MAC IEEE Address Register 6 Bit 7 6 5 NA ($16A) Read/Write Initial Value 4 3 2 1 0 IEEE_ADDR_67:60 RW 0 RW 0 RW 0 RW 0 RW 0 IEEE_ADDR_6 RW 0 RW 0 RW 0 This register contains the bits [55:48] of the MAC IEEE address for Frame Filter address recognition. * Bit 7:0 - IEEE_ADDR_67:60 - MAC IEEE Address These bits map to the bits [55:48] of the 64 bit MAC IEEE address. 9.12.49 IEEE_ADDR_7 - Transceiver MAC IEEE Address Register 7 Bit 7 6 5 NA ($16B) Read/Write Initial Value 4 3 2 1 0 IEEE_ADDR_77:70 RW 0 RW 0 RW 0 RW 0 RW 0 IEEE_ADDR_7 RW 0 RW 0 RW 0 This register contains the bits [63:56] of the MAC IEEE address for Frame Filter address recognition. 141 42073B-MCU Wireless-09/14 * Bit 7:0 - IEEE_ADDR_77:70 - MAC IEEE Address These bits map to the bits [63:56] of the 64 bit MAC IEEE address. 9.12.50 XAH_CTRL_0 - Transceiver Extended Operating Mode Control Register Bit 7 6 NA ($16C) MAX_FRAME_RETRIES3 MAX_FRAME_RETRIES2 Read/Write Initial Value RW 0 RW 0 5 4 NA ($16C) MAX_FRAME_RETRIES1 MAX_FRAME_RETRIES0 Read/Write Initial Value RW 1 RW 1 3 2 NA ($16C) MAX_CSMA_RETRIES2 MAX_CSMA_RETRIES1 Read/Write Initial Value RW 1 RW 0 1 0 NA ($16C) MAX_CSMA_RETRIES0 SLOTTED_OPERATION Read/Write Initial Value RW 0 RW 0 Bit Bit Bit XAH_CTRL_0 XAH_CTRL_0 XAH_CTRL_0 XAH_CTRL_0 This register is used to control various settings of the Extended Operating Mode. * Bit 7:4 - MAX_FRAME_RETRIES3:0 - Maximum Number of Frame Retransmission Attempts The setting of MAX_FRAME_RETRIES in TX_ARET mode specifies the number of attempts to retransmit a frame when it was not acknowledged by the recipient. The transaction gets canceled if the number of attempts exceeds MAX_FRAME_RETRIES. Table 9-73 MAX_FRAME_RETRIES Register Bits Register Bits MAX_FRAME_RETRIES3:0 Value Description 0x0 Retransmission of frame is not attempted. 0x1 Retransmission of frame is attempted once. 0x2 ... 0xF Retransmission of frame is attempted 15 times. * Bit 3:1 - MAX_CSMA_RETRIES2:0 - Maximum Number of CSMA-CA Procedure Repetition Attempts MAX_CSMA_RETRIES specifies the number of retries in TX_ARET mode to repeat the CSMA-CA procedure before the transaction gets canceled. According to IEEE 802.15.4 the valid range of MAX_CSMA_RETRIES is 0 to 5. A value of MAX_CSMA_RETRIES = 7 initiates an immediate frame transmission without performing CSMA-CA. This may especially be required for slotted acknowledgment operation. MAX_CSMA_RETRIES = 6 is reserved. 142 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Table 9-74 MAX_CSMA_RETRIES Register Bits Register Bits Value MAX_CSMA_RETRIES2:0 Description 0x0 No repetition of CSMA-CA procedure 0x1 One repetition of CSMA-CA procedure 0x2 ... 0x5 Five repetitions (highest IEEE 802.15.4 compliant value) 0x6 Reserved 0x7 Immediate frame re-transmission without performing CSMA-CA * Bit 0 - SLOTTED_OPERATION - Set Slotted Acknowledgment When using RX_AACK mode in networks operating in beacon or slotted mode according to IEEE 802.15.4-2006, chapter 5.5.1 the register bit SLOTTED_OPERATION indicates that acknowledgment frames are to be sent on backoff slot boundaries (slotted acknowledgment). If this register bit is set the acknowledgment frame transmission has to be initiated by the application software using bit SLPTR of register TRXPR. This waiting state is signaled in sub register TRAC_STATUS of register TRX_STATE with value SUCCESS_WAIT_FOR_ACK. Table 9-75 SLOTTED_OPERATION Register Bits Register Bits Value SLOTTED_OPERATION Description 0 The radio transceiver operates in unslotted mode. An acknowledgment frame is automatically sent if requested. 1 The transmission of an acknowledgment frame has to be controlled by the microcontroller. 9.12.51 CSMA_SEED_0 - Transceiver CSMA-CA Random Number Generator Seed Register Bit 7 6 5 NA ($16D) Read/Write Initial Value 4 3 2 1 0 CSMA_SEED_07:00 RW 1 RW 1 RW 1 RW 0 RW 1 CSMA_SEED_0 RW 0 RW 1 RW 0 This register contains the lower 8 bits of the CSMA_SEED. The upper 3 bits are part of register CSMA_SEED_1. CSMA_SEED is the seed for the random number generation that determines the length of the back-off period in the CSMA-CA algorithm. It is recommended to initialize registers CSMA_SEED by random values. This can be done using the bits RND_VALUE of register PHY_RSSI. * Bit 7:0 - CSMA_SEED_07:00 - Seed Value for CSMA Random Number Generator These bits contain the bits [7:0] of the CSMA_SEED. 143 42073B-MCU Wireless-09/14 9.12.52 CSMA_SEED_1 - Transceiver Acknowledgment Frame Control Register 2 Bit 7 6 NA ($16E) AACK_FVN_MODE1 AACK_FVN_MODE0 Read/Write Initial Value RW 0 RW 1 5 4 NA ($16E) AACK_SET_PD AACK_DIS_ACK Read/Write Initial Value RW 0 RW 0 3 2 NA ($16E) AACK_I_AM_COORD CSMA_SEED_12 Read/Write Initial Value RW 0 RW 0 1 0 NA ($16E) CSMA_SEED_11 CSMA_SEED_10 Read/Write Initial Value RW 1 RW 0 Bit Bit Bit CSMA_SEED_1 CSMA_SEED_1 CSMA_SEED_1 CSMA_SEED_1 This register is a control register for RX_AACK and contains a part of the CSMA_SEED for the CSMA-CA algorithm. * Bit 7:6 - AACK_FVN_MODE1:0 - Acknowledgment Frame Filter Mode The frame control field of the MAC header (MHR) contains a frame version subfield. The setting of AACK_FVN_MODE specifies the frame filtering behavior of the radio transceiver. According to the content of these register bits the radio transceiver passes frames with a specific frame version number, number group or independent of the frame version number. Thus the register bits AACK_FVN_MODE define the maximum acceptable frame version. Received frames with a higher frame version number than configured do not pass the address filter and are not acknowledged. Table 9-76 AACK_FVN_MODE Register Bits Register Bits AACK_FVN_MODE1:0 Value Description 0 Acknowledge frames with version number 0 1 Acknowledge frames with version number 0 or 1 2 Acknowledge frames with version number 0 or 1 or 2 3 Acknowledge frames independent of frame version number * Bit 5 - AACK_SET_PD - Set Frame Pending Sub-field The content of AACK_SET_PD bit is copied into the frame pending subfield of the acknowledgment frame if the acknowledgment is the answer to a data request MAC command frame. If in addition the bits AACK_FVN_MODE of this register are configured to accept frames with a frame version other than 0 or 1, the content of register bit AACK_SET_PD is also copied into the frame pending subfield of the acknowledgment frame for any MAC command frame with a frame version of 2 or 3 that have the security enabled subfield set to 1. This is done in the assumption that a future version of the IEEE 802.15.4 standard might change the length or structure of the auxiliary security header, so that it is not possible to safely detect whether the MAC command frame is actually a data request command or not. 144 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 * Bit 4 - AACK_DIS_ACK - Disable Acknowledgment Frame Transmission If this bit is set no acknowledgment frames are transmitted in RX_AACK Extended Operating Mode even if requested. * Bit 3 - AACK_I_AM_COORD - Set Personal Area Network Coordinator This register bit has to be set if the node is a PAN coordinator. It is used for address filtering in RX_AACK. * Bit 2:0 - CSMA_SEED_12:10 - Seed Value for CSMA Random Number Generator These bits contain the bits [10:8] of the CSMA_SEED. The lower part is defined in register CSMA_SEED_0. See register CSMA_SEED_0 for details. 9.12.53 CSMA_BE - Transceiver CSMA-CA Back-off Exponent Control Register Bit 7 6 5 4 NA ($16F) MAX_BE3 MAX_BE2 MAX_BE1 MAX_BE0 Read/Write Initial Value RW 0 RW 1 RW 0 RW 1 3 2 1 0 NA ($16F) MIN_BE3 MIN_BE2 MIN_BE1 MIN_BE0 Read/Write Initial Value RW 0 RW 0 RW 1 RW 1 Bit CSMA_BE CSMA_BE This register controls the back-off exponent for the CSMA-CA procedure. * Bit 7:4 - MAX_BE3:0 - Maximum Back-off Exponent These register bits define the maximum back-off exponent used in the CSMA-CA algorithm to generate a pseudo random number for back off the CCA. For details refer to IEEE 802.15.4-2006, section 7.5.1.4. Valid values are 3 to 8. Table 9-77 MAX_BE Register Bits Register Bits MAX_BE3:0 Value Description 1 This value is not valid for the maximum back-off exponent. 2 This value is not valid for the maximum back-off exponent. 3 Minimum, IEEE compliant value for the maximum back-off exponent. 4 ... 8 Maximum, IEEE compliant value for the maximum back-off exponent. * Bit 3:0 - MIN_BE3:0 - Minimum Back-off Exponent These register bits define the minimum back-off exponent used in the CSMA-CA algorithm to generate a pseudo random number for back off the CCA. For details refer to IEEE 802.15.4-2006, section 7.5.1.4. Valid values are MAX_BE, MAX_BE-1), ..., 0. If MIN_BE = 0 and MAX_BE = 0 the CCA back off period is always set to 0. 145 42073B-MCU Wireless-09/14 Table 9-78 MIN_BE Register Bits Register Bits Value MIN_BE3:0 Description 0 Minimum value of minimum back-off exponent. 1 ... 8 Maximum value of minimum back-off exponent. MIN_BE must be smaller or equal to MAX_BE. 9.12.54 MAFCR0 - Multiple Address Filter Configuration Register 0 Bit 7 6 5 4 NA ($10C) Res3 Res2 Res1 Res0 Read/Write Initial Value R 0 R 0 R 0 R 0 3 2 1 0 MAF3EN MAF2EN MAF1EN MAF0EN RW 0 RW 0 RW 0 MAFCR0 RW 1 With this register, the four independent Address Filter can be enabled or disabled. * Bit 7:4 - Res3:0 - Reserved Bit These bits are reserved for future use. The result of a read access is undefined. The register bits must always be written with the reset value. * Bit 3 - MAF3EN - Multiple Address Filter 3 Enable This bit enables the Multiple Address Filter 3. If the bit is set and the corresponding Short Address and PAN ID Register is configured, an address match is indicated in the IRQ_STATUS1 register and an interrupt occurs if the interrupt enable flag is set in the IRQ_MASK register. * Bit 2 - MAF2EN - Multiple Address Filter 2 Enable This bit enables the Multiple Address Filter 2. If the bit is set and the corresponding Short Address and PAN ID Register is configured, an address match is indicated in the IRQ_STATUS1 register and an interrupt occurs if the interrupt enable flag is set in the IRQ_MASK register. * Bit 1 - MAF1EN - Multiple Address Filter 1 Enable This bit enables the Multiple Address Filter 1. If the bit is set and the corresponding Short Address and PAN ID Register is configured, an address match is indicated in the IRQ_STATUS1 register and an interrupt occurs if the interrupt enable flag is set in the IRQ_MASK register. * Bit 0 - MAF0EN - Multiple Address Filter 0 Enable This bit enables the Multiple Address Filter 0. If the bit is set and the corresponding Short Address and PAN ID Register is configured, an address match is indicated in the IRQ_STATUS1 register and an interrupt occurs if the interrupt enable flag is set in the IRQ_MASK register. 146 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 9.12.55 MAFCR1 - Multiple Address Filter Configuration Register 1 Bit 7 6 NA ($10D) AACK_3_SET_PD AACK_3_I_AM_COORD Read/Write Initial Value RW 0 RW 0 5 4 NA ($10D) AACK_2_SET_PD AACK_2_I_AM_COORD Read/Write Initial Value RW 0 RW 0 3 2 NA ($10D) AACK_1_SET_PD AACK_1_I_AM_COORD Read/Write Initial Value RW 0 RW 0 1 0 NA ($10D) AACK_0_SET_PD AACK_0_I_AM_COORD Read/Write Initial Value RW 0 RW 0 Bit Bit Bit MAFCR1 MAFCR1 MAFCR1 MAFCR1 With this register, the behavior of the four independent Address Filters can be configured. * Bit 7 - AACK_3_SET_PD - Set Data Pending bit for address filter 3. Set the data pending subfield in Frame Control Field (FCF) for automatic frame acknowledge. The content of AACK_SET_PD3 bit is copied into the frame pending subfield of the acknowledgment frame if the ACK is the answer to a data request MAC command frame. * Bit 6 - AACK_3_I_AM_COORD - Enable PAN Coordinator mode for address filter 3. This register bit has to be set if the node is a PAN coordinator for address filter 3. It is used for frame filtering in RX_AACK. If set, the device acts as a PAN coordinator within the filtered network, i.e. it responds to a null address. If the devices handles multiple networks, it can operate as coordinator for one network and as a end node for the other network simultaneously. * Bit 5 - AACK_2_SET_PD - Set Data Pending bit for address filter 2. Set the data pending subfield in Frame Control Field (FCF) for automatic frame acknowledge. The content of AACK_SET_PD2 bit is copied into the frame pending subfield of the acknowledgment frame if the ACK is the answer to a data request MAC command frame. * Bit 4 - AACK_2_I_AM_COORD - Enable PAN Coordinator mode for address filter 2. This register bit has to be set if the node is a PAN coordinator for address filter 2. It is used for frame filtering in RX_AACK. If set, the device acts as a PAN coordinator within the filtered network, i.e. it responds to a null address. If the devices handles multiple networks, it can operate as coordinator for one network and as a end node for the other network simultaneously. * Bit 3 - AACK_1_SET_PD - Set Data Pending bit for address filter 1. Set the data pending subfield in Frame Control Field (FCF) for automatic frame acknowledge. The content of AACK_SET_PD1 bit is copied into the frame pending 147 42073B-MCU Wireless-09/14 subfield of the acknowledgment frame if the ACK is the answer to a data request MAC command frame. * Bit 2 - AACK_1_I_AM_COORD - Enable PAN Coordinator mode for address filter 1. This register bit has to be set if the node is a PAN coordinator for address filter 1. It is used for frame filtering in RX_AACK. If set, the device acts as a PAN coordinator within the filtered network, i.e. it responds to a null address. If the devices handles multiple networks, it can operate as coordinator for one network and as a end node for the other network simultaneously. * Bit 1 - AACK_0_SET_PD - Set Data Pending bit for address filter 0. Set the data pending subfield in Frame Control Field (FCF) for automatic frame acknowledge. The content of AACK_SET_PD0 bit is copied into the frame pending subfield of the acknowledgment frame if the ACK is the answer to a data request MAC command frame. * Bit 0 - AACK_0_I_AM_COORD - Enable PAN Coordinator mode for address filter 0. This register bit has to be set if the node is a PAN coordinator for address filter 0. It is used for frame filtering in RX_AACK. If set, the device acts as a PAN coordinator within the filtered network, i.e. it responds to a null address. If the devices handles multiple networks, it can operate as coordinator for one network and as a end node for the other network simultaneously. 9.12.56 MAFPA0H - Transceiver Personal Area Network ID Register for Frame Filter 0 (High Byte) Bit 7 6 5 4 RW 1 RW 1 RW 1 RW 1 NA ($111) Read/Write Initial Value 3 2 1 0 RW 1 RW 1 RW 1 MAFPA0H7:0 RW 1 MAFPA0H This register contains the upper 8 bits of the MAC PAN ID for Frame Filter 0 address recognition. * Bit 7:0 - MAFPA0H7:0 - MAC Personal Area Network ID high Byte for Frame Filter 0 These bits contain the bits [15:8] of the MAC PAN ID for Frame Filter 0. 9.12.57 MAFPA0L - Transceiver Personal Area Network ID Register for Frame Filter 0 (Low Byte) Bit 7 6 5 NA ($110) Read/Write Initial Value 4 3 2 1 0 MAFPA0L7:0 RW 1 RW 1 RW 1 RW 1 RW 1 MAFPA0L RW 1 RW 1 RW 1 This register contains the lower 8 bits of the MAC PAN ID for Frame Filter 0 address recognition. * Bit 7:0 - MAFPA0L7:0 - MAC Personal Area Network ID low Byte for Frame Filter 0 148 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 These bits contain the bits [7:0] of the MAC PAN ID for Frame Filter 0. 9.12.58 MAFPA1H - Transceiver Personal Area Network ID Register for Frame Filter 1 (High Byte) Bit 7 6 5 4 RW 1 RW 1 RW 1 RW 1 NA ($115) Read/Write Initial Value 3 2 1 0 RW 1 RW 1 RW 1 MAFPA1H7:0 RW 1 MAFPA1H This register contains the upper 8 bits of the MAC PAN ID for Frame Filter 1 address recognition. * Bit 7:0 - MAFPA1H7:0 - MAC Personal Area Network ID high Byte for Frame Filter 1 These bits contain the bits [15:8] of the MAC PAN ID for Frame Filter 1. 9.12.59 MAFPA1L - Transceiver Personal Area Network ID Register for Frame Filter 1 (Low Byte) Bit 7 6 5 4 RW 1 RW 1 RW 1 RW 1 NA ($114) Read/Write Initial Value 3 2 1 0 RW 1 RW 1 RW 1 MAFPA1L7:0 RW 1 MAFPA1L This register contains the lower 8 bits of the MAC PAN ID for Frame Filter 1 address recognition. * Bit 7:0 - MAFPA1L7:0 - MAC Personal Area Network ID low Byte for Frame Filter 1 These bits contain the bits [7:0] of the MAC PAN ID for Frame Filter 1. 9.12.60 MAFPA2H - Transceiver Personal Area Network ID Register for Frame Filter 2 (High Byte) Bit 7 6 5 4 RW 1 RW 1 RW 1 RW 1 NA ($119) Read/Write Initial Value 3 2 1 0 RW 1 RW 1 RW 1 MAFPA2H7:0 RW 1 MAFPA2H This register contains the upper 8 bits of the MAC PAN ID for Frame Filter 2 address recognition. * Bit 7:0 - MAFPA2H7:0 - MAC Personal Area Network ID high Byte for Frame Filter 2 These bits contain the bits [15:8] of the MAC PAN ID for Frame Filter 2. 149 42073B-MCU Wireless-09/14 9.12.61 MAFPA2L - Transceiver Personal Area Network ID Register for Frame Filter 2 (Low Byte) Bit 7 6 5 NA ($118) Read/Write Initial Value 4 3 2 1 0 MAFPA2L7:0 RW 1 RW 1 RW 1 RW 1 RW 1 MAFPA2L RW 1 RW 1 RW 1 This register contains the lower 8 bits of the MAC PAN ID for Frame Filter 2 address recognition. * Bit 7:0 - MAFPA2L7:0 - MAC Personal Area Network ID low Byte for Frame Filter 2 These bits contain the bits [7:0] of the MAC PAN ID for Frame Filter 2. 9.12.62 MAFPA3H - Transceiver Personal Area Network ID Register for Frame Filter 3 (High Byte) Bit 7 6 5 NA ($11D) Read/Write Initial Value 4 3 2 1 0 MAFPA3H7:0 RW 1 RW 1 RW 1 RW 1 RW 1 MAFPA3H RW 1 RW 1 RW 1 This register contains the upper 8 bits of the MAC PAN ID for Frame Filter 3 address recognition. * Bit 7:0 - MAFPA3H7:0 - MAC Personal Area Network ID high Byte for Frame Filter 3 These bits contain the bits [15:8] of the MAC PAN ID for Frame Filter 3. 9.12.63 MAFPA3L - Transceiver Personal Area Network ID Register for Frame Filter 3 (Low Byte) Bit 7 6 5 NA ($11C) Read/Write Initial Value 4 3 2 1 0 MAFPA3L7:0 RW 1 RW 1 RW 1 RW 1 RW 1 MAFPA3L RW 1 RW 1 RW 1 This register contains the lower 8 bits of the MAC PAN ID for Frame Filter 3 address recognition. * Bit 7:0 - MAFPA3L7:0 - MAC Personal Area Network ID low Byte for Frame Filter 3 These bits contain the bits [7:0] of the MAC PAN ID for Frame Filter 3. 9.12.64 MAFSA0H - Transceiver MAC Short Address Register for Frame Filter 0 (High Byte) Bit 7 6 5 NA ($10F) Read/Write Initial Value 150 4 3 2 1 0 MAFSA0H7:0 RW 1 RW 1 RW 1 RW 1 RW 1 MAFSA0H RW 1 RW 1 RW 1 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 This register contains the upper 8 bits of the MAC short address for Frame Filter 0 address recognition. * Bit 7:0 - MAFSA0H7:0 - MAC Short Address high Byte for Frame Filter 0 These bits contain the bits [15:8] of the MAC short address for Frame Filter 0. 9.12.65 MAFSA0L - Transceiver MAC Short Address Register for Frame Filter 0 (Low Byte) Bit 7 6 5 4 RW 1 RW 1 RW 1 RW 1 NA ($10E) Read/Write Initial Value 3 2 1 0 RW 1 RW 1 RW 1 MAFSA0L7:0 RW 1 MAFSA0L This register contains the lower 8 bits of the MAC short address for Frame Filter 0 address recognition. * Bit 7:0 - MAFSA0L7:0 - MAC Short Address low Byte for Frame Filter 0 These bits contain the bits [7:0] of the MAC short address for Frame Filter 0. 9.12.66 MAFSA1H - Transceiver MAC Short Address Register for Frame Filter 1 (High Byte) Bit 7 6 5 NA ($113) Read/Write Initial Value 4 3 2 1 0 MAFSA1H7:0 RW 1 RW 1 RW 1 RW 1 RW 1 MAFSA1H RW 1 RW 1 RW 1 This register contains the upper 8 bits of the MAC short address for Frame Filter 1 address recognition. * Bit 7:0 - MAFSA1H7:0 - MAC Short Address high Byte for Frame Filter 1 These bits contain the bits [15:8] of the MAC short address for Frame Filter 1. 9.12.67 MAFSA1L - Transceiver MAC Short Address Register for Frame Filter 1 (Low Byte) Bit 7 6 5 NA ($112) Read/Write Initial Value 4 3 2 1 0 MAFSA1L7:0 RW 1 RW 1 RW 1 RW 1 RW 1 MAFSA1L RW 1 RW 1 RW 1 This register contains the lower 8 bits of the MAC short address for Frame Filter 1 address recognition. * Bit 7:0 - MAFSA1L7:0 - MAC Short Address low Byte for Frame Filter 1 These bits contain the bits [7:0] of the MAC short address for Frame Filter 1. 151 42073B-MCU Wireless-09/14 9.12.68 MAFSA2H - Transceiver MAC Short Address Register for Frame Filter 2 (High Byte) Bit 7 6 5 NA ($117) Read/Write Initial Value 4 3 2 1 0 MAFSA2H7:0 RW 1 RW 1 RW 1 RW 1 RW 1 MAFSA2H RW 1 RW 1 RW 1 This register contains the upper 8 bits of the MAC short address for Frame Filter 2 address recognition. * Bit 7:0 - MAFSA2H7:0 - MAC Short Address high Byte for Frame Filter 2 These bits contain the bits [15:8] of the MAC short address for Frame Filter 2. 9.12.69 MAFSA2L - Transceiver MAC Short Address Register for Frame Filter 2 (Low Byte) Bit 7 6 5 NA ($116) Read/Write Initial Value 4 3 2 1 0 MAFSA2L7:0 RW 1 RW 1 RW 1 RW 1 RW 1 MAFSA2L RW 1 RW 1 RW 1 This register contains the lower 8 bits of the MAC short address for Frame Filter 2 address recognition. * Bit 7:0 - MAFSA2L7:0 - MAC Short Address low Byte for Frame Filter 2 These bits contain the bits [7:0] of the MAC short address for Frame Filter 2. 9.12.70 MAFSA3H - Transceiver MAC Short Address Register for Frame Filter 3 (High Byte) Bit 7 6 5 NA ($11B) Read/Write Initial Value 4 3 2 1 0 MAFSA3H7:0 RW 1 RW 1 RW 1 RW 1 RW 1 MAFSA3H RW 1 RW 1 RW 1 This register contains the upper 8 bits of the MAC short address for Frame Filter 3 address recognition. * Bit 7:0 - MAFSA3H7:0 - MAC Short Address high Byte for Frame Filter 3 These bits contain the bits [15:8] of the MAC short address for Frame Filter 3. 9.12.71 MAFSA3L - Transceiver MAC Short Address Register for Frame Filter 3 (Low Byte) Bit 7 6 5 NA ($11A) Read/Write Initial Value 4 3 2 1 0 MAFSA3L7:0 RW 1 RW 1 RW 1 RW 1 RW 1 MAFSA3L RW 1 RW 1 RW 1 This register contains the lower 8 bits of the MAC short address for Frame Filter 3 address recognition. 152 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 * Bit 7:0 - MAFSA3L7:0 - MAC Short Address low Byte for Frame Filter 3 These bits contain the bits [7:0] of the MAC short address for Frame Filter 3. 9.12.72 TST_CTRL_DIGI - Transceiver Digital Test Control Register Bit NA ($176) Read/Write Initial Value Bit NA ($176) Read/Write Initial Value Bit NA ($176) Read/Write Initial Value Bit NA ($176) Read/Write Initial Value 7 6 TST_CTRL_DIG_7 TST_CTRL_DIG_6 RW 0 RW 0 5 4 TST_CTRL_DIG_5 TST_CTRL_DIG_4 RW 0 RW 0 3 2 TST_CTRL_DIG3 TST_CTRL_DIG2 RW 0 RW 0 1 0 TST_CTRL_DIG1 TST_CTRL_DIG0 RW 0 RW 0 TST_CTRL_DIGI TST_CTRL_DIGI TST_CTRL_DIGI TST_CTRL_DIGI This register takes part in the activation sequence of the continuous transmission test mode. Other functionality of this register is reserved for internal use. * Bit 7 - TST_CTRL_DIG_7 - Disable Receiver Baseband Frequency Synthesis This bit is reserved for internal use. It is used to switch the frequency synthesis of the receiver baseband path. A value of 0 switches the synthesis on. A value of 1 switches the synthesis off. * Bit 6 - TST_CTRL_DIG_6 - Disable Receiver Baseband Drift Compensation This bit is reserved for internal use. It is used to switch the drift compensation of the receiver baseband path. A value of 0 switches the compensation on. A value of 1 switches the compensation off. * Bit 5 - TST_CTRL_DIG_5 - Enable Switch of Transceiver FIFO This bit is reserved for internal use. It is used enable a bypass for TX/RX FIFO buffers. A frame transmit will be write the TX FIFO data directly into the RX FIFO data field with the same address. This test can be used for the RX/TX FIFO test. A value of 0 disables the bypass. A value of 1 enables the bypass. * Bit 4 - TST_CTRL_DIG_4 - Switch Receiver Input Data This bit is reserved for internal use. It is used to switch the input source from the receiver. A value of 0 selects the default RX ADC path. A value of 1 selects the DIG1 pin as a receive data source. * Bit 3:0 - TST_CTRL_DIG3:0 - Digital Test Controller Register This sub-register selects a test controller function. All values not listed int the following table are reserved for internal use. 153 42073B-MCU Wireless-09/14 Table 9-79 TST_CTRL_DIG Register Bits Register Bits Value TST_CTRL_DIG3:0 Description 0 NORMAL (no test is active) 15 TST_CONT_TX (continuous transmit) 9.12.73 TST_RX_LENGTH - Transceiver Received Frame Length Register Bit 7 6 5 4 NA ($17B) RX_LENGTH7 RX_LENGTH6 RX_LENGTH5 RX_LENGTH4 Read/Write Initial Value R 0 R 0 R 0 R 0 Bit 3 2 1 0 NA ($17B) RX_LENGTH3 RX_LENGTH2 RX_LENGTH1 RX_LENGTH0 Read/Write Initial Value R 0 R 0 R 0 R 0 TST_RX_LENGTH TST_RX_LENGTH This register contains the frame length information of a received frame. This information is not stored in the frame buffer. The frame length information is written to this register after the last received octet. * Bit 7:0 - RX_LENGTH7:0 - Received Frame Length These bits contain the length of the last received frame. 9.12.74 TRXFBST - Start of frame buffer Bit 7 6 5 NA ($180) Read/Write Initial Value 4 3 2 1 0 TRXFBST7:0 RW 0 RW 0 RW 0 RW 0 RW 0 TRXFBST RW 0 RW 0 RW 0 This register is the first byte of the 128 byte long frame buffer of the radio transceiver. * Bit 7:0 - TRXFBST7:0 - Frame Buffer Start Byte 9.12.75 TRXFBEND - End of frame buffer Bit 7 6 5 RW 0 RW 0 RW 0 NA ($1FF) Read/Write Initial Value 4 3 2 1 0 RW 0 RW 0 RW 0 TRXFBEND7:0 RW 0 RW 0 TRXFBEND This register is the last byte of the 128 byte long frame buffer of the radio transceiver. * Bit 7:0 - TRXFBEND7:0 - Frame Buffer End Byte 154 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 10 MAC Symbol Counter 32kHz RTC 16MHz xtal Figure 10-1. Symbol Counter Overview clock prescaler configuration register clock select 320s backoff slot counter AVR I/O Bus 32Bit Symbol Counter compare unit 1 SFD timestamp Beacon timestamp interrupt generation compare unit 2 compare unit 3 10.1 Main Features The MAC symbol counter provides symbol timing information for IEEE 802.15.4 wireless networks. The counter time base can be derived from the 16 MHz crystal or the RTC (32.768 kHz crystal on TOSC) during operation. In deep-sleep mode the counter operates from the RTC clock. The module provides the following features: * Backoff slot counter with interrupt generation * Counter clock source selection between XTAL1 (16 MHz) and TOSC1 (RTC) * Automatic RTC clock selection for sleep mode operation and automatic fallback * 3 independent compare units with relative and absolute compare mode and interrupt generation (support for slotted operation and superframe handling) * Low-power, deep-sleep mode operation and system wake up with all symbol counter interrupt events * Automatic SFD and incoming beacon timestamping * Manual beacon timestamping * Manual timer synchronization within a 16 s symbol period by resetting clock prescaler and backoff slot counter * Atomic read/write access for 32 bit registers 10.2 Clock source selection and Sleep/Active mode operation The symbol counter can be sourced by the transceiver clock or by the asynchronous Real Time Clock (RTC) oscillator. If the transceiver goes from active mode into sleep mode, the symbol counter clock source is switched to the RTC clock automatically. A 155 42073B-MCU Wireless-09/14 clock source change is indicated in the bit SCCKSEL of Register "SCCR0 - Symbol Counter Control Register 0" on page 169 . The bit SCCKSEL can not be written if the radio transceiver is in SLEEP mode. After wake up, the counter switches back to the clock source which was selected before going to sleep mode. Switching the clock source from RTC to 16 MHz resets the 16 MHz clock prescaler. This makes sure, that after switching back the clock source, the symbol counter starts counting with a full 16 s symbol period. The clock source can be selected with bit SCCKSEL in the SCCR0 Register Note: The AVR system clock has to be at least 4 times the symbol counter clock frequency. The symbol counter clock frequency is usually 62.5kHz, which would require a minimum of 250kHz AVR system clock frequency. 10.3 32 bit Register Access (Atomic Read/Write) All 32 bit registers support atomic read or write operation. That means reading or writing the least significant xxxLL byte (the register name ends in LL) updates or captures the complete 32 bit value. Read Access: 1. Reading the LL-Byte captures the 32 bit value in a temporary register 2. Read the upper 3 bytes Write Access: 1. Write the upper 3 byte 2. Writing the LL-Byte stores the 32 bit value in the counter registers The same temporary register is used for all 32 bit register of the MAC symbol counter. 10.4 Symbol Counter (32 bit, SCCNT) The symbol counter is a 32 bit counter which can be sourced by a 62.5 kHz clock, derived from the 16 MHz system clock or from the RTC (32.768 kHz). If sourced by the RTC, a special control circuitry ensures that the counter error does not exceed one symbol period. The symbol counter can be set or read from the controller. Reading must start with the least significant byte. If the least significant byte is accessed, all 32 bit of the counter are captured. A read access to SCCNTLL requires a maximum of three AVR clocks. Reading the upper three bytes of the counter requires two CPU clock cycles for each byte. Writing to the counter should start with the most significant byte. Writing the least significant byte initiates the counter update and the new 32 bit counter value is loaded into the counter with the next available counter clock edge. This can take up to 16 s beginning from the low byte write operation, if the counter is sourced by the RTC. If the counter clock is derived from the 16 MHz clock system, the new counter value is stored immediately. During the counter update cycle, the counter busy flag SCBSY in the SCSR register is set to "1". As long as this bit is "1", no further read/write access to the counter should be initiated. The same applies if the AVR is forced to any sleep mode with disabled AVR clock, right after writing to the SCCNT register. If the counter busy flag is not checked before going to sleep, it is possible that the counter register is not updated correctly. The symbol counter overflow is indicated by a overflow interrupt. The interrupt is generated when the counter turns from 0xFFFFFFFF to 0x00000000. 10.5 Symbol Counter SFD Timestamp Register (32 bit, SCTSR, Read Only) The SFD timestamp register stores the symbol counter value at the time, the SFD has been detected. The Register value becomes valid if a valid frame length byte (frame 156 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 length > 0) has been detected, but it is not checked if the received frame is valid (CRC check). Timestamping must be enabled in the control register (Bit SCTSE of Register SCCR0). A read access to SCTSRLL requires a maximum of three AVR clocks. Reading the upper three bytes of the timestamp requires two CPU clock cycles for each byte. Note that there is no separate interrupt provided for timestamping. Instead the TRX24_RX_START interrupt can be used (see "Interrupt Vectors in ATmega2564/1284/644RFR2" on page 241). 10.6 Symbol Counter Beacon Timestamp Register (32 bit, SCBTSR) If timestamping is enabled in the SCCR register, the beacon timestamp register is updated with the SFD timestamp at the end of the received frame, if the received frame was a beacon frame with valid FCS and: * Source PAN identifier == {PAN_ID_1, PAN_ID_0} * {PAN_ID_1, PAN_ID_0} == 0xFFFF or PAN_ID_0 and PAN_ID_1 are register of the radio transceiver, see "PAN_ID_0 - Transceiver Personal Area Network ID Register (Low Byte)" on page 139. Beacon timestamps can also be generated manually. Writing "1" to SCMBTS of Register SCCR0 captures the current symbol counter value and stores it in the beacon timestamp register. The bit is cleared automatically afterwards. It is also possible to manually set the register in order to provide a distinct starting value for the relative compare modes (see next section). 10.7 Compare Unit (3x 32 bit, SCOCR1, SCOCR2, SCOCR3) The compare unit contains 3 independent 32 bit compare modules and is used to compare the current counter value with the value stored in the compare register, and optionally the beacon timestamp register. There are two possible modes available which can be selected separately for all three compare modules: 1. Absolute Compare: In this mode the value stored in the compare register is compared directly with the symbol counter value (SCCNT == SCOCRx). If the values are equal an interrupt is generated. 2. Relative Compare: This mode allows the compare between the current symbol counter value and the compare value plus the beacon timestamp value (SCCNT == SCBTSR + SCOCRx). This mode can be used to generate an interrupt at a time offset relative to the value stored in the beacon timestamp register. Note that a beacon timestamp is valid after a valid FCS. The relative compare must exceed the beacon length, otherwise no relative compare interrupt will occur. 10.8 Interrupt Control Registers The interrupt status and mask registers control the interrupt generation. Each interrupt can be enabled in SCIRQM (Symbol Counter IRQ Mask Register). If an interrupt occurs, the appropriate interrupt flag within the interrupt status register is set regardless of the interrupt mask register setting. If the appropriate interrupt is enabled, an interrupt is generated. The interrupt flags can be cleared either by: 1. Entering the respective interrupt handler, or 2. Writing "one" to the according interrupt flag in the interrupt status register. 157 42073B-MCU Wireless-09/14 All Interrupts can be used to wakeup the controller from any sleep state. 10.9 Backoff Slot Counter The backoff slot counter can be used to provide accurate MAC protocol timing. The counter is sourced by the transceiver clock and works only if the transceiver clock is running. If the transceiver is disabled or in sleep mode the counter is also disabled. The counter generates periodic Interrupts every 20 symbols, i.e. every 320 s. 10.10 Symbol Counter Usage 10.10.1 SFD and Beacon Timestamp Generation The SFD timestamp register is updated with the symbol counter value at the time the SFD value has been received completely. For an incoming frame, the register is valid after the RX_START IRQ was issued until the next RX_START IRQ. SFD timestamps are generated for all incoming frames with valid SFD and length field even if the PSDU is corrupted (invalid FCS). Figure 10-2. SFD and Beacon Timestamp Generation Note that Figure 10-2 contains no exact timing information; it is for visualization only. The beacon timestamp register is updated with the SFD timestamp value at the end of the frame (RX_END IRQ), if the received frame was a beacon frame with valid FCS and expected source PAN identifier or { PAN_ID_1, PAN_ID_0} = 0xFFFF. The register value is valid until a new beacon frame has been received or the beacon timestamp is updated manually. A manual beacon timestamp can be generated by writing "1" to SCMBTS of the SCCR0 register. 10.10.2 Relative Compare Mode for Superframe Access Timing The IEEE 802.15.4 describes a superframe structure which contains different time slots where a device can access the channel. 158 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 The Symbol Counter together with the three compare units provide support for waking up the device at the right time to receive the beacon for superframe synchronization and at certain times within the superframe. A typical superframe timing scenario using the symbol counter relative compare mode is shown in Figure 10-3 below. The Symbol Counter values in the figure do not reflect realistic time intervals but demonstrate the principle of operation. Beacon Activation 635 636 637 638 640 641 480 481 482 483 484 485 402 403 404 405 406 407 Beacon 323 324 325 326 327 328 329 Activation Figure 10-3. Relative Compare Mode The compare match registers are programmed with symbol intervals relative to the beacon frame SFD timestamp. For instance the SCCMP1 is programmed to 80, because the first Granted Time Slot (GTS1) is expected 80 symbols after the beacon frame. Register SCCMP2 is programmed to 156 to meet GTS3 156 symbols after the beacon frame. SCCMP3 is programmed to 312. This is the time interval where the beacon of the next superframe is expected. Because it requires some time to activate the transceiver and there is also some timing drift possible, the compare interrupt must be programmed to wake up some symbols in advance to make sure the next beacon is not missed. If the controller receives a compare match wake up event it is activating the transceiver. After the frame operations are finished, the system can go back to sleep until the next compare match event occurs. 10.11 Register Description 10.11.1 SCCSR - Symbol Counter Compare Source Register Bit NA ($DB) Read/Write Initial Value 7 6 Res1 Res0 R 0 R 0 5 4 3 2 1 0 SCCS31 SCCS30 SCCS21 SCCS20 SCCS11 SCCS10 RW 0 RW 0 RW 0 RW 0 RW 0 SCCSR RW 0 159 42073B-MCU Wireless-09/14 The Register describes the source timestamp register used for the relative compare mode. The time stamp source can be selected separately for each compare unit. Possible sources for the relative compare are the Transmit Timestamp, the Receive Timestamp or the Beacon Timestamp (default). * Bit 7:6 - Res1:0 - Reserved Bit This bit is reserved for future use. The result of a read access is undefined. The register bit must always be written with the reset value. * Bit 5:4 - SCCS31:30 - Symbol Counter Compare Source select register for Compare Unit 3 This configuration bits allow the selection of the source timestamp used for the relative compare mode. The default selection is the Beacon Timestamp Register, but the Transmit Frame Timestamp or the Receive Frame Timestamp register can also be selected. Table 10-80 SCCS3 Register Bits Register Bits SCCS31:30 Value Description 0 Compare Unit 3 Relative Compare Source = Beacon Timestamp Register 1 Compare Unit 3 Relative Compare Source = Transmit Frame Timestamp Register 2 Compare Unit 3 Relative Compare Source = Received Frame Timestamp Register * Bit 3:2 - SCCS21:20 - Symbol Counter Compare Source select register for Compare Unit 2 This configuration bits allow the selection of the source timestamp used for the relative compare mode. The default selection is the Beacon Timestamp Register, but the Transmit Frame Timestamp or the Receive Frame Timestamp register can also be selected. Table 10-81 SCCS2 Register Bits Register Bits SCCS21:20 Value Description 0 Compare Unit 2 Relative Compare Source = Beacon Timestamp Register 1 Compare Unit 2 Relative Compare Source = Transmit Frame Timestamp Register 2 Compare Unit 2 Relative Compare Source = Received Frame Timestamp Register * Bit 1:0 - SCCS11:10 - Symbol Counter Compare Source select register for Compare Unit 1 This configuration bits allow the selection of the source timestamp used for the relative compare mode. The default selection is the Beacon Timestamp Register, but the Transmit Frame Timestamp or the Receive Frame Timestamp register can also be selected. Table 10-82 SCCS1 Register Bits Register Bits SCCS11:10 160 Value Description 0 Compare Unit 1 Relative Compare Source = Beacon Timestamp Register 1 Compare Unit 1 Relative Compare Source = Transmit Frame Timestamp Register ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Register Bits Value Description 2 Compare Unit 1 Relative Compare Source = Received Frame Timestamp Register 10.11.2 SCCNTHH - Symbol Counter Register HH-Byte Bit 7 6 5 NA ($E4) Read/Write Initial Value 4 3 2 1 0 SCCNTHH7:0 RW 0 RW 0 RW 0 RW 0 RW 0 SCCNTHH RW 0 RW 0 RW 0 This register contains the most significant byte of the 32 bit Symbol Counter. * Bit 7:0 - SCCNTHH7:0 - Symbol Counter Register HH-Byte 10.11.3 SCCNTHL - Symbol Counter Register HL-Byte Bit 7 6 5 4 RW 0 RW 0 RW 0 RW 0 NA ($E3) Read/Write Initial Value 3 2 1 0 RW 0 RW 0 RW 0 SCCNTHL7:0 RW 0 SCCNTHL This register contains the second most significant byte of the 32 bit Symbol Counter. * Bit 7:0 - SCCNTHL7:0 - Symbol Counter Register HL-Byte 10.11.4 SCCNTLH - Symbol Counter Register LH-Byte Bit 7 6 5 NA ($E2) Read/Write Initial Value 4 3 2 1 0 SCCNTLH7:0 RW 0 RW 0 RW 0 RW 0 RW 0 SCCNTLH RW 0 RW 0 RW 0 This register contains the second least significant byte of the 32 bit Symbol Counter. * Bit 7:0 - SCCNTLH7:0 - Symbol Counter Register LH-Byte 10.11.5 SCCNTLL - Symbol Counter Register LL-Byte Bit 7 6 5 4 RW 0 RW 0 RW 0 RW 0 NA ($E1) Read/Write Initial Value 3 2 1 0 RW 0 RW 0 RW 0 SCCNTLL7:0 RW 0 SCCNTLL This register contains the least significant byte of the 32 bit Symbol Counter. * Bit 7:0 - SCCNTLL7:0 - Symbol Counter Register LL-Byte 161 42073B-MCU Wireless-09/14 10.11.6 SCTSRHH - Symbol Counter Frame Timestamp Register HH-Byte Bit 7 6 5 NA ($EC) Read/Write Initial Value 4 3 2 1 0 SCTSRHH7:0 R 0 R 0 R 0 R 0 R 0 SCTSRHH R 0 R 0 R 0 This register contains the most significant byte of the 32 bit frame (SFD) timestamp register * Bit 7:0 - SCTSRHH7:0 - Symbol Counter Frame Timestamp Register HH-Byte 10.11.7 SCTSRHL - Symbol Counter Frame Timestamp Register HL-Byte Bit 7 6 5 R 0 R 0 R 0 NA ($EB) Read/Write Initial Value 4 3 2 1 0 R 0 R 0 R 0 SCTSRHL7:0 R 0 R 0 SCTSRHL This register contains the second most significant byte of the 32 bit Frame (SFD) Timestamp Register * Bit 7:0 - SCTSRHL7:0 - Symbol Counter Frame Timestamp Register HL-Byte 10.11.8 SCTSRLH - Symbol Counter Frame Timestamp Register LH-Byte Bit 7 6 5 NA ($EA) Read/Write Initial Value 4 3 2 1 0 SCTSRLH7:0 R 0 R 0 R 0 R 0 R 0 SCTSRLH R 0 R 0 R 0 This register contains the second least significant byte of the 32 bit Frame (SFD) Timestamp Register * Bit 7:0 - SCTSRLH7:0 - Symbol Counter Frame Timestamp Register LH-Byte 10.11.9 SCTSRLL - Symbol Counter Frame Timestamp Register LL-Byte Bit 7 6 5 R 0 R 0 R 0 NA ($E9) Read/Write Initial Value 4 3 2 1 0 R 0 R 0 R 0 SCTSRLL7:0 R 0 R 0 SCTSRLL This register contains the least significant byte of the 32 bit Frame (SFD) Timestamp Register * Bit 7:0 - SCTSRLL7:0 - Symbol Counter Frame Timestamp Register LL-Byte 162 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 10.11.10 SCTSTRHH - Symbol Counter Transmit Frame Timestamp Register HH-Byte Bit 7 6 5 NA ($FC) Read/Write Initial Value 4 3 2 1 0 SCTSTRHH7:0 R 0 R 0 R 0 R 0 R 0 SCTSTRHH R 0 R 0 R 0 This register contains the most significant byte of the 32 bit Transmit Frame Timestamp Register. The Transmit Frame Timestamp Register is updated one symbol before the beginning of the frame transmission (preamble transmission). To allign the Transmit Frame Timestamp with a Received Frame Timestamp (SFD Timestamp),a fixed offset of 11 symbols (1 Symbol Startup + 8 Symbols Preamble + 2 Symbols SFD) need to be added to the Transmit Timestamp . * Bit 7:0 - SCTSTRHH7:0 - Symbol Counter Transmit Frame Timestamp Register HH-Byte 10.11.11 SCTSTRHL - Symbol Counter Transmit Frame Timestamp Register HL-Byte Bit 7 6 5 R 0 R 0 R 0 NA ($FB) Read/Write Initial Value 4 3 2 1 0 R 0 R 0 R 0 SCTSTRHL7:0 R 0 R 0 SCTSTRHL This register contains the second most significant byte of the 32 bit Transmit Frame Timestamp Register. * Bit 7:0 - SCTSTRHL7:0 - Symbol Counter Transmit Frame Timestamp Register HL-Byte 10.11.12 SCTSTRLH - Symbol Counter Transmit Frame Timestamp Register LH-Byte Bit 7 6 5 NA ($FA) Read/Write Initial Value 4 3 2 1 0 SCTSTRLH7:0 R 0 R 0 R 0 R 0 R 0 SCTSTRLH R 0 R 0 R 0 This register contains the second least significant byte of the 32 bit Transmit Frame Timestamp Register. * Bit 7:0 - SCTSTRLH7:0 - Symbol Counter Transmit Frame Timestamp Register LH-Byte 10.11.13 SCTSTRLL - Symbol Counter Transmit Frame Timestamp Register LL-Byte Bit 7 6 5 R 0 R 0 R 0 NA ($F9) Read/Write Initial Value 4 3 2 1 0 R 0 R 0 R 0 SCTSTRLL7:0 R 0 R 0 SCTSTRLL 163 42073B-MCU Wireless-09/14 This register contains the least significant byte of the 32 bit Transmit Frame Timestamp Register. * Bit 7:0 - SCTSTRLL7:0 - Symbol Counter Transmit Frame Timestamp Register LL-Byte 10.11.14 SCRSTRHH - Symbol Counter Received Frame Timestamp Register HH-Byte Bit 7 6 5 R 0 R 0 R 0 NA ($DA) Read/Write Initial Value 4 3 2 1 0 R 0 R 0 R 0 SCRSTRHH7:0 R 0 R 0 SCRSTRHH This register contains the most significant byte of the 32 bit Received Frame Timestamp Register. The Received Frame Timestamp Register is updated at the end of the frame reception with the contents of the Frame Timestamp Register (SFD timestamp) if the received frame was valid (FCS ok). If the transceiver auto modes are enabled and address filtering is active, the Received Frame Timestamp is only updated, if there was an address match also. * Bit 7:0 - SCRSTRHH7:0 - Symbol Counter Received Frame Timestamp Register HH-Byte 10.11.15 SCRSTRHL - Symbol Counter Received Frame Timestamp Register HL-Byte Bit 7 6 5 NA ($D9) Read/Write Initial Value 4 3 2 1 0 SCRSTRHL7:0 R 0 R 0 R 0 R 0 R 0 SCRSTRHL R 0 R 0 R 0 This register contains the second most significant byte of the 32 bit Received Frame Timestamp Register. * Bit 7:0 - SCRSTRHL7:0 - Symbol Counter Received Frame Timestamp Register HL-Byte 10.11.16 SCRSTRLH - Symbol Counter Received Frame Timestamp Register LH-Byte Bit 7 6 5 NA ($D8) Read/Write Initial Value 4 3 2 1 0 SCRSTRLH7:0 R 0 R 0 R 0 R 0 R 0 SCRSTRLH R 0 R 0 R 0 This register contains the second least significant byte of the 32 bit Received Frame Timestamp Register. * Bit 7:0 - SCRSTRLH7:0 - Symbol Counter Received Frame Timestamp Register LH-Byte 164 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 10.11.17 SCRSTRLL - Symbol Counter Received Frame Timestamp Register LL-Byte Bit 7 6 5 NA ($D7) Read/Write Initial Value 4 3 2 1 0 SCRSTRLL7:0 R 0 R 0 R 0 R 0 R 0 SCRSTRLL R 0 R 0 R 0 This register contains the least significant byte of the 32 bit Received Frame Timestamp Register. * Bit 7:0 - SCRSTRLL7:0 - Symbol Counter Received Frame Timestamp Register LL-Byte 10.11.18 SCBTSRHH - Symbol Counter Beacon Timestamp Register HH-Byte Bit 7 6 5 RW 0 RW 0 RW 0 NA ($E8) Read/Write Initial Value 4 3 2 1 0 RW 0 RW 0 RW 0 SCBTSRHH7:0 RW 0 RW 0 SCBTSRHH This register contains the most significant byte of the 32 bit Beacon Timestamp Register. The Beacon Timestamp Register is updated with the contents of the Frame Timestamp Register if the received frame was a valid beacon frame with matching source PAN identifier or register {PAN_ID_1, PAN_ID_0} = 0xFFFF. * Bit 7:0 - SCBTSRHH7:0 - Symbol Counter Beacon Timestamp Register HHByte 10.11.19 SCBTSRHL - Symbol Counter Beacon Timestamp Register HL-Byte Bit 7 6 5 NA ($E7) Read/Write Initial Value 4 3 2 1 0 SCBTSRHL7:0 RW 0 RW 0 RW 0 RW 0 RW 0 SCBTSRHL RW 0 RW 0 RW 0 This register contains the second most significant byte of the 32 bit Beacon Timestamp Register. * Bit 7:0 - SCBTSRHL7:0 - Symbol Counter Beacon Timestamp Register HLByte 10.11.20 SCBTSRLH - Symbol Counter Beacon Timestamp Register LH-Byte Bit 7 6 5 RW 0 RW 0 RW 0 NA ($E6) Read/Write Initial Value 4 3 2 1 0 RW 0 RW 0 RW 0 SCBTSRLH7:0 RW 0 RW 0 SCBTSRLH 165 42073B-MCU Wireless-09/14 This register contains the second least significant byte of the 32 bit Beacon Timestamp Register. * Bit 7:0 - SCBTSRLH7:0 - Symbol Counter Beacon Timestamp Register LHByte 10.11.21 SCBTSRLL - Symbol Counter Beacon Timestamp Register LL-Byte Bit 7 6 5 RW 0 RW 0 RW 0 NA ($E5) Read/Write Initial Value 4 3 2 1 0 RW 0 RW 0 RW 0 SCBTSRLL7:0 RW 0 RW 0 SCBTSRLL This register contains the least significant byte of the 32 bit Beacon Timestamp Register. * Bit 7:0 - SCBTSRLL7:0 - Symbol Counter Beacon Timestamp Register LL-Byte 10.11.22 SCOCR1HH - Symbol Counter Output Compare Register 1 HH-Byte Bit 7 6 5 NA ($F8) Read/Write Initial Value 4 3 2 1 0 SCOCR1HH7:0 RW 0 RW 0 RW 0 RW 0 RW 0 SCOCR1HH RW 0 RW 0 RW 0 This register contains the most significant byte of the 32 bit compare value for the first compare unit * Bit 7:0 - SCOCR1HH7:0 - Symbol Counter Output Compare Register 1 HH-Byte 10.11.23 SCOCR1HL - Symbol Counter Output Compare Register 1 HL-Byte Bit 7 6 5 NA ($F7) Read/Write Initial Value 4 3 2 1 0 SCOCR1HL7:0 RW 0 RW 0 RW 0 RW 0 RW 0 SCOCR1HL RW 0 RW 0 RW 0 This register contains the second most significant byte of the 32 bit compare value for the first compare unit * Bit 7:0 - SCOCR1HL7:0 - Symbol Counter Output Compare Register 1 HL-Byte 10.11.24 SCOCR1LH - Symbol Counter Output Compare Register 1 LH-Byte Bit 7 6 5 RW 0 RW 0 RW 0 NA ($F6) Read/Write Initial Value 166 4 3 2 1 0 RW 0 RW 0 RW 0 SCOCR1LH7:0 RW 0 RW 0 SCOCR1LH ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 This register contains the second least significant byte of the 32 bit compare value for the first compare unit * Bit 7:0 - SCOCR1LH7:0 - Symbol Counter Output Compare Register 1 LH-Byte 10.11.25 SCOCR1LL - Symbol Counter Output Compare Register 1 LL-Byte Bit 7 6 5 RW 0 RW 0 RW 0 NA ($F5) Read/Write Initial Value 4 3 2 1 0 RW 0 RW 0 RW 0 SCOCR1LL7:0 RW 0 RW 0 SCOCR1LL This register contains the least significant byte of the 32 bit compare value for the first compare unit * Bit 7:0 - SCOCR1LL7:0 - Symbol Counter Output Compare Register 1 LL-Byte 10.11.26 SCOCR2HH - Symbol Counter Output Compare Register 2 HH-Byte Bit 7 6 5 NA ($F4) Read/Write Initial Value 4 3 2 1 0 SCOCR2HH7:0 RW 0 RW 0 RW 0 RW 0 RW 0 SCOCR2HH RW 0 RW 0 RW 0 This register contains the most significant byte of the 32 bit compare value for the second compare unit * Bit 7:0 - SCOCR2HH7:0 - Symbol Counter Output Compare Register 2 HH-Byte 10.11.27 SCOCR2HL - Symbol Counter Output Compare Register 2 HL-Byte Bit 7 6 5 NA ($F3) Read/Write Initial Value 4 3 2 1 0 SCOCR2HL7:0 RW 0 RW 0 RW 0 RW 0 RW 0 SCOCR2HL RW 0 RW 0 RW 0 This register contains the second most significant byte of the 32 bit compare value for the second compare unit * Bit 7:0 - SCOCR2HL7:0 - Symbol Counter Output Compare Register 2 HL-Byte 10.11.28 SCOCR2LH - Symbol Counter Output Compare Register 2 LH-Byte Bit 7 6 5 RW 0 RW 0 RW 0 NA ($F2) Read/Write Initial Value 4 3 2 1 0 RW 0 RW 0 RW 0 SCOCR2LH7:0 RW 0 RW 0 SCOCR2LH 167 42073B-MCU Wireless-09/14 This register contains the second least significant byte of the 32 bit compare value for the second compare unit * Bit 7:0 - SCOCR2LH7:0 - Symbol Counter Output Compare Register 2 LH-Byte 10.11.29 SCOCR2LL - Symbol Counter Output Compare Register 2 LL-Byte Bit 7 6 5 RW 0 RW 0 RW 0 NA ($F1) Read/Write Initial Value 4 3 2 1 0 RW 0 RW 0 RW 0 SCOCR2LL7:0 RW 0 RW 0 SCOCR2LL This register contains the least significant byte of the 32 bit compare value for the second compare unit * Bit 7:0 - SCOCR2LL7:0 - Symbol Counter Output Compare Register 2 LL-Byte 10.11.30 SCOCR3HH - Symbol Counter Output Compare Register 3 HH-Byte Bit 7 6 5 NA ($F0) Read/Write Initial Value 4 3 2 1 0 SCOCR3HH7:0 RW 0 RW 0 RW 0 RW 0 RW 0 SCOCR3HH RW 0 RW 0 RW 0 This register contains the most significant byte of the 32 bit compare value for the third compare unit * Bit 7:0 - SCOCR3HH7:0 - Symbol Counter Output Compare Register 3 HH-Byte 10.11.31 SCOCR3HL - Symbol Counter Output Compare Register 3 HL-Byte Bit 7 6 5 NA ($EF) Read/Write Initial Value 4 3 2 1 0 SCOCR3HL7:0 RW 0 RW 0 RW 0 RW 0 RW 0 SCOCR3HL RW 0 RW 0 RW 0 This register contains the second most significant byte of the 32 bit compare value for the third compare unit * Bit 7:0 - SCOCR3HL7:0 - Symbol Counter Output Compare Register 3 HL-Byte 10.11.32 SCOCR3LH - Symbol Counter Output Compare Register 3 LH-Byte Bit 7 6 5 RW 0 RW 0 RW 0 NA ($EE) Read/Write Initial Value 168 4 3 2 1 0 RW 0 RW 0 RW 0 SCOCR3LH7:0 RW 0 RW 0 SCOCR3LH ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 This register contains the second least significant byte of the 32 bit compare value for the third compare unit * Bit 7:0 - SCOCR3LH7:0 - Symbol Counter Output Compare Register 3 LH-Byte 10.11.33 SCOCR3LL - Symbol Counter Output Compare Register 3 LL-Byte Bit 7 6 5 4 RW 0 RW 0 RW 0 NA ($ED) Read/Write Initial Value 3 2 1 0 RW 0 RW 0 RW 0 SCOCR3LL7:0 RW 0 RW 0 SCOCR3LL This register contains the least significant byte of the 32 bit compare value for the third compare unit * Bit 7:0 - SCOCR3LL7:0 - Symbol Counter Output Compare Register 3 LL-Byte 10.11.34 SCCR0 - Symbol Counter Control Register 0 Bit NA ($DC) Read/Write Initial Value 7 6 5 4 3 SCRES SCMBTS SCEN SCCKSEL SCTSE RW 0 RW 0 RW 0 RW 0 RW 0 2 1 0 SCCMP3 SCCMP2 SCCMP1 RW 0 RW 0 SCCR0 RW 0 The Control Register 0 is used to setup the operating mode of the symbol counter and the compare units * Bit 7 - SCRES - Symbol Counter Synchronization If this bit is set to 1, the 16 MHz clock prescaler as well as the backoff slot counter is cleared. This function can be used to align the symbol timing within one 16 s symbol period and to restart the backoff slot counter with a complete 320 s period. This feature works only if the symbol counter module operates with the 16 MHz clock from XTAL1. After switching to RTC clock source, the symbol period synchronization is lost. This bit is cleared automatically. * Bit 6 - SCMBTS - Manual Beacon Timestamp With this bit a manual beacon timestamp can be generated. If set to 1, the current symbol counter value is stored into the beacon timestamp register. The bit is cleared afterwards. The manual beacon timestamping can be used in conjunction with the relative compare mode of the three compare units to generate compare match interrupts without having a beacon frame received. * Bit 5 - SCEN - Symbol Counter enable This bit activates the symbol counter module. If the bit is not set, the counter, backoff slot counter and the compare unit are disabled and disconnected from the clock. In this way the power consumption can be reduced. All registers can be accessed, but write access to the counter register SCCNT is not possible. * Bit 4 - SCCKSEL - Symbol Counter Clock Source select With this bit the clock source for the symbol counter can be selected. If the bit is one, the RTC clock from TOSC1 is selected, otherwise the symbol counter operates with the clock from XTAL1. During transceiver sleep modes the clock falls back to the RTC clock 169 42073B-MCU Wireless-09/14 source, regardless of the selected clock. After wakeup, it switches back to the previosly selected clock source. * Bit 3 - SCTSE - Symbol Counter Automatic Timestamping enable This bit enables automatic SFD and Beacon Timestamping. If the bit is zero, no automatic timestamp capturing is possible. Only manual beacon timestamping can be used. * Bit 2 - SCCMP3 - Symbol Counter Compare Unit 3 Mode select This bit enables the relative compare mode for compare unit 3. If enabled, the counter value is compared against the content of the timestamp register selected in Compare Source Register SCCSR select bits SCCS3 plus the content of the compare register 3 (SCCNT == timestamp+SCOCR3). Otherwise, the counter is compared against the compare register 3 (SCCNT == SCOCR3). * Bit 1 - SCCMP2 - Symbol Counter Compare Unit 2 Mode select This bit enables the relative compare mode for compare unit 2. If enabled, the counter value is compared against the content of the timestamp register selected in Compare Source Register SCCSR select bits SCCS2 plus the content of the compare register 2 (SCCNT == timestamp+SCOCR2). Otherwise, the counter is compared against the compare register 2 (SCCNT == SCOCR2). * Bit 0 - SCCMP1 - Symbol Counter Compare Unit 1 Mode select This bit enables the relative compare mode for compare unit 1. If enabled, the counter value is compared against the content of the timestamp register selected in Compare Source Register SCCSR select bits SCCS1 plus the content of the compare register 1 (SCCNT == timestamp+SCOCR1). Otherwise, the counter is compared against the compare register 1 (SCCNT == SCOCR1). 10.11.35 SCCR1 - Symbol Counter Control Register 1 Bit NA ($DD) 7 6 5 4 Res6 Res5 SCBTSM SCCKDIV2 Read/Write Initial Value R 0 R 0 RW 0 RW 0 Bit 3 2 1 0 SCCKDIV1 SCCKDIV0 SCEECLK SCENBO RW 0 RW 0 RW 0 RW 0 NA ($DD) Read/Write Initial Value SCCR1 SCCR1 This register is used to enable the backoff slot counter. * Bit 7:6 - Res6:5 - Reserved Bit This bit is reserved for future use. The result of a read access is undefined. The register bit must always be written with the reset value. * Bit 5 - SCBTSM - Symbol Counter Beacon Timestamp Mask Register This bit must be set to disable automatic beacon timestamping. All other timestamps as well as manual beacon timestamping is not effected by this setting. * Bit 4:2 - SCCKDIV2:0 - Clock divider for synchronous clock source (16MHz Transceiver Clock) 170 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 The 3 Bit value controls the symbol counter clock prescaler. The input clock to the prescaler is the 16MHz transceiver clock. The different prescaler values are defined in the table below. The default prescaler setting is 62.5kHz. If the transceiver clock is selected, the counter continues on the RTC time base during sleep mode, regardless of the SCCKDIV setting. Table 10-83 SCCKDIV Register Bits Register Bits Value Description SCCKDIV2:0 0 Transceiver Clock divided by 256, (62.5kHz) 1 Transceiver Clock divided by 128, (125kHz) 2 Transceiver Clock divided by 64, (250kHz) 3 Transceiver Clock divided by 32, (500kHz) 4 Transceiver Clock divided by 16, (1MHz) 5 Transceiver Clock divided by 8, (2MHz) 6 Transceiver Clock divided by 4, (4MHz) * Bit 1 - SCEECLK - Enable External Clock Source on PG2 If this bit is set, a asynchronous clock provided on PG2 can be used to run the symbol counter. SCEECLK overrieds SCCKSEL and forces the selection of the external clock source. The clock source on PG2 can have a maximum frequency of 1/4 of the controller clock speed. If selected, the clock on PG2 is used during sleep mode also. * Bit 0 - SCENBO - Backoff Slot Counter enable If this bit is set, the backoff slot counter starts working. To enable the corresponding IRQ the SCIRQM register must be updated. 10.11.36 SCSR - Symbol Counter Status Register Bit NA ($DE) Read/Write Initial Value 7 6 5 4 3 2 1 0 Res6 Res5 Res4 Res3 Res2 Res1 Res0 SCBSY R 0 R 0 R 0 R 0 R 0 R 0 R 0 R 0 SCSR * Bit 7:1 - Res6:0 - Reserved Bit This bit is reserved for future use. The result of a read access is undefined. The register bit must always be written with the reset value. * Bit 0 - SCBSY - Symbol Counter busy This bit is set if a write operation to the symbol counter register is pending. This bit is set after writing the counter low byte (SCCNTLL) until the symbol counter is updated with the new value. This update process can take up to 16 s and during this time no read or write access to the 32 bit counter register should occur. 10.11.37 SCIRQS - Symbol Counter Interrupt Status Register Bit NA ($E0) Read/Write Initial Value 7 6 5 Res2 Res1 Res0 R 0 R 0 R 0 4 3 2 1 0 IRQSBO IRQSOF IRQSCP3 IRQSCP2 IRQSCP1 RW 0 RW 0 RW 0 RW 0 SCIRQS RW 0 171 42073B-MCU Wireless-09/14 The Interrupt Status Register indicates pending interrupt requests. If the corresponding interrupt mask bit is set, an interrupt service routine is called and the status bit is cleared automatically. It is also possible to clear the status bit by writing "1" to the selected bit. * Bit 7:5 - Res2:0 - Reserved Bit This bit is reserved for future use. The result of a read access is undefined. The register bit must always be written with the reset value. * Bit 4 - IRQSBO - Backoff Slot Counter IRQ This interrupt is generated every 320 s, that means every 20 symbols. * Bit 3 - IRQSOF - Symbol Counter Overflow IRQ This interrupt is generated when the 32 bit counter turns from 0xFFFFFFF to 0x00000000. * Bit 2 - IRQSCP3 - Compare Unit 3 Compare Match IRQ This interrupt indicates a compare match on compare unit 3. * Bit 1 - IRQSCP2 - Compare Unit 2 Compare Match IRQ This interrupt indicates a compare match on compare unit 2. * Bit 0 - IRQSCP1 - Compare Unit 1 Compare Match IRQ This interrupt indicates a compare match on compare unit 1. 10.11.38 SCIRQM - Symbol Counter Interrupt Mask Register Bit NA ($DF) Read/Write Initial Value 7 6 5 Res2 Res1 Res0 R 0 R 0 R 0 4 3 2 1 0 IRQMBO IRQMOF IRQMCP3 IRQMCP2 IRQMCP1 RW 0 RW 0 RW 0 RW 0 SCIRQM RW 0 The Interrupt Mask Register is used to enable corresponding interrupts. After reset all interrupts are disabled. Disabled interrupts are still captured in the interrupt status register SCIRQS, but no interrupt is requested. Before enabling an interrupt, the corresponding interrupt status bit should be cleared by writing a 1. If the status bit is set and the IRQ gets enabled, the IRQ handler is called immediately. * Bit 7:5 - Res2:0 - Reserved Bit This bit is reserved for future use. The result of a read access is undefined. The register bit must always be written with the reset value. * Bit 4 - IRQMBO - Backoff Slot Counter IRQ enable This bit enables the SCNT_BACKOFF interrupt. * Bit 3 - IRQMOF - Symbol Counter Overflow IRQ enable This bit enables the SCNT_OVFL interrupt. * Bit 2 - IRQMCP3 - Symbol Counter Compare Match 3 IRQ enable This bit enables the SCNT_CMP3 interrupt. * Bit 1 - IRQMCP2 - Symbol Counter Compare Match 2 IRQ enable This bit enables the SCNT_CMP2 interrupt. 172 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 * Bit 0 - IRQMCP1 - Symbol Counter Compare Match 1 IRQ enable This bit enables the SCNT_CMP1 interrupt. 173 42073B-MCU Wireless-09/14 11 System Clock and Clock Options This section describes the clock options for the AVR microcontroller. 11.1 Overview Figure 11-1 below presents the principal clock systems in the AVR and their distribution. All of the clocks need not be active at a given time. In order to reduce power consumption, the clocks to modules not being used can be halted by using different sleep modes, as described in chapter "Power Management and Sleep Modes" on page 183. The clock systems are detailed below. Figure 11-1. Clock Distribution Asynchronous Timer General I/O Modules ADC CPU Core Flash and EEPROM RAM clkASY Symbol Counter Radio Transceiver clkADC clk RAMREGF Clock Multiplexer Clock Multiplexer clk CPU clk I/O AVR Clock Control Unit clk CALIB clkFLASH Source clock Reset Logic Watchdog Timer 1/8 Clock Prescaler System Clock Prescaler Clock Multiplexer clkTRX clk RCOSC clk W DT 1:2 Prescaler Calibrated RC Oscillator (16MHz) W atchdog Oscillator (128kHz) XTAL2 XTAL1 Transceiver Crystal Oscillator (16MHz) CLKI External Clock AMR TOSC2 TOSC1 Timer/Counter Oscillator (32.768kHz) 11.2 Clock Systems and their Distribution The AVR Clock Control Unit distributes the pre-scaled system clock to the various functional blocks of the device. The radio transceiver always runs with the 16 MHz crystal oscillator clock. 11.2.1 CPU Clock - clkCPU The CPU clock is routed to parts of the system concerned with operation of the AVR core. Examples of such modules are the General Purpose Register File, the Status Register and the data memory holding the Stack Pointer. Halting the CPU clock inhibits the core from performing general operations and calculations. 174 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 11.2.2 I/O Clock - clkI/O The I/O clock is used by the majority of the I/O modules, like Timer/Counters, SPI, and USART. The I/O clock is also used by the External Interrupt module, but note that some external interrupts are detected by asynchronous logic, allowing such interrupts to be detected even if the I/O clock is halted. Also note that start condition detection in the 2wire serial interface (TWI) module is carried out asynchronously when clkI/O is halted. Similar the TWI address recognition in all sleep modes also occurs asynchronously. 11.2.3 Flash Clock - clkFLASH The Flash clock controls operation of the Flash interface. The Flash clock is usually active simultaneously with the CPU clock. 11.2.4 Asynchronous Timer Clock - clkASY The Asynchronous Timer clock allows the Asynchronous Timer/Counter to be clocked directly from an external clock or an external 32 kHz clock crystal. The dedicated clock domain allows using this Timer/Counter as a real-time counter even if the device is in sleep mode. 11.2.5 ADC Clock - clkADC The ADC is provided with a dedicated clock domain. This allows halting the CPU and I/O clocks in order to reduce noise generated by digital circuitry. This gives more accurate ADC conversion results. 11.3 Clock Sources The device has the following clock source options, selectable by Flash Fuse bits as shown below. The clock from the selected source is input to the AVR clock generator, and routed to the appropriate modules. (1) Table 11-1. Device Clocking Options Select Device Clocking Option CKSEL3:0 Transceiver clock 1111 - 0110 Reserved 0101 - 0100 Internal 128 kHz RC Oscillator 0011 Calibrated Internal RC Oscillator 0010 External Clock 0000 Reserved 0001 Notes: 1. For all fuses "1" means unprogrammed while "0" means programmed. 11.3.1 Default Clock Source The device is shipped with internal RC oscillator at 16.0 MHz, the 1:2 prescaler enabled and with the fuse CKDIV8 programmed, resulting in 1.0 MHz system clock. The startup time is set to maximum time. (CKSEL = "0010", SUT = "10", CKDIV8 = "0"). The default setting ensures that all users can make their desired clock source setting using any available programming interface. 11.3.2 Clock Start-up Sequence Any clock source needs a minimum number of oscillating cycles before it can be considered stable. 175 42073B-MCU Wireless-09/14 To ensure sufficient startup time, the device issues an internal reset with a time-out delay (tTOUT) after the device reset is released by all other reset sources. Section "Power-on Reset" on page 208 describes the start conditions for the internal reset. The delay (tTOUT) is timed from the Watchdog Oscillator and the number of cycles in the delay is set by the SUTx and CKSELx fuse bits. The selectable delays are shown in Table 11-2 below. The frequency of the Watchdog Oscillator is voltage dependent as shown in section "Typical Characteristics" on page 564. Table 11-2. Number of Watchdog Oscillator Cycles Typ Time-out Number of Cycles 0 ms 0 4.0 ms 512 64 ms 8K (8,192) Main purpose of the delay is to keep the AVR in reset until it is supplied with a stable VDEVDD. The delay will not monitor the actual voltage and it will be required to select a delay longer than the DEVDD rise time. If this is not possible, an internal or external Brown-Out Detection (BOD) circuit should be used. A BOD circuit will ensure sufficient VDEVDD before it releases the reset, and the time-out delay can be disabled. Disabling the time-out delay without utilizing a Brown-Out Detection circuit is not recommended. The oscillator is required to oscillate for a minimum number of cycles before the clock is considered stable. An internal ripple counter monitors the oscillator output clock, and keeps the internal reset active for a given number of clock cycles. The reset is then released and the device will start to execute. The recommended oscillator start-up time is dependent on the clock type, and varies from 6 cycles for an externally applied clock to 32K cycles for a low frequency crystal. The start-up sequence for the clock includes both the time-out delay and the start-up time when the device starts up from reset. When starting up from Power-save or Powerdown mode, DEVDD is assumed to be at a sufficient level and only the start-up time is included. 11.4 Calibrated Internal RC Oscillator By default, the Internal RC Oscillator provides an approximate 16 MHz clock. The RC oscillator is voltage and temperature dependent, but can be very accurately calibrated by the user. See chapter "Clock Characteristics" on page 552 and "Internal Oscillator Speed" on page 587 for more details. The device is shipped with the CKDIV8 Fuse and the 1:2 system clock prescaler programmed. See section "System Clock Prescaler" on page 179 for more details. This clock may be selected as the system clock by programming the CKSEL Fuses as shown in Table 11-3 on page 177. If selected, it will operate with no external components. During reset, hardware loads the pre-programmed calibration value into the OSCCAL Register and thereby automatically calibrates the RC Oscillator. The accuracy of this calibration is shown as Factory calibration in section "Clock Characteristics" on page 552. By changing the OSCCAL register (see "OSCCAL - Oscillator Calibration Value" on page 180) from Software, it is possible to get a higher calibration accuracy than by using the factory calibration. The accuracy of this calibration is shown as User calibration in section "Clock Characteristics" on page 552. 176 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 When this Oscillator is used as the chip clock, the Watchdog Oscillator will still be used for the Watchdog Timer and for the Reset Time-out. For more information on the preprogrammed calibration value, see the section "Calibration Byte" on page 505. Table 11-3. Internal Calibrated RC Oscillator Operating Modes Frequency Range (MHz) CKSEL3:0 9.6 ... 22.4 0010 Notes: (1)(2) 2. The device is shipped with this option selected. When this Oscillator is selected, start-up times are determined by the SUT Fuses as shown in the following table. Table 11-4. Start-up times for the internal calibrated RC Oscillator clock selection Power Conditions Start-up Time from Powerdown and Power-save Additional Delay from Reset SUT1:0 BOD enabled 6 CK 14CK 00 Fast rising power 6 CK 14CK + 4.0 ms Slowly rising power 6 CK 14CK + 64 ms (1) Reserved Notes: 01 10 11 1. The device is shipped with this option selected 11.5 128 kHz Internal Oscillator The 128 kHz Internal Oscillator is an ultra-low power RC oscillator providing a clock of approximate 128 kHz nominal frequency. This clock may be selected as the system clock by programming the CKSEL Fuses to "0011" as shown in the following table. Table 11-5. 128 kHz Internal Oscillator Operating Modes Nominal Frequency CKSEL3:0 128 kHz 0011 Notes: (1) 1. Note that the 128 kHz oscillator is a very low power clock source, and is not designed for high accuracy When this clock source is selected, start-up times are determined by the SUT Fuses as shown in the following table. Table 11-6. Start-up Times for the 128 kHz Internal Oscillator Power Conditions Start-up Time from Power-down and Power-save Additional Delay from Reset SUT1:0 BOD enabled 6 CK 14CK 00 Fast rising power 6 CK 14CK + 4.1 ms 01 Slowly rising power 6 CK 14CK + 64 ms 10 Reserved 11 11.6 External Clock To drive the device from an external clock source, CLKI should be used as shown in Figure 11-2 on page 178. To run the device on an external clock, the CKSEL Fuses must be programmed to "0000". 177 42073B-MCU Wireless-09/14 Figure 11-2. External Clock Drive Configuration external clock CLKI VSS When this clock source is selected, start-up times are determined by the SUT Fuses as shown in Table 11-8 below. Table 11-7. External Clock Frequency Nominal Frequency CKSEL3:0 0 - 16 MHz 0000 Table 11-8. Start-up Times for the External Clock Selection Power Conditions Start-up Time from Power-down and Power-save Additional Delay from Reset SUT1:0 BOD enabled 6 CK 14 CK 00 Fast rising power 6 CK 14 CK + 4.0 ms 01 Slowly rising power 6 CK 14 CK + 64 ms 10 Reserved 11 When applying an external clock, it is required to avoid sudden changes in the applied clock frequency to ensure stable operation of the microcontroller unit (MCU). A variation in frequency of more than 2% from one clock cycle to the next can lead to unpredictable behavior. If changes of more than 2% are required, ensure that the MCU is kept in Reset during the changes. Note that the System Clock Prescaler can be used to implement run-time changes of the internal clock frequency while still ensuring stable operation. Refer to section "System Clock Prescaler" on page 179 for details. 11.7 Transceiver Crystal Oscillator The integrated crystal oscillator for the radio transceiver generates a low-jitter 16MHz clock frequency. See section "Crystal Oscillator (XOSC)" on page 86 for details about the operation of this oscillator. The AVR core and the radio transceiver operate synchronously on the same clock if this oscillator is selected. If the transceiver crystal oscillator is selected as AVR core clock, it remains enabled even if the radio transceiver is in SLEEP mode or its power reduction bit PRTRX24 is set. Table 11-9. Transceiver Crystal Clock Operating Mode Frequency Range (MHz) 16 Notes: 178 CKSEL3:0 (1) 1111 - 0110 1. All CKSEL fuse values have the same significance. ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Table 11-10. Start-up Times for the Transceiver Oscillator Clock Selection Power Conditions Start-up Time from Power-down and Power-save Additional Delay from Reset CKSEL0 SUT1:0 fast rising power 258 CK 14CK + 4.1 ms 0 00 slowly rising power 258 CK 14CK + 65 ms 0 01 BOD enabled 1K CK 14CK + 0 ms 0 10 fast rising power 1K CK 14CK + 4.1 ms 0 11 slowly rising power 1K CK 14CK + 65 ms 1 00 BOD enabled 16K CK 14CK + 0 ms 1 01 fast rising power 16K CK 14CK + 4.1 ms 1 10 slowly rising power 16K CK 14CK + 65 ms 1 11 11.8 Clock Output Buffer The device can output the system clock on the CLKO pin. To enable the output, the CKOUT Fuse has to be programmed. This mode is suitable when the chip clock is used to drive other circuits on the system. The clock also will be output during reset, and the normal operation of I/O pin will be overridden when the fuse is programmed. Any clock source, including the internal RC Oscillator, can be selected when the clock is output on CLKO. If the System Clock Prescaler is used, it is the divided system clock that is output. Special attention is required to prevent unwanted radiation from the connected PCB clock trace. Proper filtering can help to suppress higher harmonics. 11.9 Timer/Counter Oscillator The device can operate the Timer/Counter2 as well as the MAC Symbol Counter from the 32.768 kHz crystal oscillator or an external clock source. See section "Application Circuits" on page 538 for the watch crystal connection and the asynchronous control register "ASSR - Asynchronous Status Register" on page 358 to get the 32.768 kHz crystal oscillator enabled by the control bit AS2. 11.10 System Clock Prescaler The ATmega2564/1284/644RFR2 has a system clock prescaler, and the system clock can be divided by setting the "CLKPR - Clock Prescale Register". This feature can be used to decrease the system clock frequency and the power consumption when the requirement for processing power is low. This can be used with all clock source options, and it will affect the clock frequency of the CPU and all synchronous peripherals. The clocks clkI/O, clkADC, clkCPU, and clkFLASH are divided by a factor as shown in CLKPR - Clock Prescale Register on page 181. The prescaler clock division factor of the internal RC-Oscillator is different from all other clock sources, see register description CLKPR - Clock Prescale Register on page 181 Flash, EEPROM, Fuse- and Lock-bit programming is not allowed while using RCOscillator with CLKPS=0xF (clkCPU = 16MHz). When switching between prescaler settings, the System Clock Prescaler ensures that no glitches occur in the clock system. It also ensures that no intermediate frequency is higher than neither the clock frequency corresponding to the previous setting nor the clock frequency corresponding to the new setting. 179 42073B-MCU Wireless-09/14 The prescaler is implemented as a ripple counter running at the frequency of the undivided clock, which may be faster than the CPU's clock frequency. Hence, it is not possible to determine the state of the prescaler - even if it were readable. The exact time it takes to switch from one clock division to another cannot be exactly predicted. From the time the CLKPS values are written, it takes between t1 + t2 and t1 + 2t2 before the new clock frequency is active. In this interval 2 active clock edges are produced. Here t1 is the previous clock period and t2 is the clock period corresponding to the new prescaler setting. To avoid unintentional changes of clock frequency, a special write procedure must be followed to change the CLKPS bits: 1. Write the Clock Prescaler Change Enable (CLKPCE) bit to one and all other bits in CLKPR to zero. 2. Within four cycles, write the desired value to CLKPS while writing a zero to CLKPCE. Interrupts must be disabled when changing prescaler settings to make sure the write procedure is not interrupted. It is not required to change the prescaler setting of an existing software package written for an 8MHz internal RC oscillator. The change of the prescaler (additional 1:2 divider) is compensated by doubling the RC oscillator frequency of the ATmega2564/1284/644RFR2. 11.11 Register Description 11.11.1 OSCCAL - Oscillator Calibration Value Bit 7 6 5 4 3 2 1 0 NA ($66) CAL7 CAL6 CAL5 CAL4 CAL3 CAL2 CAL1 CAL0 Read/Write Initial Value R/W 0 R/W 0 R/W 0 R/W 0 R/W 0 R/W 0 R/W 0 R/W 0 OSCCAL The Oscillator Calibration Register is used to trim the Calibrated Internal RC Oscillator to remove process variations from the oscillator frequency. A preprogrammed calibration value is automatically written to this register during chip reset, giving the Factory calibrated frequency. The application software can write this register to change the oscillator frequency. The oscillator can be calibrated to frequencies as specified in the section "Electrical Characteristics". Calibration outside that range is not guaranteed. Note that this oscillator is used to time EEPROM and Flash write accesses and these write times will be affected accordingly. The calibration to very high frequencies can cause EEPROM or Flash erase/write failures. The CAL7 bit determines the range of operation for the oscillator. Setting this bit to 0 gives the lowest frequency range, setting this bit to 1 gives the highest frequency range. The two frequency ranges are overlapping, in other words a setting of OSCCAL = 0x7F gives a higher frequency than OSCCAL = 0x80. The CAL6..0 bits are used to tune the frequency within the selected range. A setting of 0x00 gives the lowest frequency in that range, and a setting of 0x7F gives the highest frequency in the range. * Bit 7:0 - CAL7:0 - Oscillator Calibration Tuning Value Table 11-11 CAL Register Bits 180 Register Bits Value Description CAL7:0 0x00 Calibration value for lowest oscillator frequency ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Register Bits Value Description 0x7f End value of low frequency range calibration 0x80 Start value of high frequency range calibration 0xff Calibration value for highest oscillator frequency 11.11.2 CLKPR - Clock Prescale Register Bit NA ($61) 7 6 5 4 CLKPCE Res2 Res1 Res0 RW 0 R 0 R 0 R 0 Read/Write Initial Value 3 2 1 0 CLKPS3 CLKPS2 CLKPS1 CLKPS0 RW 0 RW 0 RW 0 CLKPR RW 0 * Bit 7 - CLKPCE - Clock Prescaler Change Enable The CLKPCE bit must be written to logic one to enable change of the CLKPS bits. The CLKPCE bit is only updated when the other bits in CLKPR are simultaneously written to zero. CLKPCE is cleared by hardware four cycles after it is written or when CLKPS bits are written. Rewriting the CLKPCE bit within this time-out period does neither extend the time-out period, nor clear the CLKPCE bit. * Bit 6:4 - Res2:0 - Reserved * Bit 3:0 - CLKPS3:0 - Clock Prescaler Select Bits These bits define the division factor between the selected clock source and the internal system clock. These bits can be written run-time to vary the clock frequency to suit the application requirements. As the divider divides the master clock input to the MCU, the speed of all synchronous peripherals is reduced when a division factor is used. The division factors are given in the following table. Note that the factor is different when using the internal 16MHz RC oscillator as the clock source. The CKDIV8 Fuse determines the initial value of the CLKPS bits. If CKDIV8 is not programmed, the CLKPS bits will be reset to 0000. If CKDIV8 is programmed, CLKPS bits are reset to 0011 giving a division factor of 8 at start up. This feature should be used if the selected clock source has a higher frequency than the maximum frequency of the device at the present operating conditions. Note that any value can be written to the CLKPS bits regardless of the CKDIV8 Fuse setting. The Application software must ensure that a sufficient division factor is chosen if the selected clock source has a higher frequency than the maximum frequency of the device at the present operating conditions. The device is shipped with the CKDIV8 Fuse programmed. Table 11-12 CLKPS Register Bits Register Bits CLKPS3:0 Value Description 0x0 Division factor 1 / RC-Oscillator 2 0x1 Division factor 2 / RC-Oscillator 4 0x2 Division factor 4 / RC-Oscillator 8 0x3 Division factor 8 / RC-Oscillator 16 0x4 Division factor 16 / RC-Oscillator 32 0x5 Division factor 32 / RC-Oscillator 64 0x6 Division factor 64 / RC-Oscillator 128 0x7 Division factor 128 / RC-Oscillator 256 181 42073B-MCU Wireless-09/14 Register Bits 182 Value Description 0x8 Division factor 256 / RC-Oscillator 512 0x9 Reserved 0xA Reserved 0xB Reserved 0xC Reserved 0xD Reserved 0xE Reserved 0xF Division factor 1 only permitted for RCOscillator. Flash and EEPROM programming is not allowed. ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 12 Power Management and Sleep Modes Sleep modes enable the application to shut down unused modules in the MCU, thereby saving power. The AVR microcontroller and the RF transceiver provide various sleep modes allowing the user to tailor the power consumption to the application's requirements. 12.1 Deep-Sleep Mode When the microcontroller goes into Power-down or Power-save modes while the transceiver is in SLEEP state the device enters the Deep-Sleep mode. Sending the microcontroller to Power-down or Power-save is not allowed during the wake-up phase of the transceiver. The TRX24_AWAKE interrupt shall be used to wait for the transceiver is operational. The DVDD voltage regulator and the associated power chain will be switched off. Remaining running logic will then be supplied from the Low Leakage Voltage Regulator. Even the AVDD regulator will switched off. See chapter "Radio Transceiver" on page 188 how to disable the radio transceiver. Before entering Deep-Sleep mode the automatic calibration of the Low Leakage Voltage Regulator must be completed. This automatic calibration can be temporarily disabled for very short wake-up times. For details see "Low Leakage Voltage Regulator (LLVREG)" on page 192. The SRAM blocks use the data retention mode to preserve its content while saving leakage power. The Low Leakage Voltage Regulator has only limited driving capabilities, see section "Supply Voltage and Leakage Control" on page 189 for details. Therefore the remaining running logic must be clocked with low frequencies only. The Deep-Sleep mode can be finished by a wake-up source shown by the Table 12-1 on page 184. Then DVDD voltage regulator and the associated power chain will be switched on. If the power-chain is completely enabled the standard AVR wake-up procedure continues (for details see chapter "Power-chain" on page 189). Note that the wake-up time from Deep-sleep mode is significantly longer than the wakeup time from the Power-down or Power-save mode because the entire power-chain will be restarted. Additionally note that if the ADC is enabled and/or running a conversion, while entering Deep-sleep mode, the ADC supply voltage is switched off. Therefore the ADC must be disabled before entering Deep-sleep mode to avoid an undefined ADC operation. If Timer/Counter 2 is not operated asynchronously (i.e., AS2 in ASSR is 0), the timer is kept running in all sleep modes (see chapter Power-save Mode on page 186). This implies the main oscillator (as selected by the fuse configuration) is kept running. The power chain remains enabled and the device does not enter the Deep-Sleep mode. Assembly Code Example ... ldi r16, (1< int main(void) { ... TRXPR = 1 << SLPTR; // sent transceiver to sleep set_sleep_mode(SLEEP_MODE_PWR_DOWN); // select power down mode sleep_enable(); sleep_cpu(); // go to deep sleep sleep_disable(); // executed after wake-up ... } Notes: 1. See also section "About Code Examples" on page 8. The C-source code example uses high level functions from the library. Deep-Sleep mode will not be entered during on-chip debug sessions. Refer to section "Transceiver Pin Register TRXPR" on page 35 for a description of the functionality of the SLPTR bit. 12.2 AVR Microcontroller Sleep Modes In chapter "System Clock and Clock Options" on page 174 the different clock systems in the ATmega2564/1284/644RFR2, and their distribution were presented. Figure 11-1 on page 174 is helpful in selecting an appropriate sleep mode. The following table shows the different sleep modes and their wake-up sources. Table 12-1. Active Clock Domains and Wake-up Sources in the Different Sleep Modes X (2) Powerdown (3) X (3) X (3) X (3) X (3) X X X Powersave (2) X Standby X X (1) Extended Standby (2) X Notes: X X X (2) X X X (2) X X X X X X X X X X X X X X X X X X X X Transceiver X X Symbol Counter X X Other I/O X ADCNRM (2) WDT Interrupt X ADC X SPM/EEPROM Ready X Timer/Counter2 X TWI Address Match X Wake-up Sources INT7:0 and Pin Change clkASY Timer Oscillator Enabled clkADC Main Clocksource Enabled Oscillators clkIO Idle clkFLASH Sleep Mode clkCPU Active Clock Domains (4) X (4) (4) X (4) X (4) X (4) X (4) X (4) (4) (4) (4) (4) 1. Only recommended with external crystal or resonator selected as clock source. 2. If Timer/Counter2 is running in asynchronous mode. 3. For INT7:4, only level interrupt. 4. The Symbol Counter and/or the Transceiver can wakeup the AVR if the Transceiver Oscillator is enabled (Transceiver not in SLEEP). 184 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 To enter any of the sleep modes, the SE bit in in the SMCR register (see "SMCR - Sleep Mode Control Register" on page 194) must be written to logic one and a SLEEP instruction must be executed. The SM2, SM1, and SM0 bits in the SMCR Register select which sleep mode will be activated by the SLEEP instruction. See chapter "Register Description" on page 194 for a summary. If an enabled interrupt occurs while the MCU is in a sleep mode, the MCU wakes up. The MCU is then halted for four cycles in addition to the start-up time, executes the interrupt routine, and resumes execution from the instruction following SLEEP. The contents of the Register File and SRAM are unaltered when the device wakes up from sleep. Note that SRAM data retention must be enabled in some sleep modes to preserve the memory contents (see section "SRAM with Data Retention" on page 191). If a reset occurs during sleep mode, the MCU wakes up and executes from the Reset Vector. 12.2.1 Idle Mode When the SM2:0 bits are written to 000 in the SMCR register, the SLEEP instruction makes the MCU enter Idle mode, stopping the CPU but allowing the SPI, USART, Analog Comparator, ADC, 2-wire Serial Interface, Timer/Counters, Watchdog, and the interrupt system to continue operating. This sleep mode basically halts clkCPU and clkFLASH, while allowing the other clocks to run. Idle mode enables the MCU to wake up from external triggered interrupts as well as internal ones like the Timer Overflow and USART Transmit Complete interrupts. If wake-up from the Analog Comparator interrupt is not required, the Analog Comparator can be powered down by setting the ACD bit in the Analog Comparator Control and Status Register - ACSR. This will reduce power consumption in Idle mode. If the ADC is enabled, a conversion starts automatically when this mode is entered. 12.2.2 ADC Noise Reduction Mode When the SM2:0 bits are written to 001, the SLEEP instruction makes the MCU enter ADC Noise Reduction mode (ADCNRM), stopping the CPU but allowing the ADC, the external interrupts, 2-wire Serial Interface address match, Timer/Counter2 and the Watchdog to continue operating (if enabled). This sleep mode basically halts clkI/O, clkCPU, and clkFLASH, while allowing the other clocks to run. This improves the noise environment for the ADC, enabling higher resolution measurements. If the ADC is enabled, a conversion starts automatically when this mode is entered. Apart form the ADC Conversion Complete interrupt, only an External Reset, a Watchdog System Reset, a Watchdog interrupt, a Brown-out Reset, a 2-wire serial interface interrupt, a Timer/Counter2 interrupt, an SPM/EEPROM ready interrupt, an external level interrupt on INT7:4 or a pin change interrupt can wakeup the MCU from ADC Noise Reduction mode. 12.2.3 Power-down Mode When the SM2:0 bits are written to 010, the SLEEP instruction makes the MCU enter Power-down mode. In this mode, the 16 MHz crystal oscillator is stopped (if selected by CKSEL fuses), while the external interrupts, the 2-wire Serial Interface, and the Watchdog continue operating (if enabled). Only an External Reset, a Watchdog Reset, a Brown-out Reset, 2-wire Serial Interface address match, an external level interrupt on INT7:4, an external interrupt on INT3:0, a pin change interrupt, or a symbol counter interrupt can wake up the MCU. This sleep mode basically halts all generated clocks, allowing operation of asynchronous modules only. 185 42073B-MCU Wireless-09/14 Note that if a level triggered interrupt is used for wake-up from Power-down mode, the changed level must be held for some time to wake up the MCU. Refer to section "External Interrupts" on page 248 for details. When waking up from Power-down mode, there is a delay from the wake-up condition occurs until the wake-up becomes effective. This allows the clock to restart and become stable after have been stopped. The wake-up period is defined by the same CKSEL Fuses that define the Reset Time-out period, as described in chapter "System Clock and Clock Options" on page 174. 12.2.4 Power-save Mode When the SM2:0 bits are written to 011, the SLEEP instruction makes the MCU enter Power-save mode. This mode is identical to Power-down, with one exception: If Timer/Counter2 is enabled, it will keep running during sleep. The device can wake up from either Timer Overflow or Output Compare event from Timer/Counter2 if the corresponding Timer/Counter2 interrupt enable bits are set in TIMSK2, and the Global Interrupt Enable bit in SREG is set. If Timer/Counter2 is not running, Power-down mode is recommended instead of Power-save mode. The Timer/Counter2 can be clocked both synchronously and asynchronously in Powersave mode. If the Timer/Counter2 is not using the asynchronous clock, the Timer/Counter Oscillator is stopped during sleep. If the Timer/Counter2 is not using the synchronous clock, the clock source is stopped during sleep. Note that even if the synchronous clock is running in Power-save, this clock is only available for the Timer/Counter2. Timer/Counter2 operation is described in detail in section "8-bit Timer/Counter2 with PWM and Asynchronous Operation" on page 339. 12.2.5 Standby Mode When the SM2:0 bits are 110 and the crystal oscillator of the radio transceiver is selected, the SLEEP instruction makes the MCU enter Standby mode. This mode is identical to Power-down with the exception that the Oscillator is kept running. From Standby mode, the device wakes up in six clock cycles. 12.2.6 Extended Standby Mode When the SM2:0 bits are 111 and the crystal oscillator of the radio transceiver is selected, the SLEEP instruction makes the MCU enter Extended Standby mode. This mode is identical to Power-save mode with the exception that the oscillator is kept running. From Extended Standby mode, the device wakes up in six clock cycles. 12.3 Power Reduction Register The Power Reduction Register (PRR), see "PRR0 - Power Reduction Register0" on page 195, "PRR1 - Power Reduction Register 1" on page 196 and "PRR2 - Power Reduction Register 2" on page 197, provide a method to stop the clock to individual peripherals to reduce power consumption. Note that when the clock for a peripheral is stopped, then: * The current state of the peripheral is frozen. * The associated registers can not be read or written. * Resources used by the peripheral (e.g. IO pins) will remain occupied. The peripheral unit should in most cases be disabled before stopping the clock. Waking up a module, which is done by clearing the bit in PRR, puts the module in the same state as before the shutdown. Exceptions are the SRAM blocks and the radio 186 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 transceiver. The SRAM is shut down by a DRT switch and the radio transceiver is in reset state if its respective power reduction bit is set. Module shutdown can be used in Idle mode and Active mode to significantly reduce the overall power consumption. See chapter "Typical Characteristics" on page 564 for examples. In all other sleep modes, the clock is already stopped. 12.4 Minimizing Power Consumption There are several issues to consider when trying minimizing the power consumption in an AVR controlled system. In general, sleep modes should be used as much as possible, and the sleep mode should be selected so that as few as possible of the device's functions are operating. All functions not needed should be disabled. In particular, the following modules may need special consideration when trying to achieve the lowest possible power consumption. 12.4.1 Analog to Digital Converter If enabled, the ADC will be enabled in all sleep modes. To save power, the ADC should be disabled before entering any sleep mode. Refer to chapter "ADC - Analog to Digital Converter" on page 442 for details on ADC operation. 12.4.2 Analog Comparator When entering Idle mode, the Analog Comparator should be disabled if not used. When entering ADC Noise Reduction mode the Analog Comparator should also be disabled. In other sleep modes, the Analog Comparator is automatically disabled. However, if the Analog Comparator is set up to use the Internal Voltage Reference as input, the Analog Comparator should be disabled in all sleep modes. Otherwise, the Internal Voltage Reference will be enabled, independent of sleep mode. Refer to "AC - Analog Comparator" on page 438 for details on how to configure the Analog Comparator. 12.4.3 Brown-out Detector If the Brown-out Detector is enabled by the BODLEVEL Fuses, it will be disabled in Deep-sleep mode. Refer to "Brown-out Detection" on page 209 for details on how to configure the Brown-out Detector. It is recommended to enable the Brown-out Detector. 12.4.4 Internal Voltage Reference The Internal Voltage Reference will be enabled when needed by the Brown-out Detection, the Analog Comparator or the ADC. If these modules are disabled as described in the sections above, the internal voltage reference will be disabled and not consume power. When turned on again, the user must allow the reference to start up before the output is used. If the reference is kept on in sleep mode, the output can be used immediately. Refer to "Internal Voltage Reference" on page 210 for details on the start-up time. 12.4.5 Watchdog Timer If the Watchdog Timer is not needed in the application, the module should be turned off. If the Watchdog Timer is enabled, it will be enabled in all sleep modes, and hence, always consume power. In the deeper sleep modes, this will contribute significantly to the total current consumption. Refer to "Watchdog Timer" on page 211 for details on how to configure the Watchdog Timer. 187 42073B-MCU Wireless-09/14 12.4.6 Port Pins When entering a sleep mode, all port pins should be configured to use minimum power. The most important is then to ensure that no pins drive resistive loads. In sleep modes where both the I/O clock (clkI/O) and the ADC clock (clkADC) are stopped, the input buffers of the device will be disabled. This ensures that no power is consumed by the input logic when not needed. In some cases, the input logic is needed for detecting wake-up conditions, and it will then be enabled. Refer to the section "I/O-Ports" on page 217 for details on which pins are enabled. If the input buffer is enabled and the input signal is left floating or have an analog signal level close to DEVDD/2, the input buffer will use excessive power. For analog input pins, the digital input buffer should be disabled at all times. An analog signal level close to DEVDD/2 on an input pin can cause significant current even in active mode. Digital input buffers can be disabled by writing to the Digital Input Disable Registers DIDR1 and DIDR0. Refer to "DIDR1 - Digital Input Disable Register 1" on page 440 and "DIDR0 - Digital Input Disable Register 0" on page 467 for details. 12.4.7 On-chip Debug System If the On-chip debug system is enabled by the OCDEN Fuse and the chip enters sleep mode, the main clock source is enabled, and hence, always consumes power. In the deeper sleep modes, this will contribute significantly to the total current consumption. There are three alternative ways to disable the OCD system: * Disable the OCDEN Fuse. * Disable the JTAGEN Fuse. * Write one to the JTD bit in MCUCR. 12.4.8 Symbol Counter The Symbol Counter acts as a separate counter, which uses either the 16MHz clock from XTAL1/XTAL2 crystal pins or the clock from PG3/PG4 low frequency crystal pins. If the Symbol Counter module is not used, it should be disabled, see section "MAC Symbol Counter" on page 155. 12.4.9 Radio Transceiver The radio transceiver module is automatically starting its state machine after power on. While the CPU is in any sleep mode, the radio transceiver remains active. This enables the radio transceiver to wakeup the MCU if a pending action is over (frame received or transmission completed). The radio transceiver will be inactive during sleep, if either the its power reduction bit PRTRX24 in register PRR1 is set or it is send into SLEEP mode, see "PRR1 - Power Reduction Register 1" on page 196 for details. After reactivation the 16MHz crystal oscillator is started first and afterwards the radio transceiver with TRX_OFF state. The radio transceiver is derived from a stand alone solution that was partly controlled by external pins. Now the radio transceiver is fully controlled by individual register bits. The radio transceiver has a separate reset signal. A radio transceiver reset is initiated by setting bit TRXRST in register TRXPR. This bit is self-resetting. The radio transceiver signal SLPTR can be controlled by the bit SLPTR in register TRXPR and is used to set the radio transceiver into SLEEP mode (assuming TRX_STATE is TRX_OFF). This bit has a multiple function, see section "Low-Power 2.4 GHz Transceiver" on page 32 for a detailed description of the radio transceiver. 188 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 12.5 Supply Voltage and Leakage Control For battery applications using DEEP_SLEEP periods, the leakage current defines the system life time. Due to the typical strong temperature dependency of the leakage current, major contributors to the leakage budget are turned off: * Analog and digital voltage regulator, * Non-volatile memory (NVM), * SRAM, * Digital signal processor of the radio transceiver including AES engine. If the CPU uses one of the sleep modes "power-down" or "power-save", the above mentioned blocks will be switched off by power switches. When the CPU wakes up, the blocks are switched on again. There are some additional exceptions (internal voltage regulator, SRAM, radio transceiver), see section "Power-chain" below . The supply voltage control is mainly hidden to the application, it is not necessary to configure the supply voltage control. Nevertheless some configurations can be done in order to get the maximum effect and the lowest sleep current, for details see section "SRAM with Data Retention" on page 191. 12.5.1 Power-chain The following figure shows the major dependencies of the power-chain and how the power switches are situated inside the chain. Figure 12-1. Power-chain connections powerchain_ ok power_control bandgap llvreg_ok DVREG drt_switch drt_switch power_switch power_switch LLVREG First SRAM Last SRAM Radio Transceiver NVM trx24_sleeps Startup and Wakeup from DEEP_SLEEP After power-on reset (POR) or wakeup from DEEP_SLEEP the power switches of the blocks will be enabled one after another (power-chained) to decrease current peaks. The blocks will be enabled in the following order: 1. Bandgap reference and voltage regulator, 2. Digital voltage regulator (DVREG) and low leakage voltage regulator (LLVREG), 3. first SRAM block (lower 4k bytes), 4. last SRAM block (upper 4k bytes), 5. Radio transceiver including AES engine, 6. Non-volatile memory. If the power-chain is completely enabled the standard AVR wake-up procedure continues. 189 42073B-MCU Wireless-09/14 Figure 12-2 shows the chained startup procedure after power up. The Figure 12-3 shows the startup from DEEP_SLEEP. A module is only switched on if it is not deselected by power reduction register (PRR1 or PRR2). This is possible for SRAM blocks and radio transceiver power switch. At the end of the startup, the pin RSTON is enabled. Depending of the currently enabled memory blocks (NSRAM), the startup procedure takes different time. tSTARTUP_TOTAL = tBG + tDVREG + NSRAM*tDRT_ON + 3*tPWRSW_ON + tOSC_STARTUP The SRAM is organized in 4kByte blocks, the NVM in 128kByte blocks. Deselected SRAM blocks (by PRR2 register) reduce the wakeup time from DEEP_SLEEP. For further timing information see "Power Management Electrical Characteristics" on page 554. Figure 12-2. Timing visualization of power up RSTON POR s ta rtu p bandgap s ta rtu p DVREG D R T s w itc h SRAM #0 D R T s w it c h SR AM #1 D R T s w itc h SR AM #2 D R T s w it c h SRAM #3 p o w e r s w itc h r a d io tr a n s . p o w e r s w itc h NVM tP O R tB G tD V R E G tD R T_O N tD R T_O N tD R T _ O N tD R T_O N tP W R S W _O N tP W R S W _O N o s c il l a t o r s ta rtu p tO S C _S TA R TU P tS T A R T U P Figure 12-3. Timing visualization of wakeup from DEEP_SLEEP SLEEP s ta rtu p bandgap s ta rtu p DVREG D R T s w it c h SRAM #0 D R T s w itc h SR AM #1 D R T s w itc h SRAM #2 D R T s w itc h SR AM #3 p o w e r s w it c h r a d io tr a n s . p o w e r s w itc h NVM tB G tD V R E G tD R T _ O N tD R T_O N tD R T_O N tD R T _ O N tP W R S W _O N tP W R S W _ O N o s c il l a t o r s ta rtu p tO S C _S T A R TU P tS T A R T U P Sleep Six sleep modes are defined for the CPU. Disabling the power-chain and thus switching off of the above mentioned blocks makes only sense for the modes "power-down" and "power-save". Also an enabled radio transceiver prevents the power-chain from being disabled. In order to disable the power-chain, one of the following conditions must fit: * The radio transceiver has to be disabled (power reduction register PRR1 bit PRTRX24). * The radio transceiver is sent into SLEEP mode (register TRXPR bit SLPTR). The SRAM blocks may be configured separately to decrease their leakage current (see section "SRAM with Data Retention" on page 191). The following table shows the different implemented sleep modes and the behavior of the power-chain depending on the current state of the radio transceiver. Table 12-2. Power states of microcontroller and radio transceiver AVR State Radio Transceiver State Powerchain ON ON ON ON 190 off (SLEEP or power reduction) ON off (1...6) ON ON off (1,4...6) off (SLEEP or power reduction) ON ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 AVR State (2,3) off DEEP SLEEP Notes: Radio Transceiver State Powerchain off (SLEEP or power reduction) off (7) 1. Idle 2. Power Down 3. Power Save 4. ADC Noise Reduction Mode 5. Standby 6. Extended Standby 7. If the OCDEN fuse is programmed, the Power-chain is always on 12.5.2 SRAM with Data Retention It is necessary to prevent any data loss of the SRAM when setting the CPU in one of the DEEP_SLEEP modes. For that purpose the SRAM blocks will not be completely switched off if the power-chain is disabled. The supply voltage for any individual SRAM block is decreased to reduce its leakage current but guaranteeing its data retention. The SRAM memory is divided into 4kByte blocks. Each block can be fully switched off by setting the correspondent bit (PRRAM0 ... PRRAM3) in register PRR2 (see "PRR2 - Power Reduction Register 2" on page 197). This enables the application software to switch off unused SRAM memory to save power and to reduce leakage currents. Every SRAM block can be enabled again by resetting the respective bit (PRRAM0 ... PRRAM3) of register PRR2. For each SRAM block n the bit DRTSWOK of the corresponding register DRTRAMn shows the state of the DRT switch (logic high means SRAM block can be accessed). If the power-chain is switched off during deep-sleep modes, the content of the SRAM blocks must be sustained. To provide data retention and lowest leakage current, a data retention block controls the SRAM behavior during deep-sleep. Since the leakage current is dramatically depending from the voltage of the SRAM, the supply voltage can be decreased by enabling the data retention mode DRT. Every SRAM block n is controlled by its assigned register DRTRAMn. The bit ENDRT enables the data retention mode during deep-sleep. If this bit is zero, the respective SRAM block is completely switched off. Table 12-3. SRAM behavior while in deep-sleep mode ENDRT Power-chain SRAM supply voltage 1 ON 1.8V (DVDD) 0 ON 1.8V (DVDD) 1 off Reduced 0 off Disconnected The lower 4-bit of the register DRTRAMn are reserved and should not be changed. The reset value of the DRT voltage settings are preprogrammed during the manufacturing process and need not to be changed. 12.5.3 Voltage Regulators (AVREG, DVREG) The main features of the Voltage Regulator blocks are: * Bandgap stabilized 1.8V supply for analog and digital domain; * Low dropout (LDO) voltage regulator; 191 42073B-MCU Wireless-09/14 * Configurable to use an external voltage regulator; The internal voltage regulators supply a stabilized voltage to the ATmega2564/1284/644RFR2. The AVREG provides the regulated 1.8V supply voltage for the analog section and the DVREG supplies the 1.8V supply voltage for the digital section. The DVREG is enabled during startup and is switched off if the power-chain is disabled. The AVREG is enabled only on request by either the A/D converter or the radio transceiver. A simplified schematic of the internal voltage regulator is shown in Figure 12-4 below. Figure 12-4. Simplified Schematic of AVREG/DVREG (D )E V D D B andgap voltage reference 1.25V AVDD, DVDD The voltage regulators require bypass capacitors for stable operation. The value of the bypass capacitors determines their settling time. The bypass capacitors shall be placed as close as possible to the pins and shall be connected to ground with the shortest possible traces. The voltage regulators can be configured with the register VREG_CTRL. It is recommended to use the internal regulators but it is also possible to supply the low voltage domains by an external voltage supply. For this configuration the internal analog voltage regulator needs to be switched off by setting the register bit AVREG_EXT = 1 (see "VREG_CTRL - Voltage Regulator Control and Status Register" on page 127). The internal digital voltage regulator may not be switched off, an external voltage has to overdrive the internal voltage. A regulated external supply voltage of 1.8V must then be connected to the pins 13, 14 (DVDD) and pin 29 (AVDD). When turning on the external supply ensure a sufficiently long stabilization time before interacting with the ATmega2564/1284/644RFR2. The status bits AVDD_OK = 1 and DVDD_OK = 1 of register VREG_CTRL indicate an enabled and stable internal supply voltage. Reading value 0 indicates that the internal supply voltage is disabled or not yet settled to the final value. In case the ATmega2564/1284/644RFR2 is not supplied with a sufficient (D)EVDD and the digital voltage regulator output voltage is too low, a power on reset (POR) is initiated. 12.5.4 Low Leakage Voltage Regulator (LLVREG) The main digital voltage regulator (DVREG) will be switched off during the DEEP_SLEEP modes "power-down" and "power-save". The Low Leakage Voltage Regulator will then keep the digital supply voltage to provide data retention. No application software control is required. During the active power states, when the main voltage regulator supplies the chip, the Low Leakage Voltage Regulator is digitally calibrated. Its output voltage is adjusted to 192 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 match the output voltage of the main regulator. This fixed calibration result is stored and used when the chip enters a power-down state where the main regulator is switched off. Because the calibration setting is fixed, temperature and load current variations during the following DEEP_SLEEP period are not regulated out. Thus the output voltage may drift away from the target value. However the design guarantees that for allowed operating conditions the output voltage will stay within valid limits. After every wake-up a new calibration cycle is initiated. The output driving capability of the Low Leakage Voltage Regulator is limited. Its main purpose is to provide the leakage current of the connected analog and digital blocks. At least one full calibration cycle of the Low Leakage Voltage Regulator has to be completed before the power-chain can be disabled. Therefore if the CPU uses one of the DEEP_SLEEP modes "power down" or "power save", the power-chain is not disabled before the Low Leakage Voltage Regulator completed this first calibration cycle. By default the LLVREG automatically starts the calibration after finishing the power-on reset and the wake-up/start-up procedures (see section "Low Leakage Voltage Regulator Control" below for a detailed description of the Low Leakage Voltage Regulator). Notes: 1. The LLVREG calibration will be inaccurate at a DEVDD supply voltage of 1.8V or lower. Therefore when operating the device at 1.8V the LLVREG calibration should be disabled and the register values of LLDRL and LLDRH should be set to 0x06 and 0x0f, respectively. 2. When waking up from Deep Sleep mode the LLVREG calibration starts after 4 clock cycles of the 128 kHz oscillator. If the device goes to sleep again earlier then the old calibration values will be used. 12.5.5 Low Leakage Voltage Regulator Control The three register LLCR, LLDRL and LLDRH allow the software to monitor the calibration process and to modify or correct the calibration results. The automatic calibration is the normal operation mode. It is an internal process that does not require any software interaction. Nevertheless the calibration is transparent for the user through LLCR, LLDRL and LLDRH (control and data register respectively). The register access requires a minimum system clock of at least the output frequency of the 128 kHz RC oscillator. The register access will not work if the system clock is slower. See chapter "System Clock and Clock Options" on page 174 for details on how to set the system clock frequency. Before the device can enter the sleep mode "power down" or "power save" the first calibration cycle of the Low Leakage Voltage Regulator must be completed to get valid data in LLDRL and LLDRH. The cycle time tCAL (see Table 35-28 on page 555) is not fixed. It depends on the temperature, manufacturing process and the frequency of the 128 kHz RC oscillator (independent of the Watchdog setting). Systems that require very short power-up times may temporarily disable the calibration process by setting bit LLENCAL to 0. After disabling the calibration the register values read from LLCR, LLDRL and LLDRH will be stable after at most five 64 kHz clock cycles (clock output of the 128 kHz RC oscillator divided by 2). The output voltage of the Low Leakage Voltage Regulator in sleep mode will be the most accurate if constantly calibrated to compensate for any environmental changes (e.g. temperature). However these changes may be slow enough to skip the calibration 193 42073B-MCU Wireless-09/14 th during some power-up cycles (e.g. calibrate only every 10 power-up time and use the old calibration results during all other times). After the completion of the power-up process the calibration will start automatically if bit LLENCAL in the control register LLCR is 1 (default). The completion of a calibration cycle is indicated by the bit LLDONE in that same register. After the first cycle the calibration will continue to run until either the device goes into a sleep mode ("power down" or "power save") or by setting the LLENCAL bit to 0. The output voltage of the Low Leakage Voltage Regulator is then defined by the values in the data register LLDRL and LLDRH and by the bits LLTCO and LLSHORT of the control register. Write access to the three register is granted when the bit LLENCAL is set to 0. The application software can then modify the calibration results. Higher values in the data register generate lower output voltages in the sleep modes. In general it is not recommended nor required to alter the automatically generated calibration result. The write access to the three register must follow a certain scheme to be successful. The registers are implemented in the I/O clock domain while the logic of the Low Leakage Voltage Regulator runs with 64 kHz (clock output of the 128 kHz RC oscillator divided by 2). It takes at least two 64 kHz clock cycles before the data written to the register take effect in the regulator circuit. The write access from the software must be aware of this process. Furthermore the value of LLDRH must be written first followed by LLDRL. Otherwise the LLDRH write access will be ignored. The following Assembler code fragment shows a working example. Note the polling of bit 3 LLCAL of the LLCR register to verify the completion of the synchronization process. Assembly Code Example ... clr r20 sts LLDRH,r18 ; write LLDRH first sts LLDRL,r19 ; write LLDRL second sts LLCR,r20 ; bit 0 cleared = disable automatic calibration ; poll LLCAL bit of LLCR to check if automatic calibration is ; turned of wait_calib: lds r20,LLCR sbrc r20,3 rjmp wait_calib ; not executed if bit 3 of LLCR is cleared ... 12.6 Register Description 12.6.1 SMCR - Sleep Mode Control Register Bit $33 ($53) Read/Write Initial Value 7 6 5 4 3 2 1 0 Res3 Res2 Res1 Res0 SM2 SM1 SM0 SE R 0 R 0 R 0 R 0 RW 0 RW 0 RW 0 RW 0 SMCR The Sleep Mode Control Register contains control bits for power management. * Bit 7:4 - Res3:0 - Reserved * Bit 3:1 - SM2:0 - Sleep Mode Select bit 2 194 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 These bits select between the five available sleep modes. Standby modes are only recommended for use with external crystals or resonators. Table 12-103 SM Register Bits Register Bits Value Description SM2:0 0x00 Idle 0x01 ADC Noise Reduction (If Available) 0x02 Power Down 0x03 Power Save 0x04 Reserved 0x05 Reserved 0x06 Standby 0x07 Extended Standby * Bit 0 - SE - Sleep Enable The SE bit must be written to logic one to make the MCU enter the sleep mode when the SLEEP instruction is executed. To avoid the MCU entering the sleep mode unless it is the programmers purpose, it is recommended to write the Sleep Enable (SE) bit to one just before the execution of the SLEEP instruction and to clear it immediately after waking up. 12.6.2 PRR0 - Power Reduction Register0 Bit NA ($64) Read/Write Initial Value 7 6 5 4 3 2 PRTWI PRTIM2 PRTIM0 PRPGA PRTIM1 PRSPI R/W 0 R/W 0 R/W 0 R/W 0 R/W 0 R/W 0 1 0 PRUSART0 PRADC R/W 0 PRR0 R/W 0 * Bit 7 - PRTWI - Power Reduction TWI Writing a logic one to this bit shuts down the TWI by stopping the clock to the module. When waking up the TWI again, the TWI should be re initialized to ensure proper operation. * Bit 6 - PRTIM2 - Power Reduction Timer/Counter2 Writing a logic one to this bit shuts down the Timer/Counter2 module. When the Timer/Counter2 is enabled, operation will continue like before the shutdown. * Bit 5 - PRTIM0 - Power Reduction Timer/Counter0 Writing a logic one to this bit shuts down the Timer/Counter0 module. When the Timer/Counter0 is enabled, operation will continue like before the shutdown. * Bit 4 - PRPGA - Power Reduction PGA Writing a logic one to this bit reduced the power consumption of the programmable gain amplifier. The block is not turned off. Only the current levels in the amplifiers are reduced. Reducing the PGA current levels is only recommended for slow ADC clock frequencies. A new ADC conversion using the PGA should be delayed by a default start-up time after changing (setting or resetting) this bit. * Bit 3 - PRTIM1 - Power Reduction Timer/Counter1 Writing a logic one to this bit shuts down the Timer/Counter1 module. When the Timer/Counter1 is enabled, operation will continue like before the shutdown. 195 42073B-MCU Wireless-09/14 * Bit 2 - PRSPI - Power Reduction Serial Peripheral Interface Writing a logic one to this bit shuts down the Serial Peripheral Interface by stopping the clock to the module. When waking up the SPI again, the SPI should be re initialized to ensure proper operation. * Bit 1 - PRUSART0 - Power Reduction USART Writing a logic one to this bit shuts down the USART0 by stopping the clock to the module. When waking up the USART0 again, the USART0 should be reinitialized to ensure proper operation. * Bit 0 - PRADC - Power Reduction ADC Writing a logic one to this bit shuts down the ADC. The ADC must be disabled (reset ADEN bit in register ADCSRA) before shut down. The analog comparator cannot use the ADC input MUX when the ADC is shut down. 12.6.3 PRR1 - Power Reduction Register 1 Bit NA ($65) Read/Write Initial Value 7 Res R 0 6 5 PRTRX24 PRTIM5 RW 0 RW 0 4 3 2 1 0 PRTIM4 PRTIM3 PRUSART1 RW 0 RW 0 RW 0 PRR1 * Bit 7 - Res - Reserved Bit This bit is reserved for future use. A read access always will return zero. A write access does not modify the content. * Bit 6 - PRTRX24 - Power Reduction Transceiver Writing a logic one to this bit shuts down the transceiver (disconnect from the power supply). In power-down and power-save modes the power-chain will be disabled when this bit is one. Writing a logic zero to this bit will re-enable the transceiver. * Bit 5 - PRTIM5 - Power Reduction Timer/Counter5 Writing a logic one to this bit shuts down the Timer/Counter5 module. When the Timer/Counter5 is enabled, operation will continue like before the shutdown. * Bit 4 - PRTIM4 - Power Reduction Timer/Counter4 Writing a logic one to this bit shuts down the Timer/Counter4 module. When the Timer/Counter4 is enabled, operation will continue like before the shutdown. * Bit 3 - PRTIM3 - Power Reduction Timer/Counter3 Writing a logic one to this bit shuts down the Timer/Counter3 module. When the Timer/Counter3 is enabled, operation will continue like before the shutdown. * Bit 0 - PRUSART1 - Power Reduction USART1 Writing a logic one to this bit shuts down the USART1 by stopping the clock to the module. When waking up the USART1 again, the USART1 should be reinitialized to ensure proper operation. 196 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 12.6.4 PRR2 - Power Reduction Register 2 Bit NA ($63) Read/Write Initial Value 7 6 5 4 Res3 Res2 Res1 Res0 R 0 R 0 R 0 R 0 3 2 1 0 PRRAM3 PRRAM2 PRRAM1 PRRAM0 RW 0 RW 0 RW 0 PRR2 RW 0 The Power Reduction Register PRR2 allows to individually disable all four SRAM blocks. Setting any PRRAM3:0 bit to one will completely switch off (disconnect from the power supply) the corresponding SRAM block. This enables the application to disable unused SRAM memory to save power. Every SRAM block can be re-enabled by reseting the appropriate PRRAM3:0 bit. * Bit 7:4 - Res3:0 - Reserved Bit This bit is reserved for future use. A read access always will return zero. A write access does not modify the content. * Bit 3 - PRRAM3 - Power Reduction SRAM 3 Setting this bit to one will disable the SRAM block 3. Setting this bit to zero will enable the SRAM block 3. * Bit 2 - PRRAM2 - Power Reduction SRAM 2 Setting this bit to one will disable the SRAM block 2. Setting this bit to zero will enable the SRAM block 2. * Bit 1 - PRRAM1 - Power Reduction SRAM 1 Setting this bit to one will disable the SRAM block 1. Setting this bit to zero will enable the SRAM block 1. * Bit 0 - PRRAM0 - Power Reduction SRAM 0 Setting this bit to one will disable the SRAM block 0. Setting this bit to zero will enable the SRAM block 0. 12.6.5 TRXPR - Transceiver Pin Register Bit NA ($139) Read/Write Initial Value 7 6 5 4 3 2 1 0 Res3 Res2 Res1 Res0 ATBE TRXTST SLPTR TRXRST R 0 R 0 R 0 R 0 RW 0 RW 0 RW 0 RW 0 TRXPR The register TRXPR allows to control basic actions of the radio transceiver like reset or state transitions. The register bit functionality is inherited from the external pins of the stand-alone radio transceiver. * Bit 7:4 - Res3:0 - Reserved * Bit 3 - ATBE - Analog Test-bus Enable The analog test-bus can be enabled by setting this bit to one. The test-bus can only be activated in the test-mode. Internal analog signals are then available at the TSTOP, TSTON, TSIP and TSTIN pins. * Bit 2 - TRXTST - Transceiver Test-mode Enable The TRXTST bit enables the test-functionality of the transceiver. In addition the general device test-mode must be enabled by applying the appropriate test-signature. 197 42073B-MCU Wireless-09/14 * Bit 1 - SLPTR - Multi-purpose Transceiver Control Bit The bit SLPTR is a multi-functional bit to control transceiver state transitions. Dependent on the radio transceiver state, a rising edge of bit SLPTR causes the following state transitions: TRX_OFF => SLEEP (level sensitive), PLL_ON => BUSY_TX. Whereas the falling edge of bit SLPTR causes the following state transition: SLEEP => TRX_OFF (level sensitive). When the radio transceiver is in TRX_OFF state the microcontroller forces the transceiver to SLEEP by setting SLPTR = H. The Transceiver awakes when the microcontroller releases the bit SLPTR. In states PLL_ON and TX_ARET_ON, bit SLPTR is used as trigger input to initiate a TX transaction. Here SLPTR is sensitive on rising edge only. After initiating a state change by a rising edge at Bit SLPTR in radio transceiver states TRX_OFF, RX_ON or RX_AACK_ON, the radio transceiver remains in the new state as long as the pin is logical high and returns to the preceding state with the falling edge. * Bit 0 - TRXRST - Force Transceiver Reset The RESET state is used to set back the state machine and to reset all registers of the transceiver (except IRQ_MASK) to their default values. A reset forces the radio transceiver into the TRX_OFF state and resets all transceiver register to their default values. A reset is initiated with bit TRXRST = H. The bit is cleared automatically. During transceiver reset the microcontroller has to set the radio transceiver control bit SLPTR to the default value. 12.6.6 DRTRAM0 - Data Retention Configuration Register #0 Bit NA ($135) Read/Write Initial Value 7 6 Res1 Res0 R 0 R 0 5 4 DRTSWOK ENDRT R 0 RW 0 3 2 1 0 DRTMP1 DRTMP0 DRTMN1 DRTMN0 DRTRAM0 RW 0 RW 0 RW 0 RW 0 The DRTRAM0 register controls the behavior of SRAM block #0 (ATmega256RF block #0 and #1 in parallel) in the power-states "power-save" and "power-down". To prevent any data loss the SRAM will not completely disconnected from the power supply. Reserved bits will be overwritten during chip reset by the factory calibration and should not be modified. * Bit 7:6 - Res1:0 - Reserved * Bit 5 - DRTSWOK - DRT Switch OK This bit indicates the status of the SRAM power-switch. A logical one indicates that the SRAM supply voltage is fully available and the memory may be accessed normally. * Bit 4 - ENDRT - Enable SRAM Data Retention During "Deep-Sleep" each SRAM block will either be switched off or provides data retention of its memory content. This bit must set to one if data retention mode should be used. Otherwise the SRAM is switched off (disconnected from the power supply) and all its data are lost. * Bit 3:2 - DRTMP1:0 - Positive Data Retention Voltage Setting The bits DRTMP1:0 define the reduction of the positive supply voltage during data retention (DRT) mode. A preprogrammed calibration value is automatically written to this register during chip reset, giving the factory value. The DRT mode must be enabled by setting ENDRT high. Otherwise the SRAM is switched off (disconnected from the power supply) and all its data are lost. The typical voltage reduction levels are shown in the following table. 198 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Table 12-104 DRTMP Register Bits Register Bits Value DRTMP1:0 Description 0 500 mV 1 425 mV 2 360 mV 3 < 5 mV * Bit 1:0 - DRTMN1:0 - Negative Data Retention Voltage Setting The bits DRTMN1:0 define the reduction of the negative supply voltage during data retention (DRT) mode. A preprogrammed calibration value is automatically written to this register during chip reset, giving the factory value. The DRT mode must be enabled by setting ENDRT high. Otherwise the SRAM is switched off (disconnected from the power supply) and all its data are lost. The typical voltage reduction levels are shown in the following table. Table 12-105 DRTMN Register Bits Register Bits Value DRTMN1:0 Description 0 525 mV 1 415 mV 2 325 mV 3 < 5 mV 12.6.7 DRTRAM1 - Data Retention Configuration Register #1 Bit NA ($134) Read/Write Initial Value 7 6 Res1 Res0 R 0 R 0 5 4 DRTSWOK ENDRT R 0 RW 0 3 2 1 0 DRTMP1 DRTMP0 DRTMN1 DRTMN0 DRTRAM1 RW 0 RW 0 RW 0 RW 0 The DRTRAM1 register controls the behavior of SRAM block #1 (ATmega256RF block #2 and #3 in parallel) in the power-states "power-save" and "power-down". To prevent any data loss the SRAM will not completely disconnected from the power supply. Reserved bits will be overwritten during chip reset by the factory calibration and should not be modified. * Bit 7:6 - Res1:0 - Reserved * Bit 5 - DRTSWOK - DRT Switch OK This bit indicates the status of the SRAM power-switch. A logical one indicates that the SRAM supply voltage is fully available and the memory may be accessed normally. * Bit 4 - ENDRT - Enable SRAM Data Retention During "Deep-Sleep" each SRAM block will either be switched off or provides data retention of its memory content. This bit must set to one if data retention mode should be used. Otherwise the SRAM is switched off (disconnected from the power supply) and all its data are lost. * Bit 3:2 - DRTMP1:0 - Positive Data Retention Voltage Setting The bits DRTMP1:0 define the reduction of the positive supply voltage during data retention (DRT) mode. A preprogrammed calibration value is automatically written to this register during chip reset, giving the factory value. The DRT mode must be enabled by setting ENDRT high. Otherwise the SRAM is switched off (disconnected from the 199 42073B-MCU Wireless-09/14 power supply) and all its data are lost. The typical voltage reduction levels are shown in the following table. Table 12-106 DRTMP Register Bits Register Bits Value DRTMP1:0 Description 0 500 mV 1 425 mV 2 360 mV 3 < 5 mV * Bit 1:0 - DRTMN1:0 - Negative Data Retention Voltage Setting The bits DRTMN1:0 define the reduction of the negative supply voltage during data retention (DRT) mode. A preprogrammed calibration value is automatically written to this register during chip reset, giving the factory value. The DRT mode must be enabled by setting ENDRT high. Otherwise the SRAM is switched off (disconnected from the power supply) and all its data are lost. The typical voltage reduction levels are shown in the following table. Table 12-107 DRTMN Register Bits Register Bits Value DRTMN1:0 Description 0 525 mV 1 415 mV 2 325 mV 3 < 5 mV 12.6.8 DRTRAM2 - Data Retention Configuration Register #2 Bit NA ($133) Read/Write Initial Value 7 6 DISPC Res RW 0 R 0 5 4 3 2 1 0 DRTSWOK ENDRT DRTMP1 DRTMP0 DRTMN1 DRTMN0 DRTRAM2 R 0 RW 0 RW 0 RW 0 RW 0 RW 0 The DRTRAM2 register controls the behavior of SRAM block #2 (ATmega256RF block #4 and #5 in parallel) in the power-states "power-save" and "power-down". To prevent any data loss the SRAM will not completely disconnected from the power supply. Reserved bits will be overwritten during chip reset by the factory calibration and should not be modified. * Bit 7 - DISPC - Disable Power-chain of SRAM 2 This bit allows to temporarily disable the power-chain of the SRAM block #2 (ATmega256RF block #4 and #5 in parallel) . In this way the block can be put into data retention (DRT) mode to measure the DRT voltage levels. See section "SRAM DRT Voltage Measurement" for details. * Bit 6 - Res - Reserved Bit This bit is reserved for future use. A read access always will return zero. A write access does not modify the content. * Bit 5 - DRTSWOK - DRT Switch OK This bit indicates the status of the SRAM power-switch. A logical one indicates that the SRAM supply voltage is fully available and the memory may be accessed normally. 200 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 * Bit 4 - ENDRT - Enable SRAM Data Retention During "Deep-Sleep" each SRAM block will either be switched off or provides data retention of its memory content. This bit must set to one if data retention mode should be used. Otherwise the SRAM is switched off (disconnected from the power supply) and all its data are lost. * Bit 3:2 - DRTMP1:0 - Positive Data Retention Voltage Setting The bits DRTMP1:0 define the reduction of the positive supply voltage during data retention (DRT) mode. A preprogrammed calibration value is automatically written to this register during chip reset, giving the factory value. The DRT mode must be enabled by setting ENDRT high. Otherwise the SRAM is switched off (disconnected from the power supply) and all its data are lost. The typical voltage reduction levels are shown in the following table. Table 12-108 DRTMP Register Bits Register Bits Value DRTMP1:0 Description 0 500 mV 1 425 mV 2 360 mV 3 < 5 mV * Bit 1:0 - DRTMN1:0 - Negative Data Retention Voltage Setting The bits DRTMN1:0 define the reduction of the negative supply voltage during data retention (DRT) mode. A preprogrammed calibration value is automatically written to this register during chip reset, giving the factory value. The DRT mode must be enabled by setting ENDRT high. Otherwise the SRAM is switched off (disconnected from the power supply) and all its data are lost. The typical voltage reduction levels are shown in the following table. Table 12-109 DRTMN Register Bits Register Bits Value DRTMN1:0 Description 0 525 mV 1 415 mV 2 325 mV 3 < 5 mV 12.6.9 DRTRAM3 - Data Retention Configuration Register #3 Bit NA ($132) Read/Write Initial Value 7 6 Res1 Res0 R 0 R 0 5 4 DRTSWOK ENDRT R 0 RW 0 3 2 1 0 DRTMP1 DRTMP0 DRTMN1 DRTMN0 DRTRAM3 RW 0 RW 0 RW 0 RW 0 The DRTRAM3 register controls the behavior of SRAM block #3 (ATmega256RF block #6 and #7 in parallel) in the power-states "power-save" and "power-down". To prevent any data loss the SRAM will not completely disconnected from the power supply. Reserved bits will be overwritten during chip reset by the factory calibration and should not be modified. * Bit 7:6 - Res1:0 - Reserved * Bit 5 - DRTSWOK - DRT Switch OK 201 42073B-MCU Wireless-09/14 This bit indicates the status of the SRAM power-switch. A logical one indicates that the SRAM supply voltage is fully available and the memory may be accessed normally. * Bit 4 - ENDRT - Enable SRAM Data Retention During "Deep-Sleep" each SRAM block will either be switched off or provides data retention of its memory content. This bit must set to one if data retention mode should be used. Otherwise the SRAM is switched off (disconnected from the power supply) and all its data are lost. * Bit 3:2 - DRTMP1:0 - Positive Data Retention Voltage Setting The bits DRTMP1:0 define the reduction of the positive supply voltage during data retention (DRT) mode. A preprogrammed calibration value is automatically written to this register during chip reset, giving the factory value. The DRT mode must be enabled by setting ENDRT high. Otherwise the SRAM is switched off (disconnected from the power supply) and all its data are lost. The typical voltage reduction levels are shown in the following table. Table 12-110 DRTMP Register Bits Register Bits Value DRTMP1:0 Description 0 500 mV 1 425 mV 2 360 mV 3 < 5 mV * Bit 1:0 - DRTMN1:0 - Negative Data Retention Voltage Setting The bits DRTMN1:0 define the reduction of the negative supply voltage during data retention (DRT) mode. A preprogrammed calibration value is automatically written to this register during chip reset, giving the factory value. The DRT mode must be enabled by setting ENDRT high. Otherwise the SRAM is switched off (disconnected from the power supply) and all its data are lost. The typical voltage reduction levels are shown in the following table. Table 12-111 DRTMN Register Bits Register Bits Value DRTMN1:0 Description 0 525 mV 1 415 mV 2 325 mV 3 < 5 mV 12.6.10 LLCR - Low Leakage Voltage Regulator Control Register Bit 7 6 NA ($12F) Res1 Res0 Read/Write Initial Value R 0 R 0 5 4 LLDONE LLCOMP R 0 R 0 3 2 LLCAL LLTCO R 0 RW 0 1 0 LLSHORT LLENCAL RW 0 LLCR RW 1 This register allows to monitor and to control the calibration process of the low-leakage voltage regulator. The automatic calibration is the normal operation mode. However, certain circumstances may require to disable this automatic process for instance to save power-up time. The results of the automatic calibration can also be modified when required by the application for instance to get a higher or lower output voltage. 202 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 * Bit 7:6 - Res1:0 - Reserved Bit This bit is reserved for future use. A read access always will return zero. A write access does not modify the content. * Bit 5 - LLDONE - Calibration Done This bit indicates the last state of the calibration algorithm. The data register contents is updated with new calibration data after the bit changed to 1. The bit will only be high for one 64kHz clock period, because a new calibration loop is started automatically. * Bit 4 - LLCOMP - Comparator Output This bit indicates the output state of the comparator of the low-leakage voltage regulator. In this way the calibration progress can be directly monitored for debug purposes. The state of the bit changes at most every 64kHz clock period. * Bit 3 - LLCAL - Calibration Active This bit indicates that the automatic calibration is in progress. The analog part of the calibration circuit is powered up if the bit is 1. * Bit 2 - LLTCO - Temperature Coefficient of Current Source This bit shows the status of the selection of the temperature coefficient. The state of the bit is updated in the course of the automatic calibration. A valid value is present after the LLDONE bit is 1 for the first time. Write access is only enabled when the automatic calibration is turned off (LLENCAL is 0). This bit should not be changed without further information. * Bit 1 - LLSHORT - Short Lower Calibration Circuit This bit shows the status of the short switch for the lower calibration circuit. The state of the bit is updated in the course of the automatic calibration. A valid value is present after the LLDONE bit is 1 for the first time. If this bit is set to 1 register LLDRL has no function. Write access is only possible when the automatic calibration is turned off (LLENCAL is 0). This bit should not be changed without further information. * Bit 0 - LLENCAL - Enable Automatic Calibration This bit enables the automatic calibration. The automatic calibration runs if the state of the bit is 1. Write access to the two data register and the bits LLSHORT and LLTCO is then denied. If the state of LLENCAL is 0 then the calibration algorithm is stopped and the output voltage of the low-leakage voltage regulator is defined by the values in the two data register LLDRL and LLDRH and by the bits LLSHORT and LLTCO. 12.6.11 LLDRH - Low Leakage Voltage Regulator Data Register (High-Byte) Bit NA ($131) Read/Write Initial Value 7 6 5 Res2 Res1 Res0 R 0 R 0 R 0 4 3 2 1 0 LLDRH4 LLDRH3 LLDRH2 LLDRH1 LLDRH0 RW 0 RW 0 RW 0 RW 0 LLDRH RW 0 The high-byte of the calibration data can be accessed through this register. Write access is only enabled when the bit LLENCAL of the LLCR register is 0. Then the data bits LLDRH4:0 directly control the output voltage of the low-leakage voltage regulator. Higher numbers generate lower voltages. If the bit LLENCAL is 1 then the results of the automatic calibration are stored. * Bit 7:5 - Res2:0 - Reserved These bits are reserved for future use. 203 42073B-MCU Wireless-09/14 * Bit 4:0 - LLDRH4:0 - High-Byte Data Register Bits Value of the high-byte calibration result Table 12-112 LLDRH Register Bits Register Bits Value Description LLDRH4:0 0x00 Calibration limit for fast process corner/high output voltage 0x10 Calibration limit for slow process corner/low output voltage 12.6.12 LLDRL - Low Leakage Voltage Regulator Data Register (Low-Byte) Bit NA ($130) 7 6 5 4 3 2 1 0 Res3 Res2 Res1 Res0 LLDRL3 LLDRL2 LLDRL1 LLDRL0 R 0 R 0 R 0 R 0 RW 0 RW 0 RW 0 RW 0 Read/Write Initial Value LLDRL The low-byte of the calibration data can be accessed through this register. Write access is only enabled when the bit LLENCAL of the LLCR register is 0. Then the data bits LLDRL3:0 directly control the output voltage of the low-leakage voltage regulator. Higher numbers generate lower voltages. The contents of this register is meaningless when the bit LLSHORT of the LLCR register is 1. If the bit LLENCAL is 1 then the results of the automatic calibration are stored. * Bit 7:4 - Res3:0 - Reserved These bits are reserved for future use. * Bit 3:0 - LLDRL3:0 - Low-Byte Data Register Bits Value of the low-byte calibration result Table 12-113 LLDRL Register Bits Register Bits Value Description LLDRL3:0 0x00 Calibration limit for fast process corner/high output voltage 0x08 Calibration limit for slow process corner/low output voltage 12.6.13 DPDS0 - Port Driver Strength Register 0 Bit NA ($136) Read/Write Initial Value 7 6 5 4 3 2 1 0 PFDRV1 PFDRV0 PEDRV1 PEDRV0 PDDRV1 PDDRV0 PBDRV1 PBDRV0 RW 0 RW 0 RW 0 RW 0 RW 0 RW 0 RW 0 DPDS0 RW 0 The output driver strength can be set individually for each digital I/O port. The following tables show output current levels for a typical supply voltage of DEVDD = 3.3V. Refer to section "Electrical Characteristics" for details. * Bit 7:6 - PFDRV1:0 - Driver Strength Port F 204 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Table 12-114 PFDRV Register Bits Register Bits Value PFDRV1:0 Description 0 2 mA 1 4 mA 2 6 mA 3 8 mA * Bit 5:4 - PEDRV1:0 - Driver Strength Port E Table 12-115 PEDRV Register Bits Register Bits Value PEDRV1:0 Description 0 2 mA 1 4 mA 2 6 mA 3 8 mA * Bit 3:2 - PDDRV1:0 - Driver Strength Port D Table 12-116 PDDRV Register Bits Register Bits Value PDDRV1:0 Description 0 2 mA 1 4 mA 2 6 mA 3 8 mA * Bit 1:0 - PBDRV1:0 - Driver Strength Port B Table 12-117 PBDRV Register Bits Register Bits Value PBDRV1:0 Description 0 2 mA 1 4 mA 2 6 mA 3 8 mA 12.6.14 DPDS1 - Port Driver Strength Register 1 Bit NA ($137) Read/Write Initial Value 7 6 5 4 3 2 Res5 Res4 Res3 Res2 Res1 Res0 R 0 R 0 R 0 R 0 R 0 R 0 1 0 PGDRV1 PGDRV0 RW 0 DPDS1 RW 0 The output driver strength can be set individually for each digital I/O port. The following table shows output current levels for a typical supply voltage of DEVDD = 3.3V. Refer to section "Electrical Characteristics" for details. * Bit 7:2 - Res5:0 - Reserved * Bit 1:0 - PGDRV1:0 - Driver Strength Port G Driver strength can be set for port G except the port pins PG3 and PG4. The leakage current of the ports PG3 and PG4 is reduced. 205 42073B-MCU Wireless-09/14 Table 12-118 PGDRV Register Bits Register Bits PGDRV1:0 206 Value Description 0 2 mA 1 4 mA 2 6 mA 3 8 mA ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 13 System Control and Reset 13.1 Resetting the AVR During reset, all I/O Registers are set to their initial values, and the program starts execution from the Reset Vector. The instruction placed at the Reset Vector must be a JMP - Absolute Jump - instruction to the reset handling routine. If the program never enables an interrupt source, the Interrupt Vectors are not used, and regular program code can be placed at these locations. This is also the case if the Reset Vector is in the Application section while the Interrupt Vectors are in the Boot section or vice versa. The circuit diagram in Figure 13-1 on page 208 shows the reset logic."System and Reset Characteristics" on page 553 defines the electrical parameters of the reset circuitry. The I/O ports of the AVR are immediately reset to their initial state when a reset source goes active. This does not require any clock source to be running. After all reset sources have gone inactive, a delay counter is invoked, stretching the internal reset. This allows the power to reach a stable level before normal operation starts. The time-out period of the delay counter is defined by the user through the SUT and CKSEL Fuses. The different selections for the delay period are presented in "Clock Sources" on page 175. 13.2 Reset Sources The ATmega2564/1284/644RFR2 has five sources of reset: * Power-on Reset. The MCU is reset when the supply voltage is below the Power-on Reset threshold (VPOT). * External Reset. The MCU is reset when a low level is present on the RSTN pin for longer than the minimum pulse length. * Watchdog Reset. The MCU is reset when the Watchdog Timer period expires and the Watchdog is enabled. * Brown-out Reset. The MCU is reset when the supply voltage EVDD is below the Brown-out Reset threshold (VBOT) and the Brown-out Detector is enabled. * JTAG AVR Reset. The MCU is reset as long as there is a logic one in the Reset Register, one of the scan chains of the JTAG system. Refer to the section "IEEE 1149.1 (JTAG) Boundary-scan" on page 476 for details. 207 42073B-MCU Wireless-09/14 Figure 13-1. Reset Logic DATA BUS EVDD BORF PORF EXTRF WDRF JTRF MCU Status Register (MCUSR) Brown-out Reset Circuit BODLEVEL [2..0] DEVDD Pull-up Resistor SPIKE FILTER Reset Circuit S COUNTER RESET RSTN Watchdog Timer JTAG Reset Register Watchdog Oscillator Clock Generator CK R Q INTERNAL RESET Power-on Reset Circuit Delay Counters TIMEOUT CKSEL[3:0] SUT[1:0] 13.2.1 Power-on Reset A Power-on Reset (POR) pulse is generated by a dynamic, on-chip detection circuit. The POR is active when DEVDD is rising. The electrical characteristics are defined in "System and Reset Characteristics" on page 553. The POR circuit can be used to trigger the start-up reset. To detect a failure in the supply voltage (e.g. a voltage drop) the brown-own detector should be used. A Power-on Reset (POR) circuit ensures that the device is reset from Power-on. Reaching the Power-on Reset threshold voltage invokes the delay counter, which determines how long the device is kept in RESET after the DEVDD rise. The RESET signal is activated again without any delay, when DEVDD decreases below the detection level. Figure 13-2. MCU Start-up, RSTN Tied to DEVDD DEVDD RSTN TIME-OUT V POT V RST tTOUT INTERNAL RESET 208 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Figure 13-3. MCU Start-up, RSTN Extended Externally VCC V POT V RST RSTN tTOUT TIME-OUT INTERNAL RESET 13.2.2 External Reset An External Reset is generated by a low level on the RSTN pin. Reset pulses longer than the minimum pulse width (see "System and Reset Characteristics" on page 553) will generate a reset, even if the clock is not running. Shorter pulses are not guaranteed to generate a reset. When the applied signal reaches the Reset Threshold Voltage - VRST - on its positive edge, the delay counter starts the MCU after the Time-out period - tTOUT - has expired. Figure 13-4. Reset During Operation DEVDD RSTN TIME-OUT V RST tTOUT INTERNAL RESET 13.2.3 Brown-out Detection ATmega2564/1284/644RFR2 has an On-chip Brown-out Detection (BOD) circuit for monitoring the EVDD level during operation by comparing it to a fixed trigger level. The trigger level for the BOD can be selected by the BODLEVEL Fuses. The trigger level has a hysteresis to ensure spike free Brown-out Detection. The hysteresis on the detection level should be interpreted as VBOT+ = VBOT + VHYST/2 and VBOT-= VBOT VHYST/2. When the BOD is enabled, and EVDD decreases to a value below the trigger level (VBOT- in Figure 13-5 on page 210), the Brown-out Reset is immediately activated. When EVDD increases above the trigger level (VBOT+ in Figure 13-5 on page 210), the delay counter starts the MCU after the Time-out period tTOUT has expired. The BOD circuit will only detect a drop in EVDD if the voltage stays below the trigger level for longer than tBOD given in "System and Reset Characteristics" on page 553. 209 42073B-MCU Wireless-09/14 Figure 13-5. Brown-out Reset During Operation EVDD V BOT+ V BOT- RSTN tTOUT TIME-OUT INTERNAL RESET 13.2.4 Watchdog Reset When the Watchdog times out, it will generate a short reset pulse of one CK cycle duration. On the falling edge of this pulse, the delay timer starts counting the Time-out period tTOUT. See "Watchdog Timer" on page 211. for details on operation of the Watchdog Timer. Figure 13-6. Watchdog Reset During Operation DEVDD RSTN 1 CK Cycle WDT TIME-OUT RESET TIME-OUT tTOUT INTERNAL RESET 13.3 Internal Voltage Reference ATmega2564/1284/644RFR2 features an internal bandgap reference. This reference is used for Brown-out Detection, and it can be used as an input to the Analog Comparator or the ADC. Voltage Reference Enable Signals and Start-up Time The voltage reference has a start-up time that may influence the way it should be used. The start-up time is given in "System and Reset Characteristics" on page 553. To save power, the reference is not always turned on. The reference is on during the following situations: 1. When the BOD is enabled (by programming the BODLEVEL [2:0] Fuse). 2. When the bandgap reference is connected to the Analog Comparator (by setting the ACBG bit in ACSR). 3. When the ADC is enabled. Thus, when the BOD is not enabled, after setting the ACBG bit or enabling the ADC, the user must always allow the reference to start up before the output from the Analog Comparator or ADC is used. To reduce power consumption in Power-down mode, the user can avoid the three conditions above to ensure that the reference is turned off before entering Power-down mode. 210 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 13.4 Watchdog Timer 13.4.1 Features * Clocked from separate On-chip Oscillator * 3 Operating modes - Interrupt - System Reset - Interrupt and System Reset * Selectable Time-out period from 16ms to 8s * Possible Hardware fuse Watchdog always on (WDTON) for fail-safe mode 128kHz OSCILLATOR WATCHDOG RESET WDE OSC/2K OSC/4K OSC/8K OSC/16K OSC/32K OSC/64K OSC/128K OSC/256K OSC/512K OSC/1024K Figure 13-7. Watchdog Timer WDP0 WDP1 WDP2 WDP3 MCU RESET WDIF WDIE INTERRUPT 13.4.2 Overview ATmega2564/1284/644RFR2 has an Enhanced Watchdog Timer (WDT). The WDT is a timer counting cycles of a separate on-chip 128 kHz oscillator. The WDT gives an interrupt or a system reset when the counter reaches a given time-out value. In normal operation mode, it is required that the system uses the WDR -Watchdog Timer Reset instruction to restart the counter before the time-out value is reached. If the system doesn't restart the counter, an interrupt or system reset will be issued. In Interrupt mode, the WDT gives an interrupt when the timer expires. This interrupt can be used to wake the device from sleep-modes, and also as a general system timer. One example is to limit the maximum time allowed for certain operations, giving an interrupt when the operation has run longer than expected. In System Reset mode, the WDT gives a reset when the timer expires. This is typically used to prevent system hang-up in case of runaway code. The third mode, Interrupt and System Reset mode, combines the other two modes by first giving an interrupt and then switch to System Reset mode. This mode will for instance allow a safe shutdown by saving critical parameters before a system reset. The Watchdog always on (WDTON) fuse, if programmed, will force the Watchdog Timer to System Reset mode. With the fuse programmed the System Reset mode bit (WDE) and Interrupt mode bit (WDIE) are locked to 1 and 0 respectively. To further ensure 211 42073B-MCU Wireless-09/14 program security, alterations to the Watchdog set-up must follow timed sequences. The sequence for clearing WDE and changing time-out configuration is as follows: 1. In the same operation, write a logic one to the Watchdog change enable bit (WDCE) and WDE. A logic one must be written to WDE regardless of the previous value of the WDE bit. 2. Within the next four clock cycles, write the WDE and Watchdog prescaler bits (WDP) as desired, but with the WDCE bit cleared. This must be done in one operation. The following code example shows one assembly and one C function for turning off the Watchdog Timer. The example assumes that interrupts are controlled (e.g. by disabling interrupts globally) so that no interrupts will occur during the execution of these functions. (1) Assembly Code Example, Disable Watchdog Timer WDT_off: ; Turn off global interrupt cli ; Reset Watchdog Timer wdr ; Clear WDRF in MCUSR in r16, MCUSR andi r16, (0xff & (0< ;0x15e <__bad_interrupt> ;0x15e <__bad_interrupt> ;0x15e <__bad_interrupt> ;0x15e <__bad_interrupt> ;0x15e <__bad_interrupt> ;Transceiver PLL Lock Handler ;Transceiver PLL Unlock Handler ;Transceiver RX Start Handler ;Transceiver RX End Handler ;Transceiver CCAED DONE Handler ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 0x007C 0x007E 0x0080 0x0082 0x0084 0x0086 0x0088 0x008A 0x008C 0x008E 0x0090 0x0092 0x0094 0x0096 0x0098 ; 0x009A 0x009B 0x009C 0x009D 0x009E 0x009F ... jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp RESET: ... ldi out ldi out sei ... TRX24_XAH_AMI TRX24_TX_END TRX24_AWAKE SCNT_CMP1 SCNT_CMP2 SCNT_CMP3 SCNT_OVFL SCNT_BACKOFF AES_READY BAT_LOW TRX24_TX_START TRX24_AMI0 TRX24_AMI1 TRX24_AMI2 TRX24_AMI3 ;Transceiver Addr. Match Handler ;Transceiver Transmit End Handler ;Transceiver Wake Up Handler ;Symbol Counter Compare Match 1 ;Symbol Counter Compare Match 2 ;Symbol Counter Compare Match 3 ;Symbol Counter Overflow Handler ;Symbol Backoff Slot Counter H. ;Encryption/Decryption Ready H. ;Batterie Monitor Alert Handler ;Transceiver Transmit Start Hand. ;Transceiver Address Match 0 H. ;Transceiver Address Match 1 H. ;Transceiver Address Match 2 H. ;Transceiver Address Match 3 H. r16, high(RAMEND) SPH,r16 r16, low(RAMEND) SPL,r16 ;Main program start ;Set Stack Pointer to top of RAM ;Enable interrupts xxx ... When the BOOTRST Fuse is unprogrammed, the Boot section size set to 8KBytes and the IVSEL bit in the MCUCR Register is set before any interrupts are enabled, the most typical and general program setup for the Reset and Interrupt Vector Addresses is: Address Labels Code Comments________________________ 0x0000 RESET: 0x0001 0x0002 0x0003 0x0004 0x0005 .org 0xF002 0xF002 0xF004 ... ... ... ; 0xF098 ldi r16,high(RAMEND) out SPH,r16 ldi r16,low(RAMEND) out SPL,r16 sei xxx ;Main program start ;Set Stack Pointer to top of RAM jmp EXT_INT0 jmp EXT_INT1 ;IRQ0 Handler ;IRQ1 Handler jmp TRX24_AMI3 ;Transceiver Address Match 3 H. ;Enable interrupts When the BOOTRST Fuse is programmed and the Boot section size set to 8KBytes, the most typical and general program setup for the Reset and Interrupt Vector Addresses is: Address Labels .org 0x0002 0x0002 0x0004 ... ... ... ; .org 0xF000 0xF000 RESET: 0xF001 0xF002 0xF003 0xF004 0xF005 Code Comments________________________ jmp EXT_INT0 jmp EXT_INT1 ;IRQ0 Handler ;IRQ1 Handler ldi r16,high(RAMEND) out SPH,r16 ldi r16,low(RAMEND) out SPL,r16 sei xxx ;Main program start ;Set Stack Pointer to top of RAM ;Enable interrupts 245 42073B-MCU Wireless-09/14 When the BOOTRST Fuse is programmed, the Boot section size set to 8KBytes and the IVSEL bit in the MCUCR Register is set before any interrupts are enabled, the most typical and general program setup for the Reset and Interrupt Vector Addresses is: Address Labels .org 0xF000 0xF000 0xF002 0xF004 ... ... ... ; 0xF09A RESET: 0xF09B 0xF09C 0xF09D 0xF09E 0xF09F Code Comments________________________ jmp RESET jmp EXT_INT0 jmp EXT_INT1 ;Reset handler ;IRQ0 Handler ;IRQ1 Handler ldi r16,high(RAMEND) out SPH,r16 ldi r16,low(RAMEND) out SPL,r16 sei xxx ; Main program start ;Set Stack Pointer to top of RAM ;Enable interrupts 15.3 Moving Interrupts Between Application and Boot Section The MCU Control Register controls the placement of the Interrupt Vector table, see Code Example below. For more details, see "Reset and Interrupt Handling" on page 15. Assembly Code Example Move_interrupts: ; Get MCUCR in r16, MCUCR mov r17, r16 ; Enable change of Interrupt Vectors ori r16, (1< CSn2:0 > 1). The number of system clock cycles from the moment the timer is enabled until the first count occurs can be from 1 to N+1 system clock cycles, where N equals the prescaler divisor (8, 64, 256, or 1024). It is possible to use the prescaler reset for synchronizing the Timer/Counter to program execution. However care must be taken if the other Timer/Counter that shares the same prescaler also uses prescaling. A prescaler reset will affect the prescaler period for all connected Timer/Counters. 19.3 External Clock Source An external clock source applied to the Tn pin can be used as Timer/Counter clock (clkTn). The Tn pin is sampled once every system clock cycle by the pin synchronization logic. The synchronized (sampled) signal is then passed through the edge detector. Figure 19-1 shows a functional equivalent block diagram of the Tn synchronization and edge detector logic. The registers are clocked at the positive edge of the internal system clock (clkI/O). The latch is transparent in the high period of the internal system clock. The edge detector generates one clkTn pulse for each positive (CSn2:0 = 7) or negative (CSn2:0 = 6) edge it detects. Figure 19-1. Tn/T0 Pin Sampling Tn D Q D Q D Tn_sync (To Clock Select Logic) Q LE clk I/O Synchronization Edge Detector The synchronization and edge detector logic introduces a delay of 2.5 to 3.5 system clock cycles from an edge applied to the Tn pin to the counter being updated. 334 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Enabling and disabling of the clock input must be done when Tn has been stable for at least one system clock cycle. Otherwise there is a risk of generating a false Timer/Counter clock pulse. Each half period of the applied, external clock must be longer than one system clock cycle to ensure correct sampling. The external clock must be guaranteed to have less than half the system clock frequency (fExtClk < fclkI/O/2) given a 50/50% duty cycle. Since the edge detector uses sampling, the maximum frequency of a detectable external clock is half the sampling frequency (Nyquist sampling theorem). However due to variation of the system clock frequency and duty cycle caused by Oscillator source (crystal, resonator and capacitors) tolerances, it is recommended to limit the maximum frequency of an external clock source to less than fclkI/O/2.5. An external clock source can not be prescaled. Figure 19-2. Prescaler for synchronous Timer/Counters clk I/O Clear PSR10 Tn Synchronization Tn Synchronization CSn0 CSn0 CSn1 CSn1 CSn2 CSn2 TIMER/COUNTERn CLOCK SOURCE clkTn TIMER/COUNTERn CLOCK SOURCE clkTn 19.4 Register Description 19.4.1 GTCCR - General Timer/Counter Control Register Bit 7 6 5 4 3 2 $23 ($43) TSM Res4 Res3 Res2 Res1 Res0 Read/Write Initial Value RW 0 R 0 R 0 R 0 R 0 R 0 1 0 PSRASY PSRSYNC R 0 GTCCR RW 0 * Bit 7 - TSM - Timer/Counter Synchronization Mode Writing the TSM bit to one activates the Timer/Counter Synchronization mode. In this mode the value that is written to the PSRASY and PSRSYNC bits is kept, hence keeping the corresponding prescaler reset signals asserted. This ensures that the corresponding Timer/Counters are halted and can be configured to the same value without the risk of one of them advancing during the configuration. When the TSM bit is written to zero, the PSRASY and PSRSYNC bits are cleared by hardware and the Timer/Counters simultaneously start counting. * Bit 6:2 - Res4:0 - Reserved 335 42073B-MCU Wireless-09/14 This bit is reserved for future use. A read access always will return zero. A write access does not modify the content. * Bit 1 - PSRASY - Prescaler Reset Timer/Counter2 When this bit is one, the Timer/Counter2 prescaler will be reset. This bit is normally cleared immediately by hardware. If the bit is written when Timer/Counter2 is operating in asynchronous mode, the bit will remain one until the prescaler has been reset. The bit will not be cleared by hardware if the TSM bit is set. * Bit 0 - PSRSYNC - Prescaler Reset for Synchronous Timer/Counters When this bit is one, the Timer/Counter0, Timer/Counter1, Timer/Counter3, Timer/Counter4 and Timer/Counter5 prescaler will be reset. This bit is normally cleared immediately by hardware, except if the TSM bit is set. Note that Timer/Counter0, Timer/Counter1, Timer/Counter3, Timer/Counter4 and Timer/Counter5 share the same prescaler and a reset of this prescaler will affect all timers. 336 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 20 Output Compare Modulator (OCM1C0A) 20.1 Overview The Output Compare Modulator (OCM) allows generation of waveforms modulated with a carrier frequency. The modulator uses the outputs from the Output Compare Unit C of the 16-bit Timer/Counter1 and the Output Compare Unit of the 8-bit Timer/Counter0. For more details about these Timer/Counters see "Timer/Counter 0, 1, 3, 4, and 5 Prescaler" on page 334 and "8-bit Timer/Counter2 with PWM and Asynchronous Operation" on page 339. Figure 20-1. Output Compare Modulator, Block Diagram Timer/Counter 1 OC1C Pin Timer/Counter 0 OC1C / OC0A / PB7 OC0A When the modulator is enabled, the two output compare channels are modulated together as shown in the block diagram (Figure 20-1 above). 20.2 Description The Output Compare unit 1C and Output Compare unit 2 share the PB7 port pin for output. The outputs of the Output Compare units (OC1C and OC0A) override the normal PORTB7 Register when one of them is enabled (i.e., when COMnx1:0 is not equal to zero). When both OC1C and OC0A are enabled at the same time, the modulator is automatically enabled. The functional equivalent schematic of the modulator is shown on in the following figure. The schematic includes part of the Timer/Counter units and the port B bit 7 output driver circuit. Figure 20-2. Output Compare Modulator, Schematic COMA01 COMA00 Vcc COM1C1 COM1C0 ( From Waveform Generator ) Modulator 0 D 1 Q 1 OC1C Pin 0 ( From Waveform Generator ) D Q OC1C / OC0A/ PB7 OC0A D Q D PORTB7 Q DDRB7 DATABUS 337 42073B-MCU Wireless-09/14 When the modulator is enabled the type of modulation (logical AND or OR) can be selected by the PORTB7 Register. Note that the DDRB7 controls the direction of the port independent of the COMnx1:0 bit setting. 20.3 Timing Example Figure 20-3 below illustrates the modulator in action. In this example the Timer/Counter1 is set to operate in fast PWM mode (non-inverted) and Timer/Counter0 uses CTC waveform mode with toggle Compare Output mode (COMnx1:0 = 1). Figure 20-3. Output Compare Modulator, Timing Diagram clk I/O OC1C (FPWM Mode) OC0A (CTC Mode) PB7 (PORTB7 = 0) PB7 (PORTB7 = 1) (Period) 1 2 3 In this example Timer/Counter2 provides the carrier while the modulating signal is generated by the Output Compare unit C of the Timer/Counter1. The resolution of the PWM signal (OC1C) is reduced by the modulation. The reduction factor is equal to the number of system clock cycles of one period of the carrier (OC0A). In this example the resolution is reduced by a factor of two. The reason for the reduction is illustrated in Figure 20-3 above at the second and third period of the PB7 output when PORTB7 equals zero. The period 2 high time is one cycle longer than the period 3 high time, but the result on the PB7 output is equal in both periods. 338 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 21 8-bit Timer/Counter2 with PWM and Asynchronous Operation 21.1 Features Timer/Counter2 is a general purpose, single channel, 8-bit Timer/Counter module. The main features are: * Single channel counter * Clear timer on compare match (auto reload) * Glitch-free, phase-correct pulse-width modulator (PWM) * Frequency generator * 10 bit clock prescaler * Overflow and compare match interrupt sources (TOV2, OCF2A and OCF2B) * Able to run with external 32 kHz watch crystal independent of the I/O clock 21.2 Overview A simplified block diagram of the 8-bit Timer/Counter is shown on Figure 21-1 on page 340. For the current placement of I/O pins, see chapter "Pin Configurations" on page 2. CPU accessible I/O Registers, including I/O bits and I/O pins, are shown in bold. The device-specific I/O Register and bit locations are listed in the "Register Description" on page 354. The Power Reduction Timer/Counter2 bit PRTIM2 in register PRR0 (see "PRR0 - Power Reduction Register0" on page 195) must be written to zero to enable Timer/Counter2 module. Note: OC2B is implemented but not routed to a pin and for this reason it can't be used. 21.2.1 Registers The Timer/Counter (TCNT2) and Output Compare Register (OCR2A and OCR2B) are 8 bit registers. Interrupt request (abbreviated to Int.Req.) signals are all visible in the Timer Interrupt Flag Register (TIFR2). All interrupts are individually masked with the Timer Interrupt Mask Register (TIMSK2). TIFR2 and TIMSK2 are not shown in the figure. The Timer/Counter can be clocked internally, via the prescaler, asynchronously clocked from the TOSC1/2 pins or alternatively from the Automated Meter Reading (AMR) pin as detailed later in this section. The asynchronous operation is controlled by the Asynchronous Status Register (ASSR). The Clock Select logic block controls which clock source the Timer/Counter uses to increment (or decrement) its value. The Timer/Counter is inactive when no clock source is selected. The output from the Clock Select logic is referred to as the timer clock (clkT2). The double buffered Output Compare Register (OCR2A and OCR2B) are compared with the Timer/Counter value at all times. The result of the compare can be used by the Waveform Generator to generate a PWM or variable frequency output on the Output Compare pins (OC2A and OC2B). See chapter "Output Compare Unit" on page 346 for details. The compare match event will also set the Compare Flag (OCF2A or OCF2B) which can be used to generate an Output Compare interrupt request. 21.2.2 Definitions Many register and bit references in this document are written in general form. A lower case "n" replaces the Timer/Counter number, in this case 2. However, when using the 339 42073B-MCU Wireless-09/14 register or bit defines in a program, the precise form must be used, i.e., TCNT2 for accessing Timer/Counter2 counter value and so on. Figure 21-1. 8-bit Timer/Counter Block Diagram The definitions in Table Table 21-1 below are also used extensively throughout the section. Table 21-1. Definitions BOTTOM The counter reaches the BOTTOM when it becomes zero (0x00). MAX The counter reaches its MAXimum when it becomes 0xFF (decimal 255). TOP The counter reaches the TOP when it becomes equal to the highest value in the count sequence. The TOP value can be assigned to be the fixed value 0xFF (MAX) or the value stored in the OCR2A Register. The assignment is dependent on the mode of operation. 21.3 Timer/Counter Clock Sources The Timer/Counter can be clocked by an internal synchronous or an external asynchronous clock source. The clock source clkT2 is by default equal to the MCU clock, clkI/O. When the AS2 bit in the ASSR Register is written to logic one, the clock source is either taken from the Timer/Counter Oscillator connected to TOSC1 and TOSC2 or from the AMR pin. For details on asynchronous operation, see section 340 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 "Asynchronous Operation of Timer/Counter2" on page 350. For details on clock sources and prescaler, see section "Timer/Counter Prescaler" on page 353. 21.4 Counter Unit The main part of the 8-bit Timer/Counter is the programmable bi-directional counter unit. Figure 21-2 below shows a block diagram of the counter and its surrounding environment. Figure 21-2. Counter Unit Block Diagram Signal description (internal signals): count Increment or decrement TCNT2 by 1. direction Selects between increment and decrement. clear Clear TCNT2 (set all bits to zero). clkTn Timer/Counter clock, referred to as clkT2 in the following. top Signalizes that TCNT2 has reached maximum value. bottom Signalizes that TCNT2 has reached minimum value (zero). Depending on the mode of operation used, the counter is cleared, incremented, or decremented at each timer clock (clkT2). clkT2 can be generated from an external or internal clock source, selected by the Clock Select bits (CS22:0). When no clock source is selected (CS22:0 = 0) the timer is stopped. However, the TCNT2 value can be accessed by the CPU, regardless of whether clkT2 is present or not. A CPU write overrides (has priority over) all counter clear or count operations. The counting sequence is determined by the setting of the WGM21 and WGM20 bits located in the Timer/Counter Control Register (TCCR2A) and the WGM22 located in the Timer/Counter Control Register B (TCCR2B). There are close connections between how the counter behaves (counts) and how waveforms are generated on the Output Compare outputs OC2A and OC2B. For more details about advanced counting sequences and waveform generation, see chapter "Modes of Operation" below. The Timer/Counter Overflow Flag (TOV2) is set according to the mode of operation selected by the WGM22:0 bits. TOV2 can be used for generating a CPU interrupt. 21.5 Modes of Operation The mode of operation, i.e., the behaviour of the Timer/Counter and the Output Compare pins, is defined by the combination of the Waveform Generation mode (WGM22:0) and Compare Output mode (COM2x1:0) bits. The Compare Output mode bits do not affect the counting sequence, while the Waveform Generation mode bits do. The COM2x1:0 bits control whether the PWM output generated should be inverted or 341 42073B-MCU Wireless-09/14 not (inverted or non-inverted PWM). For non-PWM modes the COM2x1:0 bits control whether the output should be set, cleared, or toggled at a compare match (see chapter "Compare Match Output Unit" on page 347). For detailed timing information refer to chapter "Timer/Counter Timing Diagrams" on page 349. The following table shows the function of the WGM22:0 bits of registers TCCR2A and TCCR2B. These bits control the counting sequence of the counter, the source for maximum (TOP) counter value, and what type of waveform generation to be used. Table 21-2. Waveform Generation Mode Bit Description Mode WGM2 WGM1 WGM0 Timer/Counter Mode of Operation 0 0 0 0 Normal 0xFF Immediate MAX 1 0 0 1 PWM, Phase Correct 0xFF TOP BOTTOM 2 0 1 0 CTC OCRA Immediate MAX 3 0 1 1 Fast PWM 0xFF TOP MAX 4 1 0 0 Reserved - - - 5 1 0 1 PWM, Phase Correct OCRA TOP BOTTOM 6 1 1 0 Reserved - - - 7 1 1 1 Fast PWM OCRA BOTTOM TOP Notes: TOP Update of OCRX at TOV Flag (1,2) Set on 1. MAX = 0xFF 2. BOTTOM = 0x00 21.5.1 Normal Mode The simplest mode of operation is the Normal mode (WGM22:0 = 0). In this mode the counting direction is always up (incrementing), and no counter clear is performed. The counter simply overruns when it passes its maximum 8 bit value (TOP = 0xFF) and then restarts from the bottom (0x00). In normal operation the Timer/Counter Overflow Flag (TOV2) will be set in the same timer clock cycle as the TCNT2 becomes zero. The TOV2 Flag in this case behaves like a ninth bit, except that it is only set, not cleared. However combined with the timer overflow interrupt that automatically clears the TOV2 Flag, the timer resolution can be increased by software. There are no special cases to consider in the Normal mode, a new counter value can be written anytime. The Output Compare unit can be used to generate interrupts at some given time. Using the Output Compare to generate waveforms in Normal mode is not recommended, since this will occupy too much of the CPU time. 21.5.2 Clear Timer on Compare Match (CTC) Mode In Clear Timer on Compare or CTC mode (WGM22:0 = 2), the OCR2A Register is used to manipulate the counter resolution. In CTC mode the counter is cleared to zero when the counter value (TCNT2) matches the OCR2A. The OCR2A defines the top value for the counter, hence also its resolution. This mode allows greater control of the compare match output frequency. It also simplifies the operation of counting external events. The timing diagram for the CTC mode is shown in Table 20-3. The counter value (TCNT2) increases until a compare match occurs between TCNT2 and OCR2A, and then counter (TCNT2) is cleared. 342 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Figure 21-3. CTC Mode, Timing Diagram OCnx Interrupt Flag Set TCNTn OCn (Toggle) Period (COMnx1:0 = 1) 1 2 3 4 An interrupt can be generated each time the counter value reaches the TOP value by using the OCF2A Flag. If the interrupt is enabled, the interrupt handler routine can be used for updating the TOP value. However, changing TOP to a value close to BOTTOM when the counter is running with none or a low prescaler value must be done with care since the CTC mode does not have the double buffering feature. If the new value written to OCR2A is lower than the current value of TCNT2, the counter will miss the compare match. The counter will then have to count to its maximum value (0xFF) and wrap around starting at 0x00 before the compare match can occur. For generating a waveform output in CTC mode, the OC2A output can be set to toggle its logical level on each compare match by setting the Compare Output mode bits to toggle mode (COM2A1:0 = 1). The OC2A value will not be visible on the port pin unless the data direction for the pin is set to output. The waveform generated will have a maximum frequency of fOC2A = fclkI/O/2 when OCR2A is set to zero (0x00). The waveform frequency is defined by the following equation f OCnx = f clkI / O 2 N (1 + OCRnx) The N variable represents the pre-scale factor (1, 8, 32, 64, 128, 256, or 1024). As for the Normal mode of operation, the TOV2 Flag is set in the same timer clock cycle that the counter counts from MAX to 0x00. 21.5.3 Fast PWM Mode The Timer/Counter Overflow Flag (TOV2) is set each time the counter reaches TOP. If the interrupt is enabled, the interrupt handler routine can be used for updating the compare value. In fast PWM mode, the compare unit allows generation of PWM waveforms on the OC2x pin. Setting the COM2x1:0 bits to two will produce a non-inverted PWM and an inverted PWM output can be generated by setting the COM2x1:0 to three. TOP is defined as 0xFF when WGM22:0 = 3, and OCR2A when WGM22:0 = 7 (see section "Register Description" on page 354 for register TCCR2A). The actual OC2x value will only be visible on the port pin if the data direction for the port pin is set as output. The PWM waveform is generated by setting (or clearing) the OC2x Register at the compare match between OCR2x and TCNT2, and clearing (or setting) the OC2x Register at the timer clock cycle the counter is cleared (changes from TOP to BOTTOM). 343 42073B-MCU Wireless-09/14 Figure 21-4. Fast PWM Mode, Timing Diagram OCRnx Interrupt Flag Set OCRnx Update and TOVn Interrupt Flag Set TCNTn OCnx (COMnx1:0 = 2) OCnx (COMnx1:0 = 3) Period 1 2 3 4 5 6 7 The PWM frequency for the output can be calculated by the following equation: f OCnxPWM = f clkI / O N 256 The N variable represents the pre-scale factor (1, 8, 32, 64, 128, 256, or 1024). The extreme values for the OCR2A Register represent special cases when generating a PWM waveform output in the fast PWM mode. If the OCR2A is set equal to BOTTOM, the output will be a narrow spike for each MAX+1 timer clock cycle. Setting the OCR2A equal to MAX will result in a constantly high or low output (depending on the polarity of the output set by the COM2A1:0 bits.) A frequency (with 50% duty cycle) waveform output in fast PWM mode can be achieved by setting OC2x to toggle its logical level on each compare match (COM2x1:0 = 1). The waveform generated will have a maximum frequency of fOC2A = fclkI/O/2 when OCR2A is set to zero. This feature is similar to the OC2A toggle in CTC mode, except the double buffer feature of the Output Compare unit is enabled in the fast PWM mode. 21.5.4 Phase Correct PWM Mode The phase correct PWM mode (WGM22:0 = 1 or 5) provides a high resolution phase correct PWM waveform generation option. The phase correct PWM mode is based on a dual-slope operation. The counter counts repeatedly from BOTTOM to TOP and then from TOP to BOTTOM. TOP is defined as 0xFF when WGM22:0 = 1, and OCR2A when WGM22:0 = 5. In non-inverting Compare Output mode, the Output Compare (OC2x) is cleared on the compare match between TCNT2 and OCR2x while up-counting, and set on the compare match while down-counting. In inverting Output Compare mode, the operation is inverted. The dual-slope operation has lower maximum operation frequency than single slope operation. However, due to the symmetric feature of the dual-slope PWM modes, these modes are preferred for motor control applications. In phase correct PWM mode the counter is incremented until the counter value matches TOP. When the counter reaches TOP, it changes the count direction. The TCNT2 value will be equal to TOP for one timer clock cycle. The timing diagram for the phase correct PWM mode is shown on Figure 21-5 on page 345. The TCNT2 value is in the timing diagram shown as a histogram for illustrating the dual-slope operation. The diagram 344 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 includes non-inverted and inverted PWM outputs. The small horizontal line marks on the TCNT2 slopes represent compare matches between OCR2x and TCNT2. Figure 21-5. Phase Correct PWM Mode, Timing Diagram OCnx Interrupt Flag Set OCRnx Update TOVn Interrupt Flag Set TCNTn OCnx (COMnx1:0 = 2) OCnx (COMnx1:0 = 3) Period 1 2 3 The Timer/Counter Overflow Flag (TOV2) is set each time the counter reaches BOTTOM. The Interrupt Flag can be used to generate an interrupt each time the counter reaches the BOTTOM value. In phase correct PWM mode, the compare unit allows generation of PWM waveforms on the OC2x pin. Setting the COM2x1:0 bits to two will produce a non-inverted PWM. An inverted PWM output can be generated by setting the COM2x1:0 to three. TOP is defined as 0xFF when WGM22:0 = 3, and OCR2A when WGM22:0 = 7 (see section "Register Description" on page 354 for register TCCR2A). The actual OC2x value will only be visible on the port pin if the data direction for the port pin is set as output. The PWM waveform is generated by clearing (or setting) the OC2x Register at the compare match between OCR2x and TCNT2 when the counter increments, and setting (or clearing) the OC2x Register at compare match between OCR2x and TCNT2 when the counter decrements. The PWM frequency for the output when using phase correct PWM can be calculated by the following equation: f OCnxPCPWM = f clk _ I / O N 510 The N variable represents the pre-scale factor (1, 8, 32, 64, 128, 256, or 1024). The extreme values for the OCR2A Register represent special cases when generating a PWM waveform output in the phase correct PWM mode. If the OCR2A is set equal to BOTTOM, the output will be continuously low and if set equal to MAX the output will be continuously high for non-inverted PWM mode. For inverted PWM the output will have the opposite logic values. At the very start of period 2 in Figure 21-5 above OCnx has a transition from high to low even though there is no Compare Match. The point of this transition is to guarantee symmetry around BOTTOM. There are two cases that give a transition without Compare Match. 345 42073B-MCU Wireless-09/14 * OCR2A changes its value from MAX, like in Figure 21-5 on page 345. When the OCR2A value is MAX the OCn pin value is the same as the result of a downcounting compare match. To ensure symmetry around BOTTOM the OCn value at MAX must correspond to the result of an up-counting Compare Match. * The timer starts counting from a value higher than the one in OCR2A, and for that reason misses the Compare Match and hence the OCn change that would have happened on the way up. 21.6 Output Compare Unit The 8 bit comparator continuously compares TCNT2 with the Output Compare Register (OCR2A and OCR2B). Whenever TCNT2 equals OCR2A or OCR2B, the comparator signals a match. A match will set the Output Compare Flag (OCF2A or OCF2B) at the next timer clock cycle. If the corresponding interrupt is enabled, the Output Compare Flag generates an Output Compare interrupt. The Output Compare Flag is automatically cleared when the interrupt is executed. Alternatively, the Output Compare Flag can be cleared by software by writing a logical one to its I/O bit location. The Waveform Generator uses the match signal to generate an output according to operating mode set by the WGM22:0 bits and Compare Output mode (COM2x1:0) bits. The max and bottom signals are used by the Waveform Generator for handling the special cases of the extreme values in some modes of operation (chapter "Modes of Operation" on page 341). Figure 21-6 below shows a block diagram of the Output Compare unit. Figure 21-6. Output Compare Unit, Block Diagram DATA BUS OCRn TCNTn = (8-bit Comparator ) OCFn (Int.Req.) top bottom Waveform Generator OCxy FOCn WGMn1:0 COMn1:0 The OCR2x Register is double buffered when using any of the Pulse Width Modulation (PWM) modes. For the Normal and Clear Timer on Compare (CTC) modes of operation, the double buffering is disabled. The double buffering synchronizes the update of the OCR2x Compare Register to either top or bottom of the counting sequence. The synchronization prevents the occurrence of odd-length, non-symmetrical PWM pulses, thereby making the output glitch-free. 346 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 The OCR2x Register access may seem complex, but this is not the case. When the double buffering is enabled, the CPU has access to the OCR2x Buffer Register, and if double buffering is disabled the CPU will access the OCR2x directly. 21.6.1 Force Output Compare In non-PWM waveform generation modes, the match output of the comparator can be forced by writing a one to the Force Output Compare (FOC2x) bit. Forcing compare match will not set the OCF2x Flag or reload/clear the timer, but the OC2x pin will be updated as if a real compare match had occurred (the COM2x1:0 bits settings define whether the OC2x pin is set, cleared or toggled). 21.6.2 Compare Match Blocking by TCNT2 Write All CPU write operations to the TCNT2 Register will block any compare match that occurs in the next timer clock cycle, even when the timer is stopped. This feature allows OCR2x to be initialized to the same value as TCNT2 without triggering an interrupt when the Timer/Counter clock is enabled. 21.6.3 Using the Output Compare Unit Since writing TCNT2 in any mode of operation will block all compare matches for one timer clock cycle, there are risks involved when changing TCNT2 when using the Output Compare channel, independently of whether the Timer/Counter is running or not. If the value written to TCNT2 equals the OCR2x value, the compare match will be missed, resulting in incorrect waveform generation. Similarly, do not write the TCNT2 value equal to BOTTOM when the counter is down-counting. The setup of the OC2x should be performed before setting the Data Direction Register for the port pin to output. The easiest way of setting the OC2x value is to use the Force Output Compare (FOC2x) strobe bit in Normal mode. The OC2x Register keeps its value even when changing between Waveform Generation modes. Be aware that the COM2x1:0 bits are not double buffered together with the compare value. A change of the COM2x1:0 bits will take effect immediately. 21.7 Compare Match Output Unit The Compare Output mode (COM2x1:0) bits have two functions. The Waveform Generator uses the COM2x1:0 bits for defining the Output Compare (OC2x) state at the next compare match. Also, the COM2x1:0 bits control the OC2x pin output source. Figure 20-7 shows a simplified schematic of the logic affected by the COM2x1:0 bit setting. The I/O Registers, I/O bits, and I/O pins in the figure are shown in bold. Only the parts of the general I/O Port Control Registers (DDR and PORT) that are affected by the COM2x1:0 bits are shown. When referring to the OC2x state, the reference is for the internal OC2x Register, not the OC2x pin. The general I/O port function is overridden by the Output Compare (OC2x) from the Waveform Generator if either of the COM2x1:0 bits are set. However, the OC2x pin direction (input or output) is still controlled by the Data Direction Register (DDR) for the port pin. The Data Direction Register bit for the OC2x pin (DDR_OC2x) must be set as output before the OC2x value is visible on the pin. The port override function is independent of the Waveform Generation mode. The design of the Output Compare pin logic allows initialization of the OC2x state before the output is enabled. Note that some COM2x1:0 bit settings are reserved for certain modes of operation. See section "Register Description" on page 354 for details. 347 42073B-MCU Wireless-09/14 Figure 21-7. Compare Match Output Unit, Schematic COMnx1 COMnx0 FOCn Waveform Generator D Q 1 OCnx DATA BUS D 0 OCnx Pin Q PORT D Q DDR clk I/O 21.7.1 Compare Output Mode and Waveform Generation The Waveform Generator uses the COM2x1:0 bits differently in normal, CTC, and PWM modes. Setting the COM2x1:0 = 0 for all modes tells the Waveform Generator that no action on the OC2x Register is to be performed on the next compare match. For compare output actions in the non-PWM modes for fast PWM mode and for phase correct PWM refer to section "Register Description" on page 354 for register TCCR2A. A change of the COM2x1:0 bits state will have effect at the first compare match after the bits are written. For non-PWM modes, the action can be forced to have immediate effect by using the FOC2x strobe bits. The following table shows the COM2x1:0 bit functionality when the WGM02:0 bits are set to a normal or CTC mode (non-PWM). Table 21-3. Compare Output Mode, non-PWM Mode COM2x1 COM2x0 0 0 Normal port operation, OC2x disconnected; Description 0 1 Toggle OC2x on Compare Match; 1 0 Clear OC2x on Compare Match; 1 1 Set OC2x on Compare Match; Table 17-3 shows the COM2x1:0 bit functionality when the WGM21:0 bits are set to fast PWM mode. Table 21-4. Compare Output Mode, Fast PWM Mode 348 COM2x1 COM2x0 Description 0 0 Normal port operation, OC2x disconnected. 0 1 WGM22 = 0: Normal Port Operation, OC2A Disconnected. WGM22 = 1: Toggle OC2A on Compare Match. OC2B: not applicable, reserved function; ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 COM2x1 COM2x0 1 0 Clear OC2x on Compare Match, set OC2x at BOTTOM, (noninverting mode). 1 1 Set OC2x on Compare Match, clear OC2x at BOTTOM, (inverting mode). Note: Description 1. A special case occurs when OCR2x equals TOP and COM2x1 is set. In this case, the Compare Match is ignored, but the set or clear is done at BOTTOM. See "Fast PWM Mode" on page 343. Table 17-4 shows the COM2x1:0 bit functionality when the WGM22:0 bits are set to phase correct PWM mode. Table 21-5. Compare Output Mode, Phase Correct PWM Mode COM2x1 COM2x0 0 0 Normal port operation, OC2x disconnected. 0 1 WGM22 = 0: Normal Port Operation, OC2A Disconnected. WGM22 = 1: Toggle OC2A on Compare Match. OC2B: not applicable, reserved function; 1 0 Clear OC2x on Compare Match when up-counting. Set OC2x on Compare Match when down-counting. 1 1 Set OC2x on Compare Match when up-counting. Clear OC2x on Compare Match when down-counting. Note: Description 1. A special case occurs when OCR2x equals TOP and COM2x1 is set. In this case, the Compare Match is ignored, but the set or clear is done at TOP. See "Phase Correct PWM Mode" on page 344 for more details. 21.8 Timer/Counter Timing Diagrams The following figures show the Timer/Counter in synchronous mode, and the timer clock (clkT2) is therefore shown as a clock enable signal. In asynchronous mode, clkI/O should be replaced by the Timer/Counter Oscillator clock. The figures include information on when Interrupt Flags are set. Figure 21-8 below contains timing data for basic Timer/Counter operation. The figure shows the count sequence close to the MAX value in all modes other than phase correct PWM mode. Figure 21-8. Timer/Counter Timing Diagram, no Prescaling clkI/O clkTn (clkI/O /1) TCNTn MAX - 1 MAX BOTTOM BOTTOM + 1 TOVn 349 42073B-MCU Wireless-09/14 Figure 21-9 below shows the same timing data, but with the prescaler enabled. Figure 21-9. Timer/Counter Timing Diagram, with Prescaler (fclkI/O/8) clkI/O clkTn (clkI/O /8) TCNTn MAX - 1 MAX BOTTOM BOTTOM + 1 TOVn Figure 21-10 below shows the setting of OCF2A in all modes except CTC mode. Figure 21-10. Timer/Counter Timing Diagram, Setting of OCF2A, with Prescaler (fclkI/O/8) clkI/O clkTn (clkI/O /8) TCNTn OCRnx - 1 OCRnx OCRnx + 1 OCRnx + 2 OCRnx Value OCRnx OCFnx Figure 21-11 below shows the setting of OCF2A and the clearing of TCNT2 in CTC mode. Figure 21-11. Timer/Counter Timing Diagram, Clear Timer on Compare Match mode, with Prescaler (fclkI/O/8) clkI/O clkTn (clkI/O /8) TCNTn (CTC) TOP - 1 OCRnx TOP BOTTOM BOTTOM + 1 TOP OCFnx 21.9 Asynchronous Operation of Timer/Counter2 When Timer/Counter2 operates asynchronously, some considerations must be taken. 350 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 * Warning: When switching between asynchronous and synchronous clocking of Timer/Counter2, the Timer Registers TCNT2, OCR2x, and TCCR2x might be corrupted. A safe procedure for switching clock source is: 1. Disable the Timer/Counter2 interrupts by clearing OCIE2x and TOIE2. 2. Select clock source by setting AS2 as appropriate. 3. Write new values to TCNT2, OCR2x, and TCCR2x. 4. To switch to asynchronous operation: Wait for TCN2UB, OCR2xUB, and TCR2xUB. 5. Clear the Timer/Counter2 Interrupt Flags. 6. Enable interrupts, if needed. * The CPU main clock frequency must be more than four times the Oscillator frequency. * When writing to one of the registers TCNT2, OCR2x, or TCCR2x, the value is transferred to a temporary register, and latched after two positive edges on TOSC1. The user should not write a new value before the contents of the temporary register have been transferred to its destination. Each of the five mentioned registers have their individual temporary register, which means that e.g. writing to TCNT2 does not disturb an OCR2x write in progress. To detect that a transfer to the destination register has taken place, the Asynchronous Status Register - ASSR has been implemented. * When entering Power-save or ADC Noise Reduction mode after having written to TCNT2, OCR2x, or TCCR2x, the user must wait until the written register has been updated if Timer/Counter2 is used to wake up the device. Otherwise, the MCU will enter sleep mode before the changes are effective. This is particularly important if any of the Output Compare2 interrupt is used to wake up the device, since the Output Compare function is disabled during writing to OCR2x or TCNT2. If the write cycle is not finished, and the MCU enters sleep mode before the corresponding OCR2xUB bit returns to zero, the device will never receive a compare match interrupt, and the MCU will not wake up. * If Timer/Counter2 is used to wake the device up from Power-save or ADC Noise Reduction mode, precautions must be taken if the user wants to re-enter one of these modes: The interrupt logic needs one TOSC1 cycle to be reset. If the time between wake-up and re-entering sleep mode is less than one TOSC1 cycle, the interrupt will not occur, and the device will fail to wake up. If the user is in doubt whether the time before re-entering Power-save or ADC Noise Reduction mode is sufficient, the following algorithm can be used to ensure that one TOSC1 cycle has elapsed: 1. Write a value to TCCR2x, TCNT2, or OCR2x. 2. Wait until the corresponding Update Busy Flag in ASSR returns to zero. . 3. Enter Power-save or ADC Noise Reduction mode. C Code Example (Fragment) (1) ISR( TIMER2_OVF_vect ) {...} // TC2 overflow IRQ service routine int main(void){ ... ASSR = 1<>8); UBRRnL = (unsigned char) ubrr; /* Enable receiver and transmitter */ UCSRnB = (1<> 1) & 0x01; return ((resh << 8) | resl); } Note: 1. See "About Code Examples" on page 8 The receive function example reads all the I/O registers into the register file before any computation is done. This gives an optimal receive buffer utilization since the buffer location read will be free to accept new data as early as possible. 23.7.3 Receive Complete Flag and Interrupt The USART receiver has one flag that indicates the receiver state. The Receive Complete Flag (RXCn) indicates if there are unread data present in the receive buffer. This flag is one when unread data exist in the receive buffer, and zero when the receive buffer is empty (i.e., does not contain any unread data). If the receiver is disabled (RXENn = 0), the receive buffer will be flushed and consequently the RXCn bit will become zero. When the Receive Complete Interrupt Enable (RXCIEn) in UCSRnB is set, the USART receive complete interrupt will be executed as long as the RXCn flag is set (provided that global interrupts are enabled). When interrupt-driven data reception is used, the receive complete routine must read the received data from UDRn in order to clear the RXCn flag, otherwise a new interrupt will occur once the interrupt routine terminates. 23.7.4 Receiver Error Flags The USART receiver has three error flags: Frame Error (FEn), Data OverRun (DORn) and Parity Error (UPEn). All can be accessed by reading UCSRnA. Common for the error flags is that they are located in the receive buffer together with the frame for which they indicate the error status. Due to the buffering of the error flags, the UCSRnA must be read before the receive buffer (UDRn), since reading the UDRn I/O location changes the buffer read location. The error flags cannot be altered by the application software doing a write to the flag location. However, all flags must be set to zero when the UCSRnA is written for upward compatibility of future USART implementations. None of the error flags can generate interrupts. The Frame Error Flag (FEn) indicates the state of the first stop bit of the next readable frame stored in the receive buffer. The FEn flag is zero when the stop bit was correctly 381 42073B-MCU Wireless-09/14 read (as one), and the FEn flag will be one when the stop bit was incorrect (zero). This flag can be used for detecting out-of-sync conditions, detecting break conditions and protocol handling. The FEn flag is not affected by the setting of the USBSn bit in UCSRnC since the receiver ignores all, except for the first, stop bits. For compatibility with future devices, always set this bit to zero when writing to UCSRnA. The Data OverRun Flag (DORn) indicates data loss due to a receiver buffer full condition. A data overrun occurs when the receive buffer is full (two characters), it is a new character waiting in the receive shift register, and a new start bit is detected. If the DORn flag is set there was one or more serial frame lost between the frame last read from UDRn, and the next frame read from UDRn. For compatibility with future devices, always write this bit to zero when writing to UCSRnA. The DORn flag is cleared when the frame received was successfully moved from the shift register to the receive buffer. The Parity Error Flag (UPEn) indicates that the next frame in the receive buffer had a parity error when received. If parity check is not enabled the UPEn bit will always be read zero. For compatibility with future devices, always set this bit to zero when writing to UCSRnA. For more details see "Parity Bit Calculation" on page 375 and "Parity Checker" below. 23.7.5 Parity Checker The parity checker is active when the high USART parity mode (UPMn1) bit is set. Type of parity check to be performed (odd or even) is selected by the UPMn0 bit. When enabled, the parity checker calculates the parity of the data bits in incoming frames and compares the result with the parity bit from the serial frame. The result of the check is stored in the receive buffer together with the received data and stop bits. The Parity Error Flag (UPEn) can then be read by software to check if the frame had a parity error. The UPEn bit is set if the next character that can be read from the receive buffer had a parity error when received .The parity checking was enabled at that point (UPMn1 = 1). This bit is valid until the receive buffer (UDRn) is read. 23.7.6 Disabling the Receiver In contrast to the transmitter, disabling of the receiver will be immediate. Data from ongoing receptions will therefore be lost. When disabled (i.e., the RXENn is set to zero) the receiver will no longer override the normal function of the RxDn port pin. The receiver buffer FIFO will be flushed when the receiver is disabled. Remaining data in the buffer will be lost 23.7.7 Flushing the Receive Buffer The receiver buffer FIFO will be flushed when the receiver is disabled, i.e., the buffer will be emptied of its contents. Unread data will be lost. If the buffer has to be flushed during normal operation, due to for instance an error condition, read the UDRn I/O location until the RXCn flag is cleared. The following code example shows how to flush the receive buffer. Assembly Code Example USART_Flush: (1) sbis UCSRnA, RXCn ret in r16, UDRn rjmp USART_Flush 382 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 (1) C Code Example void USART_Flush( void ) { unsigned char dummy; while ( UCSRnA & (1< 3k (worst case: maximum input step). A minimum tracking time of 500ns is guaranteed by the conversion logic. Based on the ADC clock frequency the bits ADTHT[1:0] of register ADCSRC allow the adjustment of the tracking time to the user's requirements. Tracking time requirements should also be considered for the differential mode. The input signal is sampled by the gain amplifier. The value of the input capacitance CS/H depends on the selected gain (~7pF for 200x gain, <1pF otherwise). The tracking is equal to 50% of the clock period of CKADC2. Hence in differential mode a slower clock frequency is required for input sources with high impedance. Figure 27-11. Analog Input Circuitry I IH 2k ADCn C S /H = 1 4 p F I IL V A V D D /2 Signal components higher than the Nyquist frequency (fADC/2) should not be present for either kind of channels, to avoid distortion from unpredictable signal convolution. The user is advised to remove high frequency components with a low-pass filter before applying the signals as inputs to the ADC. 27.7.2 Analog Noise Canceling Techniques Digital circuitry inside and outside the device generates EMI which might affect the accuracy of analog measurements. If conversion accuracy is critical, the noise level can be reduced by applying the following techniques: 1. Keep analog signal paths as short as possible. Make sure analog tracks run over the ground plane, and keep them well away from high-speed switching digital tracks. 2. Use the ADC noise canceller function to reduce induced noise from the CPU. 3. If any ADC port pins are used as digital outputs, it is essential that these do not switch while a conversion is in progress. 27.7.3 Offset Compensation Schemes The differential amplifier has a built-in offset cancellation circuitry that nulls the offset of differential measurements as much as possible. The remaining offset in the analog path can be measured directly by selecting the same channel for both differential inputs. This offset residue can then be subtracted in software from the measurement results. The offset on any channel can be reduced below one LSB using this kind of software based offset correction. 453 42073B-MCU Wireless-09/14 27.7.4 Differential Amplifier Limitations The programmable gain, differential amplifier (PGA) converts a differential input voltage to a single-ended output voltage that is further processed with the 10 bit ADC. The performance of the PGA is determined by the physical properties of its operational amplifier: * The noise of PGA adds to the random error of the ADC conversation result. However the PGA noise enables the application of oversampling techniques to recover or even increase the ADC resolution. * The gain of the PGA falls if the output voltage of the operational amplifier approaches the supply rails (AVSS) resulting in an increased non-linearity. Hence for reasonable INL and DNL performance the input voltage range must be limited. 27.7.5 ADC Accuracy Definitions n An n-bit single-ended ADC converts a voltage linearly between 0V and VREF in 2 steps n (LSB's). The lowest code is read as 0, and the highest code is read as 2 -1. Several parameters describe the deviation from the ideal behavior: * Offset: The deviation of the first transition (0x000 to 0x001) compared to the ideal transition (at 0.5 LSB). Ideal value: 0 LSB. Figure 27-12. Offset Error Output Code Ideal ADC Actual ADC Offset Error VREF Input Voltage * Gain Error: After adjusting for offset, the Gain Error is found as the deviation of the last transition (0x3FE to 0x3FF) compared to the ideal transition (at 1.5 LSB below maximum). Ideal value: 0 LSB. 454 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Figure 27-13. Gain Error Gain Error Output Code Ideal ADC Actual ADC VREF Input Voltage * Integral Non-linearity (INL): After adjusting for offset and gain error, the INL is the maximum deviation of an actual transition compared to an ideal transition for any code. Ideal value: 0 LSB. Figure 27-14. Integral Non-linearity (INL) Output Code INL Ideal ADC Actual ADC VREF Input Voltage * Differential Non-linearity (DNL): The maximum deviation of the actual code width (the interval between two adjacent transitions) from the ideal code width (1 LSB). Ideal value: 0 LSB. 455 42073B-MCU Wireless-09/14 Figure 27-15. Differential Non-linearity (DNL) Output Code 0x3FF 1 LSB DNL 0x000 0 VREF Input Voltage * Quantization Error: Due to the quantization of the input voltage into a finite number of codes, a range of input voltages (1 LSB wide) will code to the same value. It is always 0.5 LSB. * Absolute Accuracy: The maximum deviation of an actual (unadjusted) transition compared to an ideal transition for any code. This is the compound effect of offset, gain error, differential error, non-linearity, and quantization error. Ideal value: 0.5 LSB. 27.8 ADC Conversion Result After the conversion is complete (ADIF is high), the conversion result can be found in the ADC Result Registers (ADCL, ADCH). For single ended conversion, the result is ADC = VIN 1024 VREF where VIN is the voltage on the selected input pin and VREF the selected voltage reference (see "Table 27-11" on page 462 and "Table 27-12" on page 463). 0x000 represents analog ground, and 0x3FF represents the selected reference voltage minus one LSB. If differential channels are used, the result is ADC = (VPOS - VNEG ) GAIN 512 VREF where VPOS is the voltage on the positive input pin, VNEG the voltage on the negative input pin, and VREF the selected voltage reference. The result is presented in two's complement form, from 0x200 (-512d) through 0x1FF (+511d). Note that if the user wants to perform a quick polarity check of the result, it is sufficient to read the MSB of the result (ADC9 in ADCH). If the bit is one, the result is negative, and if this bit is zero, the result is positive. Figure 27-16 on page 457 shows the decoding of the differential input range. Table 27-7 below shows the resulting output codes if the differential input channel pair (ADCn - ADCm) is selected with a gain of GAIN and a reference voltage of VREF. 456 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Figure 27-16. Differential Measurement Range Output code 0x1FF 0x000 - V REF/GAIN 0x3FF 0 VREF/GAIN Differential Input voltage (Volts) 0x200 Table 27-7. Correlation Between Input Voltage and Output Codes VADCn Read Code Corresponding Decimal Value VADCm + VREF / GAIN 0x1FF 511 VADCm + 0.999 VREF / GAIN 0x1FF 511 VADCm + 0.998 VREF / GAIN 0x1FE 510 ... ... ... VADCm + 0.001 VREF / GAIN 0x001 1 VADCm 0x000 0 VADCm - 0.001 VREF / GAIN 0x3FF -1 ... ... ... VADCm - 0.999 VREF / GAIN 0x201 -511 VADCm - VREF / GAIN 0x200 -512 Example: ADMUX = 0xED (ADC3 - ADC2, 10x gain, 1.6V reference, left adjusted result) The voltage on ADC3 is 300 mV; the voltage on ADC2 is 425 mV. ADCR = 512 * 10 * (300 - 425) / 1600 = -400 = 0x270. ADCL will thus read 0x00, and ADCH will read 0x9C. Writing zero to ADLAR right adjusts the result: ADCL = 0x70, ADCH = 0x02. 457 42073B-MCU Wireless-09/14 27.9 Internal Temperature Measurement The on-chip temperature can be measured using a special setup of the A/D converter inputs. The integrated temperature sensor provides a linear, medium-accurate voltage proportional to the absolute temperature (in Kelvin). This voltage is first amplified with the programmable gain amplifier and then processed with the A/D converter. A low frequency of the conversion clock must be selected due to the nature of the input signal. The absolute accuracy of the temperature measurement is limited by manufacturing tolerances, noise from supply and ground voltages and the exactness of the reference voltage. One time calibration at room temperature can easily compensate this distribution. The resolution of the temperature reading can be improved (<1K) by averaging (using float numbers) or decimation (based on integer numbers) of multiple A/D conversion results. In this way the impact of noise is reduced (see measurement results "Temperature Sensor" on page 585 and "Differential Amplifier Limitations" on page 454). The following table summarizes the preferred setup of the temperature measurement: Table 27-8. Recommended ADC Setup for Temperature Measurement Parameter Register Recommended Setup ADC Channel ADMUX, ADCSRB Select the Temperature Sensor, MUX4:0 = 01001; MUX5 = 1; ADC Clock ADCSRA Select a clock frequency of 500 kHz or lower; VREF ADMUX Select the internal 1.6V reference voltage; Start-up time ADCSRC Standard requirement of 20 s is sufficient; Tracking time ADCSRC Setting ADTHT = 0 is sufficient; Assembly Code Example (1) ... ldi r17,(1< 2 CPU clock cycles for fck < 12 MHz, 3 CPU clock cycles for fck >= 12 MHz; High: > 2 CPU clock cycles for fck < 12 MHz, 3 CPU clock cycles for fck >= 12 MHz; 31.9.2 Serial Programming Algorithm When writing serial data to the ATmega2564/1284/644RFR2, data is clocked on the rising edge of SCK. When reading data from the ATmega2564/1284/644RFR2, data is clocked on the falling edge of SCK. See Figure 31-15 on page 522 for timing details. To program and verify the ATmega2564/1284/644RFR2 in the serial programming mode, the following sequence is recommended (See four byte instruction formats in Table 31-18 on page 521): 1. Power-up sequence: Apply power between DEVDD and DVSS while RSTN and SCK are set to "0". In some systems, the programmer can not guarantee that SCK is held low during power-up. In this case, RSTN must be given a positive pulse of at least two CPU clock cycles duration after SCK has been set to "0". 2. Wait for at least 20 ms and enable serial programming by sending the Programming Enable serial instruction to pin PDI. 3. The serial programming instructions will not work if the communication is out of synchronization. When in sync. the second byte (0x53), will echo back when issuing the third byte of the Programming Enable instruction. Whether the echo is correct or not, all four bytes of the instruction must be transmitted. If the 0x53 did not echo back, give RSTN a positive pulse and issue a new Programming Enable command. 4. The Flash is programmed one page at a time. The memory page is loaded one byte at a time by supplying the 7 LSB of the address and data together with the Load Program Memory Page instruction. To ensure correct loading of the page, the data low byte must be loaded before data high byte is applied for a given address. The Program Memory Page is stored by loading the Write Program Memory Page instruction with the address lines 15:8. Before issuing this command, make sure the instruction Load Address Extended High Byte has been used to define the MSB of the address. The address extended high byte with the address lines 23:16 is stored until the command is re-issued, i.e., the command needs only be issued for the first page, and when crossing the 64k word boundary. If polling (RDY/BSY ) is not used, the user must wait at least tWD_FLASH before issuing the next page (see Table 31-17 on page 521). Accessing the serial programming interface before the Flash write operation completes can result in incorrect programming. 5. The EEPROM array is programmed one byte at a time by supplying the address and data together with the appropriate Write instruction. An EEPROM memory location is first automatically erased before new data is written. If polling is not used, the user must wait at least tWD_EEPROM before issuing the next byte (see Table 31-17 on page 521). In a chip erased device, no 0xFFs in the data file(s) need to be programmed. 6. Any memory location can be verified by using the Read instruction which returns the content at the selected address at serial output PDO. When reading the Flash memory, use the instruction Load Address Extended High Byte to define the upper address byte, which is not included in the Read Program Memory instruction. The address extended high byte with the address lines 23:16 is stored until the command is re-issued, i.e., the command needs only be issued for the first page, and when crossing the 64k word boundary. 7. At the end of the programming session, RSTN can be set high to commence normal operation. 520 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 8. Power-off sequence (if needed): Set RESET to "1". Turn DEVDD power off. Table 31-17. Minimum Wait Delay before writing the next Fuse/Flash/EEPROM location Symbol Minimum Wait Delay tWD_FUSE 4.5 ms tWD_FLASH 4.5 ms tWD_EEPROM 13 ms tWD_CHIPERASE 18.5 ms 31.9.3 Serial Programming Instruction Set Table 31-18 below and Figure 31-14 on page 522 describe the Instruction set. Table 31-18. Serial Programming Instruction Set (5)(6) Instruction Format Instruction/Operation (2) Byte1 Byte2 Byte3 Byte4 Programming Enable $AC $53 $00 $00 Chip Erase (Program Memory/EEPROM) $AC $80 $00 $00 Poll RDY/BSY $F0 $00 $00 data byte out $4D $00 Extended addr. $00 Load Program Memory Page, High Byte $48 $00 addr. LSB high data byte in Load Program Memory Page, Low Byte $40 $00 addr. LSB low data byte in Load EEPROM Memory Page (page access) $C1 $00 0000 000aa data byte in Read Program Memory, High byte $28 addr. MSB addr. LSB high data byte out Read Program Memory, Low byte $20 addr. MSB addr. LSB low data byte out Read EEPROM Memory $A0 0000 aaaa aaaa aaaa data byte out Read Lock Bits $58 $00 $00 data byte out Read Signature Byte $30 $00 0000 000aa data byte out Read Fuse Bits $50 $00 $00 data byte out Read Fuse High Bits $58 $08 $00 data byte out Read Extended Fuse Bits $50 $08 $00 data byte out Read Calibration Byte $38 $00 $00 data byte out Write Program Memory Page $4C addr. MSB addr. LSB $00 Write EEPROM Memory $C0 0000 aaaa aaaa aaaa data byte in Write EEPROM Memory Page (page access) $C2 0000 aaaa aaaa 00 $00 Write Lock Bits $AC $E0 $00 data byte in Write Fuse Bits $AC $A0 $00 data byte in Write Fuse High Bits $AC $A8 $00 data byte in Write Extended Fuse Bits $AC $A4 $00 data byte in Load Instruction Load Address Extended High Byte (1) Read Instruction Write Instructions Notes: (3)(4) 1. Not all instructions are applicable for all parts. 2. a = address. 3. Bits are programmed `0', un-programmed `1'. 521 42073B-MCU Wireless-09/14 4. To ensure future compatibility, unused Fuses and Lock bits should be un-programmed (`1'). 5. Refer to the corresponding section for Fuse and Lock bits, Calibration and Signature bytes and Page size. 6. See http://www.atmel.com/avr for Application Notes regarding programming and programmers. If the LSB in RDY/BSY data byte out is `1', a programming operation is still pending. Wait until this bit returns `0' before the next instruction is carried out. Within the same page, the low data byte must be loaded prior to the high data byte. After data is loaded to the page buffer, program the EEPROM page; see Figure 31-14 below. Figure 31-14. Serial Programming Instruction Example Serial Programming Instruction Load Program Memory Page (High/Low Byte)/ Load EEPROM Memory Page (page access) Byte 1 Byte 2 Adr MSB Byte 3 Write Program Memory Page/ Write EEPROM Memory Page Byte 1 Byte 4 Byte 2 Adr LSB Adr MSB Bit 15 B Bit 15 B 0 Byte 3 Byte 4 Adr LSB 0 Page Buffer Page Offset Page 0 Page 1 Page 2 Page Number Page N-1 Program Memory/ EEPROM Memory 31.9.4 Serial Programming Characteristics For characteristics of the Serial Programming module see "SPI Timing Characteristics" on page 557. Figure 31-15. Serial Programming Waveforms SERIAL DATA INPUT (MOSI) MSB LSB SERIAL DATA OUTPUT (MISO) MSB LSB SERIAL CLOCK INPUT (SCK) SAMPLE 522 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 31.10 Programming via the JTAG Interface Programming through the JTAG interface requires control of the four JTAG specific pins: TCK, TMS, TDI, and TDO. Control of the reset and clock pins is not required. To be able to use the JTAG interface, the JTAGEN Fuse must be programmed. The device is default shipped with the fuse programmed. In addition, the JTD bit in MCUCR must be cleared. Alternatively, if the JTD bit is set, the external reset can be forced low. Then, the JTD bit will be cleared after two chip clocks, and the JTAG pins are available for programming. This provides a means of using the JTAG pins as normal port pins in running mode while still allowing In-System Programming via the JTAG interface. Note that this technique can not be used when using the JTAG pins for Boundary-scan or On-chip Debug. In these cases the JTAG pins must be dedicated for this purpose. During programming the clock frequency of the TCK Input must be less than the maximum frequency of the chip. The System Clock Prescaler can not be used to divide the TCK Clock Input into a sufficiently low frequency. As a definition in this datasheet, the LSB is shifted in and out first of all Shift Registers. 31.10.1 Programming Specific JTAG Instructions The Instruction Register is 4-bit wide, supporting up to 16 instructions. The JTAG instructions useful for programming are listed below. The OPCODE for each instruction is shown behind the instruction name in hex format. The text describes which Data Register is selected as path between TDI and TDO for each instruction. The Run-Test/Idle state of the TAP-controller is used to generate internal clocks. It can also be used as an idle state between JTAG sequences. The state machine sequence for changing the instruction word is shown in Figure 31-16 on page 524. 523 42073B-MCU Wireless-09/14 Figure 31-16. State Machine Sequence for Changing the Instruction Word 1 Test-Logic-Reset 0 0 Run-Test/Idle 1 Select-DR Scan 1 Select-IR Scan 0 0 1 1 Capture-DR Capture-IR 0 0 Shift-DR Shift-IR 0 1 Exit1-DR 1 Exit1-IR 0 0 Pause-IR 0 Pause-DR 0 1 1 0 Exit2-DR Exit2-IR 1 1 Update-IR Update-DR 1 0 1 1 0 1 0 1 0 31.10.2 AVR_RESET (0xC) The AVR specific public JTAG instruction is used for setting the AVR device in the Reset mode or taking the device out from the Reset mode. The TAP-controller is not reset by this instruction. The one bit Reset Register is selected as Data Register. Note that the reset will be active as long as there is a logic "one" in the Reset Chain. The output from this chain is not latched. The active states are: * Shift-DR: The Reset Register is shifted by the TCK input. 31.10.3 PROG_ENABLE (0x4) The AVR specific public JTAG instruction enables programming via the JTAG port. The 16-bit Programming Enable Register is selected as Data Register. The active states are the following: * Shift-DR: The programming enable signature is shifted into the Data Register. 524 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 * Update-DR: The programming enable signature is compared to the correct value, and Programming mode is entered if the signature is valid. 31.10.4 PROG_COMMANDS (0x5) The AVR specific public JTAG instruction is used for entering programming commands via the JTAG port. The 15-bit Programming Command Register is selected as Data Register. The active states are the following: * Capture-DR: The result of the previous command is loaded into the Data Register. * Shift-DR: The Data Register is shifted by the TCK input, shifting out the result of the previous command and shifting in the new command. * Update-DR: The programming command is applied to the Flash inputs. * Run-Test/Idle: One clock cycle is generated, executing the applied command. 31.10.5 PROG_PAGELOAD (0x6) The AVR specific public JTAG instruction directly loads the Flash data page via the JTAG port. An 8-bit Flash Data Byte Register is selected as the Data Register. This is physically the 8 LSB's of the Programming Command Register. The active states are the following: * Shift-DR: The Flash Data Byte Register is shifted by the TCK input. * Update-DR: The content of the Flash Data Byte Register is copied into a temporary register. A write sequence is initiated that within 11 TCK cycles loads the content of the temporary register into the Flash page buffer. The AVR automatically alternates between writing the low and the high byte for each new Update-DR state, starting with the low byte for the first Update-DR encountered after entering the PROG_PAGELOAD command. The Program Counter is pre-incremented before writing the low byte, except for the first written byte. This ensures that the first data is written to the address set up by PROG_COMMANDS, and loading the last location in the page buffer does not make the program counter increment into the next page. 31.10.6 PROG_PAGEREAD (0x7) The AVR specific public JTAG instruction directly captures the Flash content via the JTAG port. An 8-bit Flash Data Byte Register is selected as the Data Register. This is physically the 8 LSB's of the Programming Command Register. The active states are the following: * Capture-DR: The content of the selected Flash byte is captured into the Flash Data Byte Register. The AVR automatically alternates between reading the low and the high byte for each new Capture-DR state, starting with the low byte for the first Capture-DR encountered after entering the PROG_PAGEREAD command. The Program Counter is post-incremented after reading each high byte, including the first read byte. This ensures that the first data is captured from the first address set up by PROG_COMMANDS, and reading the last location in the page makes the program counter increment into the next page. * Shift-DR: The Flash Data Byte Register is shifted by the TCK input. 31.10.7 Data Registers The Data Registers are selected by the JTAG instruction registers described in section "Programming Specific JTAG Instructions" on page 523. The Data Registers relevant for programming operations are: * Reset Register 525 42073B-MCU Wireless-09/14 * Programming Enable Register * Programming Command Register * Flash Data Byte Register 31.10.8 Reset Register The Reset Register is a Test Data Register used to reset the part during programming. It is required to reset the part before entering Programming mode. A high value in the Reset Register corresponds to pulling the external reset low. The part is reset as long as there is a high value present in the Reset Register. Depending on the Fuse settings for the clock options, the part will remain reset for a Reset Timeout period (refer to "Clock Sources" on page 175) after releasing the Reset Register. The output from this Data Register is not latched, so the reset will take place immediately, as shown in "Figure 29-2" on page 478. 31.10.9 Programming Enable Register The Programming Enable Register is a 16-bit register. The content of this register is compared to the programming enable signature, binary code 1010_0011_0111_0000. When the content of the register is equal to the programming enable signature, programming via the JTAG port is enabled. The register is reset to 0 on Power-on Reset, and should always be reset when leaving Programming mode. Figure 31-17. Programming Enable Register TDI D A T A 0xA370 = D Q Programming Enable ClockDR & PROG_ENABLE TDO 31.10.10 Programming Command Register The Programming Command Register is a 15-bit register. This register is used to serially shift in programming commands, and to serially shift out the result of the previous command, if any. The JTAG Programming Instruction Set is shown in Table 31-19 on page 527. The state sequence when shifting in the programming commands is illustrated in Figure 31-19 on page 530. 526 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Figure 31-18. Programming Command Register TDI S T R O B E S A D D R E S S / D A T A Flash EEPROM Fuses Lock Bits TDO Table 31-19. JTAG Programming Instruction (set a = address high bits, b = address low bits, c = address extended bits, H = 0 - Low byte, 1 - High Byte, o = data out, i = data in, x = don't care) Instruction TDI Sequence TDO Sequence Notes 1a. Chip Erase 0100011_10000000 0110001_10000000 0110011_10000000 0110011_10000000 xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx 1b. Poll for Chip Erase Complete 0110011_10000000 xxxxxox_xxxxxxxx 1c. Chip Erase EEPROM only 0100011_10000010 0110001_10000010 0110011_10000010 0110011_10000010 xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx 2a. Enter Flash Write 0100011_00010000 xxxxxxx_xxxxxxxx 2b. Load Address Extended High Byte 0001011_cccccccc xxxxxxx_xxxxxxxx 2c. Load Address High Byte 0000111_aaaaaaaa xxxxxxx_xxxxxxxx 2d. Load Address Low Byte 0000011_bbbbbbbb xxxxxxx_xxxxxxxx 2e. Load Data Low Byte 0010011_iiiiiiii xxxxxxx_xxxxxxxx 2f. Load Data High Byte 0010111_iiiiiiii xxxxxxx_xxxxxxxx 2g. Latch Data 0110111_00000000 1110111_00000000 0110111_00000000 xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx (1) 2h. Write Flash Page 0110111_00000000 0110101_00000000 0110111_00000000 0110111_00000000 xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx (1) 2i. Poll for Page Write Complete 0110111_00000000 xxxxxox_xxxxxxxx (2) 3a. Enter Flash Read 0100011_00000010 xxxxxxx_xxxxxxxx 3b. Load Address Extended High Byte 0001011_cccccccc xxxxxxx_xxxxxxxx (2) (10) (10) 527 42073B-MCU Wireless-09/14 Instruction TDI Sequence TDO Sequence 3c. Load Address High Byte 0000111_aaaaaaaa xxxxxxx_xxxxxxxx 3d. Load Address Low Byte 0000011_bbbbbbbb xxxxxxx_xxxxxxxx 3e. Read Data Low and High Byte 0110010_00000000 0110110_00000000 0110111_00000000 xxxxxxx_xxxxxxxx xxxxxxx_oooooooo xxxxxxx_oooooooo Notes Low byte High byte 4a. Enter EEPROM Write 0100011_00010001 xxxxxxx_xxxxxxxx 4b. Load Address High Byte 0000111_aaaaaaaa xxxxxxx_xxxxxxxx 4c. Load Address Low Byte 0000011_bbbbbbbb xxxxxxx_xxxxxxxx 4d. Load Data Byte 0010011_iiiiiiii xxxxxxx_xxxxxxxx 4e. Latch Data 0110111_00000000 1110111_00000000 0110111_00000000 xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx (1) 4f. Write EEPROM Page 0110011_00000000 0110001_00000000 0110011_00000000 0110011_00000000 xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx (1) 4g. Poll for Page Write Complete 0110011_00000000 xxxxxox_xxxxxxxx (2) 4h. Enter EEPROM Erase 0100011_10000011 xxxxxxx_xxxxxxxx 5a. Enter EEPROM Read 0100011_00000011 xxxxxxx_xxxxxxxx 5b. Load Address High Byte 0000111_aaaaaaaa xxxxxxx_xxxxxxxx 5c. Load Address Low Byte 0000011_bbbbbbbb xxxxxxx_xxxxxxxx 5d. Read Data Byte 0110011_bbbbbbbb 0110010_00000000 0110011_00000000 xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_oooooooo 6a. Enter Fuse Write 0100011_01000000 xxxxxxx_xxxxxxxx (10) (10) 6b. Load Data Low Byte 0010011_iiiiiiii xxxxxxx_xxxxxxxx (3)(6) 6c. Write Fuse Extended Byte 0111011_00000000 0111001_00000000 0111011_00000000 0111011_00000000 xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx (1) 6d. Poll for Fuse Write Complete 0110111_00000000 xxxxxox_xxxxxxxx (2) 6e. Load Data Low Byte 0010011_iiiiiiii xxxxxxx_xxxxxxxx (3)(7) 6f. Write Fuse High Byte 0110111_00000000 0110101_00000000 0110111_00000000 0110111_00000000 xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx (1) 6g. Poll for Fuse Write Complete 0110111_00000000 xxxxxox_xxxxxxxx (2) 6h. Load Data Low Byte 0010011_iiiiiiii xxxxxxx_xxxxxxxx (3)(8) 6i. Write Fuse Low Byte 0110011_00000000 0110001_00000000 0110011_00000000 0110011_00000000 xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx (1) 6j. Poll for Fuse Write Complete 0110011_00000000 xxxxxox_xxxxxxxx (2) 7a. Enter Lock Bit Write 0100011_00100000 xxxxxxx_xxxxxxxx 528 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Instruction TDI Sequence TDO Sequence Notes 7b. Load Data Byte 0010011_11iiiiii xxxxxxx_xxxxxxxx (4)(9) 7c. Write Lock Bits 0110011_00000000 0110001_00000000 0110011_00000000 0110011_00000000 xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx (1) 7d. Poll for Lock Bit Write complete 0110011_00000000 xxxxxox_xxxxxxxx (2) 8a. Enter Fuse/Lock Bit Read 0100011_00000100 xxxxxxx_xxxxxxxx 8b. Read Extended Fuse Byte 0111010_00000000 0111011_00000000 xxxxxxx_xxxxxxxx xxxxxxx_oooooooo (6)(5) 8c. Read Fuse High Byte 0111110_00000000 0111111_00000000 xxxxxxx_xxxxxxxx xxxxxxx_oooooooo (7)(5) 8d. Read Fuse Low Byte 0110010_00000000 0110011_00000000 xxxxxxx_xxxxxxxx xxxxxxx_oooooooo (8)(5) 8e. Read Lock Bits 0110110_00000000 0110111_00000000 xxxxxxx_xxxxxxxx xxxxxxx_xxoooooo (9)(5) 8f. Read Fuses and Lock Bits 0111010_00000000 0111110_00000000 0110010_00000000 0110110_00000000 0110111_00000000 xxxxxxx_xxxxxxxx xxxxxxx_oooooooo xxxxxxx_oooooooo xxxxxxx_oooooooo xxxxxxx_oooooooo (5) Fuse Ext. byte Fuse High byte Fuse Low byte Lock bits 9a. Enter Signature Byte Read 0100011_00001000 xxxxxxx_xxxxxxxx 9b. Load Address Byte 0000011_bbbbbbbb xxxxxxx_xxxxxxxx 9c. Read Signature Byte 0110010_00000000 0110011_00000000 xxxxxxx_xxxxxxxx xxxxxxx_oooooooo 9d. Enter User Signature Page Write 0100011_00010010 xxxxxxx_xxxxxxxx (12) 9e. Enter User Signature Page Erase 0100011_10000100 xxxxxxx_xxxxxxxx (12) 10a. Enter Calibration Byte Read 0100011_00001000 xxxxxxx_xxxxxxxx 10b. Load Address Byte 0000011_bbbbbbbb xxxxxxx_xxxxxxxx 10c. Read Calibration Byte 0110110_00000000 0110111_00000000 xxxxxxx_xxxxxxxx xxxxxxx_oooooooo 11a. Load No Operation Command 0100011_00000000 0110011_00000000 xxxxxxx_xxxxxxxx xxxxxxx_xxxxxxxx 529 42073B-MCU Wireless-09/14 Notes: 1. This command sequence is not required if the seven MSB's are correctly set by the previous command sequence (which is normally the case). 2. Repeat until o = "1". 3. Set bits to "0" to program the corresponding Fuse, "1" to un-program the Fuse. 4. Set bits to "0" to program the corresponding Lock bit, "1" to leave the Lock bit unchanged. 5. "0" = programmed, "1" = un-programmed. 6. The bit mapping for Fuses Extended byte is listed in Table 31-3 on page 503. 7. The bit mapping for Fuses High byte is listed in Table 31-4 on page 503. 8. The bit mapping for Fuses Low byte is listed in Table 31-5 on page 504. 9. The bit mapping for Lock bits byte is listed in Table 31-1 on page 502. 10. Address bits exceeding PCMSB and EEAMSB (Table 31-7 on page 505 and Table 31-8 on page 505) are don't care. 11. All TDI and TDO sequences are represented by binary digits. 12. See "User Signature Data" on page 505. Figure 31-19. State Machine Sequence for Changing/Reading the Data Word 1 Test-Logic-Reset 0 0 Run-Test/Idle 1 Select-DR Scan 1 Select-IR Scan 0 1 0 1 Capture-DR Capture-IR 0 0 Shift-DR 0 1 1 Exit1-DR 0 Pause-DR 0 0 Pause-IR 1 1 0 Exit2-DR Exit2-IR 1 1 Update-DR 530 1 Exit1-IR 0 1 0 Shift-IR 1 0 1 Update-IR 0 1 0 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 31.10.11 Flash Data Byte Register The Flash Data Byte Register provides an efficient way to load the entire Flash page buffer before executing Page Write, or to read out/verify the content of the Flash. A state machine sets up the control signals to the Flash and senses the strobe signals from the Flash, thus only the data words need to be shifted in/out. The Flash Data Byte Register actually consists of the 8-bit scan chain and an 8-bit temporary register. During page load, the Update-DR state copies the content of the scan chain over to the temporary register and initiates a write sequence that within 11 TCK cycles loads the content of the temporary register into the Flash page buffer. The AVR automatically alternates between writing the low and the high byte for each new Update-DR state, starting with the low byte for the first Update-DR encountered after entering the PROG_PAGELOAD command. The Program Counter is pre-incremented before writing the low byte, except for the first written byte. This ensures that the first data is written to the address set up by PROG_COMMANDS, and loading the last location in the page buffer does not make the Program Counter increment into the next page. During Page Read, the content of the selected Flash byte is captured into the Flash Data Byte Register during the Capture-DR state. The AVR automatically alternates between reading the low and the high byte for each new Capture-DR state, starting with the low byte for the first Capture-DR encountered after entering the PROG_PAGEREAD command. The Program Counter is post-incremented after reading each high byte, including the first read byte. This ensures that the first data is captured from the first address set up by PROG_COMMANDS, and reading the last location in the page makes the program counter increment into the next page. Figure 31-20. Flash Data Byte Register STROBES TDI State Machine ADDRESS Flash EEPROM Fuses Lock Bits D A T A TDO The state machine controlling the Flash Data Byte Register is clocked by TCK. During normal operation in which eight bits are shifted for each Flash byte, the clock cycles needed to navigate through the TAP-controller automatically feeds the state machine for the Flash Data Byte Register with sufficient number of clock pulses to complete its operation transparently for the user. However, if too few bits are shifted between each Update-DR state during page load, the TAP-controller should stay in the Run-Test/Idle state for some TCK cycles to ensure that there are at least 11 TCK cycles between each Update-DR state. 531 42073B-MCU Wireless-09/14 31.10.12 Programming Algorithm All references below of type "1a", "1b", and so on, refer to Table 31-19 on page 527. 31.10.13 Entering Programming Mode 7. Enter JTAG instruction AVR_RESET and shift 1 in the Reset Register. 8. Enter instruction PROG_ENABLE and shift 0b1010_0011_0111_0000 in the Programming Enable Register. 31.10.14 Leaving Programming Mode 1. Enter JTAG instruction PROG_COMMANDS. 2. Disable all programming instructions by using no operation instruction 11a. 3. Enter instruction PROG_ENABLE and shift 0b0000_0000_0000_0000 in the programming Enable Register. 4. Enter JTAG instruction AVR_RESET and shift 0 in the Reset Register. 31.10.15 Performing Chip Erase 1. Enter JTAG instruction PROG_COMMANDS. 2. Start Chip Erase using programming instruction 1a. 3. Poll for Chip Erase complete using programming instruction 1b, or wait for tWLRH_CE (refer to Table 31-15 on page 518). 31.10.16 Programming the Flash Before programming the Flash a Chip Erase must be performed, see section "Performing Chip Erase" above. 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable Flash write using programming instruction 2a. 3. Load Extended High byte of address using programming instruction 2b. 4. Load High byte of address using programming instruction 2c. 5. Load Low byte of address using programming instruction 2d. 6. Load data using programming instructions 2e, 2f and 2g. 7. Repeat steps 5 and 6 for all instruction words in the page. 8. Write the page using programming instruction 2h. 9. Poll for Flash write complete using programming instruction 2i, or wait for tWLRH (refer to Table 31-15 on page 518). 10. Repeat steps 4 to 9 until all data have been programmed. A more efficient data transfer can be achieved using the PROG_PAGELOAD instruction: 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable Flash write using programming instruction 2a. 3. Load the page address using programming instructions 2b, 2c and 2d. PCWORD (refer to Table 31-7 on page 505) is used to address within one page and must be written as 0. 4. Enter JTAG instruction PROG_PAGELOAD. 5. Load the entire page by shifting in all instruction words in the page byte-by-byte, starting with the LSB of the first instruction in the page and ending with the MSB of the last instruction in the page. Use Update-DR to copy the contents of the Flash 532 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Data Byte Register into the Flash page location and to auto-increment the Program Counter before each new word. 6. Enter JTAG instruction PROG_COMMANDS. 7. Write the page using programming instruction 2h. 8. Poll for Flash write complete using programming instruction 2i, or wait for tWLRH (refer to Table 31-15 on page 518). 9. Repeat steps 3 to 8 until all data have been programmed. 31.10.17 Reading the Flash 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable Flash read using programming instruction 3a. 3. Load address using programming instructions 3b, 3c and 3d. 4. Read data using programming instruction 3e. 5. Repeat steps 3 and 4 until all data have been read. A more efficient data transfer can be achieved using the PROG_PAGEREAD instruction: 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable Flash read using programming instruction 3a. 3. Load the page address using programming instructions 3b, 3c and 3d. PCWORD (refer to Table 31-7 on page 505) is used to address within one page and must be written as 0. 4. Enter JTAG instruction PROG_PAGEREAD. 5. Read the entire page (or Flash) by shifting out all instruction words in the page (or Flash), starting with the LSB of the first instruction in the page (Flash) and ending with the MSB of the last instruction in the page (Flash). The Capture-DR state both captures the data from the Flash, and also auto-increments the program counter after each word is read. Note that Capture-DR comes before the shift-DR state. Hence, the first byte which is shifted out contains valid data. 6. Enter JTAG instruction PROG_COMMANDS. 7. Repeat steps 3 to 6 until all data have been read. 31.10.18 Programming the EEPROM The EEPROM must be erased before being programmed. A Chip Erase always erases both Flash and EEPROM memories, see "Performing Chip Erase" on page 532. 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable EEPROM write using programming instruction 4a. 3. Load High byte of address using programming instruction 4b. 4. Load Low byte of address using programming instruction 4c. 5. Load data using programming instructions 4d and 4e. 6. Repeat steps 4 and 5 for all data bytes in the page. 7. Write the data using programming instruction 4f. 8. Poll for EEPROM write complete using programming instruction 4g, or wait for tWLRH (refer to Table 31-15 on page 518). 9. Repeat steps 3 to 8 until all data have been programmed. Note that the PROG_PAGELOAD instruction can not be used when programming the EEPROM. 533 42073B-MCU Wireless-09/14 31.10.19 Reading the EEPROM 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable EEPROM read using programming instruction 5a. 3. Load address using programming instructions 5b and 5c. 4. Read data using programming instruction 5d. 5. Repeat steps 3 and 4 until all data have been read. Note that the PROG_PAGEREAD instruction can not be used when reading the EEPROM. 31.10.20 Programming the Fuses 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable Fuse write using programming instruction 6a. 3. Load data high byte using programming instructions 6b. A bit value of "0" will program the corresponding fuse; a "1" will un-program the fuse. 4. Write Fuse High byte using programming instruction 6c. 5. Poll for Fuse write complete using programming instruction 6d, or wait for tWLRH (refer to Table 31-15 on page 518). 6. Load data low byte using programming instructions 6e. A "0" will program the fuse, a "1" will un-program the fuse. 7. Write Fuse low byte using programming instruction 6f. 8. Poll for Fuse write complete using programming instruction 6g, or wait for tWLRH (refer to Table 31-15 on page 518). 31.10.21 Programming the Lock Bits 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable Lock bit write using programming instruction 7a. 3. Load data using programming instructions 7b. A bit value of "0" will program the corresponding lock bit, a "1" will leave the lock bit unchanged. 4. Write Lock bits using programming instruction 7c. 5. Poll for Lock bit write complete using programming instruction 7d, or wait for tWLRH (refer to Table 31-15 on page 518). 31.10.22 Reading the Fuses and Lock Bits 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable Fuse/Lock bit read using programming instruction 8a. 3. To read all Fuses and Lock bits, use programming instruction 8e. To only read Fuse High byte, use programming instruction 8b. To only read Fuse Low byte, use programming instruction 8c. To only read Lock bits, use programming instruction 8d. 31.10.23 Reading the Signature Bytes 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable Signature byte read using programming instruction 9a. 3. Load address 0x00 using programming instruction 9b. 4. Read first signature byte using programming instruction 9c. 534 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 5. Repeat steps 3 and 4 with address 0x01 and address 0x02 to read the second and third signature bytes, respectively. 31.10.24 Reading the Calibration Byte 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable Calibration byte read using programming instruction 10a. 3. Load address 0x00 using programming instruction 10b. 4. Read the calibration byte using programming instruction 10c. 31.10.25 Performing Chip Erase of only the EEPROM The EEPROM must be erased before being programmed. A Chip Erase always erases both Flash and EEPROM memories, see "Performing Chip Erase" on page 532. This command allows erasing only the EEPROM contents. The Flash, Lock and Fuse bits are not changed. 1. Enter JTAG instruction PROG_COMMANDS. 2. Start EEPROM Chip Erase using programming instruction 1c. 3. Poll for Chip Erase complete using programming instruction 1b, or wait for tWLRH (refer to Table 31-15 on page 518). Note: 13. The EEPROM memory is also preserved during this special Chip Erase if the EESAVE Fuse is programmed. 31.10.26 Erasing an EEPROM Page The EEPROM must be erased before being programmed. A Chip Erase always erases the entire EEPROM memory. This command allows erasing selected bytes up to an entire page of EEPROM memory. 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable EEPROM erase using programming instruction 4h. 3. Load High byte of address using programming instruction 4b. 4. Load Low byte of address using programming instruction 4c. 5. Latch the address using programming instructions 4e. 6. Repeat steps 4 and 5 for all data bytes in the page. 7. Erase the data using programming instruction 4f. 8. Poll for EEPROM write complete using programming instruction 4g, or wait for tWLRH (refer to Table 31-15 on page 518). 9. Repeat steps 3 to 8 until all data have been erased. Note that the PROG_PAGELOAD instruction can not be used when programming the EEPROM. Note: 1. The EEPROM memory is not preserved during the EEPROM page erase if the EESAVE Fuse is programmed. 535 42073B-MCU Wireless-09/14 31.10.27 Programming User Signature Data Three Flash pages are dedicated for user signature data (see "User Signature Data" on page 505 for details). Before programming the user signature pages a Page Erase must be performed, see section "Erasing User Signature Data" below. 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable user signature page write using programming instruction 9d. 3. Load High byte of address using programming instruction 2c (0x01, 0x02 or 0x03). 4. Load Low byte of address using programming instruction 2d. 5. Load data using programming instructions 2e, 2f and 2g. 6. Repeat steps 4 and 5 for all instruction words in the page. 7. Write the user signature page using programming instruction 2h. 8. Poll for Flash write complete using programming instruction 2i, or wait for tWLRH (refer to Table 31-15 on page 518). 9. Repeat steps 4 to 9 until all user signature data have been programmed. A more efficient data transfer can be achieved using the PROG_PAGELOAD instruction: 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable user signature page write using programming instruction 9d. 3. Load the page address using programming instructions 2c and 2d. PCWORD (refer to Table 31-7 on page 505) is used to address within one page and must be written as 0. 4. Enter JTAG instruction PROG_PAGELOAD. 5. Load the entire page by shifting in all instruction words in the page byte-by-byte, starting with the LSB of the first instruction in the page and ending with the MSB of the last instruction in the page. Use Update-DR to copy the contents of the Flash Data Byte Register into the Flash page location and to auto-increment the Program Counter before each new word. 6. Enter JTAG instruction PROG_COMMANDS. 7. Write the user signature page using programming instruction 2h. 8. Poll for Flash write complete using programming instruction 2i, or wait for tWLRH (refer to Table 31-15 on page 518). 9. Repeat steps 3 to 8 until all user signature data have been programmed. 31.10.28 Erasing User Signature Data Three Flash pages are dedicated for user signature data (see "User Signature Data" on page 505 for details). User signature pages must be erased before being written. A Flash Chip Erase (see section "Performing Chip Erase" on page 532) does not clear the contents of signature pages. Erasing user signature data is performed with the following command sequence. 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable user signature page erase using programming instruction 9e. 3. Load High byte of address using programming instruction 2c (0x01, 0x02 or 0x03). 4. Load Low byte of address using programming instruction 2d. 5. Latch the page address using programming instructions 2g. 6. Erase the user signature page using programming instruction 2h. 536 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 7. Poll for Flash write complete using programming instruction 2i, or wait for tWLRH (refer to Table 31-15 on page 518). 8. Repeat steps 4 to 7 until all user signature data have been erased. 31.10.29 Reading User Signature Data The algorithm for reading User Signature Data is similar to read from Flash. 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable Signature read using programming instruction 9a. 3. Load address using programming instructions 3c and 3d. 4. Read data using programming instruction 3e. 5. Repeat steps 3 and 4 until all data have been read. A more efficient data transfer can be achieved using the PROG_PAGEREAD instruction: 1. Enter JTAG instruction PROG_COMMANDS. 2. Enable Signature read using programming instruction 9a. 3. Load the page address using programming instructions 3c and 3d. PCWORD (refer to Table 31-7 on page 505) is used to address within one page and must be written as 0. 4. Enter JTAG instruction PROG_PAGEREAD. 5. Read the entire User Signature page (or all three pages) by shifting out all instruction words in the page, starting with the LSB of the first instruction in the page and ending with the MSB of the last instruction in the page (or last User Signature page). The Capture-DR state both captures the data from the Flash, and also autoincrements the program counter after each word is read. Note that Capture-DR comes before the shift-DR state. Hence, the first byte which is shifted out contains valid data. 6. Enter JTAG instruction PROG_COMMANDS. 7. Repeat steps 3 to 6 until all data have been read. 537 42073B-MCU Wireless-09/14 32 Application Circuits 32.1 Basic Application Schematic A basic application schematic of the ATmega2564/1284/644RFR2 with a single-ended RF connector is shown in Figure 32-1 below and the associated Bill of Material in Table 32-1 on page 539. The 50 single-ended RF input is transformed to the 100 differential RF port impedance using Balun B1. The capacitors C1 and C2 provide AC coupling of the RF input to the RF port, capacitor C4 improves matching. Figure 32-1. Basic Application schematic (48-pin package) CX1 XTAL CX2 CB2 VDD RF B1 C4 C1 45 44 43 42 41 40 39 AVSS XTAL1 XTAL2 PE7 PE5 1 PF3/4 46 EVDD 47 PF0 48 AVDD CB1 38 37 36 2 35 3 PE0 34 4 PF7 PB7 33 5 AVSS 32 6 RFP 31 7 RFN 30 8 AVSS 29 9 TST 28 10 RSTN 27 DVDD DEVDD PD0 13 14 15 16 17 PD7 PG4 PG3 12 PB0 26 DVSS 11 PG1 18 19 CB3 CX3 XTAL 32kHz CX4 CB4 VDD 20 21 22 23 25 CLKI 24 Pins TST & CLKI must be connected The power supply bypass capacitors (CB2, CB4) are connected to the external analog supply pin (EVDD, pin 44) and external digital supply pin (DEVDD, pin 16). The capacitor C1 provides the required AC coupling of RFN/RFP. Floating pins can cause excessive power dissipation (e.g. during power on). They should be connected to an appropriate source. GPIO shall not be connected to ground or power supply directly. The digital input pins TST and CLKI must be connected. If pin TST will never be used it can be connected to AVSS while an unused pin CLKI could be connected to DVSS (see chapter "Unused Pins" on page 7). Capacitors CB1 and CB3 are bypass capacitors for the integrated analog and digital voltage regulators to ensure stable operation and to improve noise immunity. Capacitors should be placed as close as possible to the pins and should have a lowresistance and low-inductance connection to ground to achieve the best performance. 538 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 The crystal (XTAL), the two load capacitors (CX1, CX2), and the internal circuitry connected to pins XTAL1 and XTAL2 form the 16MHz crystal oscillator for the 2.4GHz transceiver. To achieve the best accuracy and stability of the reference frequency, large parasitic capacitances must be avoided. Crystal lines should be routed as short as possible and not in proximity of digital I/O signals. This is especially required for the High Data Rate Modes. The 32.768 kHz crystal connected to the internal low power (sub 1A) crystal oscillator provides a stable time reference for all low power modes including 32 Bit IEEE 802.15.4 Symbol Counter ("MAC Symbol Counter" on page 155) and real time clock application using the asynchronous timer T/C2 ("8-bit Timer/Counter2 with PWM and Asynchronous Operation" on page 339). Total shunt capacitance including CX3, CX4 should not exceed 15pF across both pins. The very low supply current of the oscillator requires careful layout of the PCB and any leakage path must be avoided. Crosstalk and radiation from switching digital signals to the crystal pins or the RF pins can degrade the system performance. The programming of minimum drive strength settings for the digital output signal is recommended (see "DPDS0 - Port Driver Strength Register 0" on page 204). Table 32-1. Bill of Materials (BoM) Designator Description B1 SMD balun SMD balun / filter Value 2.4 GHz Manufacturer Part Number Comment Wuerth Johanson Technology 748421245 2450FB15L0001 Filter included 0603YD105KAT2A GRM188R61C105KA12D X5R (0603) 10% 16V AVX Murata 06035A120JA GRP1886C1H120JA01 COG (0603) 5% 50V Epcos Epcos AVX B37930 B37920 06035A220JAT2A C0G 5% 50V CB1 CB3 LDO VREG bypass capacitor 1 F AVX (100nF minimum) Murata CB2 CB4 Power supply bypass capacitor 1 F (100nF minimum) CX1, CX2 16MHz crystal load capacitor CX3, CX4 32.768kHz crystal load capacitor 12 ... 25 pF C1, C2 RF coupling capacitor 22 pF C4 (optional) RF matching XTAL Crystal XTAL 32kHz Crystal 12 pF 0.47 pF (0402 or 0603) Johnstech CX-4025 16 MHz ACAL Taitjen SX-4025 16 MHz Siward XWBBPL-F-1 A207-011 Rs=100 kOhm 539 42073B-MCU Wireless-09/14 33 Register Summary Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Page (0x1FF) TRXFBEND TRXFBEND7 TRXFBEND6 TRXFBEND5 TRXFBEND4 TRXFBEND3 TRXFBEND2 TRXFBEND1 TRXFBEND0 154 154 ... (0x180) TRXFBST TRXFBST7 TRXFBST6 TRXFBST5 TRXFBST4 TRXFBST3 TRXFBST2 TRXFBST1 TRXFBST0 (0x17F) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 (0x17E) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 (0x17D) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 (0x17C) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 (0x17B) TST_RX_LENGTH RX_LENGTH7 RX_LENGTH6 RX_LENGTH5 RX_LENGTH4 RX_LENGTH3 RX_LENGTH2 RX_LENGTH1 RX_LENGTH0 (0x17A) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 (0x179) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 (0x178) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 (0x177) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 (0x176) TST_CTRL_DIGI Res7 Res6 Res5 Res4 TST_CTRL_DIG3 TST_CTRL_DIG2 TST_CTRL_DIG1 TST_CTRL_DIG0 (0x175) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 (0x173) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 (0x172) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 (0x171) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 (0x170) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 (0x16F) CSMA_BE MAX_BE3 MAX_BE2 MAX_BE1 MAX_BE0 MIN_BE3 MIN_BE2 MIN_BE1 MIN_BE0 (0x16E) CSMA_SEED_1 AACK_FVN_MODE1 AACK_FVN_MODE0 AACK_SET_PD AACK_DIS_ACK AACK_I_AM_COORD CSMA_SEED_12 CSMA_SEED_11 CSMA_SEED_10 144 (0x16D) CSMA_SEED_0 CSMA_SEED_07 CSMA_SEED_06 CSMA_SEED_05 CSMA_SEED_04 CSMA_SEED_03 CSMA_SEED_02 CSMA_SEED_01 CSMA_SEED_00 143 (0x16C) XAH_CTRL_0 MAX_FRAME_RETRIES3 MAX_FRAME_RETRIES2 MAX_FRAME_RETRIES1 MAX_FRAME_RETRIES0 MAX_CSMA_RETRIES2 MAX_CSMA_RETRIES1 MAX_CSMA_RETRIES0 SLOTTED_OPERATION 142 (0x16B) IEEE_ADDR_7 IEEE_ADDR_77 IEEE_ADDR_76 IEEE_ADDR_75 IEEE_ADDR_74 IEEE_ADDR_73 IEEE_ADDR_72 IEEE_ADDR_71 IEEE_ADDR_70 141 (0x16A) IEEE_ADDR_6 IEEE_ADDR_67 IEEE_ADDR_66 IEEE_ADDR_65 IEEE_ADDR_64 IEEE_ADDR_63 IEEE_ADDR_62 IEEE_ADDR_61 IEEE_ADDR_60 141 (0x169) IEEE_ADDR_5 IEEE_ADDR_57 IEEE_ADDR_56 IEEE_ADDR_55 IEEE_ADDR_54 IEEE_ADDR_53 IEEE_ADDR_52 IEEE_ADDR_51 IEEE_ADDR_50 141 (0x168) IEEE_ADDR_4 IEEE_ADDR_47 IEEE_ADDR_46 IEEE_ADDR_45 IEEE_ADDR_44 IEEE_ADDR_43 IEEE_ADDR_42 IEEE_ADDR_41 IEEE_ADDR_40 141 (0x167) IEEE_ADDR_3 IEEE_ADDR_37 IEEE_ADDR_36 IEEE_ADDR_35 IEEE_ADDR_34 IEEE_ADDR_33 IEEE_ADDR_32 IEEE_ADDR_31 IEEE_ADDR_30 140 (0x166) IEEE_ADDR_2 IEEE_ADDR_27 IEEE_ADDR_26 IEEE_ADDR_25 IEEE_ADDR_24 IEEE_ADDR_23 IEEE_ADDR_22 IEEE_ADDR_21 IEEE_ADDR_20 140 (0x165) IEEE_ADDR_1 IEEE_ADDR_17 IEEE_ADDR_16 IEEE_ADDR_15 IEEE_ADDR_14 IEEE_ADDR_13 IEEE_ADDR_12 IEEE_ADDR_11 IEEE_ADDR_10 140 (0x164) IEEE_ADDR_0 IEEE_ADDR_07 IEEE_ADDR_06 IEEE_ADDR_05 IEEE_ADDR_04 IEEE_ADDR_03 IEEE_ADDR_02 IEEE_ADDR_01 IEEE_ADDR_00 139 (0x163) PAN_ID_1 PAN_ID_17 PAN_ID_16 PAN_ID_15 PAN_ID_14 PAN_ID_13 PAN_ID_12 PAN_ID_11 PAN_ID_10 139 (0x162) PAN_ID_0 PAN_ID_07 PAN_ID_06 PAN_ID_05 PAN_ID_04 PAN_ID_03 PAN_ID_02 PAN_ID_01 PAN_ID_00 139 (0x161) SHORT_ADDR_1 SHORT_ADDR_17 SHORT_ADDR_16 SHORT_ADDR_15 SHORT_ADDR_14 SHORT_ADDR_13 SHORT_ADDR_12 SHORT_ADDR_11 SHORT_ADDR_10 139 (0x160) SHORT_ADDR_0 SHORT_ADDR_07 SHORT_ADDR_06 SHORT_ADDR_05 SHORT_ADDR_04 SHORT_ADDR_03 SHORT_ADDR_02 SHORT_ADDR_01 SHORT_ADDR_00 138 (0x15F) MAN_ID_1 MAN_ID_17 MAN_ID_16 MAN_ID_15 MAN_ID_14 MAN_ID_13 MAN_ID_12 MAN_ID_11 MAN_ID_10 138 (0x15E) MAN_ID_0 MAN_ID_07 MAN_ID_06 MAN_ID_05 MAN_ID_04 MAN_ID_03 MAN_ID_02 MAN_ID_01 MAN_ID_00 138 (0x15D) VERSION_NUM (0x15C) PART_NUM PART_NUM7 PART_NUM6 PART_NUM5 PART_NUM4 PART_NUM3 PART_NUM2 PART_NUM1 PART_NUM0 137 (0x15B) PLL_DCU PLL_DCU_START Res6 Res5 Res4 Res3 Res2 Res1 Res0 135 (0x15A) PLL_CF PLL_CF_START Res6 Res5 Res4 Res3 Res2 Res1 Res0 134 (0x159) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 (0x158) FTN_CTRL FTN_START Res6 Res5 Res4 Res3 Res2 Res1 Res0 133 (0x157) XAH_CTRL_1 Res1 Res0 Res 132 (0x156) TRX_RPC XAH_RPC_EN 136 (0x155) RX_SYN RX_PDT_LEVEL0 131 (0x154) CC_CTRL_1 (0x153) CC_CTRL_0 CC_NUMBER_7 CC_NUMBER_6 CC_NUMBER_5 (0x152) XOSC_CTRL XTAL_MODE3 XTAL_MODE2 (0x151) BATMON BAT_LOW (0x150) VREG_CTRL (0x14F) 154 153 ... VERSION_NUM7 VERSION_NUM6 VERSION_NUM5 VERSION_NUM4 VERSION_NUM3 VERSION_NUM2 VERSION_NUM1 VERSION_NUM0 RX_RPC_CTRL1 RX_RPC_CTRL0 RX_PDT_DIS Res6 AACK_FLTR_RES_FT AACK_UPLD_RES_FT Res RX_RPC_EN PDT_RPC_EN PLL_RPC_EN Res1 Res0 RX_PDT_LEVEL3 AACK_ACK_TIME AACK_PROM_MODE Res0 IPAN_RPC_EN RX_PDT_LEVEL2 RX_PDT_LEVEL1 145 137 CC_BAND_3 CC_BAND_2 CC_BAND_1 CC_BAND_0 135 CC_NUMBER_4 CC_NUMBER_3 CC_NUMBER_2 CC_NUMBER_1 CC_NUMBER_0 135 XTAL_MODE1 XTAL_MODE0 XTAL_TRIM3 XTAL_TRIM2 XTAL_TRIM1 XTAL_TRIM0 130 BAT_LOW_EN BATMON_OK BATMON_HR BATMON_VTH3 BATMON_VTH2 BATMON_VTH1 BATMON_VTH0 129 AVREG_EXT AVDD_OK Res5 Res4 Res3 DVDD_OK Res1 Res0 127 IRQ_STATUS AWAKE TX_END AMI CCA_ED_DONE RX_END RX_START PLL_UNLOCK PLL_LOCK 126 (0x14E) IRQ_MASK AWAKE_EN TX_END_EN AMI_EN CCA_ED_DONE_EN RX_END_EN RX_START_EN PLL_UNLOCK_EN PLL_LOCK_EN 125 (0x14D) ANT_DIV ANT_SEL Res2 Res1 Res0 ANT_DIV_EN ANT_EXT_SW_EN ANT_CTRL1 ANT_CTRL0 124 (0x14C) TRX_CTRL_2 RX_SAFE_MODE Res4 Res3 Res2 Res1 Res0 (0x14B) SFD_VALUE SFD_VALUE7 SFD_VALUE6 SFD_VALUE5 SFD_VALUE4 SFD_VALUE3 SFD_VALUE2 SFD_VALUE1 SFD_VALUE0 123 (0x14A) RX_CTRL Res7 Res6 Res5 Res4 PDT_THRES3 PDT_THRES2 PDT_THRES1 PDT_THRES0 122 (0x149) CCA_THRES (0x148) OQPSK_DATA_RATE1 OQPSK_DATA_RATE0 123 CCA_CS_THRES3 CCA_CS_THRES2 CCA_CS_THRES1 CCA_CS_THRES0 CCA_ED_THRES3 CCA_ED_THRES2 CCA_ED_THRES1 CCA_ED_THRES0 121 PHY_CC_CCA CCA_REQUEST CCA_MODE1 CCA_MODE0 CHANNEL4 CHANNEL3 CHANNEL2 CHANNEL1 CHANNEL0 120 (0x147) PHY_ED_LEVEL ED_LEVEL7 ED_LEVEL6 ED_LEVEL5 ED_LEVEL4 ED_LEVEL3 ED_LEVEL2 ED_LEVEL1 ED_LEVEL0 119 (0x146) PHY_RSSI RX_CRC_VALID RND_VALUE1 RND_VALUE0 RSSI4 RSSI3 RSSI2 RSSI1 RSSI0 118 540 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Page (0x145) PHY_TX_PWR Res3 Res2 Res1 Res0 TX_PWR3 TX_PWR2 TX_PWR1 TX_PWR0 117 (0x144) TRX_CTRL_1 PA_EXT_EN Res4 Res3 Res2 Res1 Res0 116 (0x143) TRX_CTRL_0 Res7 Res4 Res3 Res2 Res1 Res0 (0x142) TRX_STATE (0x141) TRX_STATUS ... Reserved IRQ_2_EXT_EN TX_AUTO_CRC_ON Res6 Res5 TRAC_STATUS2 TRAC_STATUS1 TRAC_STATUS0 CCA_DONE CCA_STATUS TST_STATUS TRX_CMD4 TRX_CMD3 TRX_CMD2 TRX_CMD1 TRX_CMD0 114 TRX_STATUS4 TRX_STATUS3 TRX_STATUS2 TRX_STATUS1 TRX_STATUS0 113 (0x13F) AES_KEY AES_KEY7 AES_KEY6 AES_KEY5 AES_KEY4 AES_KEY3 AES_KEY2 AES_KEY1 AES_KEY0 112 (0x13E) AES_STATE AES_STATE7 AES_STATE6 AES_STATE5 AES_STATE4 AES_STATE3 AES_STATE2 AES_STATE1 AES_STATE0 112 (0x13D) AES_STATUS AES_ER Res5 Res4 Res3 Res2 Res1 Res0 AES_DONE 112 (0x13C) AES_CTRL AES_REQUEST Res AES_MODE Res AES_DIR AES_IM Res1 Res0 111 (0x13B) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 ... Reserved (0x139) TRXPR Res3 Res2 Res1 Res0 Res3 Res2 SLPTR TRXRST 197 (0x138) PARCR PALTD2 PALTD1 PALTD0 PALTU2 PALTU1 PALTU0 PARDFI PARUFI 117 (0x137) DPDS1 Res5 Res4 Res3 Res2 Res1 Res0 PGDRV1 PGDRV0 205 (0x136) DPDS0 PFDRV1 PFDRV0 PEDRV1 PEDRV0 PDDRV1 PDDRV0 PBDRV1 PBDRV0 204 (0x135) DRTRAM0 Res1 Res0 DRTSWOK ENDRT Res3 Res2 Res1 Res0 198 (0x134) DRTRAM1 Res1 Res0 DRTSWOK ENDRT Res3 Res2 Res1 Res0 199 (0x133) DRTRAM2 Res7 Res DRTSWOK ENDRT Res3 Res2 Res1 Res0 200 (0x132) DRTRAM3 Res1 Res0 DRTSWOK ENDRT Res3 Res2 Res1 Res0 201 (0x131) LLDRH Res2 Res1 Res0 LLDRH4 LLDRH3 LLDRH2 LLDRH1 LLDRH0 203 (0x130) LLDRL Res3 Res2 Res1 Res0 LLDRL3 LLDRL2 LLDRL1 LLDRL0 204 (0x12F) LLCR Res1 Res0 LLDONE LLCOMP LLCAL LLTCO LLSHORT LLENCAL 202 ... Reserved (0x12D) OCR5CH OCR5CH7 OCR5CH6 OCR5CH5 OCR5CH4 OCR5CH3 OCR5CH2 OCR5CH1 OCR5CH0 330 (0x12C) OCR5CL OCR5CL7 OCR5CL6 OCR5CL5 OCR5CL4 OCR5CL3 OCR5CL2 OCR5CL1 OCR5CL0 331 (0x12B) OCR5BH OCR5BH7 OCR5BH6 OCR5BH5 OCR5BH4 OCR5BH3 OCR5BH2 OCR5BH1 OCR5BH0 329 (0x12A) OCR5BL OCR5BL7 OCR5BL6 OCR5BL5 OCR5BL4 OCR5BL3 OCR5BL2 OCR5BL1 OCR5BL0 330 (0x129) OCR5AH OCR5AH7 OCR5AH6 OCR5AH5 OCR5AH4 OCR5AH3 OCR5AH2 OCR5AH1 OCR5AH0 329 (0x128) OCR5AL OCR5AL7 OCR5AL6 OCR5AL5 OCR5AL4 OCR5AL3 OCR5AL2 OCR5AL1 OCR5AL0 329 (0x127) ICR5H ICR5H7 ICR5H6 ICR5H5 ICR5H4 ICR5H3 ICR5H2 ICR5H1 ICR5H0 331 (0x126) ICR5L ICR5L7 ICR5L6 ICR5L5 ICR5L4 ICR5L3 ICR5L2 ICR5L1 ICR5L0 331 (0x125) TCNT5H TCNT5H7 TCNT5H6 TCNT5H5 TCNT5H4 TCNT5H3 TCNT5H2 TCNT5H1 TCNT5H0 328 (0x124) TCNT5L TCNT5L7 TCNT5L6 TCNT5L5 TCNT5L4 TCNT5L3 TCNT5L2 TCNT5L1 TCNT5L0 328 ... Reserved (0x122) TCCR5C FOC5A FOC5B FOC5C Res4 Res3 Res2 Res1 Res0 327 (0x121) TCCR5B ICNC5 ICES5 Res WGM53 WGM52 CS52 CS51 CS50 326 (0x120) TCCR5A COM5A1 COM5A0 COM5B1 COM5B0 COM5C1 COM5C0 WGM51 WGM50 324 ... Reserved (0x11D) MAFPA3H MAFPA3H7 MAFPA3H6 MAFPA3H5 MAFPA3H4 MAFPA3H3 MAFPA3H2 MAFPA3H1 MAFPA3H0 150 (0x11C) MAFPA3L MAFPA3L7 MAFPA3L6 MAFPA3L5 MAFPA3L4 MAFPA3L3 MAFPA3L2 MAFPA3L1 MAFPA3L0 150 (0x11B) MAFSA3H MAFSA3H7 MAFSA3H6 MAFSA3H5 MAFSA3H4 MAFSA3H3 MAFSA3H2 MAFSA3H1 MAFSA3H0 152 (0x11A) MAFSA3L MAFSA3L7 MAFSA3L6 MAFSA3L5 MAFSA3L4 MAFSA3L3 MAFSA3L2 MAFSA3L1 MAFSA3L0 152 (0x119) MAFPA2H MAFPA2H7 MAFPA2H6 MAFPA2H5 MAFPA2H4 MAFPA2H3 MAFPA2H2 MAFPA2H1 MAFPA2H0 149 (0x118) MAFPA2L MAFPA2L7 MAFPA2L6 MAFPA2L5 MAFPA2L4 MAFPA2L3 MAFPA2L2 MAFPA2L1 MAFPA2L0 150 (0x117) MAFSA2H MAFSA2H7 MAFSA2H6 MAFSA2H5 MAFSA2H4 MAFSA2H3 MAFSA2H2 MAFSA2H1 MAFSA2H0 152 (0x116) MAFSA2L MAFSA2L7 MAFSA2L6 MAFSA2L5 MAFSA2L4 MAFSA2L3 MAFSA2L2 MAFSA2L1 MAFSA2L0 152 (0x115) MAFPA1H MAFPA1H7 MAFPA1H6 MAFPA1H5 MAFPA1H4 MAFPA1H3 MAFPA1H2 MAFPA1H1 MAFPA1H0 149 (0x114) MAFPA1L MAFPA1L7 MAFPA1L6 MAFPA1L5 MAFPA1L4 MAFPA1L3 MAFPA1L2 MAFPA1L1 MAFPA1L0 149 (0x113) MAFSA1H MAFSA1H7 MAFSA1H6 MAFSA1H5 MAFSA1H4 MAFSA1H3 MAFSA1H2 MAFSA1H1 MAFSA1H0 151 (0x112) MAFSA1L MAFSA1L7 MAFSA1L6 MAFSA1L5 MAFSA1L4 MAFSA1L3 MAFSA1L2 MAFSA1L1 MAFSA1L0 151 (0x111) MAFPA0H MAFPA0H7 MAFPA0H6 MAFPA0H5 MAFPA0H4 MAFPA0H3 MAFPA0H2 MAFPA0H1 MAFPA0H0 148 (0x110) MAFPA0L MAFPA0L7 MAFPA0L6 MAFPA0L5 MAFPA0L4 MAFPA0L3 MAFPA0L2 MAFPA0L1 MAFPA0L0 148 (0x10F) MAFSA0H MAFSA0H7 MAFSA0H6 MAFSA0H5 MAFSA0H4 MAFSA0H3 MAFSA0H2 MAFSA0H1 MAFSA0H0 150 (0x10E) MAFSA0L MAFSA0L7 MAFSA0L6 MAFSA0L5 MAFSA0L4 MAFSA0L3 MAFSA0L2 MAFSA0L1 MAFSA0L0 151 (0x10D) MAFCR1 AACK_I_AM_COORD0 147 (0x10C) MAFCR0 ... Reserved (0xFC) (0xFB) AACK_SET_PD3 AACK_I_AM_COORD3 AACK_SET_PD2 AACK_I_AM_COORD2 AACK_SET_PD1 AACK_I_AM_COORD1 AACK_SET_PD0 Res3 Res2 Res1 Res0 MAF3EN MAF2EN MAF1EN MAF0EN 146 SCTSTRHH SCTSTRHH7 SCTSTRHH6 SCTSTRHH5 SCTSTRHH4 SCTSTRHH3 SCTSTRHH2 SCTSTRHH1 SCTSTRHH0 163 SCTSTRHL SCTSTRHL7 SCTSTRHL6 SCTSTRHL5 SCTSTRHL4 SCTSTRHL3 SCTSTRHL2 SCTSTRHL1 SCTSTRHL0 163 (0xFA) SCTSTRLH SCTSTRLH7 SCTSTRLH6 SCTSTRLH5 SCTSTRLH4 SCTSTRLH3 SCTSTRLH2 SCTSTRLH1 SCTSTRLH0 163 (0xF9) SCTSTRLL SCTSTRLL7 SCTSTRLL6 SCTSTRLL5 SCTSTRLL4 SCTSTRLL3 SCTSTRLL2 SCTSTRLL1 SCTSTRLL0 163 (0xF8) SCOCR1HH SCOCR1HH7 SCOCR1HH6 SCOCR1HH5 SCOCR1HH4 SCOCR1HH3 SCOCR1HH2 SCOCR1HH1 SCOCR1HH0 166 (0xF7) SCOCR1HL SCOCR1HL7 SCOCR1HL6 SCOCR1HL5 SCOCR1HL4 SCOCR1HL3 SCOCR1HL2 SCOCR1HL1 SCOCR1HL0 166 541 42073B-MCU Wireless-09/14 Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Page (0xF6) SCOCR1LH SCOCR1LH7 SCOCR1LH6 SCOCR1LH5 SCOCR1LH4 SCOCR1LH3 SCOCR1LH2 SCOCR1LH1 SCOCR1LH0 166 (0xF5) SCOCR1LL SCOCR1LL7 SCOCR1LL6 SCOCR1LL5 SCOCR1LL4 SCOCR1LL3 SCOCR1LL2 SCOCR1LL1 SCOCR1LL0 167 (0xF4) SCOCR2HH SCOCR2HH7 SCOCR2HH6 SCOCR2HH5 SCOCR2HH4 SCOCR2HH3 SCOCR2HH2 SCOCR2HH1 SCOCR2HH0 167 (0xF3) SCOCR2HL SCOCR2HL7 SCOCR2HL6 SCOCR2HL5 SCOCR2HL4 SCOCR2HL3 SCOCR2HL2 SCOCR2HL1 SCOCR2HL0 167 (0xF2) SCOCR2LH SCOCR2LH7 SCOCR2LH6 SCOCR2LH5 SCOCR2LH4 SCOCR2LH3 SCOCR2LH2 SCOCR2LH1 SCOCR2LH0 167 (0xF1) SCOCR2LL SCOCR2LL7 SCOCR2LL6 SCOCR2LL5 SCOCR2LL4 SCOCR2LL3 SCOCR2LL2 SCOCR2LL1 SCOCR2LL0 168 (0xF0) SCOCR3HH SCOCR3HH7 SCOCR3HH6 SCOCR3HH5 SCOCR3HH4 SCOCR3HH3 SCOCR3HH2 SCOCR3HH1 SCOCR3HH0 168 (0xEF) SCOCR3HL SCOCR3HL7 SCOCR3HL6 SCOCR3HL5 SCOCR3HL4 SCOCR3HL3 SCOCR3HL2 SCOCR3HL1 SCOCR3HL0 168 (0xEE) SCOCR3LH SCOCR3LH7 SCOCR3LH6 SCOCR3LH5 SCOCR3LH4 SCOCR3LH3 SCOCR3LH2 SCOCR3LH1 SCOCR3LH0 168 (0xED) SCOCR3LL SCOCR3LL7 SCOCR3LL6 SCOCR3LL5 SCOCR3LL4 SCOCR3LL3 SCOCR3LL2 SCOCR3LL1 SCOCR3LL0 169 (0xEC) SCTSRHH SCTSRHH7 SCTSRHH6 SCTSRHH5 SCTSRHH4 SCTSRHH3 SCTSRHH2 SCTSRHH1 SCTSRHH0 162 (0xEB) SCTSRHL SCTSRHL7 SCTSRHL6 SCTSRHL5 SCTSRHL4 SCTSRHL3 SCTSRHL2 SCTSRHL1 SCTSRHL0 162 (0xEA) SCTSRLH SCTSRLH7 SCTSRLH6 SCTSRLH5 SCTSRLH4 SCTSRLH3 SCTSRLH2 SCTSRLH1 SCTSRLH0 162 (0xE9) SCTSRLL SCTSRLL7 SCTSRLL6 SCTSRLL5 SCTSRLL4 SCTSRLL3 SCTSRLL2 SCTSRLL1 SCTSRLL0 162 (0xE8) SCBTSRHH SCBTSRHH7 SCBTSRHH6 SCBTSRHH5 SCBTSRHH4 SCBTSRHH3 SCBTSRHH2 SCBTSRHH1 SCBTSRHH0 165 (0xE7) SCBTSRHL SCBTSRHL7 SCBTSRHL6 SCBTSRHL5 SCBTSRHL4 SCBTSRHL3 SCBTSRHL2 SCBTSRHL1 SCBTSRHL0 165 (0xE6) SCBTSRLH SCBTSRLH7 SCBTSRLH6 SCBTSRLH5 SCBTSRLH4 SCBTSRLH3 SCBTSRLH2 SCBTSRLH1 SCBTSRLH0 165 (0xE5) SCBTSRLL SCBTSRLL7 SCBTSRLL6 SCBTSRLL5 SCBTSRLL4 SCBTSRLL3 SCBTSRLL2 SCBTSRLL1 SCBTSRLL0 166 (0xE4) SCCNTHH SCCNTHH7 SCCNTHH6 SCCNTHH5 SCCNTHH4 SCCNTHH3 SCCNTHH2 SCCNTHH1 SCCNTHH0 161 (0xE3) SCCNTHL SCCNTHL7 SCCNTHL6 SCCNTHL5 SCCNTHL4 SCCNTHL3 SCCNTHL2 SCCNTHL1 SCCNTHL0 161 (0xE2) SCCNTLH SCCNTLH7 SCCNTLH6 SCCNTLH5 SCCNTLH4 SCCNTLH3 SCCNTLH2 SCCNTLH1 SCCNTLH0 161 (0xE1) SCCNTLL SCCNTLL7 SCCNTLL6 SCCNTLL5 SCCNTLL4 SCCNTLL3 SCCNTLL2 SCCNTLL1 SCCNTLL0 161 (0xE0) SCIRQS Res2 Res1 Res0 IRQSBO IRQSOF IRQSCP3 IRQSCP2 IRQSCP1 171 (0xDF) SCIRQM Res2 Res1 Res0 IRQMBO IRQMOF IRQMCP3 IRQMCP2 IRQMCP1 172 (0xDE) SCSR Res6 Res5 Res4 Res3 Res2 Res1 Res0 SCBSY 171 (0xDD) SCCR1 Res6 Res5 SCBTSM SCCKDIV2 SCCKDIV1 SCCKDIV0 SCEECLK SCENBO 170 (0xDC) SCCR0 SCRES SCMBTS SCEN SCCKSEL SCTSE SCCMP3 SCCMP2 SCCMP1 169 (0xDB) SCCSR Res1 Res0 SCCS31 SCCS30 SCCS21 SCCS20 SCCS11 SCCS10 159 (0xDA) SCRSTRHH SCRSTRHH7 SCRSTRHH6 SCRSTRHH5 SCRSTRHH4 SCRSTRHH3 SCRSTRHH2 SCRSTRHH1 SCRSTRHH0 164 (0xD9) SCRSTRHL SCRSTRHL7 SCRSTRHL6 SCRSTRHL5 SCRSTRHL4 SCRSTRHL3 SCRSTRHL2 SCRSTRHL1 SCRSTRHL0 164 (0xD8) SCRSTRLH SCRSTRLH7 SCRSTRLH6 SCRSTRLH5 SCRSTRLH4 SCRSTRLH3 SCRSTRLH2 SCRSTRLH1 SCRSTRLH0 164 (0xD7) SCRSTRLL SCRSTRLL7 SCRSTRLL6 SCRSTRLL5 SCRSTRLL4 SCRSTRLL3 SCRSTRLL2 SCRSTRLL1 SCRSTRLL0 165 ... Reserved (0xD1) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 (0xD0) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 ... Reserved (0xCE) UDR1 UDR17 UDR16 UDR15 UDR14 UDR13 UDR12 UDR11 UDR10 391 (0xCD) UBRR1H Res3 Res2 Res1 Res0 UBRR11 UBRR10 UBRR9 UBRR8 395 (0xCC) UBRR1L UBRR7 UBRR6 UBRR5 UBRR4 UBRR3 UBRR2 UBRR1 UBRR0 396 ... Reserved (0xCA) UCSR1C UMSEL11 UMSEL10 UPM11 UPM10 USBS1 UDORD1 UCPHA1 UCPOL1 407 (0xC9) UCSR1B RXCIE1 TXCIE1 UDRIE1 RXEN1 TXEN1 UCSZ12 RXB81 TXB81 406 (0xC8) UCSR1A RXC1 TXC1 UDRE1 FE1 DOR1 UPE1 U2X1 MPCM1 406 ... Reserved (0xC6) UDR0 UDR07 UDR06 UDR05 UDR04 UDR03 UDR02 UDR01 UDR00 387 (0xC5) UBRR0H Res3 Res2 Res1 Res0 UBRR11 UBRR10 UBRR9 UBRR8 391 (0xC4) UBRR0L UBRR7 UBRR6 UBRR5 UBRR4 UBRR3 UBRR2 UBRR1 UBRR0 391 ... Reserved (0xC2) UCSR0C UMSEL01 UMSEL00 UPM01 UPM00 USBS0 UDORD0 UCPHA0 UCPOL0 405 (0xC1) UCSR0B RXCIE0 TXCIE0 UDRIE0 RXEN0 TXEN0 UCSZ02 RXB80 TXB80 405 (0xC0) UCSR0A RXC0 TXC0 UDRE0 FE0 DOR0 UPE0 U2X0 MPCM0 404 (0xBF) IRQ_STATUS1 Res2 Res1 Res0 AMI3 AMI2 AMI1 AMI0 TX_START 127 (0xBE) IRQ_MASK1 Res2 Res1 Res0 AMI3 AMI2 AMI1 AMI0 TX_START_EN 126 (0xBD) TWAMR TWAM6 TWAM5 TWAM4 TWAM3 TWAM2 TWAM1 TWAM0 Res 437 (0xBC) TWCR TWINT TWEA TWSTA TWSTO TWWC TWEN Res TWIE 433 (0xBB) TWDR TWD7 TWD6 TWD5 TWD4 TWD3 TWD2 TWD1 TWD0 436 (0xBA) TWAR TWA6 TWA5 TWA4 TWA3 TWA2 TWA1 TWA0 TWGCE 436 (0xB9) TWSR TWS7 TWS6 TWS5 TWS4 TWS3 Res TWPS1 TWPS0 434 (0xB8) TWBR TWBR7 TWBR6 TWBR5 TWBR4 TWBR3 TWBR2 TWBR1 TWBR0 432 ... Reserved EXCLKAMR EXCLK AS2 TCN2UB OCR2AUB OCR2BUB TCR2AUB TCR2BUB 358 (0xB6) ASSR ... Reserved (0xB4) OCR2B OCR2B7 OCR2B6 OCR2B5 OCR2B4 OCR2B3 OCR2B2 OCR2B1 OCR2B0 358 (0xB3) OCR2A OCR2A7 OCR2A6 OCR2A5 OCR2A4 OCR2A3 OCR2A2 OCR2A1 OCR2A0 358 542 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Page (0xB2) TCNT2 TCNT27 TCNT26 TCNT25 TCNT24 TCNT23 TCNT22 TCNT21 TCNT20 357 (0xB1) TCCR2B FOC2A FOC2B Res1 Res0 WGM22 CS22 CS21 CS20 356 (0xB0) TCCR2A COM2A1 COM2A0 COM2B1 COM2B0 Res1 Res0 WGM21 WGM20 355 ... Reserved (0xAD) OCR4CH OCR4CH7 OCR4CH6 OCR4CH5 OCR4CH4 OCR4CH3 OCR4CH2 OCR4CH1 OCR4CH0 321 (0xAC) OCR4CL OCR4CL7 OCR4CL6 OCR4CL5 OCR4CL4 OCR4CL3 OCR4CL2 OCR4CL1 OCR4CL0 322 (0xAB) OCR4BH OCR4BH7 OCR4BH6 OCR4BH5 OCR4BH4 OCR4BH3 OCR4BH2 OCR4BH1 OCR4BH0 321 (0xAA) OCR4BL OCR4BL7 OCR4BL6 OCR4BL5 OCR4BL4 OCR4BL3 OCR4BL2 OCR4BL1 OCR4BL0 321 (0xA9) OCR4AH OCR4AH7 OCR4AH6 OCR4AH5 OCR4AH4 OCR4AH3 OCR4AH2 OCR4AH1 OCR4AH0 320 (0xA8) OCR4AL OCR4AL7 OCR4AL6 OCR4AL5 OCR4AL4 OCR4AL3 OCR4AL2 OCR4AL1 OCR4AL0 320 (0xA7) ICR4H ICR4H7 ICR4H6 ICR4H5 ICR4H4 ICR4H3 ICR4H2 ICR4H1 ICR4H0 322 (0xA6) ICR4L ICR4L7 ICR4L6 ICR4L5 ICR4L4 ICR4L3 ICR4L2 ICR4L1 ICR4L0 322 (0xA5) TCNT4H TCNT4H7 TCNT4H6 TCNT4H5 TCNT4H4 TCNT4H3 TCNT4H2 TCNT4H1 TCNT4H0 319 (0xA4) TCNT4L TCNT4L7 TCNT4L6 TCNT4L5 TCNT4L4 TCNT4L3 TCNT4L2 TCNT4L1 TCNT4L0 319 ... Reserved (0xA2) TCCR4C FOC4A FOC4B FOC4C Res4 Res3 Res2 Res1 Res0 318 (0xA1) TCCR4B ICNC4 ICES4 Res WGM43 WGM42 CS42 CS41 CS40 317 (0xA0) TCCR4A COM4A1 COM4A0 COM4B1 COM4B0 COM4C1 COM4C0 WGM41 WGM40 315 ... Reserved (0x9D) OCR3CH OCR3CH7 OCR3CH6 OCR3CH5 OCR3CH4 OCR3CH3 OCR3CH2 OCR3CH1 OCR3CH0 312 (0x9C) OCR3CL OCR3CL7 OCR3CL6 OCR3CL5 OCR3CL4 OCR3CL3 OCR3CL2 OCR3CL1 OCR3CL0 313 (0x9B) OCR3BH OCR3BH7 OCR3BH6 OCR3BH5 OCR3BH4 OCR3BH3 OCR3BH2 OCR3BH1 OCR3BH0 312 (0x9A) OCR3BL OCR3BL7 OCR3BL6 OCR3BL5 OCR3BL4 OCR3BL3 OCR3BL2 OCR3BL1 OCR3BL0 312 (0x99) OCR3AH OCR3AH7 OCR3AH6 OCR3AH5 OCR3AH4 OCR3AH3 OCR3AH2 OCR3AH1 OCR3AH0 311 (0x98) OCR3AL OCR3AL7 OCR3AL6 OCR3AL5 OCR3AL4 OCR3AL3 OCR3AL2 OCR3AL1 OCR3AL0 311 (0x97) ICR3H ICR3H7 ICR3H6 ICR3H5 ICR3H4 ICR3H3 ICR3H2 ICR3H1 ICR3H0 313 (0x96) ICR3L ICR3L7 ICR3L6 ICR3L5 ICR3L4 ICR3L3 ICR3L2 ICR3L1 ICR3L0 313 (0x95) TCNT3H TCNT3H7 TCNT3H6 TCNT3H5 TCNT3H4 TCNT3H3 TCNT3H2 TCNT3H1 TCNT3H0 310 (0x94) TCNT3L TCNT3L7 TCNT3L6 TCNT3L5 TCNT3L4 TCNT3L3 TCNT3L2 TCNT3L1 TCNT3L0 310 ... Reserved (0x92) TCCR3C FOC3A FOC3B FOC3C Res4 Res3 Res2 Res1 Res0 309 (0x91) TCCR3B ICNC3 ICES3 Res WGM33 WGM32 CS32 CS31 CS30 308 (0x90) TCCR3A COM3A1 COM3A0 COM3B1 COM3B0 COM3C1 COM3C0 WGM31 WGM30 306 ... Reserved (0x8D) OCR1CH OCR1CH7 OCR1CH6 OCR1CH5 OCR1CH4 OCR1CH3 OCR1CH2 OCR1CH1 OCR1CH0 303 (0x8C) OCR1CL OCR1CL7 OCR1CL6 OCR1CL5 OCR1CL4 OCR1CL3 OCR1CL2 OCR1CL1 OCR1CL0 303 (0x8B) OCR1BH OCR1BH7 OCR1BH6 OCR1BH5 OCR1BH4 OCR1BH3 OCR1BH2 OCR1BH1 OCR1BH0 302 (0x8A) OCR1BL OCR1BL7 OCR1BL6 OCR1BL5 OCR1BL4 OCR1BL3 OCR1BL2 OCR1BL1 OCR1BL0 302 (0x89) OCR1AH OCR1AH7 OCR1AH6 OCR1AH5 OCR1AH4 OCR1AH3 OCR1AH2 OCR1AH1 OCR1AH0 301 (0x88) OCR1AL OCR1AL7 OCR1AL6 OCR1AL5 OCR1AL4 OCR1AL3 OCR1AL2 OCR1AL1 OCR1AL0 301 (0x87) ICR1H ICR1H7 ICR1H6 ICR1H5 ICR1H4 ICR1H3 ICR1H2 ICR1H1 ICR1H0 303 (0x86) ICR1L ICR1L7 ICR1L6 ICR1L5 ICR1L4 ICR1L3 ICR1L2 ICR1L1 ICR1L0 304 (0x85) TCNT1H TCNT1H7 TCNT1H6 TCNT1H5 TCNT1H4 TCNT1H3 TCNT1H2 TCNT1H1 TCNT1H0 300 (0x84) TCNT1L TCNT1L7 TCNT1L6 TCNT1L5 TCNT1L4 TCNT1L3 TCNT1L2 TCNT1L1 TCNT1L0 301 ... Reserved (0x82) TCCR1C FOC1A FOC1B FOC1C Res4 Res3 Res2 Res1 Res0 300 (0x81) TCCR1B ICNC1 ICES1 Res WGM13 WGM12 CS12 CS11 CS10 298 (0x80) TCCR1A COM1A1 COM1A0 COM1B1 COM1B0 COM1C1 COM1C0 WGM11 WGM10 296 (0x7F) DIDR1 AIN1D AIN0D 440 (0x7E) DIDR0 ADC7D ADC6D ADC5D ADC4D ADC3D ADC2D ADC1D ADC0D 467 (0x7D) DIDR2 ADC15D ADC14D ADC13D ADC12D ADC11D ADC10D ADC9D ADC8D 468 (0x7C) ADMUX REFS1 REFS0 ADLAR MUX4 MUX3 MUX2 MUX1 MUX0 462 (0x7B) ADCSRB AVDDOK ACME REFOK ACCH MUX5 ADTS2 ADTS1 ADTS0 462 (0x7A) ADCSRA ADEN ADSC ADATE ADIF ADIE ADPS2 ADPS1 ADPS0 465 (0x79) ADCH ADCH7 ADCH6 ADCH5 ADCH4 ADCH3 ADCH2 ADCH1 ADCH0 467 (0x78) ADCL ADCL7 ADCL6 ADCL5 ADCL4 ADCL3 ADCL2 ADCL1 ADCL0 467 (0x77) ADCSRC ADTHT1 ADTHT0 Res0 ADSUT4 ADSUT3 ADSUT2 ADSUT1 ADSUT0 466 ... Reserved 501 (0x75) NEMCR Res7 ENEAM AEAM1 AEAM0 Res3 Res2 Res1 Res0 (0x74) Reserved Res7 Res6 Res5 Res4 Res3 Res2 Res1 Res0 (0x73) TIMSK5 Res1 Res0 ICIE5 Res OCIE5C OCIE5B OCIE5A TOIE5 332 (0x72) TIMSK4 Res1 Res0 ICIE4 Res OCIE4C OCIE4B OCIE4A TOIE4 323 (0x71) TIMSK3 Res1 Res0 ICIE3 Res OCIE3C OCIE3B OCIE3A TOIE3 314 (0x70) TIMSK2 Res4 Res3 Res2 Res1 Res0 OCIE2B OCIE2A TOIE2 354 543 42073B-MCU Wireless-09/14 Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Page (0x6F) TIMSK1 Res1 Res0 ICIE1 Res OCIE1C OCIE1B OCIE1A TOIE1 304 (0x6E) TIMSK0 Res4 Res3 Res2 Res1 Res0 OCIE0B OCIE0A TOIE0 272 (0x6D) PCMSK2 PCINT23 PCINT22 PCINT21 PCINT20 PCINT19 PCINT18 PCINT17 PCINT16 254 (0x6C) PCMSK1 PCINT15 PCINT14 PCINT13 PCINT12 PCINT11 PCINT10 PCINT9 PCINT8 254 (0x6B) PCMSK0 PCINT7 PCINT6 PCINT5 PCINT4 PCINT3 PCINT2 PCINT1 PCINT0 255 (0x6A) EICRB ISC71 ISC70 ISC61 ISC60 ISC51 ISC50 ISC41 ISC40 250 (0x69) EICRA ISC31 ISC30 ISC21 ISC20 ISC11 ISC10 ISC01 ISC00 249 (0x68) PCICR Res4 Res3 Res2 Res1 Res0 PCIE2 PCIE1 PCIE0 253 (0x67) BGCR Res BGCAL_FINE3 BGCAL_FINE2 BGCAL_FINE1 BGCAL_FINE0 BGCAL2 BGCAL1 BGCAL0 468 (0x66) OSCCAL CAL7 CAL6 CAL5 CAL4 CAL3 CAL2 CAL1 CAL0 180 (0x65) PRR1 Res PRTRX24 PRTIM5 PRTIM4 PRTIM3 PRUSART1 196 (0x64) PRR0 PRTWI PRTIM2 PRTIM0 PRPGA PRTIM1 PRSPI PRUSART0 PRADC 195 (0x63) PRR2 Res3 Res2 Res1 Res0 PRRAM3 PRRAM2 PRRAM1 PRRAM0 197 ... Reserved (0x61) CLKPR CLKPCE Res2 Res1 Res0 CLKPS3 CLKPS2 CLKPS1 CLKPS0 181 (0x60) WDTCSR WDIF WDIE WDP3 WDCE WDE WDP2 WDP1 WDP0 215 0x3F (0x5F) SREG I T H S V N Z C 11 0x3E (0x5E) SPH SP15 SP14 SP13 SP12 SP11 SP10 SP9 SP8 13 0x3D (0x5D) SPL SP7 SP6 SP5 SP4 SP3 SP2 SP1 SP0 14 0x3C (0x5C) EIND EIND0 15 0x3B (0x5B) RAMPZ ... Reserved 0x37 (0x57) SPMCSR ... Reserved 0x35 (0x55) 0x34 (0x54) Res5 Res4 Res3 Res2 Res1 Res0 RAMPZ1 RAMPZ0 14 SPMIE RWWSB SIGRD RWWSRE BLBSET PGWRT PGERS SPMEN 499 MCUCR JTD Res1 Res0 PUD Res1 Res0 IVSEL IVCE 234 MCUSR Res2 Res1 Res0 JTRF WDRF BORF EXTRF PORF 214 0x33 (0x53) SMCR Res3 Res2 Res1 Res0 SM2 SM1 SM0 SE 194 ... Reserved 0x31 (0x51) OCDR OCDR7 OCDR6 OCDR5 OCDR4 OCDR3 OCDR2 OCDR1 OCDR0 475 0x30 (0x50) ACSR ACD ACBG ACO ACI ACIE ACIC ACIS1 ACIS0 439 ... Reserved 0x2E (0x4E) SPDR SPDR7 SPDR6 SPDR5 SPDR4 SPDR3 SPDR2 SPDR1 SPDR0 368 0x2D (0x4D) SPSR SPIF WCOL Res4 Res3 Res2 Res1 Res0 SPI2X 368 0x2C (0x4C) SPCR SPIE SPE DORD MSTR CPOL CPHA SPR1 SPR0 367 0x2B (0x4B) GPIOR2 GPIOR27 GPIOR26 GPIOR25 GPIOR24 GPIOR23 GPIOR22 GPIOR21 GPIOR20 29 0x2A (0x4A) GPIOR1 GPIOR17 GPIOR16 GPIOR15 GPIOR14 GPIOR13 GPIOR12 GPIOR11 GPIOR10 29 ... Reserved 0x28 (0x48) OCR0B OCR0B_7 OCR0B_6 OCR0B_5 OCR0B_4 OCR0B_3 OCR0B_2 OCR0B_1 OCR0B_0 272 0x27 (0x47) OCR0A OCR0A_7 OCR0A_6 OCR0A_5 OCR0A_4 OCR0A_3 OCR0A_2 OCR0A_1 OCR0A_0 271 0x26 (0x46) TCNT0 TCNT0_7 TCNT0_6 TCNT0_5 TCNT0_4 TCNT0_3 TCNT0_2 TCNT0_1 TCNT0_0 271 0x25 (0x45) TCCR0B FOC0A FOC0B Res1 Res0 WGM02 CS02 CS01 CS00 270 0x24 (0x44) TCCR0A COM0A1 COM0A0 COM0B1 COM0B0 Res1 Res0 WGM01 WGM00 268 0x23 (0x43) GTCCR TSM Res4 Res3 Res2 Res1 Res0 PSRASY PSRSYNC 359 0x22 (0x42) EEARH Res3 Res2 Res1 Res0 EEAR11 EEAR10 EEAR9 EEAR8 26 0x21 (0x41) EEARL EEAR7 EEAR6 EEAR5 EEAR4 EEAR3 EEAR2 EEAR1 EEAR0 26 0x20 (0x40) EEDR EEDR7 EEDR6 EEDR5 EEDR4 EEDR3 EEDR2 EEDR1 EEDR0 27 0x1F (0x3F) EECR Res1 Res0 EEPM1 EEPM0 EERIE EEMPE EEPE EERE 27 0x1E (0x3E) GPIOR0 GPIOR07 GPIOR06 GPIOR05 GPIOR04 GPIOR03 GPIOR02 GPIOR01 GPIOR00 29 0x1D (0x3D) EIMSK INT7 INT6 INT5 INT4 INT3 INT2 INT1 INT0 252 0x1C (0x3C) EIFR INTF7 INTF6 INTF5 INTF4 INTF3 INTF2 INTF1 INTF0 252 0x1B (0x3B) PCIFR Res4 Res3 Res2 Res1 Res0 PCIF2 PCIF1 PCIF0 253 0x1A (0x3A) TIFR5 Res1 Res0 ICF5 Res OCF5C OCF5B OCF5A TOV5 332 0x19 (0x39) TIFR4 Res1 Res0 ICF4 Res OCF4C OCF4B OCF4A TOV4 323 0x18 (0x38) TIFR3 Res1 Res0 ICF3 Res OCF3C OCF3B OCF3A TOV3 314 0x17 (0x37) TIFR2 Res4 Res3 Res2 Res1 Res0 OCF2B OCF2A TOV2 354 0x16 (0x36) TIFR1 Res1 Res0 ICF1 Res OCF1C OCF1B OCF1A TOV1 305 0x15 (0x35) TIFR0 Res4 Res3 Res2 Res1 Res0 OCF0B OCF0A TOV0 273 0x14 (0x34) PORTG Res1 Res0 PORTG5 PORTG4 PORTG3 PORTG2 PORTG1 PORTG0 239 0x13 (0x33) DDRG Res1 Res0 DDG5 DDG4 DDG3 DDG2 DDG1 DDG0 240 0x12 (0x32) PING Res1 Res0 PING5 PING4 PING3 PING2 PING1 PING0 240 0x11 (0x31) PORTF PORTF7 PORTF6 PORTF5 PORTF4 PORTF3 PORTF2 PORTF1 PORTF0 238 0x10 (0x30) DDRF DDF7 DDF6 DDF5 DDF4 DDF3 DDF2 DDF1 DDF0 239 0x0F (0x2F) PINF PINF7 PINF6 PINF5 PINF4 PINF3 PINF2 PINF1 PINF0 239 0x0E (0x2E) PORTE PORTE7 PORTE6 PORTE5 PORTE4 PORTE3 PORTE2 PORTE1 PORTE0 237 544 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Page 0x0D (0x2D) DDRE DDE7 DDE6 DDE5 DDE4 DDE3 DDE2 DDE1 DDE0 238 0x0C (0x2C) PINE PINE7 PINE6 PINE5 PINE4 PINE3 PINE2 PINE1 PINE0 238 0x0B (0x2B) PORTD PORTD7 PORTD6 PORTD5 PORTD4 PORTD3 PORTD2 PORTD1 PORTD0 237 0x0A (0x2A) DDRD DDD7 DDD6 DDD5 DDD4 DDD3 DDD2 DDD1 DDD0 237 0x09 (0x29) PIND PIND7 PIND6 PIND5 PIND4 PIND3 PIND2 PIND1 PIND0 237 0x08 (0x28) PORTC PORTC7 PORTC6 PORTC5 PORTC4 PORTC3 PORTC2 PORTC1 PORTC0 31 0x07 (0x27) DDRC DDC7 DDC6 DDC5 DDC4 DDC3 DDC2 DDC1 DDC0 31 0x06 (0x26) PINC PINC7 PINC6 PINC5 PINC4 PINC3 PINC2 PINC1 PINC0 31 0x05 (0x25) PORTB PORTB7 PORTB6 PORTB5 PORTB4 PORTB3 PORTB2 PORTB1 PORTB0 236 0x04 (0x24) DDRB DDB7 DDB6 DDB5 DDB4 DDB3 DDB2 DDB1 DDB0 236 0x03 (0x23) PINB PINB7 PINB6 PINB5 PINB4 PINB3 PINB2 PINB1 PINB0 236 0x02 (0x22) PORTA PORTA7 PORTA6 PORTA5 PORTA4 PORTA3 PORTA2 PORTA1 PORTA0 30 0x01 (0x21) DDRA DDA7 DDA6 DDA5 DDA4 DDA3 DDA2 DDA1 DDA0 30 0x00 (0x20) PINA PINA7 PINA6 PINA5 PINA4 PINA3 PINA2 PINA1 PINA0 30 Notes: 1. Reserved registers, bits and I/O memory addresses (marked as Res*) may not be modified. 2. I/O registers within the address range 0x00 - 0x1F are directly bit-accessible using the SBI and CBI instructions. In these registers, the value of single bits can be checked by using the SBIS and SBIC instructions. 3. Some of the status flags are cleared by writing a logical one to them. Note that the CBI and SBI instructions will operate on all bits in the I/O register, writing a one back into any flag read as set, thus clearing the flag. The CBI and SBI instructions work with registers 0x00 to 0x1F only. 4. When using the I/O specific commands IN and OUT, the I/O addresses 0x00 - 0x3F must be used. When addressing I/O registers as data space using LD and ST instructions, 0x20 must be added to these addresses. The device is a complex microcontroller with more peripheral units than can be supported within the 64 location reserved in Op-code for the IN and OUT instructions. For the Extended I/O space from 0x60 - 0x1FF in SRAM, only the ST/STS/STD and LD/LDS/LDD instructions can be used. 34 Instruction Set Summary Depending on the size of the Flash memory the instructions * EICALL and EIJMP do not exist in devices with 128K/64KByte Flash memory, * ELPM does not exist in the device with 64Kbyte Flash memory. 34.1 Arithmetic and Logic Instructions Mnemonics Operands Description Operation Flags #Clocks ADD Rd, Rr Add two Registers Rd Rd + Rr Z,C,N,V,H 1 ADC Rd, Rr Add with Carry two Registers Rd Rd + Rr + C Z,C,N,V,H 1 ADIW Rdl,K Add Immediate to Word Rdh:Rdl Rdh:Rdl + K Z,C,N,V,S 2 SUB Rd, Rr Subtract two Registers Rd Rd - Rr Z,C,N,V,H 1 SUBI Rd, K Subtract Constant from Register Rd Rd - K Z,C,N,V,H 1 SBC Rd, Rr Subtract with Carry two Registers Rd Rd - Rr - C Z,C,N,V,H 1 SBCI Rd, K Subtract with Carry Constant from Reg. Rd Rd - K - C Z,C,N,V,H 1 SBIW Rdl, K Subtract Immediate from Word Rdh:Rdl Rdh:Rdl - K Z,C,N,V,S 2 AND Rd, Rr Logical AND Registers Rd Rd * Rr Z,N,V 1 ANDI Rd, K Logical AND Register and Constant Rd Rd * K Z,N,V 1 OR Rd, Rr Logical OR Registers Rd Rd v Rr Z,N,V 1 ORI Rd, K Logical OR Register and Constant Rd Rd v K Z,N,V 1 EOR Rd, Rr Exclusive OR Registers Rd Rd Rr Z,N,V 1 COM Rd One's Complement Rd 0xFF - Rd Z,C,N,V 1 NEG Rd Two's Complement Rd 0x00 - Rd Z,C,N,V,H 1 545 42073B-MCU Wireless-09/14 Mnemonics Operands Description Operation Flags #Clocks SBR Rd,K Set Bit(s) in Register Rd Rd v K Z,N,V 1 CBR Rd,K Clear Bit(s) in Register Rd Rd * (0xFF - K) Z,N,V 1 INC Rd Increment Rd Rd + 1 Z,N,V 1 DEC Rd Decrement Rd Rd - 1 Z,N,V 1 TST Rd Test for Zero or Minus Rd Rd * Rd Z,N,V 1 CLR Rd Clear Register Rd Rd Rd Z,N,V 1 SER Rd Set Register Rd 0xFF None 1 MUL Rd, Rr Multiply Unsigned R1:R0 Rd x Rr Z,C 2 MULS Rd, Rr Multiply Signed R1:R0 Rd x Rr Z,C 2 MULSU Rd, Rr Multiply Signed with Unsigned R1:R0 Rd x Rr Z,C 2 FMUL Rd, Rr Fractional Multiply Unsigned R1:R0 (Rd x Rr) << 1 Z,C 2 FMULS Rd, Rr Fractional Multiply Signed R1:R0 (Rd x Rr) << 1 Z,C 2 FMULSU Rd, Rr Fractional Multiply Signed with Unsigned R1:R0 (Rd x Rr) << 1 Z,C 2 34.2 Branch Instructions Mnemonics Operands Description Operation Flags #Clocks RJMP k Relative Jump PC PC + k + 1 None 2 IJMP Indirect Jump to (Z) PC Z None 2 EIJMP Extended Indirect Jump to (Z) PC (EIND:Z) None 2 JMP k Direct Jump PC k None 3 RCALL k Relative Subroutine Call PC PC + k + 1 None 4 Indirect Call to (Z) PC Z None 4 ICALL EICALL Extended Indirect Call to (Z) PC (EIND:Z) None 4 Direct Subroutine Call PC k None 5 RET Subroutine Return PC STACK None 5 RETI Interrupt Return PC STACK I 5 CALL k CPSE Rd,Rr Compare, Skip if Equal if (Rd = Rr) PC PC + 2 or 3 None 1/2/3 CP Rd,Rr Compare Rd - Rr Z,N,V,C,H 1 CPC Rd,Rr Compare with Carry Rd - Rr - C Z,N,V,C,H 1 CPI Rd,K Compare Register with Immediate Rd - K Z,N,V,C,H 1 SBRC Rr, b Skip if Bit in Register Cleared if (Rr(b)=0) PC PC + 2 or 3 None 1/2/3 SBRS Rr, b Skip if Bit in Register is Set if (Rr(b)=1) PC PC + 2 or 3 None 1/2/3 SBIC P, b Skip if Bit in I/O Register Cleared if (P(b)=0) PC PC + 2 or 3 None 1/2/3 SBIS P, b Skip if Bit in I/O Register is Set if (P(b)=1) PC PC + 2 or 3 None 1/2/3 BRBS s, k Branch if Status Flag Set if (SREG(s) = 1) then PC PC + k + 1 None 1/2 BRBC s, k Branch if Status Flag Cleared if (SREG(s) = 0) then PC PC + k + 1 None 1/2 BREQ k Branch if Equal if (Z = 1) then PC PC + k + 1 None 1/2 BRNE k Branch if Not Equal if (Z = 0) then PC PC + k + 1 None 1/2 BRCS k Branch if Carry Set if (C = 1) then PC PC + k + 1 None 1/2 BRCC k Branch if Carry Cleared if (C = 0) then PC PC + k + 1 None 1/2 546 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Mnemonics Operands Description Operation Flags #Clocks BRSH k Branch if Same or Higher if (C = 0) then PC PC + k + 1 None 1/2 BRLO k Branch if Lower if (C = 1) then PC PC + k + 1 None 1/2 BRMI k Branch if Minus if (N = 1) then PC PC + k + 1 None 1/2 BRPL k Branch if Plus if (N = 0) then PC PC + k + 1 None 1/2 BRGE k Branch if Greater or Equal, Signed if (N V= 0) then PC PC + k + 1 None 1/2 BRLT k Branch if Less Than Zero, Signed if (N V= 1) then PC PC + k + 1 None 1/2 BRHS k Branch if Half Carry Flag Set if (H = 1) then PC PC + k + 1 None 1/2 BRHC k Branch if Half Carry Flag Cleared if (H = 0) then PC PC + k + 1 None 1/2 BRTS k Branch if T Flag Set if (T = 1) then PC PC + k + 1 None 1/2 BRTC k Branch if T Flag Cleared if (T = 0) then PC PC + k + 1 None 1/2 BRVS k Branch if Overflow Flag is Set if (V = 1) then PC PC + k + 1 None 1/2 BRVC k Branch if Overflow Flag is Cleared if (V = 0) then PC PC + k + 1 None 1/2 BRIE k Branch if Interrupt Enabled if ( I = 1) then PC PC + k + 1 None 1/2 BRID k Branch if Interrupt Disabled if ( I = 0) then PC PC + k + 1 None 1/2 34.3 Bit and Bit Test Instructions Mnemonics Operands Description Operation Flags #Clocks SBI P,b Set Bit in I/O Register I/O(P,b) 1 None 2 CBI P,b Clear Bit in I/O Register I/O(P,b) 0 None 2 LSL Rd Logical Shift Left Rd(n+1) Rd(n), Rd(0) 0 Z,C,N,V 1 LSR Rd Logical Shift Right Rd(n) Rd(n+1), Rd(7) 0 Z,C,N,V 1 ROL Rd Rotate Left Through Carry Rd(0) C, Rd(n+1) Rd(n), C Rd(7) Z,C,N,V 1 ROR Rd Rotate Right Through Carry Rd(7) C, Rd(n) Rd(n+1), C Rd(0) Z,C,N,V 1 ASR Rd Arithmetic Shift Right Rd(n) Rd(n+1), n=0..6 Z,C,N,V 1 SWAP Rd Swap Nibbles Rd(3..0) Rd(7..4), Rd(7..4) Rd(3..0) None 1 BSET s Flag Set SREG(s) 1 SREG(s) 1 BCLR s Flag Clear SREG(s) 0 SREG(s) 1 BST Rr, b Bit Store from Register to T T Rr(b) T 1 BLD Rd, b Bit load from T to Register Rd(b) T None 1 SEC Set Carry C1 C 1 CLC Clear Carry C0 C 1 SEN Set Negative Flag N1 N 1 CLN Clear Negative Flag N0 N 1 SEZ Set Zero Flag Z1 Z 1 CLZ Clear Zero Flag Z0 Z 1 SEI Global Interrupt Enable I1 I 1 CLI Global Interrupt Disable I0 I 1 547 42073B-MCU Wireless-09/14 Mnemonics Operands Description Operation Flags #Clocks SES Set Signed Test Flag S1 S 1 CLS Clear Signed Test Flag S0 S 1 SEV Set Twos Complement Overflow V1 V 1 CLV Clear Twos Complement Overflow V0 V 1 SET Set T in SREG T1 T 1 CLT Clear T in SREG T0 T 1 SEH Set Half Carry Flag in SREG H1 H 1 CLH Clear Half Carry Flag in SREG H0 H 1 34.4 Data Transfer Instructions Mnemonics Operands Description Operation Flags #Clocks MOV Rd, Rr Move Between Registers Rd Rr None 1 MOVW Rd, Rr Copy Register Word Rd+1:Rd Rr+1:Rr None 1 LDI Rd, K Load Immediate Rd K None 1 LD Rd, X Load Indirect Rd (X) None 2 LD Rd, X+ Load Indirect and Post-Inc. Rd (X), X X + 1 None 2 LD Rd, - X Load Indirect and Pre-Dec. X X - 1, Rd (X) None 2 LD Rd, Y Load Indirect Rd (Y) None 2 LD Rd, Y+ Load Indirect and Post-Inc. Rd (Y), Y Y + 1 None 2 LD Rd, - Y Load Indirect and Pre-Dec. Y Y - 1, Rd (Y) None 2 LDD Rd,Y+q Load Indirect with Displacement Rd (Y + q) None 2 LD Rd, Z Load Indirect Rd (Z) None 2 LD Rd, Z+ Load Indirect and Post-Inc. Rd (Z), Z Z+1 None 2 LD Rd, -Z Load Indirect and Pre-Dec. Z Z - 1, Rd (Z) None 2 LDD Rd, Z+q Load Indirect with Displacement Rd (Z + q) None 2 LDS Rd, k Load Direct from SRAM Rd (k) None 2 ST X, Rr Store Indirect (X) Rr None 2 ST X+, Rr Store Indirect and Post-Inc. (X) Rr, X X + 1 None 2 ST - X, Rr Store Indirect and Pre-Dec. X X - 1, (X) Rr None 2 ST Y, Rr Store Indirect (Y) Rr None 2 ST Y+, Rr Store Indirect and Post-Inc. (Y) Rr, Y Y + 1 None 2 ST - Y, Rr Store Indirect and Pre-Dec. Y Y - 1, (Y) Rr None 2 STD Y+q,Rr Store Indirect with Displacement (Y + q) Rr None 2 ST Z, Rr Store Indirect (Z) Rr None 2 ST Z+, Rr Store Indirect and Post-Inc. (Z) Rr, Z Z + 1 None 2 ST -Z, Rr Store Indirect and Pre-Dec. Z Z - 1, (Z) Rr None 2 STD Z+q,Rr Store Indirect with Displacement (Z + q) Rr None 2 STS k, Rr Store Direct to SRAM (k) Rr None 2 LPM Load Program Memory R0 (Z) None 3 LPM Rd, Z Load Program Memory Rd (Z) None 3 LPM Rd, Z+ Load Program Memory and Post-Inc Rd (Z), Z Z+1 None 3 548 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Mnemonics Operands ELPM Description Operation Flags #Clocks Extended Load Program Memory R0 (RAMPZ:Z) None 3 ELPM Rd, Z Extended Load Program Memory Rd (RAMPZ:Z) None 3 ELPM Rd, Z+ Extended Load Program Memory Rd (RAMPZ:Z), RAMPZ:Z RAMPZ:Z+1 None 3 Store Program Memory (Z) R1:R0 None - In Port Rd P None 1 SPM IN Rd, P OUT P, Rr Out Port P Rr None 1 PUSH Rr Push Register on Stack STACK Rr None 2 POP Rd Pop Register from Stack Rd STACK None 2 Operation Flags #Clocks None 1 34.5 MCU Control Instructions Mnemonics Operands Description NOP No Operation SLEEP Sleep (see specific description for Sleep function) None 1 WDR Watchdog Reset (see specific description for WDR/timer) None 1 BREAK Break For On-chip Debug Only None N/A 549 42073B-MCU Wireless-09/14 35 Electrical Characteristics 35.1 Absolute Maximum Ratings Note that stresses beyond those listed under "Absolute Maximum Ratings" may cause permanent damage to the device. This is a stress rating only and functional operation of the device at these or any other conditions beyond those indicated in the operational sections of this specification are not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability. Symbol Parameter Condition Min. TSTOR Storage temperature TLEAD Lead temperature T = 10s (soldering profile compliant with IPC/JEDEC J-STD-020B) VESD ESD robustness Compliant to [4] PRF Input RF level VDDMAX Maximum voltage VDMAXEV Maximum voltage difference between DEVDD and EVDD VDIG Voltage on all pins VANA Voltage on pins 8,9,21,22,60,62 Typ. -50 Max. Units 150 C 260 C 4 Maximum voltage from any pin to ground except pins 8,9,21,22,60,62 kV +14 dBm -0.3 3.6 V -0.3 0.3 V -0.3 VDDMAX V -0.3 2.0 V VCOMP_IN Comparator input voltage Pins with Comparator input connected by the analog multiplexer -0.3 VDDMAX V VPGA_IN PGA input voltage Pins with PGA input connected by the analog multiplexer -0.3 VDDMAX V VADC_IN ADC input voltage Pins with ADC input connected by the analog multiplexer (PGA bypassed) -0.3 2.0 V 35.2 Recommended Operating Range Symbol Parameter TOP_ZU Operating temperature range TOP_ZF Operating temperature range Condition Min. (2) Max. Units -40 +85 C -40 +125 C 3.6 V VDD Supply voltage Voltage on pins 23,34,44,54,59 VDEV Voltage difference between DEVDD and EVDD EVDD and DEVDD should be tight together on the PCB VDD1.8 Supply voltage (on pins 21,22,60) External voltage supply VOVRDRV Pin Overdrive voltage Pin Voltage exceeding supply voltage except pins 8,9,21,22,60,62 Notes: 1. Register VREG_CTRL needs to be programmed to disable internal voltage regulators and supply blocks by an external 1.8V supply, refer to section "Voltage Regulators (AVREG, DVREG)" on page 191. (1) 1.8 Typ. 3.0 0.0 1.7 V 1.8 1.9 V +0.3 V 2. Even if an implementation uses the external 1.8V voltage supply VDD1.8 it is required to connect VDD. 550 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 35.3 Digital Pin Characteristics Test Conditions: TOP = -40C to 125C, VDD =1.8V to 3.6V (unless otherwise stated) Symbol VIH VIL VIHRSTN Parameter Condition (1) High level input voltage Low level input voltage (1) Except pin RSTN Min Typ 0.7 VDD High level input voltage (1) Pin RSTN VILRSTN Low level input voltage VOH High level output voltage VOL Low level output voltage VOHMIN High level output voltage VOLMIN Low level output voltage RRSTN Reset pull-up resistor RGPIO GPIO pull-up resistor If pull-up resistor is enabled IIL Input Leakage current VDD = 3.6V, pin low IIH Input Leakage current 0.3 VDD 0.9 VDD (1) (1) (1) IOH = -12mA, VDD = 3.6V IOH = -6mA, VDD = 1.8V Maximum. drive strength by DPDS0/1 Except Pins 17,18 0.1 VDD VDD - 0.4 0.4 VDD - 0.4 IOL = 4mA, VDD = 3.6V IOL = 2.5mA, VDD = 1.8V Minimum. drive strength by DPDS0/1 Except Pins 17,18 0.4 V 120 360 k 120 360 k 1 A 1 A <10 VDD = 3.6V, pin high T = 25 C 1. V V T = 25 C Note: V V IOL = 16mA, VDD = 3.6V IOL = 10mA, VDD = 1.8V Maximum drive strength by DPDS0/1 Except Pins 17,18 IOH = -3mA, VDD = 3.6V IOH = -1.5mA, VDD = 1.8V Minimum drive strength by DPDS0/1 Except Pins 17,18 V V Pin RSTN (1) Units V Except pin RSTN (1) Max nA <10 nA The capacitive load should not be larger than 50 pF for all I/Os when using the default driver strength settings, refer to section "DPDS0 - Port Driver Strength Register 0" on page 204 and "DPDS1 - Port Driver Strength Register 1" on page 205. Generally, large load capacitances increase the overall current consumption. 35.4 Transceiver Pin Characteristics Test Conditions: TOP = 25C, VDD =1.8V to 3.6V (unless otherwise stated) Symbol Parameter Condition Min Typ Max Units VRFNPDC1 DC level RF pins RFN and RFP Transceiver in BUSY_TX 0.9 V VRFNPDC2 Transceiver in receive states 0.02 V VRFNPDC3 Transceiver, other states 0 V CX1 and CX2 connected 0.9 V VXTALDC Note: DC level pins XTAL1 and XTAL2 1. Pins RFN and RFP require an AC coupling if the external parts (e.g. balun, antenna) have a DC path to ground. Serial capacitances and capacitance of each pin to ground must be < 30 pF. 2. For CX1 and CX2 see "Table 32-1" on page 539 551 42073B-MCU Wireless-09/14 35.5 Power Supply Currents (RF transceiver in SLEEP mode) Test Conditions: TOP = 25C, VDD =3.0V (unless otherwise stated) Symbol Parameter Condition / AVR mode ISUPPLY Power Supply Current (PRR0=0xFF, PRR1=0x3F, 16MHz RC Oscillator selected) Standby mode 0.31 mA Idle 1MHz 0.45 mA Idle 8MHz 0.8 mA Idle 16MHz 1.1 mA Active 1MHz 0.8 mA Active 8MHz 2.5 mA Active 16MHz 3.7 mA Power Supply Current (PRR0=0x00, PRR1=0x00) Min Typ Max Units Active, 16MHz RC Oscillator 4.0 mA Active, 16MHz Crystal Oscillator 4.5 mA Active, external 16MHz clock on CLKI 4.5 mA Test Conditions: TOP = 25C, VDD =3.0V (unless otherwise stated) Symbol Parameter Condition IDS0 Power Supply current in DEEP_SLEEP (Transceiver in SLEEP mode, AVR in Power Save/Down mode) AVR in Power Down mode WDT disabled 0.75 A Power Down mode, WDT enabled 1.4 A Power Save mode, 32.768kHz crystal oscillator enabled 1.5 A Power Save mode, WDT and 32.768kHz crystal oscillator enabled 2.15 A IDS_PDW IDS_PSX IDS_PSWX Min Typ Max Units Test Conditions: VDD =3.0V (unless otherwise stated) Symbol Parameter Condition IDS0T DEEP_SLEEP current (Transceiver T = 25 C in SLEEP mode, AVR in Power T = 85 C Save/Down mode, WDT disabled) T = 125 C Min Typ Max Units 0.75 A 3.0 A 19.6 A 35.6 Clock Characteristics 35.6.1 Calibrated Internal RC Oscillator Accuracy Table 35-2. Calibration Accuracy of Internal RC Oscillator Frequency VDEVDD Temperature Calibration Accuracy Factory Calibration 16 MHz 3.0V 25C 10 % User Calibration 15.1 - 17.5MHz 1.8V - 3.6V -40C - 125C 1% 35.6.2 32.768kHz Crystal Oscillator Symbol Parameter f0 Crystal frequency CEXT32 External load capacitor to ground 552 Condition Min. Typ. Max. 32.768 CEXT32 = 2*(CLOAD32 - CPAR32 - CPAR_PCB) see Application schematic CX3, CX4 Units kHz 20.0 pF ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 CLOAD32 Load capacitance as specified by the crystal manufacturer 6 12.5 pF CSHUNT32 Shunt capacitance 0.6 2.0 pF CPAR32 Internal parasitic capacitance 2.1 2.4 2.7 pF ESR Equivalent series resistance 50 100 k Crystal @ 32.768 kHz 35.6.3 External Clock Drive (pin CLKI) Figure 35-1 External Clock Drive Waveforms V IH1 V IL1 Table 35-3. External Clock Drive Symbol Parameter 1/tCLCL Oscillator Frequency tCLCL Clock Period tCHCX Min. Max. Units 16 MHz 62.5 ns High Time 25 ns tCLCX Low Time 25 ns tCLCH Rise Time 0.1 s tCHCL Fall Time 0.1 s tCLCL Change in period from one clock cycle to the next 1 % 35.7 System and Reset Characteristics (1) Table 35-23. BODLEVEL Fuse Coding BODLEVEL2:0 Fuses Note: Min VBOD Typ VBOD Max VBOD Units 111 BOD Disabled 110 1.8 V 101 1.9 V 100 2.0 V 011 2.1 V 010 2.2 V 001 2.3 V 000 2.4 V 1. VBOT may be below nominal minimum operating voltage. The device is operated down to VDEVDD = VBOT during the production test. This guarantees that a Brown-Out Reset will occur before VDEVDD drops to a voltage where correct operation of the microcontroller is no longer guaranteed. The test is performed using BODLEVEL = 110 for 16 MHz operation of the ATmega2564/1284/644RFR2. 553 42073B-MCU Wireless-09/14 Table 35-5. Reset, Brown-out and Internal Voltage Characteristics Symbol Parameter VRST RSTN Pin Threshold Voltage tRST Minimum pulse width on RSTN Pin VHYS Condition Min Typ Max 0.1VDD Units 0.9VDD V 200 300 ns Brown-out Detector Hysteresis 7.5 50 mV tBOD Min Pulse Width on Brown-out Reset 100 ns VBG Bandgap reference voltage 1.2 V VDD = 3.0V, TA = 25C Table 35-6. Power-On Reset Voltage Characteristics Symbol VPOT Parameter Condition Power-on Reset Threshold Voltage (2) (rising) Power supply discharged Power-on Reset recovery time VPSR Power-on slope rate Note: (1) Typ 1.55 Max (1) 1.65 (4) Units V (4) 1.5 (5) 1.2 1.45 (5) 0.9 Time of EVDD/DEVDDmax(16fSCL,250 tHD;STA Hold time (repeated) START condition tLOW Low period of the SCL clock High period of the SCL clock Set-up time for a repeated START condition tHD;DAT Data hold time tSU;DAT Date setup time tSU;STO tBUF Notes: V 20+0.1Cb 300 ns 20+0.1Cb (2,3) 250 ns (2) ns -10 fSCL 100 kHz Setup time for STOP condition Bus free time between a STOP and START condition kHz) (5) V 0.4 0 fSCL > 100 kHz tSU;STA (3) Units (2,3) 50 10 A 10 pF 0 400 kHz VDD -0.4V 1000 ns 3mA Cb VDD -0.4V 300 ns 3mA Cb Capacitance for each I/O Pin fSCL tHIGH 0 Rise Time for both SDA and SCL (1) tSP Ci Condition fSCL 100 kHz 4.0 s fSCL > 100 kHz 0.6 s (6) 4.7 s (7) fSCL > 100 kHz 1.3 s fSCL 100 kHz 4.0 s fSCL > 100 kHz 0.6 s fSCL 100 kHz 4.7 s fSCL > 100 kHz 0.6 s fSCL 100 kHz 0 s fSCL > 100 kHz 0 s fSCL 100 kHz 250 ns fSCL > 100 kHz 100 ns fSCL 100 kHz 4.0 s fSCL > 100 kHz 0.6 s fSCL 100 kHz 4.7 s fSCL > 100 kHz 1.3 s fSCL 100 kHz 1. This parameter is characterized and not 100% tested 2. Required only for fSCL > 100 kHz 3. Cb=capacitance of one bus line in pF 4. fCK=CPU clock frequency 556 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 5. This requirement applies to all the ATmega2564/1284/644RFR2 2-wire Serial Interface operation. Other devices connected to the 2-wire Serial Bus need only obey the general fSCL requirement. 6. The actual low period generated by the ATmega2564/1284/644RFR2 2-wire Serial interface is (1/fSCL - 2/fCK), thus fCK must be greater than 6MHz for the low time requirement to be strictly met at fSCL = 100 kHz. 7. The actual low period generated by the ATmega2564/1284/644RFR2 2-wire Serial interface is (1/fSCL - 2/fCK), thus the low time requirement will not be strictly met for fSCL > 308 kHz when fCK = 8 MHz. Still, ATmega2564/1284/644RFR2 devices connected to the bus may communicated at full speed (400 kHz) with other ATmega2564/1284/644RFR2 devices, as well as any other device with proper tLOW acceptance margin. Figure 35-2. 2-wire Serial Bus Timing tHIGH tof tLOW tr tLOW SCL tSU;STA tHD;STA tHD;DAT tSU;DAT SDA tSU;STO tBUF 35.10 SPI Timing Characteristics See Figure 35-3 on page 558 and Figure 35-4 on page 558 for details. Table 35-12. SPI Timing Parameters Description Mode SCK period Master See "SPCR - SPI Control Register" on page 367. SCK high/low Master 50% duty cycle Rise/fall time Master 3.6 ns Setup Master 10 ns Hold Master 10 ns Out to SCK Master 0.5 tSCK SCK to out Master 10 ns SCK __ to out high SS low to out Master 10 ns Slave 10 ns SCK period Min Slave 4 tCK SCK high/low Slave 2 tCK Rise/fall time Slave Setup Slave 10 Hold Slave tCK SCK to out __ Slave SCK __ to SS high SS __ high to tri-state Slave SS low to SCK Slave (1) Note: Typ Max 1600 20 ns ns 10 20 ns ns 15 Slave Units ns ns 1. In SPI Programming mode the minimum SCK high/low period is 2 tCLCL for fCK < 12 MHz and 3 tCLCL for fCK > 12 MHz. 557 42073B-MCU Wireless-09/14 Figure 35-3. SPI timing Requirements (Master Mode) SS 6 1 SCK (CPOL = 0) 2 2 SCK (CPOL = 1) 4 MISO (Data Input) 5 3 MSB ... LSB 8 7 MOSI (Data Output) MSB ... LSB Figure 35-4. SPI timing Requirements (Slave Mode) SS 10 9 16 SCK (CPOL = 0) 11 11 SCK (CPOL = 1) 13 MOSI (Data Input) 14 12 MSB ... LSB 17 15 MISO (Data Output) MSB ... X LSB 35.11 ADC Characteristics Table 35-13. ADC Electrical Characteristics Symbol Parameter Condition VREFINT1 Internal Voltage Reference 1.5 V VREFINT2 Internal Voltage Reference 1.6 V VREFINT3 Internal Voltage Reference AVDD V RAREF,EXT External Voltage Impedance Typ Max 6 IL,AREF Load Current Loading AREF is not recommended. ISUPPLY,ADCSE Supply Current ADC Current (Single ended conversion, fCLKADC = 2MHz) ISUPPLY,ADCD Supply Current ADC Current with PGA (Differential conversion, fCLKADC = 1MHz) 558 Min Units 0.1 mA 0.85 1.0 mA 1.75 2.0 mA ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Table 35-14. ADC Characteristics, Single Ended Channels Symbol dRES4M dRES8M Parameter Condition Resolution eABS500k eABS2M (1)(2) Absolute accuracy (Including INL, DNL, quantization error, (3) gain and offset error) eABS4M Min Typ Max Units Single Ended Conversion fCLKADC 4 MHz 10 Bits Single Ended Conversion fCLKADC = 8 MHz 8 Bits Single Ended Conversion VREF = 1.6V fCLKADC = 500kHz 2 LSB Single Ended Conversion VREF = 1.6V fCLKADC = 2MHz 2 LSB Single Ended Conversion VREF = 1.6V fCLKADC = 4MHz 2 LSB 0.8 LSB eINL Integral Non-Linearity (INL) Single Ended Conversion VREF = 1.6V fCLKADC = 4MHz eDNL Differential Non-Linearity (DNL) Single Ended Conversion VREF = 1.6V fCLKADC = 4MHz eGAIN Gain Error Single Ended Conversion VREF = 1.6V fCLKADC = 4MHz 1 LSB eOFFSET Offset Error Single Ended Conversion VREF = 1.6V fCLKADC = 4MHz 1.5 LSB tCONV,SE Conversion Time Free Running Conversion fCLKADC Clock Frequency Single Ended Conversion VREF Reference Voltage VIN,SE -0.5 LSB 3 240 8 s MHz 1.5 AVDD V Input Voltage 0 AVDD V fIBW Input Bandwidth 20 CAIN Input Sampling Capacitance RAIN,SER Analog Series Resistance RAIN Analog Input Resistance Notes: (4) Between pin and sampling capacitor Static load resistor of input signal kHz 14 pF 2 k 100 M 1. Values are guidelines only. 2. All values are valid for EVDD = 3.0V. 3. Absolute accuracies do not include dependencies on the absolute value of the reference voltage. 4. Series resistor depends on supply voltage (MOS switch resistance ~ 1/VSUPPLY). Table 35-15. PGA and ADC Characteristics, Differential Channels Symbol (1)(2)(4) Parameter Condition dRES,D Resolution All gain settings eABS,D1 Absolute accuracy (Including INL, DNL, quantization error, (3) gain and offset error) Gain = 1x VREF = 1.6V fCLKADC = 2MHz eINL,D1 Integral Non-Linearity (INL) Gain = 1x VREF = 1.6V fCLKADC = 2MHz eDNL,D1 Differential Non-Linearity (DNL) Gain = 1x VREF = 1.6V fCLKADC = 2MHz eGAIN,D1 eGAIN,D10 Gain Error eGAIN,D200 Min Typ Max Units 10 Bits 3 LSB 3 -0.75 LSB LSB Gain = 1x 1 Gain = 10x 1.5 Gain = 200x 10 LSB 559 42073B-MCU Wireless-09/14 Symbol Parameter Condition eOFFSET,D1 Offset Error Gain = 1x VREF = 1.6V tCONV,D Conversion Time Free Running Conversion fCLKADC Clock Frequency Single Ended Conversion VREF Reference Voltage VCM Input Common Mode Voltage VIN,DIFF Input Differential Voltage dOUT,D ADC Conversion Output fIBW,D Input Bandwidth CAIN,PGA Input Sampling Capacitance Max 0.7 fCLKADC = 2MHz Input pin voltage 0V Typ Analog Series Resistance RAIN Analog Input Resistance (5) Units LSB 100 s 2 MHz 1.5 AVDD V 0 EVDD V -AVDD AVDD -512 511 20 RAIN,SER Notes: Min V LSB kHz Gain = 200x 7.5 pF Between pin and sampling capacitor 0.5 k Static load resistor of input signal 100 M 1. Values are guidelines only 2. All values are valid for EVDD = 3.0V 3. Absolute accuracies do not include dependencies on the absolute value of the reference voltage. 4. Performance of differential channels deteriorates if PGA output voltage is close to ground. 5. Series resistor depends on supply voltage (MOS switch resistance ~ 1/VSUPPLY). 35.12 Temperature Sensor Characteristics Table 35-16. Temperature Sensor Characteristics Symbol Parameter Condition TDISTNOCAL Temperature distribution Typical, No calibration performed, T = 25 C Internal1.6V Bandgap reference selected Min Typ Max 3.5 Units K 35.13 Analog Comparator Characteristics Table 35-17. Analog Comparator Electrical Characteristics Symbol Parameter Condition (1) VACIO Input Offset Voltage IACLK Input Leakage Current tACID ISUPPLY,AC Notes: (2) Propagation Delay Supply Current (3) (4) Min Typ Max Units VDD = 3.0V, VIN = VDD/2, T = 25C <10 mV VDD = 3.0V, VIN = VDD/2, T = 25C <10 nA VDD = 3.0V, VIN = VDD/2, T = 25C 175 nA VDD = 3.0V, VIN = VDD/2, T = 25C 50 A 1. This parameter is characterized and not 100% tested. 2. Analog delay only. Output of comparator is clocked into ACO bit of ACSR register. 3. Bit ACD in register ACSR is low. 4. See also parameters IIL and IIH in section "Digital Pin Characteristics" on page 551. 35.14 Transceiver Electrical Characteristics 35.14.1 Digital Interface Timing Characteristics Test Conditions: TOP = 25C, VDD = 3.0V, CL = 50 pF (unless otherwise stated) 560 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Symbol Parameter t12 AES core cycle time tIRQ Interrupt event latency tBATMON Battery monitor latency Condition Min. Relative to the event on the RF pins to be indicated (e.g. TRX24_RX_END interrupt) Typ. Max. Units 24 s 9 s 2 s 35.14.2 General RF Specifications Test Conditions (unless otherwise stated): VDD = 3.0V, fRF = 2.45 GHz, TOP = 25C, Measurement setup see Figure 32-1 on page 538. Symbol Parameter Condition Min. fRF Frequency range As specified in [1],[2] 2405 fCH Channel spacing As specified in [1],[2] 5 MHz fHDR Header bit rate (SHR, PHR) As specified in [1],[2] 250 kb/s fPSDU PSDU bit rate As specified in [1],[2] OQPSK_DATA_RATE = 1 OQPSK_DATA_RATE = 2 OQPSK_DATA_RATE = 3 250 500 1000 2000 kb/s kb/s kb/s kb/s fCHIP Chip rate As specified in [1],[2] 2000 kchip/s fCLK Crystal oscillator frequency Reference frequency oscillator fCLK_ACC Required reference frequency accuracy PSDU bit rate tXTAL Reference oscillator settling time Leaving SLEEP state to crystal clock available B20dB 20 dB bandwidth Note: 250 kb/s 500 kb/s 1000 kb/s 2000 kb/s Typ. Max. Units 2480 MHz 16 (1) MHz (1) -60 -40 -40 -30 215 +60 +40 +40 +30 ppm ppm ppm ppm 1000 s 2.8 MHz 1. A reference frequency accuracy of 40 ppm is required by [1], [2]. 35.14.3 Transmitter Characteristics Test Conditions (unless otherwise stated): VDD = 3.0V, fRF = 2.45 GHz, TOP = 25C, Measurement setup see Figure 32-1 on page 538. Symbol Parameter Condition PTX TX Output power Maximum configurable TX output power value Register bit TX_PWR = 0 PRANGE Output power range 16 steps, configurable in register PHY_TX_PWR PACC Output power tolerance TX Return loss EVM Min. Typ. Max. Units 0 +3.5 +6 dBm 20 dB 3 100+j0 differential impedance, PTX = +3.5 dBm dB 10 dB 8 %rms 561 42073B-MCU Wireless-09/14 Symbol Parameter PHARM Harmonics nd 2 harmonic rd 3 harmonic PSPUR Condition Spurious Emissions 30 - 1000 MHz >1 - 12.75 GHz 1.8 - 1.9 GHz 5.15 - 5.3 GHz Min. Complies with EN 300 328/440, FCC-CFR-47 part 15, ARIB STD-66, RSS-210 Typ. Max. Units -38 -45 dBm dBm -36 -30 -47 -47 dBm dBm dBm dBm 35.14.4 Receiver Characteristics Test Conditions (unless otherwise stated): VDD = 3.0V, fRF = 2.45 GHz, TOP = 25C, PSDU bit rate = 250 kb/s, Measurement setup see Figure 32-1 on page 538. Symbol Parameter Condition PSENS Receiver sensitivity 250 kb/s 500 kb/s 1000 kb/s 2000 kb/s AWGN channel, PER 1%, PSDU length 20 octets High Data Rate Modes: PSDU length 20 octets Antenna Diversity RL Return loss NF Noise figure PRXMAX Maximum RX input level PACRN Min. Typ. Max. Units -100 -96 -94 -86 dBm dBm dBm dBm 250 kb/s, PSDU 20 octets -99 dBm 100+j0 differential impedance 10 dB 6 dB PER 1%, PSDU length of 20 octets 10 dBm Adjacent channel rejection: -5 MHz PER 1%, PSDU length of 20 octets, PRF = -82 dBm 34 dB PACRP Adjacent channel rejection: +5 MHz PER 1%, PSDU length of 20 octets, PRF = -82 dBm 38 dB PAACRN Alternate channel rejection: -10 MHz PER 1%, PSDU length of 20 octets, PRF = -82 dBm 54 dB PAACRP Alternate channel rejection: +10 MHz PER 1%, PSDU length of 20 octets, PRF = -82 dBm 54 dB PSPUR Spurious emissions: LO leakage 30 - 1000 MHz >1 - 12.75 GHz fRXTXOFFS TX/RX carrier frequency offset rd IIP3 3 - order intercept point IIP2 2 nd - order intercept point RSSI tolerance -71 Sensitivity loss < 2 dB (1) dBm dBm dBm +300 kHz At maximum gain Offset freq. interf. 1 = 5 MHz Offset freq. interf. 2 = 10 MHz -14 dBm At maximum gain Offset freq. interf. 1 = 60 MHz Offset freq. interf. 2 = 62 MHz 17 dBm Tolerance within gain step RSSI dynamic range 562 -300 -57 -47 5 81 dB dB ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Symbol Parameter Condition Min. RSSI resolution Typ. Max. 3 RSSI sensitivity Defined as RSSI_BASE_VAL Minimum RSSI value PRF RSSI_BASE_VAL 0 Maximum RSSI value PRF > RSSI_BASE_VAL + 81 dB 28 Note: Units dB -90 dBm 1. Offset equals 120 ppm 35.14.5 Current Consumption Specifications Test Conditions (unless otherwise stated): VDD = 3.0V, fRF = 2.45 GHz, TOP = 25C, Measurement setup see Figure 32-1 on page 538. (Power Reduction Register PRR0 and PRR1 are not set). Symbol Parameter Condition IBUSY_TX Supply current transmit state PTX = 3.5 dBm PTX = 1.5 dBm PTX = -2.5 dBm PTX = -16.5 dBm (current consumption is reduced at VDD = 1.8V for each output power level) IRX_ON_RPC Supply current RX_ON state (2) RPC mode enabled IRX_ON_P_RPC IRX_ON_RPC Supply current PLL_ON state (2) RPC mode enabled IRX_ON Supply current RX_ON state (2) RPC mode disabled IRX_ON_P Min. Typ. Max. Units 14.5 10 9 8 mA mA mA mA RX_ON state, with register setting (1) RX_PDT_LEVEL < 8 6 mA RX_ON state, with register setting (1) RX_PDT_LEVEL > 8 5 mA 0.45 mA RX_ON state 12.5 mA RX_ON state, with register setting (1) RX_PDT_LEVEL > 0 12.0 mA 5.7 mA IPLL_ON Supply current PLL_ON state (2) RPC mode disabled ITRX_OFF Supply current TRX_OFF state TRX_OFF state 0.4 mA ISLEEP Supply current SLEEP state SLEEP state 0.02 A Note: 1. Refer to section "RX_SYN - Transceiver Receiver Sensitivity Control Register" on page 131. 2. Refer to section "Reduced Power Consumption Mode (RPC)" on page 104. 35.14.6 16MHz Crystal Oscillator and Crystal Parameter Requirements Symbol Parameter Condition f0 Crystal frequency For accuracy see "General RF Specifications" on page 561 CL Load capacitance C0 R1 Min. Typ. Max. 16 8 Units MHz 14 pF Static capacitance 7 pF Series resistance 100 563 42073B-MCU Wireless-09/14 Symbol Parameter Condition Min. tXTALOFF 16MHz XTAL oscillator off-time Minimum sleep time of the transceiver Typ. Max. 1.0 Units ms 36 Typical Characteristics 36.1 Supply Current vs. Clock Speed with Transceiver in SLEEP 36.1.1 Clock source 16MHz RC Oscillator Figure 36-5. Active Supply Current vs. Frequency (VDD = 3.0V, PRR0/1 = 0xFF/0x3F) Current Consumption [mA] 5 125C 85C 25C -40C 4 3 2 1 0 0.0 2.0 4.0 6.0 8.0 10.0 12.0 14.0 16.0 Frequency [MHz] EVDD [V] 564 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Figure 36-6. Active Supply Current vs. VDD (fCLK=1MHz, PRR0/1 = 0xFF/0x3F) Current Consumption [mA] 5 4 3 2 125C 85C 25C -40C 1 0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 EVDD [V] Figure 36-7. Active Supply Current vs. VDD (fCLK = 16MHz, PRR0/1 = 0x00/0x00) 5 Current Consumption [mA] 125C 85C 25C -40C 4 3 2 1 0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 EVDD [V] 565 42073B-MCU Wireless-09/14 Figure 36-8. Idle Supply Current vs. VDD (fCLK = 1MHz; PRR0/1 = 0xFF/0x3F) 5 Current Consumption [mA] 4 3 2 1 125C 85C 25C -40C 0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 EVDD [V] Figure 36-9. Idle Supply Current vs. VDD (fCLK = 8MHz, PRR0/1 = 0xFF/0x3F) Current Consumption [mA] 5 4 3 2 125C 85C 25C -40C 1 0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 EVDD [V] 566 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 36.1.2 External clock source on pin CLKI Figure 36-10. Active Supply Current vs. Frequency (VDD = 3.0V, PRR0/1 = 0x00/0x00) 5 125C 85C 25C -40C Current Consumption [mA] 4 3 2 1 0 0.0 2.0 4.0 6.0 8.0 10.0 12.0 14.0 16.0 Frequency [MHz] CLK [MHz] Figure 36-11. Active Supply Current vs. Frequency (VDD = 3.0V, PRR0/1 = 0xFF/0x3F) 5 125C 85C 25C -40C Current Consumption [mA] 4 3 2 1 0 0.0 2.0 4.0 6.0 8.0 10.0 12.0 14.0 16.0 CLK [MHz] Frequency [MHz] 567 42073B-MCU Wireless-09/14 Figure 36-12. Idle Supply Current vs. Frequency (VDD = 3.0V, PRR0/1 set and reset) 5 Current Consumption [mA] 4 3 125C no PRR 85C no PRR 25C no PRR -40C no PRR 2 125C PRR set 85C PRR set 25C PRR set -40C PRR set 1 0 0.0 2.0 4.0 6.0 8.0 10.0 12.0 14.0 16.0 CLK [MHz] [MHz] Frequency 36.2 Current Consumption of Bandgap Source and Digital Voltage Regulator The supply currents of band-gap reference source and digital voltage regulator are part of all supply current measurement. In DEEP_SLEEP mode both units are disabled. Figure 36-13. Combined Supply Current of Bandgap Source and Voltage Regulator 1 0.9 Current Consumption [mA] 0.8 0.7 0.6 0.5 0.4 0.3 125C 85C 25C -40C 0.2 0.1 0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 CLK [MHz] EVDD [V] 36.3 Current Consumption in various Transceiver States The AVR microcontroller is in Active state (clkCPU=16MHz) with no power reduction set by the register PRR0 and PRR1. The clock source of the microcontroller is the internal 16MHz RC Oscillator. 568 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Figure 36-14. TRXOFF state supply current vs VDD 22 20 Current Consumption [mA] 18 16 14 12 10 8 125C 85C 25C -40C 6 4 2 0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 EVDD [V] Figure 36-15. RX_ON state supply current vs. VDD Current Consumption [mA] 22 20 125C 18 85C 16 25C 14 -40C 12 10 8 6 4 2 0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 EVDD [V] 569 42073B-MCU Wireless-09/14 Figure 36-16. RX_ON State Supply Current vs. VDD, RPC Enabled 22 20 Current Consumption [mA] 18 16 14 12 125C 85C 27C -40C 10 8 6 4 2 0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 EVDD [V] Figure 36-17. RX_ON State Supply Current, RPC Enabled, RX_PDT_LEVEL = 15 22 20 Current Consumption [mA] 18 16 14 12 125C 85C 27C -40C 10 8 6 4 2 0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 EVDD [V] 570 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Figure 36-18. TX Active state supply current vs. VDD (maximum TX output power) Current Consumption [mA] 22 20 125C 85C 18 25C -40C 16 14 12 10 8 6 4 2 0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 EVDD [V] 36.4 RF Measurements For all RF power measurement results the calibration level is the differential RF input of the device. It enables an easy calculation for the different RF front-ends with external power amplifier and/or RF switches (diversity, RX/TX). The combined loss of Balun, strip-line and SMA connecter on the Radio-Controller-Board is <1dB. 36.4.1 Packet Error Rate (PER) Figure 36-19. PER vs. input power for 250kbit mode 10 9 8 PER [%] 7 6 5 4 3 2 1 0 -102.0 -100.0 -98.0 -96.0 -94.0 -92.0 EVDD=1.8V EVDD=3.0V EVDD=3.6V -90.0 Input Power [dBm] 571 42073B-MCU Wireless-09/14 36.4.2 Transmit Power Figure 36-20. TX maximum output power TX Maximum Output Power [dBm] 5 -40 C 4 25 C 85 C 3 125 C 2 1 0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 Supply Voltage [V] Figure 36-21. TX output power vs. TX_PWR in register PHY_TX_PWR 10 TX Output Power [dBm] 5 0 -5 -10 -15 -40 C 25 C 85 C 125 C -20 0.0 2.0 4.0 6.0 8.0 10.0 12.0 14.0 16.0 TX_PWR register value [#] 572 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 36.5 BOD Threshold Figure 36-22. Brown-out Threshold vs. Temperature (Rising Supply Voltage) 3 switch voltage level up [V] 2.5 BOD_LEVEL=2.4 BOD_LEVEL=2.3 BOD_LEVEL=2.2 BOD_LEVEL=2.1 BOD_LEVEL=2.0 BOD_LEVEL=1.9 BOD_LEVEL=1.8 2 1.5 1 0.5 0 -40.0 -20.0 0.0 20.0 40.0 60.0 80.0 100.0 120.0 Temperature [C] Figure 36-23. Brown-out Threshold vs. Temperature (Falling Supply Voltage) 3 switch voltage level down [V] 2.5 BOD_LEVEL=2.4 BOD_LEVEL=2.3 BOD_LEVEL=2.2 BOD_LEVEL=2.1 BOD_LEVEL=2.0 BOD_LEVEL=1.9 BOD_LEVEL=1.8 2 1.5 1 0.5 0 -40.0 -20.0 0.0 20.0 40.0 60.0 80.0 100.0 120.0 Temperature [C] 573 42073B-MCU Wireless-09/14 36.6 Pin Driver Strength Figure 36-24. I/O Pin Output Voltage vs. Source Current (VDD = 3.0V, DPDS0=0) 0.45 125C 0.4 25C 85C -40 C EVDD-VOH [V] 0.35 0.3 0.25 0.2 0.15 0.1 0.05 0 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 IOH [mA] Figure 36-25. I/O Pin Output Voltage vs. Source Current (25C, DPDS0=0) 0.7 0.6 EVDD=1.8 EVDD-V_OH [V] 0.5 0.4 EVDD=2.4 EVDD=3.0 0.3 EVDD=3.6 0.2 0.1 0 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 I_OH [mA] 574 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Figure 36-26. I/O Pin Output Voltage vs. Source Current (25C, VDD = 3.0V) 0.45 DPD=0 0.4 DPD=1 DPD=2 DPD=3 EVDD-VOH [V] 0.35 0.3 0.25 0.2 0.15 0.1 0.05 0 0.0 5.0 10.0 15.0 20.0 25.0 30.0 IOH [mA] Figure 36-27. I/O Pin Output Voltage vs. Sink Current (VDD=3.0V, DPDS0 = 0) 0.45 125C 0.4 85C 25C 0.35 -40 C VOL [V] 0.3 0.25 0.2 0.15 0.1 0.05 0 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 IOL [mA] 575 42073B-MCU Wireless-09/14 Figure 36-28. I/O Pin Output Voltage vs. Sink Current (25C, DPDS0=1) 0.3 125 degC 0.25 85 degC V_OL [V] 0.2 25 degC -40 degC 0.15 0.1 0.05 0 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 I_OL [mA] Figure 36-29. I/O Pin Output Voltage vs. Sink Current (25C, VDD = 3.0V) 0.45 DPD=0 0.4 DPD=1 DPD=2 DPD=3 0.35 VOL [V] 0.3 0.25 0.2 0.15 0.1 0.05 0 0.0 5.0 10.0 15.0 20.0 25.0 30.0 IOL [mA] 576 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 36.7 Power-Down Current Figure 36-30. Power-Down Current vs. Temperature (Watchdog Disabled) 3.6V 3.0V 1.8V 10 7 5 ISUPPLY [A] 3 2 1 0.7 0.5 0.3 0.2 0.1 -40 -25 -10 5 20 35 50 65 80 95 110 125 Temperature [C] Figure 36-31. Power-Down Current vs. Supply Voltage (Watchdog Disabled) 125C 10 7 5 85C ISUPPLY [A] 3 2 1 25C 0.7 0.5 -40C 0.3 0.2 0.1 1,8 2,0 2,2 2,4 2,6 2,8 3,0 3,2 3,4 3,6 VDD [V] 577 42073B-MCU Wireless-09/14 Figure 36-32. Power-Down Current vs. Temperature (Watchdog Enabled) 3.6V 3.0V 1.8V 10 7 5 ISUPPLY [A] 3 2 1 0.7 0.5 0.3 0.2 0.1 -40 -25 -10 5 20 35 50 65 80 95 110 125 Temperature [C] Figure 36-33. Power-Down Current vs. Supply Voltage (Watchdog Enabled) 125C 10 7 5 85C ISUPPLY [A] 3 2 25C -40C 1 0.7 0.5 0.3 0.2 0.1 1,8 2,0 2,2 2,4 2,6 2,8 3,0 3,2 3,4 3,6 VDD [V] 36.8 Static ADC Parameter - INL and DNL All static parameter of the ADC have been obtained with fADCLK = 2 MHz, SUT = 10, THT = 0 and an internal reference voltage of 1.6V. 578 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Figure 36-34. Integral Nonlinearity vs. Output Code (Single-Ended, 3.0V, 25C) 0.8 0.6 INL [LSB] 0.4 0.2 0.0 -0.2 -0.4 0 128 256 384 512 640 768 896 1024 Digital Output Code Figure 36-35. Differential Nonlinearity vs. Output Code (Single-Ended, 3.0V, 25C) 0.3 0.2 DNL [LSB] 0.1 0.0 -0.1 -0.2 -0.3 0 128 256 384 512 640 768 896 1024 Digital Output Code 579 42073B-MCU Wireless-09/14 Figure 36-36. Integral Nonlinearity vs. Output Code (with PGA, Gain=10, 3.0V, 25C) 1.0 INL [LSB] 0.0 -1.0 -2.0 -3.0 -4.0 -512 -384 -256 -128 0 128 256 384 512 Digital Output Code Figure 36-37. Differential Nonlinearity vs. Output Code (with PGA, Gain=10, 3.0V, 25C) 0.8 0.6 DNL [LSB] 0.4 0.2 0.0 -0.2 -0.4 -512 -384 -256 -128 0 128 256 384 512 Digital Output Code 580 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Figure 36-38. Integral Nonlinearity vs. Temperature at VDEVDD = 3.6V 16 14 |INL|MAX [LSB] 12 10 Gain = 200 8 6 4 Gain = 10 2 Gain = 1 Single Ended 0 -40 -20 0 20 40 60 80 100 120 140 Temperature [C] Figure 36-39. Integral Nonlinearity vs. Supply Voltage at 25C 16 14 |INL|MAX [LSB] 12 Gain = 200 10 8 6 4 Gain = 10 Gain = 1 2 Single Ended 0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 VDD [V] 581 42073B-MCU Wireless-09/14 Figure 36-40. Differential Nonlinearity vs. Temperature at VEVDD = 3.6V 7 Gain = 200 6 |DNL| MAX [LSB] 5 4 3 2 1 Gain = 10 Gain = 1 Single Ended 0 -40 -20 0 20 40 60 80 100 120 140 Temperature [C] Figure 36-41. Differential Nonlinearity vs. Supply Voltage VEVDD at 25C 7 6 Gain = 200 |DNL| MAX [LSB] 5 4 3 2 1 Gain = 10 Gain = 1 Single Ended 0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 VDD [V] 36.9 Dynamic ADC Parameter - ENOB The dynamic ADC parameters for the single-ended channels have been measured with fADCLK = 4 MHz, SUT = 20, THT = 0 and an internal reference voltage of 1.6V. The sine 582 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 wave of the input signal had a frequency of fIN,SIN = 20.207 kHz and peak-to-peak amplitude of VIN,PP = 1.58V. Figure 36-42. 2048 Point FFT Output for a Single-Ended ADC Channel (3.0V, 25 C) 20 20.21; 0.00 SINAD = 57.54 dB 0 ENOB = Amplitude [dB] -20 THD 9.27 bit = -63.08 dB -40 40.41; -64.27 -60 60.62; -74.25 80.83; -71.80 101.04; -78.53 -80 -100 -120 0 20 40 60 80 100 120 140 160 Frequency [kHz] Figure 36-43. Effective Number of Bits vs. Supply Voltage for Single-Ended Channels 10.0 125C 85C 25C -40C 9.5 ENOB [LSB] 9.0 8.5 8.0 7.5 7.0 6.5 6.0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 VDD [V] 583 42073B-MCU Wireless-09/14 The dynamic ADC parameters for the differential channels with a gain of 10 have been measured with fADCLK = 2 MHz, SUT = 10, THT = 0 and an internal reference voltage of 1.6V. The input sine wave had a frequency of fIN,SIN = 20.124 kHz and peak-to-peak amplitude of VIN,PP = 0.31V. Figure 36-44. 2048 Point FFT Output for a Gain=10 ADC Channel (3.0V, 25 C) 20 SINAD = 43.59 dB 20.12; 0.00 0 ENOB = THD Amplitude [dB] -20 6.95 bit = -51.61 dB -40 40.25; -53.42 60.37; -56.28 -60 -80 -100 -120 0 10 20 30 40 50 60 70 80 Frequency [kHz] Figure 36-45. Effective Number of Bits vs. Supply Voltage for Gain=10 Channels 10.0 9.5 ENOB [LSB] 9.0 8.5 8.0 7.5 7.0 85C 125C 25C -40C 6.5 6.0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 VDD [V] 584 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 36.10 ADC Voltage Reference Figure 36-46. 1.6V ADC Voltage Reference vs. Supply Voltage 1.63 1.62 VAREF [V] 1.61 125C 85C 27C 1.60 1.59 -40C 1.58 1.57 1.56 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 VDD [V] 36.11 Temperature Sensor The temperature measurement results have been measured with an ADC clock of 500 kHz, SUT = 80, THT = 4 and an internal reference voltage of 1.6V. To enhance the accuracy and resolution the data of 128 measurements per temperature step have been decimated. 585 42073B-MCU Wireless-09/14 Figure 36-47. Measured Temperature Value vs. Temperature and VEVDD 140 3.6V 3.0V 1.8V Measured Temperature [C] 120 100 80 60 40 20 0 -20 -40 -40 -20 0 20 40 60 80 100 120 140 Temperature [C] Figure 36-48. Error of Measured Temperature Value MEAS - IDEAL vs. Temperature 4 3 3.0V Mean Error [C] 2 1 0 -1 -2 -3 -4 -40 -20 0 20 40 60 80 100 120 140 Temperature [C] 586 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Figure 36-49. Standard Deviation of Measured Temperature vs. Temperature 1.0 Standard Deviation [C] 0.8 0.6 0.4 3.0V 0.2 0.0 -0.2 -40 -20 0 20 40 60 80 100 120 140 Temperature [C] 36.12 Internal Oscillator Speed Figure 36-50. 128 kHz RC Oscillator Frequency vs. OSCCAL Register Value 200 125C 85C 25C -40C 175 150 fRC [kHz] 125 100 75 50 25 0 0 32 64 96 128 160 192 224 256 OSCCAL 587 42073B-MCU Wireless-09/14 Figure 36-51. 128 kHz RC Oscillator Frequency vs. Supply Voltage 200 175 150 125C 85C 25C -40C fRC [kHz] 125 100 75 50 25 0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 VDD [V] Figure 36-52. 16 MHz RC Oscillator Frequency vs. OSCCAL Register Value 24 125C 85C 25C -40C 20 fRC [MHz] 16 12 8 4 0 0 32 64 96 128 160 192 224 256 OSCCAL 588 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Figure 36-53. 16 MHz RC Oscillator Frequency vs. Supply Voltage VDEVDD 24 20 125C 85C 25C -40C fRC [MHz] 16 12 8 4 0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 VDD [V] 36.13 Programming Current The programming currents shown in the following figures are averaged over the entire write/erase time. The value is primarily defined by the integrated charge pump. Therefore the currents for Flash, EEPROM, Fuse- and Lock-bit programming operations are similar. 589 42073B-MCU Wireless-09/14 Figure 36-54. Programming Current vs. Supply Voltage VDEVDD 7 -40C 25C 85C 125C 6 ISUPPLY [mA] 5 4 3 2 1 0 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 VDD [V] 590 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 37 Ordering Information ATmega2564RFR2 Speed (MHz) Power Supply Ordering Code Package Packing Operation Range 16 1.8 - 3.6V ATmega2564RFR2-ZU PQ Tray Industrial (-40C to 85C) 16 1.8 - 3.6V ATmega2564RFR2-ZUR PQ Tape & Reel Industrial (-40C to 85C) 16 1.8 - 3.6V ATmega2564RFR2-ZF PQ Tray Industrial (-40C to 125C) 16 1.8 - 3.6V ATmega2564RFR2-ZFR PQ Tape & Reel Industrial (-40C to 125C) Notes: 5. Pb-free packaging, complies to European Directive for Restriction of Hazardous Substances (RoHS directive). Also Halide free and fully Green. 6. Performance figures for 125C are only valid for devices with ordering code ATmega2564RFR2-ZF/-ZFR. Package Type PQ 48-lead, 7 x 7 x 0.9 mm Body, Quad Flat No-lead Package (QFN) 591 42073B-MCU Wireless-09/14 ATmega1284RFR2 Speed (MHz) Power Supply Ordering Code Package Packing Operation Range 16 1.8 - 3.6V ATmega1284RFR2-ZU PQ Tray Industrial (-40C to 85C) 16 1.8 - 3.6V ATmega1284RFR2-ZUR PQ Tape & Reel Industrial (-40C to 85C) 16 1.8 - 3.6V ATmega1284RFR2-ZF PQ Tray Industrial (-40C to 125C) 16 1.8 - 3.6V ATmega1284RFR2-ZFR PQ Tape & Reel Industrial (-40C to 125C) Notes: 1. Pb-free packaging, complies to European Directive for Restriction of Hazardous Substances (RoHS directive). Also Halide free and fully Green. 2. Performance figures for 125C are only valid for devices with ordering code ATmega1284RFR2-ZF/-ZFR. Package Type PQ 592 48-lead, 7 x 7 x 0.9 mm Body, Quad Flat No-lead Package (QFN) ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 ATmega644RFR2 Speed (MHz) Power Supply Ordering Code Package Packing Operation Range 16 1.8 - 3.6V ATmega644RFR2-ZU PQ Tray Industrial (-40C to 85C) 16 1.8 - 3.6V ATmega644RFR2-ZUR PQ Tape & Reel Industrial (-40C to 85C) 16 1.8 - 3.6V ATmega644RFR2-ZF PQ Tray Industrial (-40C to 125C) 16 1.8 - 3.6V ATmega644RFR2-ZFR PQ Tape & Reel Industrial (-40C to 125C) Notes: 1. Pb-free packaging, complies to European Directive for Restriction of Hazardous Substances (RoHS directive). Also Halide free and fully Green. 2. Performance figures for 125C are only valid for devices with ordering code ATmega644RFR2-ZF/-ZFR. Package Type PQ 48-lead, 7 x 7 x 0.9 mm Body, Quad Flat No-lead Package (QFN) 593 42073B-MCU Wireless-09/14 38 Packaging Information PQ 594 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 39 Errata 39.1 ATmega2564RFR2 revision D * Interrupt restrictions in Deep-sleep Mode * Device does not enter Deep-Sleep if no crystal is connected to XTAL pins 39.2 ATmega2564RFR2 revision A, B, C Not sampled. 39.3 ATmega1284RFR2 revision D * Interrupt restrictions in Deep-sleep Mode * Relocation of sleep instruction within boot section not sufficient * Device does not enter Deep-Sleep if no crystal is connected to XTAL pins 39.4 ATmega1284RFR2 revision A, B, C Not sampled. 39.5 ATmega644RFR2 revision D * Interrupt restrictions in Deep-sleep Mode * Relocation of sleep instruction within boot section not sufficient * Device does not enter Deep-Sleep if no crystal is connected to XTAL pins 39.6 ATmega644RFR2 revision A, B, C Not sampled 39.7 Detailed errata description 39.7.1 Device does not enter Deep-Sleep if no crystal is connected to XTAL pins If the device is used without the transceiver then there may be no crystal connected to the pins XTAL1 and XTAL2. The transceiver will then not enter its sleep state if the SLPTR bit in the TRXPR register is set and in consequence the device will not enter the deep sleep power-down state. (3672) Problem Fix/Workaround To disable the transceiver set the PRTRX24 bit in the PRR1 register. 39.7.2 PMU shows erroneous behavior with a 3s period The results from the phase measurement unit (PMU) depend on the length of the initial delay between a frequency change and the start of the phase measurement process (software timer). If the timer delay is increased then after adding 3s, the same results are achieved. For some delay settings the PMU results are correct, for others they are wrong. (3768) Problem Fix/Workaround The software has to guarantee equidistant PMU measurements. The measurement start must be aligned to the internal clocks for instance by tweaking the program code with nop instructions. 595 42073B-MCU Wireless-09/14 39.7.3 Interrupt restrictions in Deep-sleep Mode In Deep-Sleep Mode, there is a restriction regarding allowed memory location for the sleep instruction. Otherwise the interrupts will be disabled and can not wake-up the device. (4567) Problem Fix/Workaround There are two safe constellations where Deep-sleep Mode is guaranteed to allow interrupts waking up the device. * If the IVSEL bit is not set (default value), the PC must be below the lowest possible boot segment, i.e. below word address 0x1F000 (byte address 0x3E000) for the 256K Byte FLASH memory configuration (application section of the memory). * If the IVSEL bit is set, the PC must be above the beginning of the smallest (topmost) possible boot segment, i.e. above word address 0x1FE00 (byte address 0x3FC00) for the 256K Byte FLASH memory configuration. Note that the addresses mentioned are independent of the actual state of the BOOTSZ[1:0] fuse bits in high fuse. The memory locations for wakeup by interrupts from Deep-Sleep have to been told to compiler respective linker as describe below. * Pseudo-code listing including Compiler directives for actions to take for Deep-Sleep // relocate function to last quarter of FLASH boot section // ADDRESS=0x3FC00 / 256K Byte FLASH void go_sleep_boot(void) __attribute__((section(".high"), noinline)); void go_sleep_boot(void) { asm("SLEEP"); } // relocate function to the application section // ADDRESS=0x3E000 / 256K Byte FLASH // default bootloader fuse settings void go_sleep_appl(void) __attribute__((section(".text"), noinline)); void go_sleep_appl(void) { asm("SLEEP"); } // Beware that at least one interrupt source must // be setup and enabled when entering here. void gosleep(void) { /* prepare Deep-sleep Mode */ PRR1 = (1 << PRTRX24); /* power-off transceiver */ SMCR = (2 << SM0) | (1 << SE); if (MCUCR & (1 << IVSEL)) go_sleep_boot(); else go_sleep_appl(); /* back from sleep here */ SMCR = 0; } Linker options to relocate the interrupt functions to the required memory address the linker need to have following options added (related to 256kByte FLASH memory 596 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 configuration): .... -Wl,--section-start=.text=0x3E000 -Wl,--section-start=.high=0x3FC00 For other tool chains please contact the tool vendor. If the source code needs to be portable for all memory configurations consider the limitations as described in the chapter "Relocation of sleep instruction within boot section not sufficient" below. 39.7.4 Relocation of sleep instruction within boot section not sufficient Relocation of sleep instruction within the boot section as described in chapter 39.7.3 above for the 256K Byte FLASH memory configuration does not wakeup the devices with a smaller FLASH memory configuration (128K Byte, 64K Byte). (4567) Problem Fix/Workaround Do not use wakeup interrupts in the boot section. It is recommended to place the wakeup interrupts in the application section. If it is required to save current while executing the program from the boot section choose an appropriated mode as described in the chapter "AVR Microcontroller Sleep Modes" on page 184. If the transceiver is not in SLEEP state the use of PowerDown respective PowerSave mode is possible because the device will not enter DeepSleep mode. 597 42073B-MCU Wireless-09/14 40 Revision history Please note that the referring page numbers in this section are referring to this document. The referring revision in this section are referring to the document revision Rev. 42073B-MCU Wireless-09/14 1. Routing of divided EVDD voltage to the comparator added in the chapter "EVDD Voltage Measurement" on page 461 2. Endurance value corrected in the chapter "In-System Reprogrammable Flash Program Memory" on page 18 3. Errata section added 4. Product names replaced by FLASH memory configuration in chapters "Stack Pointer" on page 13 and "Deep-Sleep Mode" on page 555 5. Comment in pseudo code in chapter "Reading the Signature Row from Software" on page 492 changed to English 6. Additional cross-link to TX chapter added in "External RF-Front End Control" on page 98 7. Assembly code and some details added to chapter "Reading the Signature Row from Software" on page 492 8. "Factory Row" replaced by "Signature Row" in NEMCR - Flash Extended-Mode Control-Register on page 501 9. Relation between SRT and Frame Buffer Protection added in "Dynamic Frame Buffer Protection" on page 99 and "SRT - Smart Receiving Technology" on page 104 10. Assembly code and some details added to chapter "Reading the Signature Row from Software" on page 492 11. Old identifier TST_FRAME_LENGTH replaced by TST_RX_LENGTH Rev. 42073A-MCU Wireless-02/13 12. Initial release 598 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Table of Contents Features .................................................................................................. 1 Applications ........................................................................................... 1 1 Pin Configurations .............................................................................. 2 2 Disclaimer ............................................................................................ 2 3 Overview .............................................................................................. 3 3.1 Block Diagram ........................................................................................................ 3 3.2 Pin Descriptions...................................................................................................... 5 3.3 Unused Pins ........................................................................................................... 7 3.4 Compatibility and Feature Limitations of QFN-48 Package ................................... 7 4 Resources............................................................................................ 8 5 About Code Examples ........................................................................ 8 6 Data Retention and Endurance .......................................................... 8 6.1 Data Retention........................................................................................................ 8 6.2 Endurance of the Code Memory (FLASH) ............................................................. 8 6.3 Endurance of the Data Memory (EEPROM) .......................................................... 8 7 AVR CPU Core..................................................................................... 9 7.1 Introduction ............................................................................................................. 9 7.2 Architectural Overview ........................................................................................... 9 7.3 ALU - Arithmetic Logic Unit ................................................................................. 10 7.4 Status Register ..................................................................................................... 11 7.5 General Purpose Register File ............................................................................. 12 7.6 Stack Pointer ........................................................................................................ 13 7.7 Instruction Execution Timing ................................................................................ 15 7.8 Reset and Interrupt Handling ............................................................................... 15 8 AVR Memories................................................................................... 18 8.1 In-System Reprogrammable Flash Program Memory.......................................... 18 8.2 SRAM Data Memory ............................................................................................ 18 8.3 EEPROM Data Memory ....................................................................................... 20 8.4 EEPROM Register Description ............................................................................ 26 8.5 I/O Memory ........................................................................................................... 28 8.6 General Purpose I/O Registers ............................................................................ 29 8.7 Other Port Registers ............................................................................................. 30 9 Low-Power 2.4 GHz Transceiver...................................................... 32 9.1 Features ............................................................................................................... 32 9.2 General Circuit Description .................................................................................. 33 599 42073B-MCU Wireless-09/14 9.3 Transceiver to Microcontroller Interface ............................................................... 34 9.4 Operating Modes .................................................................................................. 38 9.5 Functional Description .......................................................................................... 67 9.6 Module Description ............................................................................................... 80 9.7 Radio Transceiver Usage ..................................................................................... 90 9.8 Radio Transceiver Extended Feature Set ............................................................ 92 9.9 Continuous Transmission Test Mode ................................................................. 106 9.10 Abbreviations .................................................................................................... 108 9.11 Reference Documents ...................................................................................... 110 9.12 Register Description ......................................................................................... 111 10 MAC Symbol Counter ................................................................... 155 10.1 Main Features................................................................................................... 155 10.2 Clock source selection and Sleep/Active mode operation ............................... 155 10.3 32 bit Register Access (Atomic Read/Write) .................................................... 156 10.4 Symbol Counter (32 bit, SCCNT) ..................................................................... 156 10.5 Symbol Counter SFD Timestamp Register (32 bit, SCTSR, Read Only) ........ 156 10.6 Symbol Counter Beacon Timestamp Register (32 bit, SCBTSR) .................... 157 10.7 Compare Unit (3x 32 bit, SCOCR1, SCOCR2, SCOCR3) ............................... 157 10.8 Interrupt Control Registers ............................................................................... 157 10.9 Backoff Slot Counter ........................................................................................ 158 10.10 Symbol Counter Usage .................................................................................. 158 10.11 Register Description ....................................................................................... 159 11 System Clock and Clock Options ................................................ 174 11.1 Overview........................................................................................................... 174 11.2 Clock Systems and their Distribution ............................................................... 174 11.3 Clock Sources .................................................................................................. 175 11.4 Calibrated Internal RC Oscillator ...................................................................... 176 11.5 128 kHz Internal Oscillator ............................................................................... 177 11.6 External Clock .................................................................................................. 177 11.7 Transceiver Crystal Oscillator .......................................................................... 178 11.8 Clock Output Buffer .......................................................................................... 179 11.9 Timer/Counter Oscillator .................................................................................. 179 11.10 System Clock Prescaler ................................................................................. 179 11.11 Register Description ....................................................................................... 180 12 Power Management and Sleep Modes ........................................ 183 12.1 Deep-Sleep Mode ............................................................................................ 183 600 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 12.2 AVR Microcontroller Sleep Modes ................................................................... 184 12.2.6 Extended Standby Mode ............................................................................... 186 12.3 Power Reduction Register................................................................................ 186 12.4 Minimizing Power Consumption ....................................................................... 187 12.5 Supply Voltage and Leakage Control ............................................................... 189 12.6 Register Description ......................................................................................... 194 13 System Control and Reset ........................................................... 207 13.1 Resetting the AVR ............................................................................................ 207 13.2 Reset Sources .................................................................................................. 207 13.3 Internal Voltage Reference............................................................................... 210 13.4 Watchdog Timer ............................................................................................... 211 13.5 Register Description ......................................................................................... 214 14 I/O-Ports ......................................................................................... 217 14.1 Introduction ....................................................................................................... 217 14.2 Ports as General Digital I/O.............................................................................. 218 14.3 Alternate Port Functions ................................................................................... 222 14.4 Register Description ......................................................................................... 234 15 Interrupts ....................................................................................... 241 15.1 Interrupt Vectors in ATmega2564/1284/644RFR2 ........................................... 241 15.2 Reset and Interrupt Vector Placement ............................................................. 243 15.3 Moving Interrupts Between Application and Boot Section ............................... 246 15.4 Register Description ......................................................................................... 247 16 External Interrupts ........................................................................ 248 16.1 Pin Change Interrupt Timing ............................................................................ 248 16.2 Register Description ......................................................................................... 249 17 8-bit Timer/Counter0 with PWM ................................................... 256 17.1 Features ........................................................................................................... 256 17.2 Overview........................................................................................................... 256 17.3 Timer/Counter Clock Sources .......................................................................... 257 17.4 Counter Unit ..................................................................................................... 257 17.5 Output Compare Unit ....................................................................................... 258 17.6 Compare Match Output Unit............................................................................. 260 17.7 Modes of Operation .......................................................................................... 262 17.8 Timer/Counter Timing Diagrams ...................................................................... 266 17.9 Register Description ......................................................................................... 268 18 16-bit Timer/Counter (Timer/Counter 1, 3, 4, and 5) ................... 274 601 42073B-MCU Wireless-09/14 18.1 Features ........................................................................................................... 274 18.2 Overview........................................................................................................... 274 18.3 Accessing 16-bit Registers ............................................................................... 276 18.4 Timer/Counter Clock Sources .......................................................................... 279 18.5 Counter Unit ..................................................................................................... 279 18.6 Input Capture Unit ............................................................................................ 280 18.7 Output Compare Units ...................................................................................... 282 18.8 Compare Match Output Unit............................................................................. 284 18.9 Modes of Operation .......................................................................................... 286 18.10 Timer/Counter Timing Diagrams .................................................................... 294 18.11 Register Description ....................................................................................... 296 19 Timer/Counter 0, 1, 3, 4, and 5 Prescaler .................................... 334 19.1 Internal Clock Source ....................................................................................... 334 19.2 Prescaler Reset ................................................................................................ 334 19.3 External Clock Source ...................................................................................... 334 19.4 Register Description ......................................................................................... 335 20 Output Compare Modulator (OCM1C0A)..................................... 337 20.1 Overview........................................................................................................... 337 20.2 Description........................................................................................................ 337 20.3 Timing Example ................................................................................................ 338 21 8-bit Timer/Counter2 with PWM and Asynchronous Operation 339 21.1 Features ........................................................................................................... 339 21.2 Overview........................................................................................................... 339 21.3 Timer/Counter Clock Sources .......................................................................... 340 21.4 Counter Unit ..................................................................................................... 341 21.5 Modes of Operation .......................................................................................... 341 21.6 Output Compare Unit ....................................................................................... 346 21.7 Compare Match Output Unit............................................................................. 347 21.8 Timer/Counter Timing Diagrams ...................................................................... 349 21.9 Asynchronous Operation of Timer/Counter2 .................................................... 350 21.10 Timer/Counter Prescaler ................................................................................ 353 21.11 Register Description ....................................................................................... 354 22 SPI- Serial Peripheral Interface .................................................... 361 22.1 Features ........................................................................................................... 361 22.2 Functional Description ...................................................................................... 361 __ 22.3 Pin Functionality Slave Select Pin SS .............................................................. 365 602 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 22.4 Register Description ......................................................................................... 367 23 USART............................................................................................ 370 23.1 Features ........................................................................................................... 370 23.2 Overview........................................................................................................... 370 23.3 Clock Generation .............................................................................................. 371 23.4 Frame Formats ................................................................................................. 374 23.5 USART Initialization ......................................................................................... 375 23.6 Data Transmission - The USART Transmitter................................................. 376 23.7 Data Reception - The USART Receiver .......................................................... 379 23.8 Asynchronous Data Reception ......................................................................... 383 23.9 Multi-processor Communication Mode ............................................................. 386 23.10 Register Description ....................................................................................... 387 23.11 Examples of Baud Rate Setting ..................................................................... 396 24 USART in SPI Mode ...................................................................... 399 24.1 Overview........................................................................................................... 399 24.2 USART MSPIM vs. SPI .................................................................................... 399 24.3 SPI Data Modes and Timing ............................................................................ 400 24.4 Frame Formats ................................................................................................. 401 24.5 Data Transfer.................................................................................................... 402 24.6 USART MSPIM Register Description ............................................................... 404 25 2-wire Serial Interface ................................................................... 408 25.1 Features ........................................................................................................... 408 25.2 2-wire Serial Interface Bus Definition ............................................................... 408 25.2.2 Electrical ........................................................................................................ 409 25.3 Data Transfer and Frame Format..................................................................... 409 25.4 Multi-master Bus Systems, Arbitration and Synchronization ........................... 411 25.5 Overview of the TWI Module ............................................................................ 413 25.6 Using the TWI ................................................................................................... 415 25.7 Transmission Modes ........................................................................................ 418 25.8 Multi-master Systems and Arbitration .............................................................. 431 25.9 Register Description ......................................................................................... 432 26 AC - Analog Comparator ............................................................. 438 26.1 Analog Comparator Multiplexed Input .............................................................. 438 26.2 Register Description ......................................................................................... 439 27 ADC - Analog to Digital Converter .............................................. 442 27.1 Features ........................................................................................................... 442 603 42073B-MCU Wireless-09/14 27.2 Operation .......................................................................................................... 443 27.3 ADC Start-Up.................................................................................................... 444 27.4 Starting a Conversion ....................................................................................... 445 27.5 Pre-scaling and Conversion Timing ................................................................. 446 27.6 Changing Channel or Reference Selection ...................................................... 449 27.7 ADC Noise Canceller ....................................................................................... 452 27.8 ADC Conversion Result ................................................................................... 456 27.9 Internal Temperature Measurement ................................................................. 458 27.10 SRAM DRT Voltage Measurement ................................................................ 460 27.11 EVDD Voltage Measurement ......................................................................... 461 27.12 Register Description ....................................................................................... 462 28 JTAG Interface and On-chip Debug System ............................... 470 28.1 Features ........................................................................................................... 470 28.2 Overview........................................................................................................... 470 28.3 TAP - Test Access Port .................................................................................... 471 28.4 TAP Controller .................................................................................................. 472 28.5 Using the Boundary-scan Chain....................................................................... 473 28.6 Using the On-chip Debug System .................................................................... 473 28.7 On-chip Debug Specific JTAG Instructions ...................................................... 474 28.8 Using the JTAG Programming Capabilities ...................................................... 474 28.9 Bibliography ...................................................................................................... 475 28.10 On-chip Debug Related Register in I/O Memory............................................ 475 29 IEEE 1149.1 (JTAG) Boundary-scan ............................................ 476 29.1 Features ........................................................................................................... 476 29.2 System Overview ............................................................................................. 476 29.3 Data Registers .................................................................................................. 476 29.4 Boundary-scan Specific JTAG Instructions ...................................................... 478 29.5 Boundary-scan Chain ....................................................................................... 479 29.6 Boundary-scan Related Register in I/O Memory.............................................. 482 29.7 Boundary-scan Description Language Files .................................................... 483 29.8 ATmega2564/1284/644RFR2 Boundary-scan Order ....................................... 483 30 Boot Loader Support - Read-While-Write Self-Programming... 485 30.1 Features ........................................................................................................... 485 30.2 Application and Boot Loader Flash Sections ................................................... 485 30.3 Read-While-Write and No Read-While-Write Flash Sections .......................... 486 30.4 Boot Loader Lock Bits ...................................................................................... 488 604 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 30.5 Addressing the Flash During Self-Programming .............................................. 488 30.6 Self-Programming the Flash............................................................................. 489 30.7 Register Description ......................................................................................... 499 31 Memory Programming .................................................................. 502 31.1 Program And Data Memory Lock Bits .............................................................. 502 31.2 Fuse Bits ........................................................................................................... 503 31.3 Signature Bytes ................................................................................................ 505 31.4 User Signature Data ......................................................................................... 505 31.5 Calibration Byte ................................................................................................ 505 31.6 Page Size ......................................................................................................... 505 31.7 Parallel Programming Parameters, Pin Mapping, and Commands ................. 506 31.8 Parallel Programming ....................................................................................... 508 31.9 Serial Downloading .......................................................................................... 519 31.10 Programming via the JTAG Interface ............................................................. 523 32 Application Circuits ...................................................................... 538 32.1 Basic Application Schematic ............................................................................ 538 33 Register Summary ........................................................................ 540 34 Instruction Set Summary.............................................................. 545 34.1 Arithmetic and Logic Instructions ..................................................................... 545 34.2 Branch Instructions ........................................................................................... 546 34.3 Bit and Bit Test Instructions .............................................................................. 547 34.4 Data Transfer Instructions ................................................................................ 548 34.5 MCU Control Instructions ................................................................................. 549 35 Electrical Characteristics ............................................................. 550 35.1 Absolute Maximum Ratings .............................................................................. 550 35.2 Recommended Operating Range..................................................................... 550 35.3 Digital Pin Characteristics ................................................................................ 551 35.4 Transceiver Pin Characteristics........................................................................ 551 35.5 Power Supply Currents (RF transceiver in SLEEP mode) ............................... 552 35.6 Clock Characteristics ........................................................................................ 552 35.7 System and Reset Characteristics ................................................................... 553 35.8 Power Management Electrical Characteristics ................................................. 554 35.9 2-wire Serial Interface Characteristics ............................................................. 556 35.10 SPI Timing Characteristics ............................................................................. 557 35.11 ADC Characteristics ....................................................................................... 558 35.12 Temperature Sensor Characteristics ............................................................. 560 605 42073B-MCU Wireless-09/14 35.13 Analog Comparator Characteristics ............................................................... 560 35.14 Transceiver Electrical Characteristics ............................................................ 560 36 Typical Characteristics ................................................................. 564 36.1 Supply Current vs. Clock Speed with Transceiver in SLEEP .......................... 564 36.2 Current Consumption of Bandgap Source and Digital Voltage Regulator ....... 568 36.3 Current Consumption in various Transceiver States........................................ 568 36.4 RF Measurements ............................................................................................ 571 36.5 BOD Threshold ................................................................................................. 573 36.6 Pin Driver Strength ........................................................................................... 574 36.7 Power-Down Current ........................................................................................ 577 36.8 Static ADC Parameter - INL and DNL ............................................................. 578 36.9 Dynamic ADC Parameter - ENOB ................................................................... 582 36.10 ADC Voltage Reference ................................................................................. 585 36.11 Temperature Sensor ...................................................................................... 585 36.12 Internal Oscillator Speed ................................................................................ 587 36.13 Programming Current ..................................................................................... 589 37 Ordering Information .................................................................... 591 38 Packaging Information ................................................................. 594 39 Errata ............................................................................................. 595 39.1 ATmega2564RFR2 revision D ......................................................................... 595 39.2 ATmega2564RFR2 revision A, B, C ................................................................ 595 39.3 ATmega1284RFR2 revision D ......................................................................... 595 39.4 ATmega1284RFR2 revision A, B, C ................................................................ 595 39.5 ATmega644RFR2 revision D ........................................................................... 595 39.6 ATmega644RFR2 revision A, B, C................................................................... 595 39.7 Detailed errata description ............................................................................... 595 40 Revision history ............................................................................ 598 Table of Contents............................................................................... 599 606 ATmega2564/1284/644RFR2 42073B-MCU Wireless-09/14 ATmega2564/1284/644RFR2 Atmel Corporation Atmel Asia Limited Atmel Munich GmbH Atmel Japan G.K. 1600 Technology Drive Unit 01-5 & 16, 19F Business Campus 16F Shin-Osaki Kangyo Bldg. San Jose, CA 95110 BEA Tower, Millennium City 5 Parkring 4 1-6-4 Osaki, Shinagawa-ku USA 418 Kwun Tong Road D-85748 Garching b. Munich Tokyo 141-0032 Tel: (+1)(408) 441-0311 Kwun Tong, Kowloon GERMANY JAPAN Fax: (+1)(408) 487-2600 HONG KONG Tel: (+49) 89-31970-0 Tel: (+81)(3) 6417-0300 www.atmel.com Tel: (+852) 2245-6100 Fax: (+49) 89-3194621 Fax: (+81)(3) 6417-0370 Fax: (+852) 2722-1369 (c) 2014 Atmel Corporation. All rights reserved. / Rev.: 42073B-MCU Wireless-09/14 Atmel(R), Atmel logo and combinations thereof, Enabling Unlimited Possibilities(R), and others are registered trademarks or trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others. Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and products descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. 607 42073B-MCU Wireless-09/14