Clock setting of coldfire MCF54418

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

Clock setting of coldfire MCF54418

582 Views
muhamamaduzair
Contributor I

Hi,

 

I have been working on bareboard programming of MCF54418 (cold fire v4). I am using PE multilink BDM to program the processor's SRAM.  The problem is when I change the clock settings by writing PLL_CR, PLL_DR register my debug interface hangs. What I suspect,  due to change in clock BDM lost its connection. So I tried to reset processor using soft reset but it doesn't work. Below is the clock snippet i am using to change clock settings.

 

Can any body help me to find out what's wrong in it? Any help would be highly appreciated

 

MCF_CCM_CCR = 0x8502U;
MCF_CCM_MISCCR = 0x0018U;
MCF_CLOCK_PLL_CR = 39U;
MCF_CLOCK_PLL_DR = 1U; // Both debugger and processor hangs after executing this instruction

 

MCF_RCM_RCR = 0x80U;  // it should reset processor

Regards,

Uzair

Labels (1)
Tags (3)
0 Kudos
3 Replies

336 Views
TomE
Specialist II

I don't think you can change the clock while debugging. I'm pretty sure you can't reset it and expect to remain in control.


The way I've done this on recent projects the the MCF5329 is to have the debugger initialize the CPU Clock and the DRAM controller, and then have the bootstrap/startup code recognize that it is running under the debugger (because the colde detects the clock has already been reprogrammed). As a result, the code sets a "running under the debugger" variable, skips initializing the clock and DRAM, and initializes the hardware watchdog into halt/debug mode, or completely disabled mode.

Some things you just can't do in the debugger, like resetting, low power modes and single-stepping while the hardware watchdog is active. So you have to have your code KNOW not to do these things when debugging, and test that stuff the hard way. Live, with printing, LED flashing and logging to memory.

Tom

0 Kudos

336 Views
muhamamaduzair
Contributor I

Actually i cannot boot from boat loader, it has to be done using debugger. Is there any reference for this?

Regards,

Uz

0 Kudos

336 Views
TomE
Specialist II

> Actually i cannot boot from boat loader,

It doesn't matter. I'm saying ANY code you load and run under a debugger can't do lots of things that will upset the debugger. So you can't do them then. You can only do them on code loaded into FLASH and run from there, later in your product development.

> it has to be done using debugger. Is there any reference for this?

You seem to be doing it already. What do you want to know - specifically?

For more examples of coding, just read every Freescale App Note, and download every sample project you can find. I haven't found anything more organized than that, but then I've never used Code Warrior either. That should come with some sort of example platform layer, loaders, drivers and so on.

Tom

0 Kudos