Steve Green

XEP100 FCLKDIV - Calculation doesn't match datasheet table

Discussion created by Steve Green on Apr 29, 2010
Latest reply on Apr 30, 2010 by pgo

I’m using the HCS12XEP100 and need to set the FCLKDIV register. The target frequency is 1MHz (many other flashes require 200K).


So the divisor should be pretty simple then, basically it should be whatever the OSC clock is, in MHz.


There is a table in the XEP reference manual (MC9S12XEP100RMV1.pdf  Rev. 1.21 04/2010 page 1151) which shows recommended values for FCLKDIV for OSC values. But the values in the table don’t seem to be simple divisors.


For example, at an OSC of 10MHz, the recommended value is 0x09, where I might expect a value of 10. I can imagine a (maybe undocumented or did I miss something?) additional +1 in there to get the expected 10.

But the difference is greater at higher OSC frequencies. At an OSC of say 48MHz, the table shows a value of 0x2D, which is 45 where I might expect 48. My imaginary +1 doesn’t work in this case so it seems there is some other factor.


Could you confirm please that the divisor really is a simple divisor with no additional factors, or how the table in the manual was derived? I’m not sure at the moment what FCLKDIV value to use and don’t want to damage the flash. Many thanks.