EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Reset after sleep

Started by xavierwork July 10, 2012
Hello all, I have an interesting issue with my LPC1768 design. I am using the CMSIS libs and the CTL RTOS.

I have tasks running via timer IRQ events all the time, and infrequent user external IRQ events. To save power when no active task is running, I put the processor to sleep by calling CLKPWR_Sleep() from main (in ctl main is the idle task). If the user has not done anything after a while I will set an event to put the processor into deep sleep. From deep sleep it wakes up via an external IRQ. Part of that ISR sets an event that causes the my board init to run. All works good, until the end of my board init routine and the board enters sleep mode as it has become idle again. When that happen the system reboots. Let me say that my board init routine pretty much does everything so all the devices are working as they should, but somehow re-entering sleep mode after deep sleep creates the reset. BTW it works the same for booth deep sleep and power down. I am fairly sure this in not an RTOS issue.

Yes I run systemInit() after deep sleep and no I don't have the WD enabled, so I don't feed it. My guess is that after deep sleep / power down there is something I need to do, but IDK.

As this is a reset thing it is very hard to debug. Any help / clues you can offer would be great.

An Engineer's Guide to the LPC2100 Series

Il 10/07/2012 14:49, xavierwork ha scritto:

Hello Xavier, can you post the source code piece where you put the mcu
in sleep or deep sleep mode? I use both with LPC175x and LPC176x.
>
>
> Hello all, I have an interesting issue with my LPC1768 design. I am
> using the CMSIS libs and the CTL RTOS.
>
> I have tasks running via timer IRQ events all the time, and infrequent
> user external IRQ events. To save power when no active task is
> running, I put the processor to sleep by calling CLKPWR_Sleep() from
> main (in ctl main is the idle task). If the user has not done anything
> after a while I will set an event to put the processor into deep
> sleep. From deep sleep it wakes up via an external IRQ. Part of that
> ISR sets an event that causes the my board init to run. All works
> good, until the end of my board init routine and the board enters
> sleep mode as it has become idle again. When that happen the system
> reboots. Let me say that my board init routine pretty much does
> everything so all the devices are working as they should, but somehow
> re-entering sleep mode after deep sleep creates the reset. BTW it
> works the same for booth deep sleep and power down. I am fairly sure
> this in not an RTOS issue.
>
> Yes I run systemInit() after deep sleep and no I don't have the WD
> enabled, so I don't feed it. My guess is that after deep sleep / power
> down there is something I need to do, but IDK.
>
> As this is a reset thing it is very hard to debug. Any help / clues
> you can offer would be great.



Thanks for wanting to take a look. OK. I will just provide the code sections to make this a quick read...

In ctl main is the idle task..
// THIS IS THE IDLE TASK LOOP (MAIN IS THE IDEL TASK)
while (1)
{
// SLEEP TO CONSERVER POWER WHEN DOING NOTHING:
// ANY OF THE TOUCH IRQ'S, TIMER IRQs, OR RTC WILL WAKE UP
CLKPWR_Sleep();
}

Here is the task that calls the deepsleep / power down...
if (CalEvents & EVENT_D_SLEEP)
{
goToSleep();
ctl_events_set_clear(&CalEvents, 0, EVENT_D_SLEEP);
ctl_task_reschedule();
}
Part of the function goToSleep that causes sleep...
#if defined(LIGHT_SLEEP)
CLKPWR_Sleep();
#elif (defined(DEEP_SLEEP) || defined(POWER_DOWN))
// FROM NXP EXAMPLE CODE NMI_POWERDOWN.C
/*---------- Disable and disconnect the main PLL0 before enter into Deep-Sleep
* or Power-Down mode ------------*/
LPC_SC->PLL0CON &= ~(1<<1); /* Disconnect the main PLL (PLL0) */
LPC_SC->PLL0FEED = 0xAA; /* Feed */
LPC_SC->PLL0FEED = 0x55; /* Feed */
while ((LPC_SC->PLL0STAT & (1<<25)) != 0x00); /* Wait for main PLL (PLL0) to disconnect */
LPC_SC->PLL0CON &= ~(1<<0); /* Turn off the main PLL (PLL0) */
LPC_SC->PLL0FEED = 0xAA; /* Feed */
LPC_SC->PLL0FEED = 0x55; /* Feed */
while ((LPC_SC->PLL0STAT & (1<<24)) != 0x00); /* Wait for main PLL (PLL0) to shut down */
/*------------Then enter into PowerDown mode ----------------------------------*/
#if defined(DEEP_SLEEP)
CLKPWR_DeepSleep();
#endif
#if defined(POWER_DOWN)
CLKPWR_PowerDown();
#endif

#elif defined(DEEP_POWER_DOWN)
CLKPWR_DeepPowerDown();
#endif

// AFTER IRQ RESTORE THE CLOCKS AND PLL
SystemInit();
} // END OF FUNCTION goToSleep
That should be enough - it may be too much. All the same thanks.

--- In l..., "M. Manca" wrote:
>
> Il 10/07/2012 14:49, xavierwork ha scritto:
>
> Hello Xavier, can you post the source code piece where you put the mcu
> in sleep or deep sleep mode? I use both with LPC175x and LPC176x.
> >
> >
> > Hello all, I have an interesting issue with my LPC1768 design. I am
> > using the CMSIS libs and the CTL RTOS.
> >
> > I have tasks running via timer IRQ events all the time, and infrequent
> > user external IRQ events. To save power when no active task is
> > running, I put the processor to sleep by calling CLKPWR_Sleep() from
> > main (in ctl main is the idle task). If the user has not done anything
> > after a while I will set an event to put the processor into deep
> > sleep. From deep sleep it wakes up via an external IRQ. Part of that
> > ISR sets an event that causes the my board init to run. All works
> > good, until the end of my board init routine and the board enters
> > sleep mode as it has become idle again. When that happen the system
> > reboots. Let me say that my board init routine pretty much does
> > everything so all the devices are working as they should, but somehow
> > re-entering sleep mode after deep sleep creates the reset. BTW it
> > works the same for booth deep sleep and power down. I am fairly sure
> > this in not an RTOS issue.
> >
> > Yes I run systemInit() after deep sleep and no I don't have the WD
> > enabled, so I don't feed it. My guess is that after deep sleep / power
> > down there is something I need to do, but IDK.
> >
> > As this is a reset thing it is very hard to debug. Any help / clues
> > you can offer would be great.
> >
> >
>

hi,

did u check the errata sheet of your controller...,
calling system init is OK as per general flow of program..,

Previous experience of mine is that if any pblm inside controller will have
such tzpe of problems

M.Satyendra
Mob:9916326440


This is y implementation:

static void PowerOff(BYTE bType)
{
Log(PowerOffLog, SleepDebugLvl);
WDTFeed();
TickDelay(1000);
WDTFeed();
RtcIrqDisable();
TickDelay(24); // they are 200ms at 12MHz, 600ms at 4MHz
WDTDisable();
IO2IntEnR = 0xff;
IO2IntEnF = 0xff;
NvicIrqEnable(NVIC_EINT3); // abilito irq manopola encoder
PCONP = BIT15 | BIT3;
switch(bType)
{
case 0: // none sleep
break;
case 1: // sleep
PCON = 0;
NVIC_SYS_CTRL = 0;
break;
case 2: // deep sleep
NVIC_SYS_CTRL = 4;
PCON = 8;
break;
case 3: // power down
NVIC_SYS_CTRL = 4;
PCON = 1; // BOD enabled
break;
case 4: // deep power down
case 5:
case 6:
case 7:
NVIC_SYS_CTRL = 4;
PCON = 3;
break;
}
// reset wakeup flag
s_bWakeUp = 0;
do
{
asm volatile ("wfi");
} while(!s_bWakeUp);
// next function will be executed when uC will be awake
NvicSystemReset();
}
//------
Il 11/07/2012 03:11, xavierwork ha scritto:
>
>
> Thanks for wanting to take a look. OK. I will just provide the code
> sections to make this a quick read...
>
> In ctl main is the idle task..
> // THIS IS THE IDLE TASK LOOP (MAIN IS THE IDEL TASK)
> while (1)
> {
> // SLEEP TO CONSERVER POWER WHEN DOING NOTHING:
> // ANY OF THE TOUCH IRQ'S, TIMER IRQs, OR RTC WILL WAKE UP
> CLKPWR_Sleep();
> }
>
> Here is the task that calls the deepsleep / power down...
> if (CalEvents & EVENT_D_SLEEP)
> {
> goToSleep();
> ctl_events_set_clear(&CalEvents, 0, EVENT_D_SLEEP);
> ctl_task_reschedule();
> }
>
> Part of the function goToSleep that causes sleep...
> #if defined(LIGHT_SLEEP)
> CLKPWR_Sleep();
> #elif (defined(DEEP_SLEEP) || defined(POWER_DOWN))
> // FROM NXP EXAMPLE CODE NMI_POWERDOWN.C
> /*---------- Disable and disconnect the main PLL0 before enter into
> Deep-Sleep
> * or Power-Down mode
> ------------*/
> LPC_SC->PLL0CON &= ~(1<<1); /* Disconnect the main PLL (PLL0) */
> LPC_SC->PLL0FEED = 0xAA; /* Feed */
> LPC_SC->PLL0FEED = 0x55; /* Feed */
> while ((LPC_SC->PLL0STAT & (1<<25)) != 0x00); /* Wait for main PLL
> (PLL0) to disconnect */
> LPC_SC->PLL0CON &= ~(1<<0); /* Turn off the main PLL (PLL0) */
> LPC_SC->PLL0FEED = 0xAA; /* Feed */
> LPC_SC->PLL0FEED = 0x55; /* Feed */
> while ((LPC_SC->PLL0STAT & (1<<24)) != 0x00); /* Wait for main PLL
> (PLL0) to shut down */
> /*------------Then enter into PowerDown mode
> ----------------------------------*/
> #if defined(DEEP_SLEEP)
> CLKPWR_DeepSleep();
> #endif
> #if defined(POWER_DOWN)
> CLKPWR_PowerDown();
> #endif
>
> #elif defined(DEEP_POWER_DOWN)
> CLKPWR_DeepPowerDown();
> #endif
>
> // AFTER IRQ RESTORE THE CLOCKS AND PLL
> SystemInit();
> } // END OF FUNCTION goToSleep
>
> That should be enough - it may be too much. All the same thanks.
>
> --- In l... , "M.
> Manca" wrote:
> >
> > Il 10/07/2012 14:49, xavierwork ha scritto:
> >
> > Hello Xavier, can you post the source code piece where you put the mcu
> > in sleep or deep sleep mode? I use both with LPC175x and LPC176x.
> > >
> > >
> > > Hello all, I have an interesting issue with my LPC1768 design. I am
> > > using the CMSIS libs and the CTL RTOS.
> > >
> > > I have tasks running via timer IRQ events all the time, and infrequent
> > > user external IRQ events. To save power when no active task is
> > > running, I put the processor to sleep by calling CLKPWR_Sleep() from
> > > main (in ctl main is the idle task). If the user has not done anything
> > > after a while I will set an event to put the processor into deep
> > > sleep. From deep sleep it wakes up via an external IRQ. Part of that
> > > ISR sets an event that causes the my board init to run. All works
> > > good, until the end of my board init routine and the board enters
> > > sleep mode as it has become idle again. When that happen the system
> > > reboots. Let me say that my board init routine pretty much does
> > > everything so all the devices are working as they should, but somehow
> > > re-entering sleep mode after deep sleep creates the reset. BTW it
> > > works the same for booth deep sleep and power down. I am fairly sure
> > > this in not an RTOS issue.
> > >
> > > Yes I run systemInit() after deep sleep and no I don't have the WD
> > > enabled, so I don't feed it. My guess is that after deep sleep / power
> > > down there is something I need to do, but IDK.
> > >
> > > As this is a reset thing it is very hard to debug. Any help / clues
> > > you can offer would be great.
> > >
> > >
> >
> >
> >
> >
> >



Thanks for taking the time to look and making a suggestion. I reviewed what you have and it pretty much the same thing I have.

My sleep works, my deep sleep and power down works, but what does not work is trying to sleep after a deep sleep, this causes me to reset. Do you know if you can sleep after deep sleep? If you have not tried this I am not asking you to, just wanted to know if you had.

BTW I tried this sleep sequence in a different project and it also resets. Things that make you go hummmmmmm....

Thanks,
Hab

--- In l..., "M. Manca" wrote:
>
> This is y implementation:
>
> static void PowerOff(BYTE bType)
> {
> Log(PowerOffLog, SleepDebugLvl);
> WDTFeed();
> TickDelay(1000);
> WDTFeed();
> RtcIrqDisable();
> TickDelay(24); // they are 200ms at 12MHz, 600ms at 4MHz
> WDTDisable();
> IO2IntEnR = 0xff;
> IO2IntEnF = 0xff;
> NvicIrqEnable(NVIC_EINT3); // abilito irq manopola encoder
> PCONP = BIT15 | BIT3;
> switch(bType)
> {
> case 0: // none sleep
> break;
> case 1: // sleep
> PCON = 0;
> NVIC_SYS_CTRL = 0;
> break;
> case 2: // deep sleep
> NVIC_SYS_CTRL = 4;
> PCON = 8;
> break;
> case 3: // power down
> NVIC_SYS_CTRL = 4;
> PCON = 1; // BOD enabled
> break;
> case 4: // deep power down
> case 5:
> case 6:
> case 7:
> NVIC_SYS_CTRL = 4;
> PCON = 3;
> break;
> }
> // reset wakeup flag
> s_bWakeUp = 0;
> do
> {
> asm volatile ("wfi");
> } while(!s_bWakeUp);
> // next function will be executed when uC will be awake
> NvicSystemReset();
> }
> //------
> Il 11/07/2012 03:11, xavierwork ha scritto:
> >
> >
> > Thanks for wanting to take a look. OK. I will just provide the code
> > sections to make this a quick read...
> >
> > In ctl main is the idle task..
> > // THIS IS THE IDLE TASK LOOP (MAIN IS THE IDEL TASK)
> > while (1)
> > {
> > // SLEEP TO CONSERVER POWER WHEN DOING NOTHING:
> > // ANY OF THE TOUCH IRQ'S, TIMER IRQs, OR RTC WILL WAKE UP
> > CLKPWR_Sleep();
> > }
> >
> > Here is the task that calls the deepsleep / power down...
> > if (CalEvents & EVENT_D_SLEEP)
> > {
> > goToSleep();
> > ctl_events_set_clear(&CalEvents, 0, EVENT_D_SLEEP);
> > ctl_task_reschedule();
> > }
> >
> > Part of the function goToSleep that causes sleep...
> > #if defined(LIGHT_SLEEP)
> > CLKPWR_Sleep();
> > #elif (defined(DEEP_SLEEP) || defined(POWER_DOWN))
> > // FROM NXP EXAMPLE CODE NMI_POWERDOWN.C
> > /*---------- Disable and disconnect the main PLL0 before enter into
> > Deep-Sleep
> > * or Power-Down mode
> > ------------*/
> > LPC_SC->PLL0CON &= ~(1<<1); /* Disconnect the main PLL (PLL0) */
> > LPC_SC->PLL0FEED = 0xAA; /* Feed */
> > LPC_SC->PLL0FEED = 0x55; /* Feed */
> > while ((LPC_SC->PLL0STAT & (1<<25)) != 0x00); /* Wait for main PLL
> > (PLL0) to disconnect */
> > LPC_SC->PLL0CON &= ~(1<<0); /* Turn off the main PLL (PLL0) */
> > LPC_SC->PLL0FEED = 0xAA; /* Feed */
> > LPC_SC->PLL0FEED = 0x55; /* Feed */
> > while ((LPC_SC->PLL0STAT & (1<<24)) != 0x00); /* Wait for main PLL
> > (PLL0) to shut down */
> > /*------------Then enter into PowerDown mode
> > ----------------------------------*/
> > #if defined(DEEP_SLEEP)
> > CLKPWR_DeepSleep();
> > #endif
> > #if defined(POWER_DOWN)
> > CLKPWR_PowerDown();
> > #endif
> >
> > #elif defined(DEEP_POWER_DOWN)
> > CLKPWR_DeepPowerDown();
> > #endif
> >
> > // AFTER IRQ RESTORE THE CLOCKS AND PLL
> > SystemInit();
> > } // END OF FUNCTION goToSleep
> >
> > That should be enough - it may be too much. All the same thanks.
> >
> > --- In l... , "M.
> > Manca" wrote:
> > >
> > > Il 10/07/2012 14:49, xavierwork ha scritto:
> > >
> > > Hello Xavier, can you post the source code piece where you put the mcu
> > > in sleep or deep sleep mode? I use both with LPC175x and LPC176x.
> > > >
> > > >
> > > > Hello all, I have an interesting issue with my LPC1768 design. I am
> > > > using the CMSIS libs and the CTL RTOS.
> > > >
> > > > I have tasks running via timer IRQ events all the time, and infrequent
> > > > user external IRQ events. To save power when no active task is
> > > > running, I put the processor to sleep by calling CLKPWR_Sleep() from
> > > > main (in ctl main is the idle task). If the user has not done anything
> > > > after a while I will set an event to put the processor into deep
> > > > sleep. From deep sleep it wakes up via an external IRQ. Part of that
> > > > ISR sets an event that causes the my board init to run. All works
> > > > good, until the end of my board init routine and the board enters
> > > > sleep mode as it has become idle again. When that happen the system
> > > > reboots. Let me say that my board init routine pretty much does
> > > > everything so all the devices are working as they should, but somehow
> > > > re-entering sleep mode after deep sleep creates the reset. BTW it
> > > > works the same for booth deep sleep and power down. I am fairly sure
> > > > this in not an RTOS issue.
> > > >
> > > > Yes I run systemInit() after deep sleep and no I don't have the WD
> > > > enabled, so I don't feed it. My guess is that after deep sleep / power
> > > > down there is something I need to do, but IDK.
> > > >
> > > > As this is a reset thing it is very hard to debug. Any help / clues
> > > > you can offer would be great.
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> >
> >
>

Thank you for taking a look. The routine that runs to disable and turn off PLL0 is in fact taken from the errata as a known problem. I have tried to comment out the "fix code I have in ther for that" (all it does is actual make the power conservation work while in sleep). That did not help. All the same, I can find nothing in the data sheet to help guide me. Along your line of thinking, I believe I will contact the factory and say its a bug on the chip. If I say anything less they will ignore me. Lets see where that goes...

Thanks again.

--- In l..., Satyendra Chowdary wrote:
>
> hi,
>
> did u check the errata sheet of your controller...,
> calling system init is OK as per general flow of program..,
>
> Previous experience of mine is that if any pblm inside controller will have
> such tzpe of problems
>
> M.Satyendra
> Mob:9916326440
>
>

BTW, I noticed that you did not implement the disable and shutdown of PLL0. That disable and turnoff is necessary in oder to actually reduce power consumption in deep sleep and power down - its in the errata. On my board if I don't implement that power down sequence, the board will "sorta sleep", but there is not that power savings in sleep mode.

If you do notice you are not saving a power, or if you want to play with it, add the following to the top of case 2 and 3...
/* ERRATA FIX: IF PLL0 IS ENABLED AND CONNECTED BEFORE DEEP SLEEP OR PWR DOWN MODES
* IT WILL REMAIN CONNECTED AFTER THE CHIP ENTERS SAID SLEEP MODE. THE RESULT OF
* WHICH WILL BE EXCESSIVE POWER CONSUMPTION NOT INDICATIVE OF THE SLEEP MODE YOU ARE IN.
* DISABLE IRQ'S TO PREVENT PLLO REGISTER FROM NOT LOADING DUE TO IRQ INTERRUPUTING THE WRITE SEQUENCE
* SOLUTION: DISABLE AND DISCONNECT PLL0 BEFORE SLEEP */
ctl_global_interrupts_disable();
LPC_SC->PLL0CON &= ~(1<<1); // DISCONNECT PLLO
LPC_SC->PLL0FEED = 0xAA; // THIS LINE AND NEXT IS REQUIRED TO LOAD VALUE TO PLL0 REGISTER
LPC_SC->PLL0FEED = 0x55;
while ((LPC_SC->PLL0STAT & (1<<25)) != 0x00); /* Wait for main PLL (PLL0) to disconnect */
LPC_SC->PLL0CON &= ~(1<<0); // TURN OFF PLL
LPC_SC->PLL0FEED = 0xAA; // THIS LINE AND NEXT IS REQUIRED TO LOAD VALUE TO PLL0 REGISTER
LPC_SC->PLL0FEED = 0x55;
while ((LPC_SC->PLL0STAT & (1<<24)) != 0x00); /* Wait for main PLL (PLL0) to shut down */
ctl_global_interrupts_enable();

Again thanks...

--- In l..., "M. Manca" wrote:
>
> This is y implementation:
>
> static void PowerOff(BYTE bType)
> {
> Log(PowerOffLog, SleepDebugLvl);
> WDTFeed();
> TickDelay(1000);
> WDTFeed();
> RtcIrqDisable();
> TickDelay(24); // they are 200ms at 12MHz, 600ms at 4MHz
> WDTDisable();
> IO2IntEnR = 0xff;
> IO2IntEnF = 0xff;
> NvicIrqEnable(NVIC_EINT3); // abilito irq manopola encoder
> PCONP = BIT15 | BIT3;
> switch(bType)
> {
> case 0: // none sleep
> break;
> case 1: // sleep
> PCON = 0;
> NVIC_SYS_CTRL = 0;
> break;
> case 2: // deep sleep
> NVIC_SYS_CTRL = 4;
> PCON = 8;
> break;
> case 3: // power down
> NVIC_SYS_CTRL = 4;
> PCON = 1; // BOD enabled
> break;
> case 4: // deep power down
> case 5:
> case 6:
> case 7:
> NVIC_SYS_CTRL = 4;
> PCON = 3;
> break;
> }
> // reset wakeup flag
> s_bWakeUp = 0;
> do
> {
> asm volatile ("wfi");
> } while(!s_bWakeUp);
> // next function will be executed when uC will be awake
> NvicSystemReset();
> }
> //------
> Il 11/07/2012 03:11, xavierwork ha scritto:
> >
> >
> > Thanks for wanting to take a look. OK. I will just provide the code
> > sections to make this a quick read...
> >
> > In ctl main is the idle task..
> > // THIS IS THE IDLE TASK LOOP (MAIN IS THE IDEL TASK)
> > while (1)
> > {
> > // SLEEP TO CONSERVER POWER WHEN DOING NOTHING:
> > // ANY OF THE TOUCH IRQ'S, TIMER IRQs, OR RTC WILL WAKE UP
> > CLKPWR_Sleep();
> > }
> >
> > Here is the task that calls the deepsleep / power down...
> > if (CalEvents & EVENT_D_SLEEP)
> > {
> > goToSleep();
> > ctl_events_set_clear(&CalEvents, 0, EVENT_D_SLEEP);
> > ctl_task_reschedule();
> > }
> >
> > Part of the function goToSleep that causes sleep...
> > #if defined(LIGHT_SLEEP)
> > CLKPWR_Sleep();
> > #elif (defined(DEEP_SLEEP) || defined(POWER_DOWN))
> > // FROM NXP EXAMPLE CODE NMI_POWERDOWN.C
> > /*---------- Disable and disconnect the main PLL0 before enter into
> > Deep-Sleep
> > * or Power-Down mode
> > ------------*/
> > LPC_SC->PLL0CON &= ~(1<<1); /* Disconnect the main PLL (PLL0) */
> > LPC_SC->PLL0FEED = 0xAA; /* Feed */
> > LPC_SC->PLL0FEED = 0x55; /* Feed */
> > while ((LPC_SC->PLL0STAT & (1<<25)) != 0x00); /* Wait for main PLL
> > (PLL0) to disconnect */
> > LPC_SC->PLL0CON &= ~(1<<0); /* Turn off the main PLL (PLL0) */
> > LPC_SC->PLL0FEED = 0xAA; /* Feed */
> > LPC_SC->PLL0FEED = 0x55; /* Feed */
> > while ((LPC_SC->PLL0STAT & (1<<24)) != 0x00); /* Wait for main PLL
> > (PLL0) to shut down */
> > /*------------Then enter into PowerDown mode
> > ----------------------------------*/
> > #if defined(DEEP_SLEEP)
> > CLKPWR_DeepSleep();
> > #endif
> > #if defined(POWER_DOWN)
> > CLKPWR_PowerDown();
> > #endif
> >
> > #elif defined(DEEP_POWER_DOWN)
> > CLKPWR_DeepPowerDown();
> > #endif
> >
> > // AFTER IRQ RESTORE THE CLOCKS AND PLL
> > SystemInit();
> > } // END OF FUNCTION goToSleep
> >
> > That should be enough - it may be too much. All the same thanks.
> >
> > --- In l... , "M.
> > Manca" wrote:
> > >
> > > Il 10/07/2012 14:49, xavierwork ha scritto:
> > >
> > > Hello Xavier, can you post the source code piece where you put the mcu
> > > in sleep or deep sleep mode? I use both with LPC175x and LPC176x.
> > > >
> > > >
> > > > Hello all, I have an interesting issue with my LPC1768 design. I am
> > > > using the CMSIS libs and the CTL RTOS.
> > > >
> > > > I have tasks running via timer IRQ events all the time, and infrequent
> > > > user external IRQ events. To save power when no active task is
> > > > running, I put the processor to sleep by calling CLKPWR_Sleep() from
> > > > main (in ctl main is the idle task). If the user has not done anything
> > > > after a while I will set an event to put the processor into deep
> > > > sleep. From deep sleep it wakes up via an external IRQ. Part of that
> > > > ISR sets an event that causes the my board init to run. All works
> > > > good, until the end of my board init routine and the board enters
> > > > sleep mode as it has become idle again. When that happen the system
> > > > reboots. Let me say that my board init routine pretty much does
> > > > everything so all the devices are working as they should, but somehow
> > > > re-entering sleep mode after deep sleep creates the reset. BTW it
> > > > works the same for booth deep sleep and power down. I am fairly sure
> > > > this in not an RTOS issue.
> > > >
> > > > Yes I run systemInit() after deep sleep and no I don't have the WD
> > > > enabled, so I don't feed it. My guess is that after deep sleep / power
> > > > down there is something I need to do, but IDK.
> > > >
> > > > As this is a reset thing it is very hard to debug. Any help / clues
> > > > you can offer would be great.
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> >
> >
>

Il 12/07/2012 03:23, xavierwork ha scritto:
>
> BTW, I noticed that you did not implement the disable and shutdown of
> PLL0.
>
Yes I know, I "inspired" the solution, it was a big problem for me so I
collaborated with NXP engineers to find one.

I don't think you can go from deep sleep to sleep (or viceversa)
directly, you have to awake the cpu and then put it in sleep. May be
that a little delay is necessary. Anyway I have some tests to do on
Cortex-M3/M4 and I will insert also this type of tests and then I will
send to you the source to make a trial on your board (I am abroad Italy
and I have no LPC17xx board with me, only LPC43xx and LPC18xx).
>
> That disable and turnoff is necessary in oder to actually reduce power
> consumption in deep sleep and power down - its in the errata. On my
> board if I don't implement that power down sequence, the board will
> "sorta sleep", but there is not that power savings in sleep mode.
>
My mistake, I cut and paste something to simplify your understanding
because my function has ore to do, anyway this is the function as it is
with PLL disable:

static void PowerOff(BYTE bType)
{
Log(PowerOffLog, SleepDebugLvl);
// _puts("PowerOff()");
LedSet(LEDPOW, clYellow, clGreen, enLedBlinkLo, 3, 0);
WDTFeed();
TickDelay(1000);
WDTFeed();
// spegnimento sicuro dei led: prima disabilito l'irq del timer
// per l'accensione/spegnimento/lampeggio dei led
// poi li spengo agendo direttamente sui 6 pin
LedTimerIrqOff();
OffLed(LEDINP);
OffLed(LEDMOT);
OffLed(LEDPOW);
RtcIrqDisable();
I2C1Off();
UsbOff();
MotorDisable();
Disable5V();
DisableVIO();
HandleVP(VP_OFF);
clrbit(FIO0DIR, BIT22); // 5V input
clrbit(FIO4DIR, BIT28); // VP input
clrbit(FIO4DIR, BIT29); // VIO input
clrbit(FIO0DIR, BIT29 | BIT30); // USB D+ e D- input
FIO2DIR = 0;

if(g_uStatus.EnStandby == 0)
Pll0Disable();

WDTFeed();
TickDelay(24); // sono 200ms a 12MHz, 600ms a 4MHz
// abilito tutti i pin della porta2 agli irq su entrambi i fronti
// cosmuovendo la manopola potruscire dal DeepSleepMode
WDTDisable();
IO2IntEnR = 0xff;
IO2IntEnF = 0xff;
NvicIrqEnable(NVIC_EINT3); // abilito irq manopola encoder
PCONP = BIT15 | BIT3;
switch(bType)
{
case 0: // none sleep
break;
case 1: // sleep
PCON = 0;
NVIC_SYS_CTRL = 0;
break;
case 2: // deep sleep
NVIC_SYS_CTRL = 4;
PCON = 8;
break;
case 3: // power down
NVIC_SYS_CTRL = 4;
/* era cosbr /> PCON = 9; // BOD disabled
*/
PCON = 1; // BOD enabled
break;
case 4: // deep power down
case 5:
case 6:
case 7:
NVIC_SYS_CTRL = 4;
PCON = 3;
break;
}
// resetto la flag di risveglio (potrebbe essere a 1 da prima)
s_bWakeUp = 0;
do
{
asm volatile ("wfi");
} while(!s_bWakeUp);
// s_bWakeUp = 1 in EINT_IrqHandler significa che un risveglio
dovuto al movimento
// della manopola altrimenti potrebbe essere una schifezza dovuta al
BOD, o altri irq
// poi l'esecuzione riprenderda qui solo nel caso del movimento
della manopola
// al risveglio provoco un reset apposta
NvicSystemReset();
}
//------
>
> If you do notice you are not saving a power, or if you want to play
> with it, add the following to the top of case 2 and 3...
> /* ERRATA FIX: IF PLL0 IS ENABLED AND CONNECTED BEFORE DEEP SLEEP OR
> PWR DOWN MODES
> * IT WILL REMAIN CONNECTED AFTER THE CHIP ENTERS SAID SLEEP MODE. THE
> RESULT OF
> * WHICH WILL BE EXCESSIVE POWER CONSUMPTION NOT INDICATIVE OF THE
> SLEEP MODE YOU ARE IN.
> * DISABLE IRQ'S TO PREVENT PLLO REGISTER FROM NOT LOADING DUE TO IRQ
> INTERRUPUTING THE WRITE SEQUENCE
> * SOLUTION: DISABLE AND DISCONNECT PLL0 BEFORE SLEEP */
> ctl_global_interrupts_disable();
> LPC_SC->PLL0CON &= ~(1<<1); // DISCONNECT PLLO
> LPC_SC->PLL0FEED = 0xAA; // THIS LINE AND NEXT IS REQUIRED TO LOAD
> VALUE TO PLL0 REGISTER
> LPC_SC->PLL0FEED = 0x55;
> while ((LPC_SC->PLL0STAT & (1<<25)) != 0x00); /* Wait for main PLL
> (PLL0) to disconnect */
> LPC_SC->PLL0CON &= ~(1<<0); // TURN OFF PLL
> LPC_SC->PLL0FEED = 0xAA; // THIS LINE AND NEXT IS REQUIRED TO LOAD
> VALUE TO PLL0 REGISTER
> LPC_SC->PLL0FEED = 0x55;
> while ((LPC_SC->PLL0STAT & (1<<24)) != 0x00); /* Wait for main PLL
> (PLL0) to shut down */
> ctl_global_interrupts_enable();
>
> Again thanks...
>
> --- In l... , "M.
> Manca" wrote:
> >
> > This is y implementation:
> >
> > static void PowerOff(BYTE bType)
> > {
> > Log(PowerOffLog, SleepDebugLvl);
> > WDTFeed();
> > TickDelay(1000);
> > WDTFeed();
> > RtcIrqDisable();
> > TickDelay(24); // they are 200ms at 12MHz, 600ms at 4MHz
> > WDTDisable();
> > IO2IntEnR = 0xff;
> > IO2IntEnF = 0xff;
> > NvicIrqEnable(NVIC_EINT3); // abilito irq manopola encoder
> > PCONP = BIT15 | BIT3;
> > switch(bType)
> > {
> > case 0: // none sleep
> > break;
> > case 1: // sleep
> > PCON = 0;
> > NVIC_SYS_CTRL = 0;
> > break;
> > case 2: // deep sleep
> > NVIC_SYS_CTRL = 4;
> > PCON = 8;
> > break;
> > case 3: // power down
> > NVIC_SYS_CTRL = 4;
> > PCON = 1; // BOD enabled
> > break;
> > case 4: // deep power down
> > case 5:
> > case 6:
> > case 7:
> > NVIC_SYS_CTRL = 4;
> > PCON = 3;
> > break;
> > }
> > // reset wakeup flag
> > s_bWakeUp = 0;
> > do
> > {
> > asm volatile ("wfi");
> > } while(!s_bWakeUp);
> > // next function will be executed when uC will be awake
> > NvicSystemReset();
> > }
> > //----------------------
> >
> >
> > Il 11/07/2012 03:11, xavierwork ha scritto:
> > >
> > >
> > > Thanks for wanting to take a look. OK. I will just provide the code
> > > sections to make this a quick read...
> > >
> > > In ctl main is the idle task..
> > > // THIS IS THE IDLE TASK LOOP (MAIN IS THE IDEL TASK)
> > > while (1)
> > > {
> > > // SLEEP TO CONSERVER POWER WHEN DOING NOTHING:
> > > // ANY OF THE TOUCH IRQ'S, TIMER IRQs, OR RTC WILL WAKE UP
> > > CLKPWR_Sleep();
> > > }
> > >
> > > Here is the task that calls the deepsleep / power down...
> > > if (CalEvents & EVENT_D_SLEEP)
> > > {
> > > goToSleep();
> > > ctl_events_set_clear(&CalEvents, 0, EVENT_D_SLEEP);
> > > ctl_task_reschedule();
> > > }
> > >
> > > Part of the function goToSleep that causes sleep...
> > > #if defined(LIGHT_SLEEP)
> > > CLKPWR_Sleep();
> > > #elif (defined(DEEP_SLEEP) || defined(POWER_DOWN))
> > > // FROM NXP EXAMPLE CODE NMI_POWERDOWN.C
> > > /*---------- Disable and disconnect the main PLL0 before enter into
> > > Deep-Sleep
> > > * or Power-Down mode
> > > ------------*/
> > > LPC_SC->PLL0CON &= ~(1<<1); /* Disconnect the main PLL (PLL0) */
> > > LPC_SC->PLL0FEED = 0xAA; /* Feed */
> > > LPC_SC->PLL0FEED = 0x55; /* Feed */
> > > while ((LPC_SC->PLL0STAT & (1<<25)) != 0x00); /* Wait for main PLL
> > > (PLL0) to disconnect */
> > > LPC_SC->PLL0CON &= ~(1<<0); /* Turn off the main PLL (PLL0) */
> > > LPC_SC->PLL0FEED = 0xAA; /* Feed */
> > > LPC_SC->PLL0FEED = 0x55; /* Feed */
> > > while ((LPC_SC->PLL0STAT & (1<<24)) != 0x00); /* Wait for main PLL
> > > (PLL0) to shut down */
> > > /*------------Then enter into PowerDown mode
> > > ----------------------------------*/
> > > #if defined(DEEP_SLEEP)
> > > CLKPWR_DeepSleep();
> > > #endif
> > > #if defined(POWER_DOWN)
> > > CLKPWR_PowerDown();
> > > #endif
> > >
> > > #elif defined(DEEP_POWER_DOWN)
> > > CLKPWR_DeepPowerDown();
> > > #endif
> > >
> > > // AFTER IRQ RESTORE THE CLOCKS AND PLL
> > > SystemInit();
> > > } // END OF FUNCTION goToSleep
> > >
> > > That should be enough - it may be too much. All the same thanks.
> > >
> > > --- In l...
> , "M.
> > > Manca" wrote:
> > > >
> > > > Il 10/07/2012 14:49, xavierwork ha scritto:
> > > >
> > > > Hello Xavier, can you post the source code piece where you put
> the mcu
> > > > in sleep or deep sleep mode? I use both with LPC175x and LPC176x.
> > > > >
> > > > >
> > > > > Hello all, I have an interesting issue with my LPC1768 design.
> I am
> > > > > using the CMSIS libs and the CTL RTOS.
> > > > >
> > > > > I have tasks running via timer IRQ events all the time, and
> infrequent
> > > > > user external IRQ events. To save power when no active task is
> > > > > running, I put the processor to sleep by calling
> CLKPWR_Sleep() from
> > > > > main (in ctl main is the idle task). If the user has not done
> anything
> > > > > after a while I will set an event to put the processor into deep
> > > > > sleep. From deep sleep it wakes up via an external IRQ. Part
> of that
> > > > > ISR sets an event that causes the my board init to run. All works
> > > > > good, until the end of my board init routine and the board enters
> > > > > sleep mode as it has become idle again. When that happen the
> system
> > > > > reboots. Let me say that my board init routine pretty much does
> > > > > everything so all the devices are working as they should, but
> somehow
> > > > > re-entering sleep mode after deep sleep creates the reset. BTW it
> > > > > works the same for booth deep sleep and power down. I am
> fairly sure
> > > > > this in not an RTOS issue.
> > > > >
> > > > > Yes I run systemInit() after deep sleep and no I don't have the WD
> > > > > enabled, so I don't feed it. My guess is that after deep sleep
> / power
> > > > > down there is something I need to do, but IDK.
> > > > >
> > > > > As this is a reset thing it is very hard to debug. Any help /
> clues
> > > > > you can offer would be great.
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
> >
> >
> >



I may have failed to make my point clear. I don't try to go directly from deep sleep to sleep. When I wake from deep sleep, I do a ton of stuff before I go idle (go to sleep). It is when I sleep again that it resets.

--- In l..., "M. Manca" wrote:
>
> Il 12/07/2012 03:23, xavierwork ha scritto:
> >
> >
> >
> > BTW, I noticed that you did not implement the disable and shutdown of
> > PLL0.
> >
> Yes I know, I "inspired" the solution, it was a big problem for me so I
> collaborated with NXP engineers to find one.
>
> I don't think you can go from deep sleep to sleep (or viceversa)
> directly, you have to awake the cpu and then put it in sleep. May be
> that a little delay is necessary. Anyway I have some tests to do on
> Cortex-M3/M4 and I will insert also this type of tests and then I will
> send to you the source to make a trial on your board (I am abroad Italy
> and I have no LPC17xx board with me, only LPC43xx and LPC18xx).
> >
> > That disable and turnoff is necessary in oder to actually reduce power
> > consumption in deep sleep and power down - its in the errata. On my
> > board if I don't implement that power down sequence, the board will
> > "sorta sleep", but there is not that power savings in sleep mode.
> >
> My mistake, I cut and paste something to simplify your understanding
> because my function has ore to do, anyway this is the function as it is
> with PLL disable:
>
> static void PowerOff(BYTE bType)
> {
> Log(PowerOffLog, SleepDebugLvl);
> // _puts("PowerOff()");
> LedSet(LEDPOW, clYellow, clGreen, enLedBlinkLo, 3, 0);
> WDTFeed();
> TickDelay(1000);
> WDTFeed();
> // spegnimento sicuro dei led: prima disabilito l'irq del timer
> // per l'accensione/spegnimento/lampeggio dei led
> // poi li spengo agendo direttamente sui 6 pin
> LedTimerIrqOff();
> OffLed(LEDINP);
> OffLed(LEDMOT);
> OffLed(LEDPOW);
> RtcIrqDisable();
> I2C1Off();
> UsbOff();
> MotorDisable();
> Disable5V();
> DisableVIO();
> HandleVP(VP_OFF);
> clrbit(FIO0DIR, BIT22); // 5V input
> clrbit(FIO4DIR, BIT28); // VP input
> clrbit(FIO4DIR, BIT29); // VIO input
> clrbit(FIO0DIR, BIT29 | BIT30); // USB D+ e D- input
> FIO2DIR = 0;
>
> if(g_uStatus.EnStandby == 0)
> Pll0Disable();
>
> WDTFeed();
> TickDelay(24); // sono 200ms a 12MHz, 600ms a 4MHz
> // abilito tutti i pin della porta2 agli irq su entrambi i fronti
> // cosmuovendo la manopola potruscire dal DeepSleepMode
> WDTDisable();
> IO2IntEnR = 0xff;
> IO2IntEnF = 0xff;
> NvicIrqEnable(NVIC_EINT3); // abilito irq manopola encoder
> PCONP = BIT15 | BIT3;
> switch(bType)
> {
> case 0: // none sleep
> break;
> case 1: // sleep
> PCON = 0;
> NVIC_SYS_CTRL = 0;
> break;
> case 2: // deep sleep
> NVIC_SYS_CTRL = 4;
> PCON = 8;
> break;
> case 3: // power down
> NVIC_SYS_CTRL = 4;
> /* era cosbr /> > PCON = 9; // BOD disabled
> */
> PCON = 1; // BOD enabled
> break;
> case 4: // deep power down
> case 5:
> case 6:
> case 7:
> NVIC_SYS_CTRL = 4;
> PCON = 3;
> break;
> }
> // resetto la flag di risveglio (potrebbe essere a 1 da prima)
> s_bWakeUp = 0;
> do
> {
> asm volatile ("wfi");
> } while(!s_bWakeUp);
> // s_bWakeUp = 1 in EINT_IrqHandler significa che un risveglio
> dovuto al movimento
> // della manopola altrimenti potrebbe essere una schifezza dovuta al
> BOD, o altri irq
> // poi l'esecuzione riprenderda qui solo nel caso del movimento
> della manopola
> // al risveglio provoco un reset apposta
> NvicSystemReset();
> }
> //------------------------------------------
>
>
> >
> > If you do notice you are not saving a power, or if you want to play
> > with it, add the following to the top of case 2 and 3...
> > /* ERRATA FIX: IF PLL0 IS ENABLED AND CONNECTED BEFORE DEEP SLEEP OR
> > PWR DOWN MODES
> > * IT WILL REMAIN CONNECTED AFTER THE CHIP ENTERS SAID SLEEP MODE. THE
> > RESULT OF
> > * WHICH WILL BE EXCESSIVE POWER CONSUMPTION NOT INDICATIVE OF THE
> > SLEEP MODE YOU ARE IN.
> > * DISABLE IRQ'S TO PREVENT PLLO REGISTER FROM NOT LOADING DUE TO IRQ
> > INTERRUPUTING THE WRITE SEQUENCE
> > * SOLUTION: DISABLE AND DISCONNECT PLL0 BEFORE SLEEP */
> > ctl_global_interrupts_disable();
> > LPC_SC->PLL0CON &= ~(1<<1); // DISCONNECT PLLO
> > LPC_SC->PLL0FEED = 0xAA; // THIS LINE AND NEXT IS REQUIRED TO LOAD
> > VALUE TO PLL0 REGISTER
> > LPC_SC->PLL0FEED = 0x55;
> > while ((LPC_SC->PLL0STAT & (1<<25)) != 0x00); /* Wait for main PLL
> > (PLL0) to disconnect */
> > LPC_SC->PLL0CON &= ~(1<<0); // TURN OFF PLL
> > LPC_SC->PLL0FEED = 0xAA; // THIS LINE AND NEXT IS REQUIRED TO LOAD
> > VALUE TO PLL0 REGISTER
> > LPC_SC->PLL0FEED = 0x55;
> > while ((LPC_SC->PLL0STAT & (1<<24)) != 0x00); /* Wait for main PLL
> > (PLL0) to shut down */
> > ctl_global_interrupts_enable();
> >
> > Again thanks...
> >
> > --- In l... , "M.
> > Manca" wrote:
> > >
> > > This is y implementation:
> > >
> > > static void PowerOff(BYTE bType)
> > > {
> > > Log(PowerOffLog, SleepDebugLvl);
> > > WDTFeed();
> > > TickDelay(1000);
> > > WDTFeed();
> > > RtcIrqDisable();
> > > TickDelay(24); // they are 200ms at 12MHz, 600ms at 4MHz
> > > WDTDisable();
> > > IO2IntEnR = 0xff;
> > > IO2IntEnF = 0xff;
> > > NvicIrqEnable(NVIC_EINT3); // abilito irq manopola encoder
> > > PCONP = BIT15 | BIT3;
> > > switch(bType)
> > > {
> > > case 0: // none sleep
> > > break;
> > > case 1: // sleep
> > > PCON = 0;
> > > NVIC_SYS_CTRL = 0;
> > > break;
> > > case 2: // deep sleep
> > > NVIC_SYS_CTRL = 4;
> > > PCON = 8;
> > > break;
> > > case 3: // power down
> > > NVIC_SYS_CTRL = 4;
> > > PCON = 1; // BOD enabled
> > > break;
> > > case 4: // deep power down
> > > case 5:
> > > case 6:
> > > case 7:
> > > NVIC_SYS_CTRL = 4;
> > > PCON = 3;
> > > break;
> > > }
> > > // reset wakeup flag
> > > s_bWakeUp = 0;
> > > do
> > > {
> > > asm volatile ("wfi");
> > > } while(!s_bWakeUp);
> > > // next function will be executed when uC will be awake
> > > NvicSystemReset();
> > > }
> > > //----------------------
> > >
> > >
> > > Il 11/07/2012 03:11, xavierwork ha scritto:
> > > >
> > > >
> > > > Thanks for wanting to take a look. OK. I will just provide the code
> > > > sections to make this a quick read...
> > > >
> > > > In ctl main is the idle task..
> > > > // THIS IS THE IDLE TASK LOOP (MAIN IS THE IDEL TASK)
> > > > while (1)
> > > > {
> > > > // SLEEP TO CONSERVER POWER WHEN DOING NOTHING:
> > > > // ANY OF THE TOUCH IRQ'S, TIMER IRQs, OR RTC WILL WAKE UP
> > > > CLKPWR_Sleep();
> > > > }
> > > >
> > > > Here is the task that calls the deepsleep / power down...
> > > > if (CalEvents & EVENT_D_SLEEP)
> > > > {
> > > > goToSleep();
> > > > ctl_events_set_clear(&CalEvents, 0, EVENT_D_SLEEP);
> > > > ctl_task_reschedule();
> > > > }
> > > >
> > > > Part of the function goToSleep that causes sleep...
> > > > #if defined(LIGHT_SLEEP)
> > > > CLKPWR_Sleep();
> > > > #elif (defined(DEEP_SLEEP) || defined(POWER_DOWN))
> > > > // FROM NXP EXAMPLE CODE NMI_POWERDOWN.C
> > > > /*---------- Disable and disconnect the main PLL0 before enter into
> > > > Deep-Sleep
> > > > * or Power-Down mode
> > > > ------------*/
> > > > LPC_SC->PLL0CON &= ~(1<<1); /* Disconnect the main PLL (PLL0) */
> > > > LPC_SC->PLL0FEED = 0xAA; /* Feed */
> > > > LPC_SC->PLL0FEED = 0x55; /* Feed */
> > > > while ((LPC_SC->PLL0STAT & (1<<25)) != 0x00); /* Wait for main PLL
> > > > (PLL0) to disconnect */
> > > > LPC_SC->PLL0CON &= ~(1<<0); /* Turn off the main PLL (PLL0) */
> > > > LPC_SC->PLL0FEED = 0xAA; /* Feed */
> > > > LPC_SC->PLL0FEED = 0x55; /* Feed */
> > > > while ((LPC_SC->PLL0STAT & (1<<24)) != 0x00); /* Wait for main PLL
> > > > (PLL0) to shut down */
> > > > /*------------Then enter into PowerDown mode
> > > > ----------------------------------*/
> > > > #if defined(DEEP_SLEEP)
> > > > CLKPWR_DeepSleep();
> > > > #endif
> > > > #if defined(POWER_DOWN)
> > > > CLKPWR_PowerDown();
> > > > #endif
> > > >
> > > > #elif defined(DEEP_POWER_DOWN)
> > > > CLKPWR_DeepPowerDown();
> > > > #endif
> > > >
> > > > // AFTER IRQ RESTORE THE CLOCKS AND PLL
> > > > SystemInit();
> > > > } // END OF FUNCTION goToSleep
> > > >
> > > > That should be enough - it may be too much. All the same thanks.
> > > >
> > > > --- In l...
> > , "M.
> > > > Manca" wrote:
> > > > >
> > > > > Il 10/07/2012 14:49, xavierwork ha scritto:
> > > > >
> > > > > Hello Xavier, can you post the source code piece where you put
> > the mcu
> > > > > in sleep or deep sleep mode? I use both with LPC175x and LPC176x.
> > > > > >
> > > > > >
> > > > > > Hello all, I have an interesting issue with my LPC1768 design.
> > I am
> > > > > > using the CMSIS libs and the CTL RTOS.
> > > > > >
> > > > > > I have tasks running via timer IRQ events all the time, and
> > infrequent
> > > > > > user external IRQ events. To save power when no active task is
> > > > > > running, I put the processor to sleep by calling
> > CLKPWR_Sleep() from
> > > > > > main (in ctl main is the idle task). If the user has not done
> > anything
> > > > > > after a while I will set an event to put the processor into deep
> > > > > > sleep. From deep sleep it wakes up via an external IRQ. Part
> > of that
> > > > > > ISR sets an event that causes the my board init to run. All works
> > > > > > good, until the end of my board init routine and the board enters
> > > > > > sleep mode as it has become idle again. When that happen the
> > system
> > > > > > reboots. Let me say that my board init routine pretty much does
> > > > > > everything so all the devices are working as they should, but
> > somehow
> > > > > > re-entering sleep mode after deep sleep creates the reset. BTW it
> > > > > > works the same for booth deep sleep and power down. I am
> > fairly sure
> > > > > > this in not an RTOS issue.
> > > > > >
> > > > > > Yes I run systemInit() after deep sleep and no I don't have the WD
> > > > > > enabled, so I don't feed it. My guess is that after deep sleep
> > / power
> > > > > > down there is something I need to do, but IDK.
> > > > > >
> > > > > > As this is a reset thing it is very hard to debug. Any help /
> > clues
> > > > > > you can offer would be great.
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> >
> >
>
>
>
>
>


The 2024 Embedded Online Conference