I have an MCF51QE128 with a serial interface hooked to the computer. I can send a command to the microcontroller to go to wait. This works fine -- it writes to the EEPROM (using I2C) as it should then enters wait.
When I send it another serial command, it wakes up and processes normally as far as I can tell -- I've stepped through with the debugger and watched it. The problem is when I send a second wait command, it cannot write to the EEPROM. It cannot transmit a byte.
The only thing that I can figure out is that the clock frequency has changed somehow. I've read through the manual and thought it might have been the voltage regulator, so I set LPWUI to 1 to keep it powered up, but no luck.
Unfortuneately, I'm working with production hardware and it's so small I can't get a scope probe on it to check.
Here's my current startup code (I think the macros are self explanatory):
SOPT1 = bWAIT | bBKGDPE;SOPT2 = bCOPCLKS | BIIC1PS;SMPSC1 = bLVDE;SMPSC2 = bLPWUI | bLPR;SCGC1 = bCKENTPM3 | bCKENTPM2 | bCKENIIC1 | bCKENSCI1 | bCKENADC;
and this is where I go into wait:
/* Stop clocks we don't need */SCGC1 = bCKENSCI1;_Wait;/* Start the clocks */SCGCI1 = bCKENTPM3 | bCKENTPM2 | bCKENIIC1 | bCKENSCI1 | bCKENADC;
Any ideas on how to troubleshoot? Am I missing something obvious? I've not used WAIT before, so maybe I'm making assumptions that aren't correct. If there is something else that might be helpful, ask. I can't post all of my code.
Thanks for your help!