Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

user code power up or programming mode power up

user code power up or programming mode power up

2008-07-02 by Frank

How does the AVR (say atmega16) know the difference if it is going to
get programmed or if it is going to run the user program? Are there
any tricks so that avoid stimulating the pins with chips I attach to
the AVT thus confusing the AVR into what it is supposed to do at power up?

Also can I get away with only a JTAG cable for programming and
debugging, assuming that the part is fresh from factory?
Frank

Re: user code power up or programming mode power up

2008-07-02 by Don Kinzer

--- In AVR-Chat@yahoogroups.com, "Frank" <transistortoaster@...> wrote:
> How does the AVR (say atmega16) know the difference if it is going to
> get programmed or if it is going to run the user program?
It doesn't, it always begins running the code to which the reset
vector points upon any reset.

For SPI programming, the device is held in reset during programming
thus preventing it from running the existing program.  I don't know
the JTAG protocol but I suspect that there is a sequence of signals
that causes the device to enter some special mode during which
programming occurs.

> Also can I get away with only a JTAG cable for programming and
> debugging, assuming that the part is fresh from factory?
Many, perhaps most/all, AVRs that support JTAG have their JTAG
enabling fuses programmed by default.  Check the datasheet for your
device to be sure.

If you're planning to use JTAG for your In System Programming, you'll
find that those four I/O lines can't be used for anything else.  If,
on the othe rhand, you choose SPI for ISP needs you can use the SPI
lines for other purposes - you just have to be certain that you
prevent your peripheral circuitry from driving the MOSI/MISO/SCK lines
when reset is asserted.

Don Kinzer
ZBasic Microcontrollers
http://www.zbasic.net

Re: [AVR-Chat] Re: user code power up or programming mode power up

2008-07-03 by John Samperi

At 11:11 AM 3/07/2008, you wrote:
>If you're planning to use JTAG for your In System Programming, you'll
>find that those four I/O lines can't be used for anything else.

I use them for leds IF I need them. Your code simply needs to disable
JTAG as it starts. Make sure that the reset pin is wired up to the
JTAG header and then the programmer/debugger can get hold of the chip.

Of course you can't debug those lines with leds and you will need to
turn off the code that disables JTAG during debug.

Regards

John Samperi

********************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495       Fax (02) 9674-8745
Email: john@ampertronics.com.au
Website  http://www.ampertronics.com.au
*Electronic Design * Custom Products * Contract Assembly
********************************************************

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.