Cart New Account Login

HomeAbout usProductsSupportForumsBlogCustomer Service
   Home P&E Customer Support FAQs - Frequently Asked Questions FAQ ID # 40
FAQ ID # 40
 
Question
I am using an HC12 device in expanded mode, are there some special considerations for this?
 
Answer
Application Note : 68HC12 Expanded Mode Operation

Starting Up in Single Chip Mode

Starting up in special single chip mode is very simple. When the MODA and MODB are
both grounded, and PEmicro’s BDM cable is used to reset the processor, the processor will
start in single chip mode. The processor, after reset, immediately goes into a halted state
waiting for instructions from the BDM port to either program or debug the MCU.

Starting Up in Expanded Narrow and Expanded Wide Modes

Starting up in either expanded mode is not as clean cut as starting in single-chip mode.
Expanded operation is enabled when the MODA pin is high when PEmicro’s BDM cable
resets the processor.

The difficulty in using these modes usually occurs immediately after reset. Unlike the
single chip mode, the processor doesn’t enter a halted state, but instead starts executing
instructions. This can be troublesome because before PEmicro can command the processor to
halt, the processor registers may have been altered by fixed or random code which is
executing. Even if the user has something programmed into flash, this program will be
running for a specified amount of time after reset. This is a drawback to the expanded
background mode operation, so what to do about it?

(1) This is the recommended solution. If you do not wish code to run a startup, or you are
unable to reset the target, change your jumpers to boot the part into special single
chip mode. The reason special single chips starts in a halted state is to allow expanded
targets with blank flash to ALWAYS be boot-able. At this point you have to write
the MODE register to select the expanded mode you want. Note, however, that other
registers may not be set up properly for the expanded mode, and you may have to set
them up yourself with a script file (such as chip select registers). This is the only
guaranteed way to be able to boot an expanded mode target.

PEmicro’s In-circuit Debugger comes with script files for the 68HC812A4 which, when
run, will switch the part from Single Chip mode to either Narrow Expanded
(A4NARROW.ICD) mode or Wide Expanded (A4WIDE.ICD) mode. These script
files come from booting the chip properly in each of the three modes, and comparing
differences in the register values. You must run the script file whenever you reset the
processor. PEmicro’s cable, debugger, and flash programmer work for any 68HC12
device, and to use this method for other HC12 devices in the expanded modes, you
would write a similar script file to change the mode.

PEmicro’s Flash Programmer comes with programming algorithm files which
automatically place the chip into the proper mode. Hence, the chip can booted in
single chip mode, via MODA and MODB settings, and the programmer will
automatically change the mode. This method can be seen by looking at the
initialization section of one of PEmicro’s external programming algorithms.

(2) This works, but is not the recommended solution. You can RESET the target via the
software (NOT a target reset switch) until the target starts up. Sometimes it takes two,
three, or more resets (RETRYs) before the target starts properly. Note that when the
processor starts up properly, you can use it normally, as long as you understand that
all the registers might not be configured as they are out of reset. Most of the time this
will not be an issue, but this startup mode is not deterministic in terms of register
configuration as is booting into special single chip mode.

You can see this using the Motorola HC12A4EVB. If you set this up for expanded
wide mode operation with the RAM in the memory map, you will see that it takes two
or three resets before the processor starts up properly and allows the debugger to take
control. At this point write a word at address $FFFF equal to the value $E000, and
then put a loop at address $E000 such as

nop
nop
bra $e000

You will see at this point the processor will start up perfectly every time when
attempting a reset. This is because the processor, upon reset, jumps to this loop and
runs harmlessly until PEmicro issues the background HALT command a short while later.

 
Related Downloads
none
 
Architectures Categories Products
HC(S)12(X) Interface Hardware/Cable, Debugger, Flash Programming Software, Stand-Alone Programmer DEV912B32, DEV9S12DP256B, KIT9S12DP256B-MULTI, BDM MultilinkReplace, XPC560PKIT100S, XPC560SADPT280S, CYCLONEPRO, ICD12Z, BDM MULTILINK, USB-ML-12, PKG12Z_USB, PROG12Z, KIT9S12A256B-MULTI, KIT9S12A256B-USB, DEMO9S08JM16, XPC560PADPT144S, XPC560PKIT144S
 
Please rate this FAQ to help us improve our support
0 means "not helpful"
10 means "very helpful"
0 1 2 3 4 5 6 7 8 9 10

© 2017 P&E Microcomputer Systems Inc.
Website Terms of Use and Sales Agreement