Question on HCS12, Expanded Mode (How much trouble am I in?)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Question on HCS12, Expanded Mode (How much trouble am I in?)

2,158 Views
VincentV
Contributor I
I've inherited a design that uses an HCS12 and I the designer's intent was to access external flash as if it was interneal.

The trouble comes in that I'm not sure that he put everything where it is "supposed" to be for this to work well (or, as well as it can).

With the mode register set to:

MODE = E0

I would expect that I should have internal flash up to 0x8000.

Everything above 0x8000 should be external access, yes?

The trouble comes in that certain flash operations seem to be working, while reading fails at some points.

For example, I can fetch the device id and manufacturing id of the flash device, and if I do a chip erase, it seems to take as long as it should, no more, no less.

However, when I go to verify that the chip was erased, the verification will fail at some address. Instead of 0xFFFF I'll read something else (usually different each time).

Examining the memory space in the debugger, I found that the value it was reading that was not 0xFFFF was coming out of the MCU memory!

This is bad.

Any thoughts? (I would be more than happy to provide more info if needed)

Thanks!
Labels (1)
0 Kudos
3 Replies

362 Views
blood
Contributor III
On the device I use (9S12E256) the expanded address range is 0x8000 to 0xBFFF which is 16Kb. To address more than 16Kb you need to use the PPAGE register to select different pages which can be used to control the lines XAB14 - XAB19 (Port K on the device I use).
0 Kudos

362 Views
Alban
Senior Contributor II

Hello IronTek,

Freescale has a couple of Application Notes explaining how to interface external memory. AN2287 and AN2408.

The internal state machine will not erase external Flash as Flash needs high voltage to be erased and programmed and it is not available outside the MCU.

Also you have to think about Memory Paging and also Chip Select. By default, 0x8000 is the MCU local memory map is where the internal Flash starts (when Flash size >= 32KB).

You need to tell the MCU you want to map some of the memory outside.

Cheers,
Alban.

0 Kudos

362 Views
VincentV
Contributor I
Well, with ROMON=0, shouldn't the upper flash on the MCU be excluded from the memory map thus telling the MCU to map to the outside world?

And yet, this does not seem to be the behavior I am witnessing...
0 Kudos