1
Loop Back Branch Instructions with Interrupts
Errata Sheet
Application
This errata sheet applies to code in the AVR Core V2 - avr05_cdk1.3.0.
Error Description
A branch or jump instruction (BRxxx, RJMP, JMP, IJMP) may loop back on itself (-1
length loop). If this loop is followed by a two-word instruction (LDS, STS, JMP, CALL),
an interrupt cannot break the loop. In this case, the interrupt vector is never reached
and the program loops continuously until the next reset.
Bad code examples follow:
•For assembler programs:
Wait_Label :<any branch or jump instruction to Wait_Label>
<any two word instruction>
•For C programs (using IAR C Compiler V1.0 and later):
for(;;)
;
Workaround
•For assembler programs, avoid -1 length loops followed by a two-word instruction
if interrupts are enabled, or replace with the following code:
Wait_Label :<any branch or jump instruction to Wait_Label>
nop
<any two word instruction>
•For C programs (using IAR C Compiler V1.0 and later), avoid the for(;;) instruction
or replace with the following code:
while(1) ;
or
do {} while(1);
In addition, the user should avoid using the exit instruction in the main { } section.
This generates a -1 length loop which cannot be broken later by interrupts if
followed by a two-word instruction.
Embedded RISC
Microcontroller
Core V2
Errata Sheet
Rev. 1383A–06/00
© Atmel Corporation 2000.
Atmel Corporation makes no warranty for the use of its products, other than those expressly contained in the Company’s standard war-
ranty which is detailed in Atmel’s Terms and Conditions located on the Company’s web site. The Company assumes no responsibility for
any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without
notice, and does not make any commitment to update the information contained herein. No licenses to patents or other intellectual prop-
erty of Atmel are granted by the Company in connection with the sale of Atmel products, expressly or by implication. Atmel’s products are
not authorized for use as critical components in life support devices or systems.
Atmel Headquarters Atmel Operations
Corporate Headquarters
2325 Orchard Parkway
San Jose, CA 95131
TEL (408) 441-0311
FAX (408) 487-2600
Europe
Atmel U.K., Ltd.
Coliseum Business Centre
Riverside Way
Camberley, Surrey GU15 3YL
England
TEL (44) 1276-686-677
FAX (44) 1276-686-697
Asia
Atmel Asia, Ltd.
Room 1219
Chinachem Golden Plaza
77 Mody Road Tsimhatsui
East Kowloon
Hong Kong
TEL (852) 2721-9778
FAX (852) 2722-1369
Japan
Atmel Japan K.K.
9F, Tonetsu Shinkawa Bldg.
1-24-8 Shinkawa
Chuo-ku, Tokyo 104-0033
Japan
TEL (81) 3-3523-3551
FAX (81) 3-3523-7581
Atmel Colorado Springs
1150 E. Cheyenne Mtn. Blvd.
Colorado Springs, CO 80906
TEL (719) 576-3300
FAX (719) 540-1759
Atmel Rousset
Zone Industrielle
13106 Rousset Cedex
France
TEL (33) 4-4253-6000
FAX (33) 4-4253-6001
Fax-on-Demand
North America:
1-(800) 292-8635
International:
1-(408) 441-0732
e-mail
literature@atmel.com
Web Site
http://www.atmel.com
BBS
1-(408) 436-4309
Printed on recycled paper.
1383A–06/00/xM
Marks bearing ® and/or are registered trademarks and trademarks of Atmel Corporation.
Terms and product names in this document may be trademarks of others.