> I still have one question :
> Since flashCLK seems to be based on the flash bus clock:
> Is the FSYS/2 part caused by and thus influenced by the CFMCLKSEL[CLKSEL] bits ?
I believe the short answer is "no".
The docs for the MCF52223 and MCF52235 are a bit inconsistent in their usage of the term Fsys, if I remember.
In the MCF52223 Reference Manual there is a *great* picture in section 5.5 that shows Fsys as being the CPU clock, and it is divided by 2 to get the bus clock for all peripherals except BDM and potentially USB. This picture is unfortunately missing from the MCF52235 Reference Manual.
The "/2" is because of this divide by 2.
In my new code, I don't use the term Fsys at all any more, but instead use the CPU and bus frequencies explicitly -- maybe this makes it more clear:
Code:
cpu_frequency = 60000000; bus_frequency = cpu_frequency/2; if (bus_frequency > 12800000) { MCF_CFM_CFMCLKD = MCF_CFM_CFMCLKD_PRDIV8|MCF_CFM_CFMCLKD_DIV((bus_frequency-1)/8/200000); } else { MCF_CFM_CFMCLKD = MCF_CFM_CFMCLKD_DIV((bus_frequency-1)/200000); }
The goal is to implement the algorithm in section 21.6 of the MCF52235 Reference Manual.
The flash controller module runs at the system clock frequency divided by 2, but
FCLK must be divided down from this frequency to a frequency between 150 kHz and 200 kHz. Use the
following procedure to set the PRDIV8 and DIV[5:0] bits in the clock configuration register.
-- Rich