Hello,
I still have the same problem in trying to wake-up the the micro.
I can put the micro in standby using the command suggested by you but I cannot wake it up.
| asm ANDCC #0x7F; | // clear S bit in Condition Code Register (CCR) - enable the stop mode. |
| | // If the S bit is not cleared then STOP instruction has no effect and is |
| | // executed as a dummy instruction NOP. |
| asm STOP; | // Now MCU is in STOP mode |
This is the PIM initialization in my code:
// --- digital input function enable --- [1] digital in [0] analog in
DIENADL_DIENADL0 = 1;
DIENADL_DIENADL1 = 1;
DIENADL_DIENADL2 = 1;
DIENADL_DIENADL3 = 1;
DIENADL_DIENADL4 = 1;
DIENADL_DIENADL5 = 1;
DIENL_DIENL0 = 1; // REAR_DOME (Port L input enable register)
// --- set direction --- [1] out [0] in
// Inputs
DDRADL_DDRADL0 = 0; // SMBT
DDRADL_DDRADL1 = 0; // DOOR_OP
DDRADL_DDRADL2 = 0; // ALL_LIGHTS
DDRADL_DDRADL3 = 0; // LIGHT_SX
DDRADL_DDRADL4 = 0; // LIGHT_DX
DDRADL_DDRADL5 = 0; // DOORS
// Outputs
DDRS_DDRS3 = 1; // REAR_ON
DDRP_DDRP3 = 1; // STATUS
DDRP_DDRP5 = 0; // Debug LED demo board
// -- set pull up connection --- [1] ON [0] Off
PERADL_PERADL0 = 1;
PERADL_PERADL1 = 1;
PERADL_PERADL2 = 1;
PERADL_PERADL3 = 1;
PERADL_PERADL4 = 1;
PERADL_PERADL5 = 1;
// -- Polarity select register -- [1] Pull Down [0] Pull Up
// Configure pull device and pin interrupt edge polarity on input pin
PPSAD_PPSADL0 = 1;
PPSAD_PPSADL1 = 0;
PPSAD_PPSADL2 = 0;
PPSAD_PPSADL3 = 0;
PPSAD_PPSADL4 = 0;
PPSAD_PPSADL5 = 0;
PPSL_PPSL0 = 0;
// -- Interrupt enable register -- [1] Enable [0] Disable
PIEAD_PIEADH0 = 1;
PIEAD_PIEADH1 = 1;
PIEAD_PIEADL0 = 1;
PIEAD_PIEADL1 = 1;
PIEAD_PIEADL2 = 1;
PIEAD_PIEADL3 = 1;
PIEAD_PIEADL4 = 1;
PIEAD_PIEADL5 = 1;
PIEL_PIEL0 = 1;
// --- Set initial value ---
//PTS_PTS3 = 0; // Output Digital pin initial value REAR_ON
PTP_PTP3 = 0; // Output Digital pin initial value STATUS
PTP_PTP5 = 0; // Debug LED demo board
// PWM output pin // PWM1 to PP1 (default configuration)
MODRR1_PWM0RR = 1; // PWM0 to PT1
MODRR1_PWM2RR = 1; // PWM2 to PT0
This is the setting for the registers related to the STOP mode function:
CPMUPROT = 0x26;
CPMUOSC_OSCE = 0;
CPMUCLKS_COPOSCSEL0 = 1;
CPMUCLKS_RTIOSCSEL = 0;
CPMUCLKS_PCE = 0;
CPMUCLKS_PRE = 0;
CPMUCLKS_COPOSCSEL1 = 0;
CPMUCLKS_CSAD = 0;
CPMUCLKS_PSTP = 1;
CPMUCLKS_PLLSEL = 0;
The interrupts of the PORT AD an Port L (VECTOR 66 and VECTOR 79) work properly when the micro is running.
When the micro is in stop mode and I put something on AD or L port nothing happens. I have checked and these port interrupts should be used to wake-up the micro (and you have confirmed it previously).
Could you confirm that these settings are ok and I do not miss other registers settings?
It is a long time since I am trying to fix this problem and now I have no other ideas to fix it.
Thanks a lot for the precious help
Fabrizio