mcf5329, init clock

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

mcf5329, init clock

3,709件の閲覧回数
VeronicaFNX
Contributor I
Hello,
 
I want to set the clock in the mcf5329EVB. The oscillator is the 16MHz and I want to work to 180MHz in mode PLL. 
The function that I write is (copied of the program Coldfire Init):

void init_clock_config (void)
{
 /* Clock module uses normal PLL mode with 16.0000 MHz external reference
       Bus clock frequency = 60.00 MHz
       Processor clock frequency = 3 x bus clock = 180.00 MHz
       Dithering disabled
    */

    /* Check to see if the SDRAM has already been initialized
       by a run control tool. If it has, put SDRAM into self-refresh mode before
       initializing the PLL
    */
    if (MCF_SDRAMC_SDCR & MCF_SDRAMC_SDCR_REF)
        MCF_SDRAMC_SDCR &= ~MCF_SDRAMC_SDCR_CKE;

    /* Temporarily switch to LIMP mode
       NOTE: Ensure that this code is not executing from SDRAM, since the 
             SDRAM Controller is disabled in LIMP mode 
    */
    MCF_CCM_CDR = (MCF_CCM_CDR & 0xf0ff) | MCF_CCM_CDR_LPDIV(0x2);
    MCF_CCM_MISCCR |= MCF_CCM_MISCCR_LIMP;

    /* Configure the PLL settings */
    MCF_PLL_PODR = MCF_PLL_PODR_CPUDIV(0x2) |
                   MCF_PLL_PODR_BUSDIV(0x6);
    MCF_PLL_PFDR = MCF_PLL_PFDR_MFD(0x5a);
    MCF_PLL_PLLCR = 0;
    MCF_PLL_PMDR = 0;

    /* Enable PLL and wait for lock */
    MCF_CCM_MISCCR &= ~MCF_CCM_MISCCR_LIMP;
    while ((MCF_CCM_MISCCR & MCF_CCM_MISCCR_PLL_LOCK) == 0)
        ;

    /* If we put the SDRAM into self-refresh mode earlier, restore mode now */
    if (MCF_SDRAMC_SDCR & MCF_SDRAMC_SDCR_REF)
        MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_CKE;

}

 

void main()

{

init_clock_config();

******

}

If I run the program, it does not work well and I do not have a valid signal clock
 
Thanks in advance.
ラベル(1)
0 件の賞賛
返信
7 返答(返信)

1,303件の閲覧回数
VeronicaFNX
Contributor I
Please, I would appreciate it if someone I reply. :smileysad:
 
Thanks. Veronica
0 件の賞賛
返信

1,303件の閲覧回数
stzari
Contributor III
Hi VeronicaFNX,

Not sure, if I can help you (no experience with MCF5329) ... but in most configurations I use, main() is executed from RAM (usually some form of DRAM).
Since switching to Limp mode will disable the SDRAM controller (as stated in the code), I would expect at least some problems -  if you haven't changed your C runtime, of course :smileywink:

HTH
  stzari
0 件の賞賛
返信

1,303件の閲覧回数
VeronicaFNX
Contributor I
No, I have tried to do,
 
void init_clock_config (void)
{
    /* Clock module uses normal PLL mode with 16.0000 MHz external reference
       Bus clock frequency = 80.00 MHz
       Processor clock frequency = 3 x bus clock = 240.00 MHz
       Dithering disabled
    */
    /* Configure the PLL settings */
    MCF_PLL_PODR = MCF_PLL_PODR_CPUDIV(0x2) |
                   MCF_PLL_PODR_BUSDIV(0x6);
    MCF_PLL_PFDR = MCF_PLL_PFDR_MFD(0x78);
    MCF_PLL_PLLCR = 0;
    MCF_PLL_PMDR = 0;
    /* Enable PLL and wait for lock */
    MCF_CCM_MISCCR &= ~MCF_CCM_MISCCR_LIMP;
    while ((MCF_CCM_MISCCR & MCF_CCM_MISCCR_PLL_LOCK) == 0)
        ;
    /* From the Device Errata:
        
       "After exiting LIMP mode, the value of 0x40000000 should be written
        to address 0xFC0B8080 before attempting to initialize the SDRAMC
        or exit the SDRAM from self-refresh mode."
    */
    * (vuint32 *) 0xfc0b8080 = 0x40000000;

}
 
and I have the same problem. Always the board works at 60MHz.
 
Anyway, thanks
0 件の賞賛
返信

1,304件の閲覧回数
stzari
Contributor III
Hi,

I've downloaded the Reference Manual and had a (admittedly very quick) look ...
In chapter 7.3.3 it is stated that PFDR can only be modified while in Limp mode !
So my questions are:
- Is your cpu in Limp mode ? Because the setting of MISCCR[LIMP] is missing in your function
- where is your function located ? If it is in DRAM then upon entering Limp mode, refresh would stop and your DRAM loose its contents ... leading to a crash in the process.

HTH
  stzari

0 件の賞賛
返信

1,304件の閲覧回数
VeronicaFNX
Contributor I
Hello,
 
If I put the first code, the program have an exception and don't work.
 
So, if I want to work in SDRAM I can not change the frequency?
 
Also, I can not to put the program in flash because it says me that "Cannot connect with the BDM" but it is connected.
 
It,s very dificult!! :smileysad: 
0 件の賞賛
返信

1,304件の閲覧回数
Arev
Contributor III
Hello,
 
If you are using a debugger, all initialisations (Clock SDRAM etc...)must be done by the debugger initialisation file (xxxxx.cfg for CodeWarrior) at start-up.

Bye
0 件の賞賛
返信

1,304件の閲覧回数
VeronicaFNX
Contributor I
But I don't know how to do this.
 
Can you say me the code that I have to put?
 
Thanks, I have been several days with it and I am hopeless.
0 件の賞賛
返信