Hi, I'm trying to use all the STOP modes. I've written some simple projects to test, then I tested on a Flexis DEMOJM with a MCF51JM128. I measured the current on the jumper J24. Results are different with debugger connected or not, because XCSR[ENBDM] changes the behaviour. I don't know how to set this bit if can be set at all:
STOP2 App:
- with Debugger: 18.8mA, i.e. it's the STOP4 current (Ref man says when debg is connected instead of STOP2 & STOP3 will go STOP4)
- without dbuger: 580uA, I guess it's the STOP2 current + USB quiescent current
STOP3 App:
- w/ DBG: 18.8 mA, it's the STOP4 current again
- w/o DBG: RESET!
STOP4 App:
- w/ DBG: 18.8 mA, it's the STOP4 current
- w/o DBG: RESET!
My question: why I get a Reset? Exception? I'm not expert on exceptions, illegal opcodes and such. How can I now the exception number thrown? Is there any way to debug this?
The SOPT1, SPMSC1, SPMSC2 registers are set correctly as provided by the Reference Manual, rev.2 What could be wrong?
Also: why I get high STOP2 current? Anyone knows how much is the STOP3 current? I'd rather go STOP3 if it gets nearly the same amount of current (as told by the data sheet).
Thanks, bye
People, I solved my problems. I inspected the SRS register after reset to figure out the cause for the reset and discovered it was a LOC reset, then reading the Ref Man I understood the CME bit in MCGC3 must be cleared if you want to go STOP3 or STOP4, otherwise you get a Loss of Clock Reset.
That's all, now STOP3 works fine and it has a fast recovery time.
Were you able to write to XCSR[ENBDM], could you post your code to enter STOP mode? I use this, but to no avail:
SOPT1_STOPE=1;
SOPT1_WAITE=0;
SPMSC1_LVDE=1; //habilitar modo stop
SPMSC1_LVDSE=1;
SPMSC2_PPDC=0;
SRS_LOC =0;
MCGC3_CME=0;
Trying to enter STOP4, I am using the same microcontroller as you.