Flash Clock

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Flash Clock

370 Views
Dougq5x
Contributor I

Hello

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.

Thanks

Doug

Labels (1)
0 Kudos
1 Reply

253 Views
bigmac
Specialist III

Hello Doug,

 

If your clock frequency is 4 MHz, the division required to achive a 200 kHz flash clock frequency will be 20.  This would mean that the FCDIV register should have a value of 19 decimal (or $13 hexadecimal).  For the lower limit of 150 kHz, the value would be 26 decimal.  Any value between these limits should work.

 

Maybe you should check that you have correctly switched to FBE mode when the flash operations take place.

 

Of course, if you are having USB Multilink programming problems, you may have a faulty device.

 

Regards,

Mac

 

0 Kudos