Cosmic HC08 User manual

STARTER KIT
HC08
The Cosmic Software 68HC08 Starter Kit includes everything you need to write, compile, debug and program a full
on-chip application for the 68HC08JK1 processor. In less than an hour, you can program an application and see it
running in real-time. The Starter Kit includes :
Cosmic MC68HC908JK1 Development Board
Colored LEDs and push button configured to work with PORTB
Potentiometer setup to operate the ADC
Direct MON08 connection via standard serial cable
9 Volt battery
Serial debug cable
Cosmic 68HC08 IDEA – Integrated Development Environment
Cosmic 68HC08 Compiler, Assembler and Linker
Cosmic ZAP 68HC08 Debugger Simulator
Cosmic ZAP 68HC08 MON08 Debugger and Flash Programmer
Working example application using the on-chip Analog to Digital
converter and LEDs
Documentation and board schematic
The complete kit is only £79 while supplies last.
This is a great learning tool to jump start HC08 development with an easy to use integrated package.
For a limited time, purchase the starter kit and receive a full credit towards an upgrade to any
68HC08 professional package.
Oakwood House, Wield Road, Medstead, Alton, Hampshire GU34 5NJ, ENGLAND – Tel. : +44 (0) 1420 563498 Fax :+44 (0) 1420 561946
http://www.cosmic-software.com

Cosmic Software 68HC908JK1 Evaluation Board
68HC908JK1 Evaluation board provides a complete target system with a serial debug
connection that can be used with Cosmic Software’s development tools to create and
debug real programs for the 68HC08 range of micro controllers. The serial debug
interface included on the evaluation board can also be used to debug other 68HC08
target systems that do not have a dedicated serial debug interface.
To use the evaluation board with the Zap Mono8 debugger software provided with the
starter kit it is only necessary to connect the board to the PC with the serial cable
provided and to connect the battery. These connections should be completed before
running the debugger. The default setting for the software is to use COM2. If the
board is connected to COM1, the debugger will automatically open the connect
window so that a new COM port can be selected.
Mono08 Connection
The 68HC08 micro controller family includes a small monitor program permanently
installed in PROM. The Cosmic Zap Mon08 debugger communicates with this
monitor program and it is important for correct operation, that the 68HC08 chip enters
monitor mode at power on and after a reset. The Cosmic 68HC908JK1 Evaluation
board has been configured to do this. If using Zap with another target board, the user
is strongly recommended to read the monitor mode section of the 68HC08 manual.
The monitor program will allow full access to any code programmed in FLASH for
debugging purposes, however, as this would allow for unauthorised access to
customers code once products had been shipped, there is a security feature. This
security can cause problems during debugging if it is not fully understood. When Zap
connects to the 68HC08 chip it provides a set of security bytes. If these are correct,
the 68HC08 monitor program enters a security passed mode. If the security bytes are
not correct it enters in security failed mode. Zap reports the security status at the
bottom of the screen.
If security is passed, the user is allowed full access to the FLASH which in turn
allows for full high level debug. If security fails, the debugger is still allowed to
access the RAM and registers of the 68HC08, but it is not possible to read the
FLASH. If an attempt to read the FLASH is made by the debugger, a read takes place
but the data returned is not valid (usually returns 0xad). Attempts to program the
FLASH are also inhibited. In this mode, the only valid operation on the FLASH is to
totally erase it. If the security bytes are not known for a programmed chip, the only
way to recover it is to enter monitor mode without passing security and then to erase
the whole FLASH.
Once monitor mode has been entered in security fail mode, it will stay in fail mode
until the power has been removed and restored on the chip. In this case a power on
reset is different from just applying a reset input to the reset pin. If the user tries to re-
connect Zap to the chip in security fail mode without re-cycling the power, it will stay
in fail mode even though the correct security bytes are being sent. It is necessary to
disconnect the battery and reconnect the battery before re-connecting Zap.

The following sequence is needed to recover a programmed chip where the security
bytes are not known. After connecting the board run Zap. This will connect in security
fail mode. Then in the target window select Program/Erase and erase the FLASH.
Next disconnect the battery allowing a few seconds for any charge in the decoupling
capacitors to decay and re-connect the battery. In the Target menu select Connect. In
the connect window make sure the right security bytes option is selected (in this case
all FF’s) and then click the connect button. The chip will now re-enter monitor mode
with security passed.
If the security bytes are known, but the chip has failed security, it is still necessary to
remove and re-apply power to the chip before trying to reconnect Zap with the correct
security bytes.
Once connection is established in the security passed mode, it is possible to load a
program using the debuggers File menu and the Load option. This will automatically
erase the FLASH and then program the code to be debugged. Provided that the target
system remains powered and in monitor mode, new versions of the code being
debugged can be created and loaded into the 68HC08 chip repeatedly without further
security problems. However, if it is necessary to discounted power or to re-establish
connection with the debugger, security must be passed again.
The security bytes must match the data programmed into locations 0xfff6 to 0xfffd.
This area of the memory map is used for the interrupt vectors. In an erased chip these
bytes will in most cases be 0xff. The Zap connect window allows the security bytes to
be all 0’s, all ff’s, user defined or automatically set from the file used to program the
FLASH.
Debugging with Mon08
The monitor program built-in to the 68HC08 chip has limited functionality so as not
to occupy too much of the memory map. The monitor program does not have a single
step function or an abort function. However, the 68HC08 hardware does provide a
single hardware break point register. The Cosmic Zap debugger uses this breakpoint
feature to implement both assembly level and C level single stepping.
With assembly level stepping it is always possible to stop the processor and return to
the monitor program after each assembly instruction. With C level stepping it is not
possible to always predict the out come of multiple assembly instructions that relate to
one C line. The debugger uses multiple machine code steps to simulate a C step. With
a complex C statement there may be a perceived delay while the C step takes place.
It is also possible for the user to set the hardware breakpoint and then run the code at
full speed until the breakpoint is reached. However, there is no abort function, so if
the breakpoint is placed at a point that is never reached, the monitor program and
hence the debugger, cannot regain control.
The debug interface on the evaluation board includes a reset signal and this can be
used to stop a runaway program and allow the debugger to reconnect. The sequence to
achieve this is to first click the red stop traffic light icon in the debugger’s tool bar
and then to press the Control and Delete keys at the same time. The traffic light is to

tell the debugger that the target is being aborted and the key inputs actual cause a hard
reset to take place. Because a hard reset has occurred, the code being debugged cannot
be continued, only restarted and the values of the processor’s registers will be lost.
RAM values are preserved.
Using the Debug Interface with Another Target
Another target system, which does not have its own dedicated debug interface, can be
connected to the debug section of the evaluation board. To do this, disconnect the 3
jumpers at JP3. These 3 signals are the bi-directional serial communications signal,
the reset signal and a +9v signal.
The user should read the monitor mode section of the 68HC08 manual and make the
appropriate connections for this mode. As part of entering monitor mode it is
necessary to take the processors IRQ pin to a voltage higher than VDD. If running
with a 5v target it is normal to connect IRQ to +9v. The 3 signals from the evaluation
can be connected across to the alternative target system. Make sure the any normal
connection to IRQ is disconnected or protected from damage by the +9v. Also make
sure that any reset circuit on the target does not inhibit the debug reset signal from
operating. It will also be necessary to power the evaluation board. If this is to be
powered by a battery, a common 0v connection between the evaluation board and the
alternative target will be required.
With the 3 jumpers removed, the 68HC08 on the evaluation board will, at power on,
start running from the reset vector and will execute any code programmed in its
FLASH. This can be stopped by connecting the reset pin on the evaluation board side
of JP3 to 0v.
Trouble Shooting
Problem Possible Cause
Zap connect window keeps appearing Board not connected or connected to
wrong COM port, Battery not connected,
wrong target selected, wrong baud rate
selected
Zap connected but security failed
message displayed
Wrong security bytes set in connect
window. Power re-cycling needed
Disassembly window or memory display
showing "adad" repeatedly
Security not passed
Processor continually resetting when
running code
COP timer not disabled
Table of contents