Forums

LPC17xx Deep Sleep and WDT wakeup question

Started by goodgodgivemeanaliasalready December 13, 2011
Hi all,

I'm using Deep Sleep mode on an LPC1768. You can wakeup from this mode using Watchdog, external interrupts, RTC alarm. However, I don't have external interrupts to use, and the RTC is inoperative (it is also listed as an unreliable item in the LPC17xx errata anyway), so I'm using the WDT.

The problem I have is that this doesn't easily allow multiple entries / exits of deep sleep. I can easily set the watchdog interrupt as the wakeup, and this works successfully. However, the WDINT bit of the WDMOD register says it is only clearable by an external reset. So while I can use this approach once to go to deep sleep and then return to the line right after I went to sleep, the WDT ISR has to be disabled or it just keeps firing off. There is no way of clearing that bit it seems.

So the only answer I think is the more complex way of having to reset the whole processor, setup all the clocks and such just like it was a fresh boot, and then jump to a different startup routine to decide where to resume my code.

Does anyone know if there is a sneaky way of clearing that WDINT bit? Or is there another way out there that you are using to go to deep sleep mode and then wakeup and resume right after where you left off?

Thanks!

An Engineer's Guide to the LPC2100 Series

Il 13/12/2011 17:47, goodgodgivemeanaliasalready ha scritto:
>
>
> Hi all,
>
> I'm using Deep Sleep mode on an LPC1768. You can wakeup from this mode
> using Watchdog, external interrupts, RTC alarm. However, I don't have
> external interrupts to use, and the RTC is inoperative (it is also
> listed as an unreliable item in the LPC17xx errata anyway), so I'm
> using the WDT.
>
> The problem I have is that this doesn't easily allow multiple entries
> / exits of deep sleep. I can easily set the watchdog interrupt as the
> wakeup, and this works successfully. However, the WDINT bit of the
> WDMOD register says it is only clearable by an external reset. So
> while I can use this approach once to go to deep sleep and then return
> to the line right after I went to sleep, the WDT ISR has to be
> disabled or it just keeps firing off. There is no way of clearing that
> bit it seems.
>
> So the only answer I think is the more complex way of having to reset
> the whole processor, setup all the clocks and such just like it was a
> fresh boot, and then jump to a different startup routine to decide
> where to resume my code.
>
> Does anyone know if there is a sneaky way of clearing that WDINT bit?
> Or is there another way out there that you are using to go to deep
> sleep mode and then wakeup and resume right after where you left off?
>
> Thanks!
>
I could try to help you but I don't understand what is the event/reason
to wake up the mcu. Do you need to wake up periodically (every 1 sec for
instance) make some things and then go to sleep or do you need to wake
up the mcu only some times when a particular event is fired?
>



I have a function that I call that puts me into deep sleep mode for XX minutes. So, for example, I want to sleep for 60 minutes then resume, I'd send it "deepsleep(60)". This time will vary depending on application / mode changes...
--- In l..., "M. Manca" wrote:
>
> Il 13/12/2011 17:47, goodgodgivemeanaliasalready ha scritto:
> >
> >
> > Hi all,
> >
> > I'm using Deep Sleep mode on an LPC1768. You can wakeup from this mode
> > using Watchdog, external interrupts, RTC alarm. However, I don't have
> > external interrupts to use, and the RTC is inoperative (it is also
> > listed as an unreliable item in the LPC17xx errata anyway), so I'm
> > using the WDT.
> >
> > The problem I have is that this doesn't easily allow multiple entries
> > / exits of deep sleep. I can easily set the watchdog interrupt as the
> > wakeup, and this works successfully. However, the WDINT bit of the
> > WDMOD register says it is only clearable by an external reset. So
> > while I can use this approach once to go to deep sleep and then return
> > to the line right after I went to sleep, the WDT ISR has to be
> > disabled or it just keeps firing off. There is no way of clearing that
> > bit it seems.
> >
> > So the only answer I think is the more complex way of having to reset
> > the whole processor, setup all the clocks and such just like it was a
> > fresh boot, and then jump to a different startup routine to decide
> > where to resume my code.
> >
> > Does anyone know if there is a sneaky way of clearing that WDINT bit?
> > Or is there another way out there that you are using to go to deep
> > sleep mode and then wakeup and resume right after where you left off?
> >
> > Thanks!
> >
> I could try to help you but I don't understand what is the event/reason
> to wake up the mcu. Do you need to wake up periodically (every 1 sec for
> instance) make some things and then go to sleep or do you need to wake
> up the mcu only some times when a particular event is fired?
> >
> >
> >
>

Hi:

The RTC issues were fixed in the Rev A of the chip's silicon. I have used the RTC to wake up reliably the processors from deep sleep modes every X seconds. No need to use the WDT.

Regards,

Alex R.
--- In l..., "goodgodgivemeanaliasalready" wrote:
>
> I have a function that I call that puts me into deep sleep mode for XX minutes. So, for example, I want to sleep for 60 minutes then resume, I'd send it "deepsleep(60)". This time will vary depending on application / mode changes...
> --- In l..., "M. Manca" wrote:
> >
> > Il 13/12/2011 17:47, goodgodgivemeanaliasalready ha scritto:
> > >
> > >
> > > Hi all,
> > >
> > > I'm using Deep Sleep mode on an LPC1768. You can wakeup from this mode
> > > using Watchdog, external interrupts, RTC alarm. However, I don't have
> > > external interrupts to use, and the RTC is inoperative (it is also
> > > listed as an unreliable item in the LPC17xx errata anyway), so I'm
> > > using the WDT.
> > >
> > > The problem I have is that this doesn't easily allow multiple entries
> > > / exits of deep sleep. I can easily set the watchdog interrupt as the
> > > wakeup, and this works successfully. However, the WDINT bit of the
> > > WDMOD register says it is only clearable by an external reset. So
> > > while I can use this approach once to go to deep sleep and then return
> > > to the line right after I went to sleep, the WDT ISR has to be
> > > disabled or it just keeps firing off. There is no way of clearing that
> > > bit it seems.
> > >
> > > So the only answer I think is the more complex way of having to reset
> > > the whole processor, setup all the clocks and such just like it was a
> > > fresh boot, and then jump to a different startup routine to decide
> > > where to resume my code.
> > >
> > > Does anyone know if there is a sneaky way of clearing that WDINT bit?
> > > Or is there another way out there that you are using to go to deep
> > > sleep mode and then wakeup and resume right after where you left off?
> > >
> > > Thanks!
> > >
> > I could try to help you but I don't understand what is the event/reason
> > to wake up the mcu. Do you need to wake up periodically (every 1 sec for
> > instance) make some things and then go to sleep or do you need to wake
> > up the mcu only some times when a particular event is fired?
> > >
> > >
> > >
> >
> >
> >
> >
>

Thanks Alex. The hardware I'm using is non Rev - A. Maybe I'll try to get the chips replaced.

I've had some issues in the past with RTC crystals (probably just capacitor selection). Did you bump into any RTC related issues w/r/t deep sleep wakeup you'd like to pass on however?

Thanks!

--- In l..., "alexander_ribero" wrote:
>
> Hi:
>
> The RTC issues were fixed in the Rev A of the chip's silicon. I have used the RTC to wake up reliably the processors from deep sleep modes every X seconds. No need to use the WDT.
>
> Regards,
>
> Alex R.
> --- In l..., "goodgodgivemeanaliasalready" wrote:
> >
> > I have a function that I call that puts me into deep sleep mode for XX minutes. So, for example, I want to sleep for 60 minutes then resume, I'd send it "deepsleep(60)". This time will vary depending on application / mode changes...
> >
> >
> > --- In l..., "M. Manca" wrote:
> > >
> > > Il 13/12/2011 17:47, goodgodgivemeanaliasalready ha scritto:
> > > >
> > > >
> > > > Hi all,
> > > >
> > > > I'm using Deep Sleep mode on an LPC1768. You can wakeup from this mode
> > > > using Watchdog, external interrupts, RTC alarm. However, I don't have
> > > > external interrupts to use, and the RTC is inoperative (it is also
> > > > listed as an unreliable item in the LPC17xx errata anyway), so I'm
> > > > using the WDT.
> > > >
> > > > The problem I have is that this doesn't easily allow multiple entries
> > > > / exits of deep sleep. I can easily set the watchdog interrupt as the
> > > > wakeup, and this works successfully. However, the WDINT bit of the
> > > > WDMOD register says it is only clearable by an external reset. So
> > > > while I can use this approach once to go to deep sleep and then return
> > > > to the line right after I went to sleep, the WDT ISR has to be
> > > > disabled or it just keeps firing off. There is no way of clearing that
> > > > bit it seems.
> > > >
> > > > So the only answer I think is the more complex way of having to reset
> > > > the whole processor, setup all the clocks and such just like it was a
> > > > fresh boot, and then jump to a different startup routine to decide
> > > > where to resume my code.
> > > >
> > > > Does anyone know if there is a sneaky way of clearing that WDINT bit?
> > > > Or is there another way out there that you are using to go to deep
> > > > sleep mode and then wakeup and resume right after where you left off?
> > > >
> > > > Thanks!
> > > >
> > > I could try to help you but I don't understand what is the event/reason
> > > to wake up the mcu. Do you need to wake up periodically (every 1 sec for
> > > instance) make some things and then go to sleep or do you need to wake
> > > up the mcu only some times when a particular event is fired?
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
>

Il 14/12/2011 06:34, goodgodgivemeanaliasalready ha scritto:
>
>
> Thanks Alex. The hardware I'm using is non Rev - A. Maybe I'll try to
> get the chips replaced.
>
Hmmm... I believe that the WDT is not usable for your purpose. If you
could work on the hw side you could use a timer in output compare mode
connecting the output pin of the output compare to an interrupt pin (or
a GPIO P0 or P2 pin) and use that pin to wake up the mcu. You could also
distinguish by sw non Rev A parts to enable this management and a normal
RTC management for parts >= Rev. A
> I've had some issues in the past with RTC crystals (probably just
> capacitor selection). Did you bump into any RTC related issues w/r/t
> deep sleep wakeup you'd like to pass on however?
>
> Thanks!
>
> --- In l... ,
> "alexander_ribero" wrote:
> >
> > Hi:
> >
> > The RTC issues were fixed in the Rev A of the chip's silicon. I have
> used the RTC to wake up reliably the processors from deep sleep modes
> every X seconds. No need to use the WDT.
> >
> > Regards,
> >
> > Alex R.
> >
> >
> > --- In l... ,
> "goodgodgivemeanaliasalready" wrote:
> > >
> > > I have a function that I call that puts me into deep sleep mode
> for XX minutes. So, for example, I want to sleep for 60 minutes then
> resume, I'd send it "deepsleep(60)". This time will vary depending on
> application / mode changes...
> > >
> > >
> > > --- In l... ,
> "M. Manca" wrote:
> > > >
> > > > Il 13/12/2011 17:47, goodgodgivemeanaliasalready ha scritto:
> > > > >
> > > > >
> > > > > Hi all,
> > > > >
> > > > > I'm using Deep Sleep mode on an LPC1768. You can wakeup from
> this mode
> > > > > using Watchdog, external interrupts, RTC alarm. However, I
> don't have
> > > > > external interrupts to use, and the RTC is inoperative (it is also
> > > > > listed as an unreliable item in the LPC17xx errata anyway), so I'm
> > > > > using the WDT.
> > > > >
> > > > > The problem I have is that this doesn't easily allow multiple
> entries
> > > > > / exits of deep sleep. I can easily set the watchdog interrupt
> as the
> > > > > wakeup, and this works successfully. However, the WDINT bit of the
> > > > > WDMOD register says it is only clearable by an external reset. So
> > > > > while I can use this approach once to go to deep sleep and
> then return
> > > > > to the line right after I went to sleep, the WDT ISR has to be
> > > > > disabled or it just keeps firing off. There is no way of
> clearing that
> > > > > bit it seems.
> > > > >
> > > > > So the only answer I think is the more complex way of having
> to reset
> > > > > the whole processor, setup all the clocks and such just like
> it was a
> > > > > fresh boot, and then jump to a different startup routine to decide
> > > > > where to resume my code.
> > > > >
> > > > > Does anyone know if there is a sneaky way of clearing that
> WDINT bit?
> > > > > Or is there another way out there that you are using to go to deep
> > > > > sleep mode and then wakeup and resume right after where you
> left off?
> > > > >
> > > > > Thanks!
> > > > >
> > > > I could try to help you but I don't understand what is the
> event/reason
> > > > to wake up the mcu. Do you need to wake up periodically (every 1
> sec for
> > > > instance) make some things and then go to sleep or do you need
> to wake
> > > > up the mcu only some times when a particular event is fired?
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >