EmbeddedRelated.com
Forums

HC12D60A, EEprom and Flash programming

Started by bitjockey1 October 7, 2003

Hello,
I am using CW to develop and app using the HC12D60A MCU. I
have settings in EEprom that I don't want overwritten when the
debugger is started. I have the section declared as "NO_INIT" in my
flash.prm file, but the EEprom still gets initialized to FF's on
debugger startup. I looked in the ICD-12 sub menu/flash and it lists
the two flash eeprom banks and their locations and the EEprom and
its' location. Is there a way to stop the debugger from initializing
the EEprom??? Another question: Can I have flash programming code in
the boot block of the 28K bank and run out of that bank to program
the 32K bank?? I am planning to point the reset vector to the 28K
bank where the flash programming code is, then the first thing
executed is a check to see if there is valid code in the 32K bank. If
there is the program would jump to the 32K bank and run the
application. Also during normal execution of the application code, if
a special character sequence is received via SCI or CAN the program
would jump back to the boot block in the 28K boot block of code and
initiate a flash program sequence....

Thanks for your help,

Brian




Hello Brian.

Most of default CodeWarrior projects or Wizard projects (CodeWarrior HC12
V3) perform a device mass erase before loading the application.

In your case, this mass erase is executed from a command file called
"preload.cmd" command file. You should be able to find this file in the
"Debugger Cmd Files" folder of your project. ***** PRELOAD.CMD file - Dump Begin ***********************************

// Before loading the commands written below will be executed
// The following commands must be enabled to load in flash with the ICD12
// initialize the flash mechanism
FLASH
// select the flash modules
FLASH SELECT
// unprotect the flash modules
FLASH UNPROTECT
// erase the flash modules
FLASH ERASE
// arm the flash for programming
FLASH ARM

***** PRELOAD.CMD file - Dump End *********************************** In this file, replace the FLASH ERASE command/line (which performs a mass
erase) by:

FLASH ERASE 0,1

This way, you will only erase the "FEE28" and "FEE32" modules. The "Manual
Flash Programming.pdf" document of your installation contains more info
about FLASH commands.

I will reply (if I can) to the second question later.

Regards,
Gilles At 04:14 PM 10/7/2003, you wrote:

> Hello,
> I am using CW to develop and app using the HC12D60A MCU. I
>have settings in EEprom that I don't want overwritten when the
>debugger is started. I have the section declared as "NO_INIT" in my
>flash.prm file, but the EEprom still gets initialized to FF's on
>debugger startup. I looked in the ICD-12 sub menu/flash and it lists
>the two flash eeprom banks and their locations and the EEprom and
>its' location. Is there a way to stop the debugger from initializing
>the EEprom??? Another question: Can I have flash programming code in
>the boot block of the 28K bank and run out of that bank to program
>the 32K bank?? I am planning to point the reset vector to the 28K
>bank where the flash programming code is, then the first thing
>executed is a check to see if there is valid code in the 32K bank. If
>there is the program would jump to the 32K bank and run the
>application. Also during normal execution of the application code, if
>a special character sequence is received via SCI or CAN the program
>would jump back to the boot block in the 28K boot block of code and
>initiate a flash program sequence....
>
> Thanks for your help,
>
> Brian >
>-------------------- >
>">http://docs.yahoo.com/info/terms/




Hello Brian.

Replying to your second question. From the HC912D60A specs:

"Programming and erasing of Flash locations cannot be performed by
code being executed from the Flash memory. While these operations
must be performed in the order shown, other unrelated operations may
occur between the steps."

Motorola or other people from this list could precise if both blocks are
tightly coupled, or if one block can program the other.

For sure, if above not possible, you can copy your programming
routine/runtime from flash (28k for example) to sram, then run it from sram
to program any flash block. You'll need less than 256 bytes for the
flashing runtime.

I hope this help.

Regards,
Gilles At 04:14 PM 10/7/2003, you wrote:

> Hello,
> I am using CW to develop and app using the HC12D60A MCU. I
>have settings in EEprom that I don't want overwritten when the
>debugger is started. I have the section declared as "NO_INIT" in my
>flash.prm file, but the EEprom still gets initialized to FF's on
>debugger startup. I looked in the ICD-12 sub menu/flash and it lists
>the two flash eeprom banks and their locations and the EEprom and
>its' location. Is there a way to stop the debugger from initializing
>the EEprom??? Another question: Can I have flash programming code in
>the boot block of the 28K bank and run out of that bank to program
>the 32K bank?? I am planning to point the reset vector to the 28K
>bank where the flash programming code is, then the first thing
>executed is a check to see if there is valid code in the 32K bank. If
>there is the program would jump to the 32K bank and run the
>application. Also during normal execution of the application code, if
>a special character sequence is received via SCI or CAN the program
>would jump back to the boot block in the 28K boot block of code and
>initiate a flash program sequence....
>
> Thanks for your help,
>
> Brian >
>-------------------- >
>">http://docs.yahoo.com/info/terms/