background image

12

32166A–AVR32806–06/11

Atmel AVR32806

7. Using the boot loader

7.1 Reprogramming the boot loader

By default, all parts are shipped with the boot loader, and so there is no need to program it
except if it has been erased with a hardware debugger (such as 

Atmel AVR JTAGICE mkII

 or

Atmel AVR ONE!

) using a JTAG chip erase command (

avr32program chiperase

) or if the user

wants to program a previous version.

If the 

avr32program 

commands are not accessible through a DOS command, install Atmel

AVR32 Studio 2.7.

Any of the released boot loaders can be programmed while the part is connected to a hardware
debugger through its JTAG interface. The avr32806.zip file enclosed with the application note
delivers the binary of the boot loader under the 

/releases/at32uc3x/

 folder. The binary of the

released ISP is an 

at32uc3x-isp-x.x.x.hex

 file, which can be programmed under a Windows

command shell using the 

program_at32uc3x-isp-x.x.x.cmd

 script. For example, to program ver-

sion 1.1.4 of the Atmel AVR UC3 C USB DFU boot loader, simply execute 

./program_at32uc3c-

isp-1.1.4.cmd

 in the 

releases/at32uc3c01/

 folder.

The steps performed by the programming scripts (for version 1.1.4 of the AVR UC3 C ISP) are:

Issue a JTAG chip erase command to make sure the part is unprotected and free to use:

avr32program chiperase -F

Program the boot loader:

avr32program program -finternal@0x80000000 -cint -e -v -O0x80000000 -Fbin at32uc3c-
isp-1.1.4.bin

Program the boot loader configuration words in the user page:

avr32program program -finternal@0x80000000 -cint -e -v -O0x808001F8(1) -Fbin 
at32uc3c-isp_cfg-1.1.2.bin

Note:

See 

Section 7.3

 for a description of how to generate such a .bin file from two customized configu-

ration words.

Note:

Write the general purpose fuses with their default value used by the ISP:

avr32program writefuses -finternal@0x80000000 gp=0xF877FFFF

7.2 Activating the ISP

The ISP is activated according to the boot process conditions described in 

Figure 6-2

.

ISP activation can be requested in one of the following ways:

External point of view: Reset the part, and make sure the configured hardware conditions 
are true when reset is released. By default, the hardware condition is to press the PB0 push 
button on the 

Atmel UC3C-EK

, and so the user simply has to keep PB0 pressed while 

releasing the reset push button

Internal point of view: The programmed application can launch the ISP by setting the 
ISP_FORCE configuration bit to one (and, therefore, updating the whole Configuration 
Word1). The next execution of the reset vector will then systematically launch the ISP. 

To 

launch the boot process from the application, the reset vector should be reached by 
using the watchdog timer reset rather than a software jump or call to 80000000h. In 
the latter case, unexpected behavior could occur because the MCU reset causes are 
not updated and MCU peripherals may still be active

Once the ISP is activated, it establishes USB communication with the connected PC. This may
take a few seconds while the auto-baud feature uses the USB start-of-frame packets to deter-

Summary of Contents for AT32UC3C0128C

Page 1: ...fault is pressing the joystick on Atmel EVK1100 and Atmel EVK1101 SW2 button on Atmel EVK1104 PB0 button on Atmel UC3C EK HBUTTON0 button on Atmel UC3 C2 Xplained board stored in user page Protected b...

Page 2: ...er Atmel AT32UC3C0256C rev D and higher Atmel AT32UC3C0128C rev D and higher Atmel AT32UC3C064C rev D and higher Atmel AT32UC3C1512C rev D and higher Atmel AT32UC3C1256C rev D and higher Atmel AT32UC3...

Page 3: ...sheet http www atmel com dyn resources prod_documents doc32117 pdf Atmel AVR UC3 A0 A1 A3 B0 B1 DFU boot loader up to version 1 0 3 http www atmel com dyn resources prod_documents doc7745 pdf Atmel AV...

Page 4: ...cated at the beginning of the on chip flash array where an area of up to 64KB can be configured to be write protected by the internal flash controller The boot loader protected size must be at least t...

Page 5: ...by two 32 bit configuration words located at the end of the flash user page Figure 6 1 The Atmel AT32UC3C0512C non volatile memory layout with USB DFU boot loader 6 2 Configuration The boot loader con...

Page 6: ...GURATION memory with BatchISP see Section 7 4 2 or execute Program Fuses on the appropriate ISP AVR 32 bit target in AVR32 Studio see Section 7 5 2 From the running embedded application use the WGPB E...

Page 7: ...to know whetherto start the USB DFU ISP or the application Refer to Table 6 2 for a description of the user page Configuration Word2 Setting this bit to 0 allows the application to save a GPIO pin an...

Page 8: ...C8 of the boot loader user page Configuration Word2 usingthe polynomial P X X8 X2 X 1 This CRC is used to check the validity of Configuration Word2 15 8 ISP_IO_COND_PIN The GPIO pin number to test dur...

Page 9: ...e ISP_IO_COND_EN configuration bit is 1 and if so launches either the USB DFU ISP or the application according to the ISP I O configuration specified by the user page Configuration Word2 If ISP_IO_CON...

Page 10: ...D_EN and ISP_FORCE are respectively bit 8 and bit 9 of the user page configuration word1 ISP_IO_COND_EN 1 Reset Vector 80000000h Bootloader 80000000h ISP_FORCE 1 on DFU Reset Cause POR or EXT or OCD o...

Page 11: ...sequent reset thanks to an appropriate linker script the C99 standard requires a null pointer to compare unequally to a pointer to any object or function Thus it is recommended that applications leave...

Page 12: ...ogram the boot loader configuration words in the user page avr32program program finternal 0x80000000 cint e v O0x808001F8 1 Fbin at32uc3c isp_cfg 1 1 2 bin Note See Section 7 3 for a description of ho...

Page 13: ...SP_FORCE field is either activated 1 or not 0 and set at bit 9 of ISP Configuration Word1 When ISP_FORCE is set to 1 ISP Configuration Word1 is always 0xE11EFE with bit 8 not set yet Otherwise ISP Con...

Page 14: ...his step Configuration Word2 is always 0x929E with bit 16 unset 7 3 2 2 Step 2 Setting the ISP_IO_COND_LEVEL field As mentioned in Table 6 2 the ISP_IO_COND_LEVEL field is either high 1 or low 0 and s...

Page 15: ...fg bin for example Issue the following command through a hardware debugger such as AVR JTAGICE mkII or AVR ONE avr32program program finternal 0x80000000 512Kb cxtal e v O0x808001F8 Fbin isp_mycfg bin...

Page 16: ...USB cable and then activate the ISP as described in Section 7 2 For instance with the default con figuration on the Atmel UC3C EK board press the reset push button then keep PB0 pressed while releasi...

Page 17: ...11 Atmel AVR32806 On the next screen select Install from a list or specific location advanced and click Next Then request a search in the usb folder of the Atmel FLIP installation directory as shown...

Page 18: ...vironment variable When running BatchISP on an AT32UC3xxxxx the target part has to be specified with device at32uc3xxxxx and the communication port with hardware usb Commands can then be placed after...

Page 19: ...buffer with a byte value LOADBUFFER in_elffile in_hexfile loads the ISP buffer from an input file PROGRAM programs the selected address range with the ISP buffer VERIFY verifies that the selected addr...

Page 20: ...t manufacture Add1 2 the product number Add3 the product revision USER This memory is the internal flash user page of the target with addresses from 0 to the size of the user page minus 1 For further...

Page 21: ...et will appear in this pane and its properties will be displayed in the Proper ties pane where it can be renamed In general tab From the Details tab in the Properties pane select USB DFU for the debug...

Page 22: ...To achieve this a trampoline section is placed at the reset vector 80000000h This section simply jumps to the beginning of the application 80002000h To program an application with Atmel AVR JTAGICE mk...

Page 23: ...ne is not programmed and a warning is issued by BatchISP to tell the user that the binary image may contain an application linked directly at the reset vector without the trampo line Consequently when...

Page 24: ...An application can be programmed and run with BatchISP with boot loader by issuing make isp program run for a GCC project For IAR projects which are configured to use the Atmel AVR JTAGICE mkII hardw...

Page 25: ...11 Atmel AVR32806 batchisp device at32uc3c0512c hardware usb operation erase f memory flash blankcheck loadbuffer TARGET_BPATH hex program verify start reset 0 This requires the generation of an Intel...

Page 26: ...n the binary image of the part at the location of the trampoline 7 6 3 Project customization All the following parts are related to the ASF architecture 7 6 3 1 Adding or removing the trampoline To ad...

Page 27: ...debug purposes when using a hardware debugger To add the boot loader binary image to a GCC project do the following in config mk Add common services usb class dfu device atmel isp avr32 to the INC_PA...

Page 28: ...mpile it by using GCC or IAR and program it as any other project with Atmel AVR JTAGICE mkII These changes will automatically be applied to the boot loader binary image used for IAR projects 7 6 3 3 E...

Page 29: ...of the boot loader on the Atmel AT32UC3C0256C Atmel s Bootloader Reset vector is 80000000h Application is 80002000h Free Flash Space MCU Address Space Application Applicative Bootloader BOOT PROT 8 k...

Page 30: ...and higher Atmel AVR UC3 A3 rev E and higher Atmel AVR UC3 B0 B1 rev F and higher Atmel AVR UC3 C rev D and higher Devices delivered with version 1 1 3 Atmel AVR UC3 C rev D and higher 8 1 3 Version 1...

Page 31: ...being referred to as Configuration Word2 Supported devices Atmel AVR UC3 A0 A1 rev H and higher Atmel AVR UC3 A3 rev E and higher Atmel AVR UC3 B0 B1 rev F and higher Atmel AVR UC3 C rev D and higher...

Page 32: ...32UC3A0 1 rev E Atmel AT32UC3B rev B Known bugs and limitations The device erratum titled On AT32UC3A0512 and AT32UC3A1512 corrupted read in flash after FLASHC WP EP EA WUP EUP com mands may happen is...

Page 33: ...ic prior written permission 4 ATMEL grants developer a non exclusive limited license to use the Software as a development platform solely in connection with an Atmel AVR product Atmel Product THIS SOF...

Page 34: ...ation How do I do that A Remove the boot loader with a hardware debugger by unprotecting and erasing the MCU flash array with avr32program chiperase The trampoline should then be removed from your pro...

Page 35: ...t the referring page numbers in this section refer to this document The referring revisions in this section are referring to the document revision 10 1 Rev A 06 11 1 Initial revision for boot loader 1...

Page 36: ...36 32166A AVR32806 06 11 Atmel AVR32806...

Page 37: ...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 EX...

Reviews: