AVR1921: Reprogramming the Xplain AT90USB1287 and ATxmega128A1 firmware Features • ATxmega128A1 microcontroller • External Memory - 8MB SDRAM - 8MB Serial Data Flash • AT90USB1287 - Communication gateway - Programmer for Atmel® AVR® XMEGATM - Analog Input (to ADC) - Temperature sensor - Potentiometer • Analog Output (from DAC) - Mono speaker via audio amplifier • Digital IO - UART communication through USB gateway - 8 micro switch buttons - 8 LEDs - 8 spare analog pins - 8 spare digital pins 8-bit Microcontrollers Application Note 1 Introduction This application note describes how to reprogram the AT90USB1287 and the ATxmega128A1 on the Xplain board with the original firmware, or your own application code. Figure 1-1. Xplain evaluation kit. Rev. 8301A-AVR-04/10 2 Reprogramming the firmware 2.1 Powering the Xplain board Power the Xplain kit by connecting it to a PC host or a USB power adapter. The Xplain USB connector is the mini-B type used for most portable products today. Figure 2-1. Xplain connectors If connecting the Xplain kit to a PC, you might be required to install the Xplain USB driver the first time it is connected. Please find the install file in the /software/USB driver/ folder of the zip file distributed with this application note (http://www.atmel.com/avr/). Select the driver corresponding to the Xplain/AT90USB1287 firmware revision used. You will find the revision ID on the back side of the Xplain as shown in Figure 2.2b. It is possible to replace the AT90USB1287 firmware of a revision 1 kit with later firmware, in that case it is required to uninstall the USB driver and install the new driver. 0 2 AVR1921 8301A-AVR-04/10 AVR1921 Figure 2-2a. Xplain revision Figure 2-2b. Xplain revision 8301A-AVR-04/10 2.2 Using the preprogrammed firmware The preprogrammed firmware in the ATxmega128A1 runs a demo application where sounds/tunes are played when the buttons are pushed. The preprogrammed firmware of the AT90USB1287 is composed of two distinct sections: the bootloader and the application. The bootloader provides a simple way for the user to update the application section of the AT90USB1287 with the only need of FLIP (a free PC application) and a USB cable. The preprogrammed application is a USB to serial port bridge. When the USB is connected to a PC host and correctly enumerated, the AT90USB1287 will operate as a communication gateway, and pass on data between the UART and the USB (COM port). When powered from a USB power adapter (and therefore not enumerated) the AT90USB1287 will echo back data received on the UART. 2.3 Reprogramming the ATxmega128A1 firmware using JTAGICE mkII This guide requires that AVR Studio 4 is installed. It is a walkthrough which describes how to download the original firmware using a JTAGICE mkII with AVR Studio 4.18. 1. Make sure the Xplain board is powered (please refer to the “2.1 Powering the Xplain board” section). 5 6 2. Connect the JTAGICE mkII to the “JTAG & PDI XMEGA” pin header (J100) as shown in figure 2.1. 3. Open the programming dialog in AVR Studio selecting Tools -> Program AVR -> Connect. Select “JTAGICE mkII” and Auto and click “Connect”. 4. Select the “Main” tab and choose the “ATxmega128A1” from the dropdown list. Choose “JTAG mode” as programming mode. 5. Select the “Program” tab and choose the XMEGA hex file provided with the application note as Flash input hex file (/firmware/revision_XXX/ATxmega128A1/ATxmega128A1.hex). Click Program. The device is now programmed original firmware. The same procedure can be used to download your own application code. 2.4 Reprogramming the AT90USB1287 firmware using JTAGICE mkII This guide requires that AVR Studio is installed. It is a walkthrough which describes how to download the bootloader, the application as well as setting the correct fuse settings. The firmware is downloaded with the JTAGICE mkII and AVR Studio 4.18. Downloading the firmware: 1. Make sure the Xplain board is powered (please refer to the “2.1 Powering the Xplain board” section). 7 8 2. Connect the JTAGICE mkII to the “JTAG USB” pin header (J200) as shown in figure 2.1. 3. Open the programming dialog in AVR Studio selecting Tools -> Program AVR -> Connect. Select “JTAGICE mkII” and Auto and click “Connect”. 4 AVR1921 8301A-AVR-04/10 AVR1921 4. Select the “Main” tab and choose the “AT90USB1287” from the dropdown list. Choose “JTAG mode” as programming mode. 5. Select the “Program” tab and choose the USB bootloader hex file provided with the application note as Flash input hex file (/firmware/revision_XXX/AT90USB1287/ AT90USB1287.hex). Click Program. 6. Select the “Fuses” tab in the programming dialog. The fuses should be set as shown below. (Ext 0xFB, High 0x98, Low 0xDE) Figure 2-2. USB fuse settings 2.5 Reprogramming the AT90USB1287 application firmware using FLIP This guide requires that both AVR Studio® and FLIP are installed. It is a walkthrough which describes how to download the USB application firmware. To use FLIP as a stand alone application, please refer to the application note: “AVR282: USB Firmware Upgrade for AT90USB”. 1. Disconnect the USB power source. 2. Unplug the JTAGICE mkII and place a jumper between pins 1 and 2 on the “JTAG USB” pin header (J200). 3. Connect the USB cable to a computer. 4. The first time this is done, the bootloader driver will have to be installed. A “Found new hardware wizard” will pop up. Select “No, not this time” and next as shown bellow. 8301A-AVR-04/10 Figure 2-3. Found new hardware 5. Select “Install from a list or specific location (Advanced). Click next. 6. Select “Include this location in the search:”. Select the FLIP installation folder and the usb folder as shown bellow. Click next. Figure 2-4. Driver path selection 7. Click finish. 8. Open AVR Studio and select Tools -> Flip X.X.X. 9. Select Device -> Select... -> AT90USB1287 and click “OK” 10. Select Settings -> Communication -> USB and click “Open”. 11. Under “Operations Flow” check out “Erase, “Program” and “Verify”. 12. Choose the hex file to be programmed: select File -> Load hex file. Choose the USB application firmware file (/firmware/revision_XXX/AT90USB1287/ Xplain_USB.a90) and click “OK”. 13. Press “Run”. 6 AVR1921 8301A-AVR-04/10 AVR1921 The device is now programmed with the serial gateway application firmware. The same procedure can be used to download your own application code. Remove the jumper at the “JTAG USB” pin header (J200) and cycle power to start the application code. 8301A-AVR-04/10 Disclaimer Headquarters International Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131 USA Tel: 1(408) 441-0311 Fax: 1(408) 487-2600 Atmel Asia Unit 1-5 & 16, 19/F BEA Tower, Millennium City 5 418 Kwun Tong Road Kwun Tong, Kowloon Hong Kong Tel: (852) 2245-6100 Fax: (852) 2722-1369 Atmel Europe Le Krebs 8, Rue Jean-Pierre Timbaud BP 309 78054 Saint-Quentin-enYvelines Cedex France Tel: (33) 1-30-60-70-00 Fax: (33) 1-30-60-71-11 Atmel Japan 9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chuo-ku, Tokyo 104-0033 Japan Tel: (81) 3-3523-3551 Fax: (81) 3-3523-7581 Technical Support [email protected] Sales Contact www.atmel.com/contacts Product Contact Web Site http://www.atmel.com/ 1 2 3 Literature Request www.atmel.com/literature 4 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 ATMEL’S TERMS AND CONDITIONS OF SALE LOCATED ON ATMEL’S WEB SITE, 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 OF 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’s products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. ® ® ® ® © 2010 Atmel Corporation. All rights reserved. Atmel , Atmel logo and combinations thereof, AVR , AVR logo, AVR Studio and others, are the registered trademarks; XMEGA™ and others are trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others. 8301A-AVR-04/10