AVR364: MEGA-1284P Xplained Hardware User's Guide Features • Atmel® megaAVR® ATmega1284P microcontroller - Target controller • Atmel AVR® AT32UC3B1256 32-bit microcontroller - Board controller - Communication gateway • Analog input (to ADC) - Temperature sensor - Light sensor - RC filter • Digital I/O - Three mechanical buttons - Four LEDs - Four expansion headers • Footprints for external memory - Atmel AT45DB series DataFlash® serial flash - Atmel AT25DF series industrial standard serial data flash • Touch - One Atmel QTouch® button 8-bit Atmel Microcontrollers Application Note 1 Introduction The Atmel MEGA-1284P Xplained evaluation kit is a hardware platform for evaluating the ATmega1284P MCU. The kit offers a large range of features that enable the megaAVR user to get started using megaAVR peripherals right away and to get an understanding of how to integrate a megaAVR MCU in their own design. Figure 1-1. MEGA-1284P Xplained evaluation kit. Rev. 8377B-AVR-11/11 2 Related items Atmel AVR Studio® 4 (free IDE from Atmel) http://atmel.com/dyn/products/tools_card.asp?tool_id=2725&category_id=163&family _id=607&subfamily_id=760 Atmel AVR Dragon™ (on-chip programming and debugging tool) http://atmel.com/dyn/products/tools_card.asp?tool_id=3891&category_id=163&family _id=607&subfamily_id=760 Atmel AVR JTAGICE mkII (on-chip programming and debugging tool) http://atmel.com/dyn/products/tools_card.asp?tool_id=3353&category_id=163&family _id=607&subfamily_id=760 Atmel AVR ONE! (on-chip programming and debugging tool) http://atmel.com/dyn/products/tools_card.asp?tool_id=4279&category_id=163&family _id=607&subfamily_id=760 2 AVR364 8377B-AVR-11/11 AVR364 3 General information This document targets the Atmel ATmega1284P evaluation kit revision 3, and parts of the document may, therefore, be inconsistent with earlier revisions of the product. For earlier revisions, please refer to the schematics, which is the only documentation available for these revisions. The Atmel MEGA-1284P Xplained kit is intended to demonstrate the ATmega1284P, and the hardware that relates to the Atmel AT32UC3B1256 (board controller) is, therefore, not covered in detail in this document. Figure 3-1. Overview of the MEGA-1284P Xplained kit. 3 8377B-AVR-11/11 Figure 3-2. Functional overview of the Atmel MEGA-1284P Xplained kit. 3.1 Preprogrammed firmware The MEGA-1284P Xplained kit comes with both the Atmel ATmega1284P and the Atmel AT32UC3B1256 preprogrammed. The preprogrammed firmware in the ATmega1284P is set up with example code that allows the user to choose different sleep modes, and provides an example of how to use the light sensor to dim the four onboard LEDs. It also includes a boot loader (AVROSP) which allows the user to reprogram the ATmega1284P without using an external programmer. Please refer to the Atmel application note, AVR370: MEGA1284P Xplained Getting Started Guide, for more details regarding the preprogrammed firmware. The preprogrammed AT32UC3B1256 firmware offers features such as a boot loader for self-programming of the board controller itself, and a USART-to-USB gateway, which can be used to communicate with the target controller, the ATmega1284P. 4 AVR364 8377B-AVR-11/11 AVR364 3.2 Power supply The kit is powered via the USB connector, which presents two options for powering it: Either connect the kit to a PC through a USB cable or to a 5V USB power supply (AC/DC adapter). The 5V is regulated to 3.3V with an LDO regulator, which provides power to the entire board. The Atmel ATmega1284P is powered by 3.3V, but if 1.8V operation is desired, some modifications to the board are needed. This includes replacing the regulator with one that delivers a 1.8V output and rerouting the power to the device (see schematic for an explanation). As some of the other ICs on the Atmel MEGA-1284P Xplained require 3.3V to operate correctly, these devices have to be removed. 3.3 Measuring the ATmega1284P power consumption As part of an ATmega1284Pevaluation, it can be of interest to measure its power consumption. The two-pin power measurement header is the only connection between the VCC_P3V3 common power plane and the VCC_MCU_P3V3 power plane. By replacing the jumper with an ammeter, it is possible to determine the ATmega1284P current consumption. To locate the power measurement header, please refer to Figure 3-1. Do not power the board without having the jumper or an ammeter mounted. If this is done the board might be powered through an I/O pin. The result might be erratic behavior and the device might get damaged. 3.4 Communication through the USART-to-USB gateway The ATmega1284P USART is connected to a USART on the Atmel AT32UC3B1256. The ATmega1284P USART is communicating at 57600 baud using one start bit, eight data bits, one stop bit, and no parity. When the AT32UC3B1256 device is enumerated (connected to a PC). the data transmitted from the ATmega1284P is passed to a (virtual) COM port. This means that it is possible to use a terminal program on a PC to receive the transmitted data. Similarly data transmitted from the PC COM port is passed to the ATmega1284P USART through the gateway. 5 8377B-AVR-11/11 4 Connectors The Atmel MEGA-1284P Xplained kit has five 10-pin, 100mil headers. Two headers have a fixed communication interface (J1 and J4). One header has analog functionality (J2), and the last header (J3) has general purpose digital I/O. The 90° angled header is the Atmel ATmega1284P JTAG programming and debugging header. For the location of the respective headers, refer to Figure 3-1. 4.1 Programming headers The ATmega1284P can be programmed and debugged by connecting an external programming/debugging tool to the JTAG pin header. The pin header has a standard JTAG programmer pin-out (refer to online help in the Atmel AVR Studio), enabling tools like the Atmel AVR JTAGICE mkII or the Atmel AVR ONE! to be connected directly to the header. The grey, female, 10-pin header on the AVR JTAGICE mkII must be used when connecting to the kit. A scoring in the board is made to fit the orientation tab on the header. A standoff adapter (nr. 1) is needed when using the AVR ONE! Pin 1 on the JTAG header is at the top right corner. This is rotated 180° compared to the other headers (J1, J2, J3, and J4). Table 4-1. MEGA-1284P Xplained programming and debugging interface – JTAG. Pin JTAG (1) 1 TCK 2 GND 3 TDO 4 VCC 5 TMS 6 nSRST 7 - 8 - 9 TDI 10 GND Note: 1. Standard pin-out for the AVR JTAGICE mkII and other Atmel programming tools The Atmel AT32UC3B1256 can be programmed through its boot loader. The boot loader is evoked by shorting the two holes marked BOOTLOADER BOARD CONTROLLER on the bottom side of the board before applying power to the board. The two holes have 100mil spacing, enabling the user to solder in a two-pin header and use a jumper to easily enter the boot loader. Programming is performed through the boot loader programmer target in the Atmel AVR Studio. Alternatively, the AT32UC3B1256 can also be programmed by connecting a programming tool, such as the AVR JTAGICE mkII, to the 10 holes marked JTAG BOARD CONTROLLER on the bottom side of the board. The holes have 100mil spacing, letting the user solder in a 10-pin header to program the board controller. 6 AVR364 8377B-AVR-11/11 AVR364 Please note that programming the Atmel AT32UC3B1256 using a programming tool will erase the boot loader. Please refer to the Atmel application note, AVR370: MEGA-1284P Xplained Getting Started Guide, for more details regarding how to program the onboard microcontrollers. 4.2 I/O expansion headers There are four available I/O expansion headers in the kit. Because of the low pin count on the device, the I/O expansion header pins are shared with onboard functionality. If “clean” expansion ports are needed, cut-straps are available to remove onboard functionality. Table 4-2 through Table 4-5 show what is shared on the respective header pins. Table 4-2. Atmel MEGA-1284P Xplained I/O expansion header – J1. Pin J1 ATmega1284P pin Shared with onboard functionality 1 TWI SDA PC1 Header J4, board controller 2 TWI SCL PC0 Header J4, board controller 3 USART RXD0 PD0 Header J4 4 USART TXD0 PD1 Header J4 5 6 7 SPI SS (1) PB4 Board controller SPI MOSI (1) PB5 Header J4, DataFlash, board controller SPI MISO (1) PB6 Header J4, DataFlash, board controller PB7 Header J4, DataFlash, board controller (1) 8 SPI SCK 9 GND - - 10 VCC_P3V3 - - Note: 1. These signals can be disconnected from the board controller by cutting the cutstraps marked SPI on the bottom side of the board. Table 4-3. MEGA-1284P Xplained I/O expansion header – J2. Pin J2 (1) ATmega1284P pin Shared with onboard functionality PA0 Possible to connect to AREF 1 ADC0 2 ADC1 PA1 - 3 ADC2 PA2 - 4 ADC3 PA3 - 5 ADC4 PA4 - ADC5 (2) PA5 Filter output ADC6 (2) PA6 Light sensor 8 ADC7 (2) PA7 NTC sensor 9 GND - - 10 VCC_ANA_P3V3 - - 6 7 Notes: 1. AREF with 100nF capacitor to GND can be connected to ADC0 by shorting two pads marked EXTERNAL AREF on the bottom side of the board. 2. These signals can be disconnected from the sensor/filter output by cutting the cut-straps marked SENSORS & FILTER on the bottom side of the board. 7 8377B-AVR-11/11 Table 4-4. Atmel MEGA-1284P Xplained I/O expansion header – J3. Pin J3 ATmega1284P pin Shared with onboard functionality 1 GPIO0 PB0 SW0, LED0 2 GPIO1 PB1 SW1, LED2 3 GPIO2 PB2 SW2, LED3 4 GPIO3 PB3 LED1 5 GPIO4 PD4 J4 (SPI SS1), DataFlash (SPI SS1) PD5 Filter input (1) 6 GPIO5 7 GPIO6 PC4 JTAG(TDO) 8 GPIO7 PC5 JTAG(TDI) 9 GND - - - - 10 VCC_P5V0 Notes: (2) 1. This signal can be disconnected from the filter input by cutting the cut-strap marked FILTER INPUT in the SENSORS & FILTER section on the bottom side of the board. 2. Pin 10 of header J3 is connected to the USB voltage (VCC_P5V0). Table 4-5. MEGA-1284P Xplained I/O expansion header – J4. Pin J4 ATmega1284P pin Shared with onboard functionality 1 TWI SDA PC1 Header J1, board controller 2 TWI SCL PC0 Header J1, board controller 3 USART RXD1 PD2 Board controller 4 USART TXD1 PD3 Board controller 5 SPI SS1 PD4 Header J3 (GPIO4), DataFlash SPI MOSI (1) PB5 Header J1, DataFlash, board controller 7 SPI MISO (1) PB6 Header J1, DataFlash, board controller 8 SPI SCK (1) PB7 Header J1, DataFlash, board controller 9 GND - - 10 VCC_P3V3 - - 6 Note: 8 1. These signals can be disconnected from the board controller by cutting the cutstraps marked SPI on the bottom side of the board. AVR364 8377B-AVR-11/11 AVR364 5 Memories The Atmel MEGA-1284P Xplained kit does not have any external memories mounted on the board. Footprints are available for adding either an industrial standard flash device or an Atmel proprietary serial DataFlash device. The footprints share the same SPI lines, including the chip select, and it is, therefore, not possible to mount devices on both footprints at the same time. Table 5-1. Compatible devices for the footprints. Atmel AT45DB Atmel AT25DF AT45DB64D2-CNU AT25DF641A-SH AT45DB321D-MWU AT25DF321A-SH AT45DB161D-SS AT25DF161-SH AT45DB081D-SS AT25DF081-SSH AT45DB041D-SS AT25DF021-SSH AT45DB021D-SS AT45DB011D-SS 9 8377B-AVR-11/11 6 Miscellaneous I/O 6.1 Mechanical buttons The board is equipped with three mechanical buttons. The buttons (SW0:2) are shared with LED0, LED2, and LED3. Onboard protection circuitry is added to avoid a short when driving the port high at the same time as pushing the button, which will short it to the ground. To be able to use both button and LED, time multiplexing has to be used. To be able to detect a button press, the firmware has to periodically set the I/O pin to input with pull-up and check if it is low. When doing this fast enough, the human eye will not see any change in the LED. 6.2 LEDs The Atmel MEGA-1284P Xplained has four standard yellow LEDs mounted onboard, which are connected to the Atmel ATmega1284P. The four LEDs are active low. LED0, LED2, and LED3 are shared with the three mechanical buttons (SW0:2). When turning an LED on, set the I/O pin to output low. When turning an LED off, set the I/O pin as input with pull-up. The protection circuitry added to the button will make the LED shine brighter when the button is pressed and the LED is turned on. When the LED is off, any button press will light up the LED. The Atmel MEGA-1284P Xplained also has one dual LED mounted near the USB connector. This is the power and status LED, which is connected to the board controller. This LED will be green when power is applied, and will toggle between green and orange when communication over USB is ongoing. 6.3 Analog I/O An RC filter, a light sensor, and an NTC are connected to ADC5, ADC6, and ADC7, respectively. These analog sources can be used as input to the ADC. All of the analog signals can be disconnected by cutting the cut-straps on the bottom side of the board. The RC filter (first-order low-pass) has an approximate 3dB cut-off frequency of 159Hz. The input to the RC filter is GPIO5 (PD5) on the ATmega1284P, which can be configured to output a PWM signal to the RC filter. This can be used to generate a DC voltage on the output of the RC filter, which can be measured on the ADC5 pin. As this is a first-order filter, the ripple on the DC voltage is inversely proportional to the input frequency. A higher input frequency will result in lower ripple on the output. 6.4 Touch The MEGA-1284P XPLAINED kit has one Atmel QTouch button, QTB0. Table 6-1. MEGA-1284P Xplained touch connections. 10 Touch sensor onboard reference QTouch method pin name ATmega1284P pin QTB0 SNSK0 PD7 QTB0 SNS0 PD6 AVR364 8377B-AVR-11/11 AVR364 6.5 Board controller The Atmel AT32UC3B1256 board controller and the Atmel ATmega1284P are connected through TWI, SPI, and USART interfaces. All interfaces can be used to communicate between the devices, but only the USART is implemented by default on the board controller. Table 6-2. ATmega1284P and board controller communication interface. Interface ATmega1284P pin Atmel AT32UC3B1256 pin UART RX (1) PD2 PA24 UART TX (1) PD3 PA23 TWI SCL PC0 PA09 TWI SDA PC1 PA10 SPI SS (2) PB4 PA16 (2) PB5 PA14 SPI MISO (2) PB6 PA25 PB7 PA17 SPI MOSI SPI SCK (2) Notes: 1. This represents the RX and TX on the ATmega1284P. The RX is connected to TX on the other device, and vice versa. 2. These signals can be disconnected from the board controller by cutting the cutstraps marked SPI on the bottom side of the board. 11 8377B-AVR-11/11 7 Included code example For documentation, help, and examples on the drivers used, please refer to the Atmel application note, AVR370: MEGA-1284P Xplained Getting Started Guide. 8 Revision history The kit revision can be identified by a barcode sticker on the bottom side of the kit. For example, A09-1164/4 indicates that the product number for this kit is A09-1164 and the revision is 4. 8.1 Revision 4 Revision 4 of the MEGA-1284P Xplained kit is the first revision released. 12 AVR364 8377B-AVR-11/11 AVR364 9 EVALUATION BOARD/KIT IMPORTANT NOTICE This evaluation board/kit is intended for use for FURTHER ENGINEERING, DEVELOPMENT, DEMONSTRATION, OR EVALUATION PURPOSES ONLY. It is not a finished product, and may not (yet) comply with some or any technical or legal requirements that are applicable to finished products, including, without limitation, directives regarding electromagnetic compatibility, recycling (WEEE), FCC, CE, or UL (except as may be otherwise noted on the board/kit). Atmel supplied this board/kit “AS IS,” without any warranties, with all faults, at the buyer’s and further users’ sole risk. The user assumes all responsibility and liability for proper and safe handling of the goods. Further, the user indemnifies Atmel from all claims arising from the handling or use of the goods. Due to the open construction of the product, it is the user’s responsibility to take any and all appropriate precautions with regard to electrostatic discharge and any other technical or legal concerns. EXCEPT TO THE EXTENT OF THE INDEMNITY SET FORTH ABOVE, NEITHER USER NOR ATMEL SHALL BE LIABLE TO EACH OTHER FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES. No license is granted under any patent right or other intellectual property right of Atmel covering or relating to any machine, process, or combination in which such Atmel products or services might be or are used. Mailing Address: Atmel Corporation, 2325 Orchard Parkway, San Jose, CA 95131 Copyright © 2011, Atmel Corporation 13 8377B-AVR-11/11 10 Table of contents Features ............................................................................................... 1 1 Introduction ...................................................................................... 1 2 Related items.................................................................................... 2 3 General information......................................................................... 3 3.1 Preprogrammed firmware.................................................................................... 4 3.2 Power supply ....................................................................................................... 5 3.3 Measuring the ATmega1284P power consumption ............................................ 5 3.4 Communication through the USART-to-USB gateway........................................ 5 4 Connectors ....................................................................................... 6 4.1 Programming headers......................................................................................... 6 4.2 I/O expansion headers ........................................................................................ 7 5 Memories .......................................................................................... 9 6 Miscellaneous I/O........................................................................... 10 6.1 Mechanical buttons ........................................................................................... 10 6.2 LEDs.................................................................................................................. 10 6.3 Analog I/O.......................................................................................................... 10 6.4 Touch................................................................................................................. 10 6.5 Board controller ................................................................................................. 11 7 Included code example ................................................................. 12 8 Revision history ............................................................................. 12 8.1 Revision 3.......................................................................................................... 12 9 EVALUATION BOARD/KIT IMPORTANT NOTICE ........................ 13 10 Table of contents ......................................................................... 14 14 AVR364 8377B-AVR-11/11 Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131 USA Tel: (+1)(408) 441-0311 Fax: (+1)(408) 487-2600 www.atmel.com Atmel Asia Limited Unit 01-5 & 16, 19F BEA Tower, Milennium City 5 418 Kwun Tong Road Kwun Tong, Kowloon HONG KONG Tel: (+852) 2245-6100 Fax: (+852) 2722-1369 Atmel Munich GmbH Business Campus Parkring 4 D-85748 Garching b. Munich GERMANY Tel: (+49) 89-31970-0 Fax: (+49) 89-3194621 Atmel Japan 9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chou-ku, Tokyo 104-0033 JAPAN Tel: (+81) 3523-3551 Fax: (+81) 3523-7581 © 2011 Atmel Corporation. All rights reserved. ® ® ® ® ® ® ® Atmel , Atmel logo and combinations thereof, AVR , AVR logo, AVR Studio , megaAVR , QTouch , DataFlash , and others are registered 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 product 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. 8377B-AVR-11/11