Hi everybody.
I've just done a new design based on MCF52259 and I'm having several issues with it.
I think it could be related with the crystal, but I'm not confident about it.
I've got the very same configuration as in Tower, Demo or Evaluation boards. A Citizen crystal, 48Mhz fundamental, with 16pF capacitors, 1MOhm resistance between pins 1 and 3 and CLKMOD[1:0] are both set to zero with 10k pull down resistors. XTAL is set to 3.3V by a 10k pull-up resistor. As you can see, this is the same that is done in Evaluation and Demo boards.
I've got a simple program which compiles and I program the flash memory with an P&E BDM. Everything works fine, first it erases the flash memory and then programs it.
Next step, I run the program in debug mode. It's just a led blinking and it works fine. If I check the XTAL signal, it has a 48Mhz signal, and the CLKOUT has a 80MHz signal.
Then I turn off the board, unplug the BDM and turn on the board. The program doesn't work at all, and if I check the XTAL, it doesn't have any signal at all, and the CLKOUT has a 8MHz signal.
I'm really confused so any help will be welcomed.
> A Citizen crystal, 48Mhz fundamental, with 16pF capacitors,
48MHz is the spec, but is quite a high frequency. Read the following (search this forum for "48mHz"):
https://community.freescale.com/message/66903#66903
Apparently 48MHz is required for the USB to work.
> 1MOhm resistance between pins 1 and 3 and CLKMOD[1:0] are both set to zero with
>10k pull down resistors. XTALis set to 3.3V by a 10k pull-up resistor.
According to Tables 7-1 and 7-4 in the Reference Manual, that selects "Relaxation Oscillator with PLL disabled".
> and the CLKOUT has a 8MHz signal.
Which is the Relaxation Oscillator frequency.
To use the external crystal you don't want the pullup on XTAL. The table says "0 on XTAL", but doesn't say anywhere if that means "floating" or there's a pulldown involved, or what value that is.
> As you can see, this is the same that is done in Evaluation and Demo boards.
Are there any jumper options to remove that pullup or convert to a pulldown?
Tom
Thank you very much for your help Tom.
In demo board, which I own, this is the only configuration that you can have, as there are no jumpers for these purposes.
I've found out that in the BSP_init.c, in "void mcf5225_init" the instruction "reg_ptr->CLK.OCLR = 0xf0;" is to turn on the external crystal.
If I run in debug mode with the BDM, until this line of code, there is no clock signal in the crystal, but once it is activated, you can find the 48MHz signal. Therefore, it seems that this is not a crystal hardware problem, but some other.
So the question now is, what's happening when I run the program after unpluging the BDM? The program isn't getting to this line of code and consequently not turning on the external crystal.
The problem is that before the void mcf5225_init the only code that is called is that found on boot.c.
Thanks for your help to anyone.
News.
The problem is that when running alone, without BDM, it doesn't even get to the "void mcf5225_init" function.
Regards.
Search this forum for keywords. This one is close to yours (but no answer):
https://community.freescale.com/message/48085#48085
This one was a poor 3V3 regulator:
https://community.freescale.com/message/28976#28976
I found one for a PPC part with the same problem, but can't find it again. It suggested that the Debugger usually performs some board initialisation, and it might be doing something that your standalone code isn't doing. Like the startup vectors, the stack pointer initialisation, SRAM/Crossbar/Clock and so on.
Tom
Thanks again Tom.
I finally found the problem. The BKPT_B pin doesn't have a pull-up resistor, so when the micro turns on it is in zero volts and the MCF is set in halt state.
Best regards.