Hi,
I am trying to reset the MCF52259 by asserting the SOFTRST bit on MCF_RCM_RCR.
After asserting, the microcontroller does not start the program or you can say that it is hanged.
I am resetting the mcu by a usb vendor command and also i am using the demo board M52259DEMOMCU.
Any help will be highly appreciated.
Regards.
Check what happens to the oscillator and the clocks when you attempt a soft reset.
You may need to reprogram the chip to a different clock source and PLL setting prior to the reset.
Read up on the RCR[FRCRSTOUT] bit. You need this set if external logic uses this signal to drive the configuration reset data.
Read "7.3.1 Backup Watchdog Time Module". It looks like POR acts differently on this module to the other resets.
Also "7.7.1.9 Real-Time Clock Control Register" as it behaves differently on POR as well.
Do as I did and search the entire Reference Manual for keywords like "soft" and "POR".
TOm
Hi Tom,
Thanks for the quick reply.
I did follow your instructions but it still hangs.
I have used the following piece of code in order to do software reset
void SoftwareReset()
{
MCF_CLOCK_SYNCR = MCF_CLOCK_SYNCR_PLLMODE | MCF_CLOCK_SYNCR_MFD(1);
MCF_CLOCK_SYNSR = MCF_CLOCK_SYNSR_OCOSC;
MCF_CLOCK_ROCR = MCF_CLOCK_ROCR_TRIM(603);
MCF_CLOCK_LPDR = MCF_CLOCK_LPDR_LPD(0);
MCF_CLOCK_CCHR = MCF_CLOCK_CCHR_CCHR(5);
MCF_CLOCK_CCLR = MCF_CLOCK_CCLR_OSCSEL0;
MCF_CLOCK_OCHR = MCF_CLOCK_OCHR_OCOEN;
MCF_CLOCK_OCLR = MCF_CLOCK_OCLR_RANGE | MCF_CLOCK_OCLR_LPEN;
MCF_CLOCK_RTCCR = MCF_CLOCK_RTCCR_RTCSEL |
MCF_CLOCK_RTCCR_LPEN |
MCF_CLOCK_RTCCR_REFS |
MCF_CLOCK_RTCCR_OSCEN |
MCF_CLOCK_RTCCR_EXTALEN;
MCF_CLOCK_BWCR = MCF_CLOCK_BWCR_BWDSTOP;
// Assert software reset
MCF_RCM_RCR = MCF_RCM_RCR_SOFTRST |
MCF_RCM_RCR_FRCRSTOUT;
}
Thanks in advance.
Regards.
Get an oscilloscope and see what happens to the pins on the chip when you attempt a soft reset. There should be some "external signature" of what's going wrong. Have your code drive a pin just as it is about to reset so you can use that to trigger the oscilloscope. Drive another pin first thing in your bootstrap to see if it got that far.
Can you stop it with the debugger and see where it is, or has the debugger "lost control"?
Check the schematic of the board you're using. There may be something that only works when the on-board reset circuitry activates that doesn't happen when it is an internal one.
Try switching to other clocking modes. Don't you have to wait in a loop for the clocks to stabilize for some mode switches in that chip?