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