Yahoo Groups archive

AVR-Chat

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

Thread

How to use /EA-Vpp pin?

How to use /EA-Vpp pin?

2004-02-08 by Srdjan Ridanovic

Hi, I'm working on a boot loader project with some SRAM, EEPROM and AT89C52 and I want to ask you guys some things that I coudn't find in any tehnical spacifications. For instance, if the /EA-Vpp pin is on "1", procesor will execute program from internal code memory ( in this case 8Kb ) and then countinu using external memory up to 64Kb ! If the /EA-Vpp is on "0" procesor will read program code from external memory only ( 0x0000 - 0xFFFF ). The question is: What will heppn if I change /EA-Vpp pin from "1" to "0" while the program is executing comands from internal code memory? ( If I change it while internal program is running )
My presupposition is that the program will continue executing code from the PC ( program counter ) address of the external memory code and if it's not right sincronized it will gone mad. Or it will countinue doing it's program from internal 8Kb code memory and afther next reset it will start from 0x0000 of external code memory.
If enyone has some experiance with these things I would be more than grateful.
Sincerly Srdjan Ridanovic

Re: How to use /EA-Vpp pin?

2004-02-09 by poitsplace

According to the datasheet, the value is latched from the EA pin at 
reset...so the only way to do it on the fly is to have the CPU put 
everything in memory first...then reset.   If it looks like the 
hardware to change the EA pin and reset the CPU (on the fly) is goint 
to take too much space you might do well to simply use a 2k 
flash/eeprom chip.  That's enough for a boot loader.



--- In AVR-Chat@yahoogroups.com, "Srdjan Ridanovic" <ridanovic@p...> 
wrote:
> Hi, I'm working on a boot loader project with some SRAM, EEPROM and 
AT89C52 and I want to ask you guys some things that I coudn't find in 
any tehnical spacifications. For instance, if the  /EA-Vpp  pin is 
on "1", procesor will execute program from internal code memory ( in 
this case 8Kb ) and then countinu using external memory up to 64Kb ! 
If the /EA-Vpp is on "0" procesor will read program code from 
external memory only ( 0x0000 - 0xFFFF ). The question is: What will 
heppn if I change /EA-Vpp pin from "1" to "0" while the program is 
executing comands from internal code memory? ( If I change it while 
internal program is running ) 
> My presupposition is that the program will continue executing code 
from the PC ( program counter ) address of the external memory code 
and if it's not right sincronized it will gone mad. Or it will 
countinue doing it's program from internal 8Kb code memory and afther 
next reset it will start from 0x0000 of external code memory.
> 
> If enyone has some experiance with these things I would be more 
than grateful.
> Sincerly Srdjan Ridanovic

Re: How to use /EA-Vpp pin?

2004-02-09 by poitsplace

Oh, another way you could do it is to add a second MCU (maybe just an 
8-pin) which would (after it reset the main MCU) could act as some 
sort of slave I/O 



--- In AVR-Chat@yahoogroups.com, "Srdjan Ridanovic" <ridanovic@p...> 
wrote:
> Hi, I'm working on a boot loader project with some SRAM, EEPROM and 
AT89C52 and I want to ask you guys some things that I coudn't find in 
any tehnical spacifications. For instance, if the  /EA-Vpp  pin is 
on "1", procesor will execute program from internal code memory ( in 
this case 8Kb ) and then countinu using external memory up to 64Kb ! 
If the /EA-Vpp is on "0" procesor will read program code from 
external memory only ( 0x0000 - 0xFFFF ). The question is: What will 
heppn if I change /EA-Vpp pin from "1" to "0" while the program is 
executing comands from internal code memory? ( If I change it while 
internal program is running ) 
> My presupposition is that the program will continue executing code 
from the PC ( program counter ) address of the external memory code 
and if it's not right sincronized it will gone mad. Or it will 
countinue doing it's program from internal 8Kb code memory and afther 
next reset it will start from 0x0000 of external code memory.
> 
> If enyone has some experiance with these things I would be more 
than grateful.
> Sincerly Srdjan Ridanovic

Re: [AVR-Chat] Re: How to use /EA-Vpp pin?

2004-02-09 by Wagner Lipnharski

poitsplace wrote:
> According to the datasheet, the value is latched from the EA pin at
> reset...so the only way to do it on the fly is to have the CPU put
> everything in memory first...then reset.   If it looks like the
> hardware to change the EA pin and reset the CPU (on the fly) is goint
> to take too much space you might do well to simply use a 2k
> flash/eeprom chip.  That's enough for a boot loader.


Just remembering that "RESET" here stated is literal, meaning "hardware
reset".
Some people could confuse it by just jumping to address zero.

That is much easier than you can think.

A bootloader could be implemented easily by just incorporating an external
RAM (and the address decoder) to the unit, wired as data and code.

The bootloader is an internal software that its only job is to monitor the
internal UART, dealing with transmission from an external source, your PC,
sending the new code to be run on this target uC.  The bootloader will move
the incoming binary data to the external RAM, now acting as a regular
external data memory. Upon the PC transmission is finished, all the new code
(to run and test) is already in the external RAM, and if the uC could
address external code, will run that code, since the external RAM is wired
to be accessed as data (for read and write) and as well as code (as an
eprom).

The point is that when powering up the uC, or by manual selection, the
internal code should first run, the bootloader.  Then, after the code is
downloaded, it should run the external code.  This is selected by the /EA
pin as discussed.

There are several ways to do that, selecting /EA high or low.  You can even
do it manually with a simple SPDT switch, that is the easiest way to do.
Turn the switch to /EA high, press reset, bootloader takes place. Once the
new code is downloaded to the external RAM, turn the switch to /EA low,
press reset, your new test code will be running.

Another way is to use an external flip-flop, as a 74HC74, using few pins of
the uC to switch the 74HC74 that will hold the new level for the /EA and at
the same time a pulse to reset.

But I like the easy idea of using a capacitor.

Connecting a small 10uF capacitor between +VCC and /EA is enough, and that
is all it takes.
Upon power up, the capacitor is discharged, so at reset, /EA will be close
to VCC value and dropping fast, but not fast as the reset that will be using
a 1uF capacitor.  So, during RESET the /EA will be at high level. It is
latched internally and internal code is choosen, thus, the bootloader takes
place.

During the few dozens milliseconds that follows, the 10uF capacitor (or any
other value you find appropriate) will be charging to almost the whole VCC
span, so it takes /EA down close to ground.  It doesn't matter if the
bootloader already downloaded the code from the PC or not, the uC continue
to run internally until the next reset.  So, even if after half an hour
later the PC sends the test code to the uC's RAM, it will still runing in
internal code, and after that download completion, the bootloader issues a
port pin to issues a brief reset pulse to itself, reseting the uC, but now,
the /EA is forced down via the capacitor. Guess what? external code now is
selected and the test code stored at the RAM takes place.

A second switch installed in paralel to the capacitor can be used to
dischage it and copy a pulse to reset, so it is a forced way to call back
the bootloader for further downloads...

Easy and simple. Difficult combination to happens.


Wagner Lipnharski - email:  wagner@ustr.net
UST Research Inc. - Development Director
http://www.ustr.net - Orlando Florida 32837
Licensed Consultant Atmel AVR _/_/_/_/_/_/

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.