Doug Leverton

Flash Clock

Discussion created by Doug Leverton on Sep 2, 2011
Latest reply on Sep 3, 2011 by bigmac


I have an interesting problem with the FlashClock.

I am using the FLASHERASE1 and FLASHPROG1 in order to write to FLASH.  I have used these routines successfully before on an MC9S08QG8, but now I am using it on an MC9S08AW16 and am having issues.  It seems to work intermittently.  If I use it to store one byte it seems to work well, if I use it to write 3 consecutive bytes, it only writes the first byte.  Also I have noticed that often my P&E USB Multilink programmer has become intermittent and often hangs up a page or 2 into programming flash.  I am suspicious the two issues are linked. My main suspicion is that somehow I am not getting the FCLK right.  I am using an external 8Mhz oscillator on EXTAL in FBE mode with the RFD bits in ICGC2 = 000 for division factor = 1.  Therefore my ICGOUT should = 8Mhz and my Fbus should be 4Mhz.  The data sheet recommends FCDIV = $19 in order to place Fclk around 200Khz (my calculation makes it $13 to $20 and I have tried both).  It may not be an FCLK issue, but I can't think what else might be intermittent.