Hi nw,
Not sure about the KX8 but with a GP32 its very difficult 'cause it ain't got one.
You either use a canned osc, a high freq xtal or a low freq xtal and the PLL.
BR Peg
Message Edited by peg on 04-11-200607:29 PM
Hello,
I am using ISP with only the datapin used.
To do that the flash has to be erased for the device to enter monitormode. There is application notes on how to do this, but I will give you an example for the 908JL3 processor (a good processor to start with). The small processors have built in flash erasing programs in ROM and the ones with more RAM haven't but you can copy the erasing program to RAM and then jump to RAM. I think there is an application note for how to to this on GP32 (AN1770). If the flash is erased the monitor uses the crystal oscillator so no external oscillator is needed. For the GP32 with its 32kHz crystal the baudrate on monitor pin will be 9600 baud.
For the JL3 the baudrate will be crystal_MHz/9.8304*9600. Unfortunately there is no suitable standard baudrate for 32MHz crystal, but if you use 24MHz then you can use a baudrate of 23040.
Here's an example of erasing the JL3: I have an pullup on the monitorpin PTB0 and if it is = 0 at program start the flash is erased. Of course you can use any condition you like to erase the flash
void main(void) {
if(PTB_PTB0==0) Erase();//erase flash if PTBO is =0 (PTB0 is the monitor pin)
MCU_init();
listing of erase.c
//#include "JL3_REGS.h"
#define config1 0x001F // System configuration register
#define config2 0x001E //System configuration register
void Erase(void)
{
asm{
clr config2
mov #0x31,config1 ;disable cop andLVI
clrx
lda #0xff
sta 0xfe09
mov #0b01000000,0x88 ;prepare for masserase
mov #0x18,$89 ;crystal speed 24Mhz=> 24dec.
ldhx #0xffff
jsr 0xfc06 ; jump to erase routine in ROM
}
}
After flash is erased the mcu starts in monitormode without any other conditions required. It is using the same oscillator as in user mode so it means in this case that the only pin sacrified is PTB0.
I have attached an simple programmer that can be used with any HC08 mcu(EAGLE files). The onboard sockets are for JL processors but you will only need the 3-pin ISP header: +5V, monitorpin and GND. The power can be switched by the DTR line, or manually - useful when you want to test your program and use the programmer as the powersource.
When you start the debugger, choose class 1 interface and specify the baudrate to 23040 if you are using JL3 with 24MHz crystal and if GP32 choose 9600.
Hope you find this information useful
Sungam
Hi nw,
Firstly, with the questions you have asked here you will get a different answer from every person you ask!
Here are my answers:
1. Especially if your new and experimenting, its best to provide the whole 16 pin MON08 connector on your PCB. If you want to use a MON08 pin for something else, wire that something else to the odd numbered pin opposite. This way when you don't have the programmer plugged in you use a jumper shunt to bridge the adjacent pins (1 to 2, 3 to 4 etc). This also means not using the power and OSC pins in the MON08. which brings me to 2. The downside of this is you can't debug through the MON08 to that peripheral.
2. Probably not at your stage. The programmer supplying the power is handy on a production line and for automatically cycling the power but not necessary for you. When you connect the programmer you will tie the programmer ground to the CPU ground so you already have to allow for this.
3. If you can arrange for your board to run on an oscillator that works for the Monitor this is the easiest. If not, then your programmer must supply the OSC. Which specific HC08?
I have a product that has no MON08 specific pins or pullups whatsoever. As a number of signals go off the board anyway (to LCD's and option boards etc) I arranged it so all of the MON08 pins where used for these. That way I just have an adapter that plugs into 3 different sockets and adapts them into a standard MON08 16 pin header. This way there is no additional cost to allow for ICP.
BR Peg