|
|
|
|
|
Microcontroller
|
| |
|
You can build yourself a Programmer for the HC08 MCU´s on your own very
easy. The programmer can be used for debugging purposes too. The description
in the Motorola Manuals can be a little confusing, because Motorola describes
all the cases for entering Monitor Mode in one schematic. Another point
is that Motorola allways states only one frequency for a baudrate of 9600
bps in there Manual but you can use other frequencys too to get other baudrates.
In Application Note AN2317 the Monitor Mode circuits are explained in more detail with some variants
on the circuits. I allways use the combination of the MAX232 and the 74HCT125
for Levelshifting and signalswitching. I won´t discuss this here any further,
because this part is allways the same for all HC08 MCU´s. There are two
modes in which the MCU can operate. The User Mode and the Monitor Mode.
In User Mode the reset vector is loaded from adress FFFF and FFFE into
the program counter and program execution is started. In Monitor Mode the
reset vector is fetched from FEFF and FEFE and starts a program in the
internal ROM of the MCU. There are two types of Monitor Mode. Forced Monitor
Mode and Normal Monitor Mode. The MCU allways enters Forced Monitor Mode
when the reset vector at adress FFFF ans FFFE contains FF FF because the
reset vector is not programmed and there is no user program to execute
and it is assumed that the MCU is blank. So forced Monitor Mode can only
be used for initial programming of the MCU and not for debugging or reprogramming.
You don´t have to care much about signal conditions for Forced Monotir
mode, so you can use it at the end of the software development for production
programming.
What Signals are needed to enter Monitor Mode?
There are different Pins used acrosse the HC08 family, but the function
is allways the same. Some MCU´s require less signals, because of low pincount
or missing functions.
Vtst/IRQ : For Normal Monitor Mode entry there must be a voltage between 7
and 9V for a 5V MCU on this pin to enter Monitor Mode. There is no current
needed, so you can get this voltage from the charge pump of the MAX232.
COM : This signal ist mostly on PTA0 but sometimes on PTB0. This pin is
used for serial communication between the MCU and the host. The communicatio
is half duplex, so there is only one pin needed. You have to add some extra
hardware to the MCU to take care of signal switching i.e. a 74HCT125.
MOD0/MOD1 : These pins select Monitor Mode und must be tied to a proper
level. Motorola uses this pins for internal tests too, but there is no
more documentation on this.
DIV4 : if this pin is on a logic high state the the busfreqeuncy is the
external frequency divided by 4. If this pin is in login low state the
the external frequency is only divided by 2.
SSEL : Serial Select. Decides how the security bytes are transfered to
the MCU. Programming is allways serial. Usually the security bytes are
transfered serial, parralel isn´t possible on all MCU´s and there is no
more documentation from Motorola.
Which pins are these signal on?
You have to take a look at the datasheet for the specific MCU. Here is
a little table with some MCU´s listed.
|
GP/GT |
JL/JK |
KX |
MR |
QB/QY/QT |
AB32 |
JB16 |
| Vtst |
IRQ |
IRQ |
IRQ |
IRQ |
IRQ |
IRQ |
IRQ |
| COM |
PTA0 |
|
PTA0 |
PTA0 |
PTA0 |
PTA0 |
PTA0 |
| MOD0 |
PTC0 |
PTB1 |
PTB0 |
PTC3 |
PTA1 |
PTC0 |
PTA1 |
| MOD1 |
PTC1 |
PTB2 |
PTB1 |
PTC4 |
PTA4 |
PTC1 |
PTA2 |
| DIV4 |
PTC3 |
PTB3 |
NC |
NC |
NC |
PTC3 |
PTA3 |
| SSEL |
PTA7 |
PTB0 |
PTA1 |
PTC2 |
NC |
NC |
PTE3 |
What happens in Monitor Mode?
If after powering on the MCU the proper signal conditions are found the
MCU waits till the 8 security bytes are transfered. If this 8 bytes matches
the bytes on adress FFF6 to FFFD the the flash memory ist accessible. This
adresses are occupied by the interrupt vectors, so the security bytes are
usually application specific .If the security bytes don´t match only the
RAM is accessible. You can erase the whole FLASH memory in this state.
What freqency is needed to get proper baudrates for programming ?
In most datasheets Motorola uses a frequency of 4,1952 MHz to get 9600
bps with DIV4 pulled to low. Other frequencys are still possible. You have
to take care the the busfrequency has to bee at least 1 MHz for flash programming.
| Frequency |
Busclock |
Baudrate |
DIV4 |
| 2,4576 MHz |
1.2288 MHz |
4800 |
Low |
| 4,9152 MHz |
2.4576 MHz |
9600 |
Low |
| 4,9152 MHz |
1,2288MHz |
4800 |
High |
| 7,3728 MHz |
3,6864 MHz |
14400 |
Low |
| 9,8304 MHz |
4.9152 MHz |
19200 |
Low |
| 9,8304 MHz |
2,4576 MHz |
9600 |
High |
| 14,7456 MHz |
7,3728 MHz |
28800 |
Low |
| 14,7456 MHz |
3,6864 MHz |
14400 |
High |
| 19,6608 MHz |
4,9152 MHz |
19200 |
High |
| 29,4912 MHz |
7,3728 MHz |
28800 |
High |
I tried to use a 20 MHz oscillator with good results. I think programming
is possible wit 5,10,15 and 30 MHz too. This frequencys are often easier
to get.
Hoe does it look ?

Must I use all this port pins ?
Not nessesarily. The ports has to be on a defined state after reset. When
Monitor mode is entered you can change them. Take care of COM ( PTA0 ).
This pin must allways be used for serial communication, so by using this
port you can confuse the monitor program. To use the other pins ther are
some choices. You can disconnect them from the programmer using switches
or jumpers or you can use them so that their usage won´t conflict with
minitor mode entry. Ports which need a logic high, can be used as activ
low inputs or outputs with a pullup resistor at a value of approx. 10 KOhm.
Ports that need logic low can be used for input/output that is active high.
If you want to use the IRQ input for debugging it gets a little more complicated
Vtst has to be applied on the reset pin before you disconnect it from the IRQ
pin. After that you cam remmove the high voltage from IRQ und use the IRQ
input. For the Nitron chips ( 68HC908QYX 68HC908QTX ) you can use the User
Monitor after initially programmed into the MCU. For the other MCU´s there
is nothing like that. If you only want to program the MCU´s take a look
at Motorolas AN2295 Developers Serial Bootloader. One more choice is to
use Pony Monitor from L3Systems for programming and debugging.
Why should I use a quarz for clocking when I need an oscillator for programming
?
The quarz gives you the possibility to change the busclock that the PLL
generates at runtime. This can come handy in different ways. You can reduce
the clock to reduce the current that te MCU uses. Or you can raise the
busclock to 8.2 MHz if speed is needed. You can even change the busclock
to get proper baudrates for serial communication. If the MCU is equipped
with a TBM then the TBM will only work with the crystal.
|
| |
|
|
|