Message Edited by sungam on 2007-03-0410:05 PM
Message Edited by Avery Z on 2007-03-0803:27 AM
Message Edited by Avery Z on 2007-03-0402:31 AM
Message Edited by bigmac on 2007-03-0403:55 PM
Hello,
You can use ISP with only the datapin used.
To do that the flash has to be erased for the device to enter monitormode (i think it is called forced monitormode). You will find a description of these in the databook <Rom-Resident Routines>, but I will give you an example for the 908JL8 processor. The small processors have built in flash erasing routines in ROM and the ones with more RAM haven't but you can copy the erasing program to RAM and then jump to RAM. If the flash is erased the monitor uses the crystal oscillator so no external oscillator is needed. 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 JL8: 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 Erase(void)
{
asm{
clr CONFIG2 mov #0x31,CONFIG1 ;disable cop andLVI
ldhx #0xffff
sthx 0x62 ;this tells the rom-routine to erase entire flash
mov #24,0x60 ;crystal speed 24Mhz
jsr 0xfc06 ; jump to erase routine in ROM, of course after this it will return the the
} ;erased flash but that will not do any harm as you recycle the power
} ;and the monitor will start
void main(void) {
if(PTB_PTB0==0) Erase();//erase flash if PTBO is =0 (PTB0 is the monitor pin)
MCU_init();
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 .
When you start the debugger, specify the baudrate to 23040 if you are using JL8 with 24MHz crystal .
Hope you find this information useful
Sungam