



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




We will in this article take a closer look at the JTAG interface and how Fuses and Lockbits affect operation. If you are using, or planning to use the JTAG interface, you should definitely spend a couple of minutes reading this article! Note: This article is not intended for newbies. Readers should read and get an understanding of the JTAG section in the datasheet before reading this document.
New megaAVR devices with more than 8KB of Flash, include a JTAG interface for Programming, Boundary Scan and On-chip Debugging. This article will take a peek at some of the features that are somewhat hidden, or difficult to find, in the datasheets.
JTAG Programming, OCD, IEEE 1149.1 compliant, Boundary-Scan. It is easy to get confused and start mixing the terminology. To summarize the AVR JTAG interface is compliant with the IEEE 1149.1 Standard. Through this interface you have access to the following "services":
The first source of confusion when looking at the JTAG interface is understanding the fuses, and how they affect the behavior of the device and/or JTAG interface. In addition; An IO control bit "JTD" is a available. Unlike the fuses this bit can be set at run-time allowing you to disable the JTAG / OCD functionality in software during program execution. So what is the difference between the JTAGEN and OCDEN fuse? What do they do, and what is the consequence of only programming one of them? To save you some time fine-reading the Datasheet, we here at AVRfreaks have compiled the following table and functional block diagram that should explain the relationship between these fuses and functionality. The block diagram below the table shows the relationship between the Fuses and JTD control bit. Note that setting either of the Lock bits LB1or LB2 will disable OCD. NOTE: In the following table we use " P " for programmed, and " U " for un- programmed fuse.
unique features not found in any other emulator: The most obvious advantage is that you actually are running the code on the device itself, so all electrical and timing characteristics are FOR REAL. No emulated behavior! The main thing to remember is that the JTAG OCD is not an EMULATOR, it is the real thing. Which leads us to the JTAG ICE which actually is no ICE at all. It is a protocol converter/interface allowing AVR Studio to talk to the OCD interface inside the AVR. :-) One thing that you should be aware of is that when the AVR OCDEN fuse is programmed (OCD Enabled) some of the clock system is left running even though you put the AVR in sleep mode. So, if you experience high power consumption during SLEEP mode, make sure you are not running the device with the OCDEN programmed!
Boundary-Scan is very efficient way of verifying that your device is soldered in correctly, and that inter connectivity to other devices is correct. There are a number of tools available today that will read your layout files and generate a complete test vector set to verify your design. When JTAGEN fuse is programmed and JTD is not set, the Boundary Scan Chain is available. This chain include all (almost) physical pins on the device. This chain do not include the internal scan chain. The internal Scan Chain is part of the OCD system, and is not accessible unless OCD is enabled, and LB1 and LB2 is unprogrammed.
The JTAG programming interface works much the same way as the two other programming interfaces. The same functionality and restrictions apply. The main thing to remember if you want to use the JTAG for programming is to set the Lock bits correctly. Setting the JTAGEN will not do you any good if you have disabled Further write or Read/write by programming the Lock Bits! This table explains the relationship between JTAG Programming interface and the Lock Bits: NOTE: In the following table we use " P " for programmed, and " U " for un- programmed fuse. LB mode
1 U U No memory lock features enabled. 2 U P Further programming of the Flash and EEPROM is disabled in Parallel and SPI/JTAG Serial Programming mode. The Fuse bits are locked in both Serial and Parallel Programming mode. Read- back is possible.
- P U Invalid Mode 3 P P Further programming and verification of the Flash and EEPROM is disabled in Parallel and SPI/JTAG Serial Programming mode. The Fuse bits are locked in both Serial and Parallel Programming mode.
We have now looked at the different services offered by the JTAG interface, and the final task is to take an analysis of the security of the JTAG implementation.