Dwayne Dietrich

Subject: External Program Memory

Discussion created by Dwayne Dietrich Employee on Jan 29, 2006

This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.


Posted: Mon Feb 7, 2005 5:35am
Subject: External Program Memory

I want to use a HCS12 (a 9S12E128 would fit very well) for my project and I need one thing of which I'm unsure that the HCS12 supports it.

For my project I do not want to use the flash as memory for the program, I want to put the programm in an external OTP ROM. I read that I can switch this sowmehow through the BDM Interface, but is it possible to compile the program the same way I do it for the internal flash and then just "put" it in the ROM ?

In which way is the flag which says that the uC has to work in "get proggie from extern" mode ? Is it also possible to hardwire this, somehow ?

Are there also HCS08 which are able to do that "get proggie from extern" mode ?

Thanks for your answers in advance.
With best regards.

Posted: Mon Feb 7, 2005 8:29am
What you're looking for is expanded mode. Check the HCS12 docs.

There are a couple of mode pins that you can strap high or low at reset

to select whether the chip comes up in single-chip mode, which is how

most people use it, or in expanded mode. In expanded mode, the chip

has an external bus to which memories can, in principle, be attached.

More about that in a moment...
The BDM interface does not come into play in the single-chip/expanded

mode equation, except in two ways: First, the state of the BKGD pin at

power-up can select between "normal" and "special" modes. Special mode

turns on various debugging features of the chip. Secondly, it's possible

to use the BDM interface to change the chip's mode between single-chip

and expanded. The chip's own code can change the modes, too, but there

are restrictions on that ability (for system stability reasons) that are

loosened in special mode. Despite all of this, special mode is really

not relevant to your question -- what you're looking for is expanded mode.
Now, the bad news about expanded mode: The 9S12s are designed for

single-chip operation. It is *very* difficult to interface to their

external busses. There was a recent thread on this list, in just the

last week or so, discussing the challenges involved.
The other alternative is to use one of the HC12 members that is designed

to have a usable external bus. The older 68HC812A4 is one choice,

though it's hard to meet all of its timing specs above 5 or 6 MHz.

Doron tells us that the 9S12X series has a much-improved external bus.

Unfortunately that series won't be marketed to us small-fry customers

for another year or so.
With the 9S12 parts available today, you'd be best off using the internal

flash, which is both easier to design for and more versatile than OTP.

Perhaps, if you described the reasons you want to use an external OTP

PROM, some folks on the list could help you figure out how to get the

same effects with the internal flash.

Posted: Mon Feb 7, 2005 10:42am


    Some thoughts:

One thing you would have to work out is mapping the external space. If

you know how to map it to the right address so they will be the same

addresses you load to internal Falsh, you're set. If not, try to work

out mapping so that at least the vectors table is in the right spot

Another method that could avoid any problem of mapping could be to

have a bootstrap in internal Flash, which you would have to load once.

That code can switch the mcu to expanded mode, maybe disable internal

rom, then star the program in the external rom.

Posted: Mon Feb 7, 2005 10:45am
    I beleive the E128 is much better than this for expanded mode timing,

but you might need to change some more settings to meet your external

timing needs