Reply by Peter Jakacki February 2, 20052005-02-02
How about you startup on the IRC and calibrate the WDT against this,
then run on the WDT wth DIVM. I would not think that a 32k xtal can
really better this seeing that you are starting off with a much higher
freq calibrated RC oscillator. Considering the startup time for the 32k
xtal and that it is not really all that accurate anyway this surely must
be the option of choice.

The application sounds a little unusual and if you are only timing in 1
sec intervals then you really don't need all that much accuracy, just
low-power (i.e. WDT+DIVM).

Don't worry about using the RTC, it is really meant for conventional
"time-of-day" timekeeping. The inclusion of it in the 901 is causing you
to focus on it too much. Instead, the WDT timeout period can be adjusted
to suit. You can go to power-down, consume 50ua, and the WDT can reset
or wakeup the CPU. I have used this method with other micros to acheive
low-power operation with fast startup times.

my2cents
*Peter*

ow_tong_peow wrote:

>Sorry for the confusion.
>
>I need doing this:
>
>1) Power up, uP -> Power down mode.
>
>2) On Keypad Interrupt (Low Level), Start RTC with 1 second interrupt.
>
>3) Keep updating counter based on the RTC interrupt.
>
>4) On Keypad Interrupt again (High Level),
> Stop RTC.
> Write counter to flash.
>
>5) Go to Power down mode.
>
>6) Go to Step (2).
>
>So, now the question is:
> I am supposed to be able to use IRC, with RTC using 32kHz as
>reference. This is based on datasheet.
>
> But if LPC901 goes into Power down mode, can the RTC interrupt
>wakes up LPC? Tried and LPC sleeps forver.
>
>Regards,
>Ow Tong Peow


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.3 - Release Date: 1/31/05


Reply by ow_tong_peow February 2, 20052005-02-02

Dear all,

Just found out something very interesting, which I could use as a
workaround.

Main Oscillator and RTC is using 32kHz watch clock

When LPC901 goes to Total Power down mode, and RTC is power down,
Keypad Interrupt takes up to 2 seconds. Current consumption 3uA.

When LPC901 goes to Total Power down mode, and RTC is interrupting
at 60s, Keypad Interrupt is < 10ms. Current consumption 14uA.

Why is this happening to me!

Regards,
Ow Tong Peow
--- In lpc900_users@lpc9..., "ow_tong_peow"
<ow_tong_peow@y...> wrote:
>
> Sorry for the confusion.
>
> I need doing this:
>
> 1) Power up, uP -> Power down mode.
>
> 2) On Keypad Interrupt (Low Level), Start RTC with 1 second
interrupt.
>
> 3) Keep updating counter based on the RTC interrupt.
>
> 4) On Keypad Interrupt again (High Level),
> Stop RTC.
> Write counter to flash.
>
> 5) Go to Power down mode.
>
> 6) Go to Step (2).
>
> So, now the question is:
> I am supposed to be able to use IRC, with RTC using 32kHz as
> reference. This is based on datasheet.
>
> But if LPC901 goes into Power down mode, can the RTC interrupt
> wakes up LPC? Tried and LPC sleeps forver.
>
> Regards,
> Ow Tong Peow
>
> --- In lpc900_users@lpc9..., Peter Jakacki <peterjak@t...>
> wrote:
> > Now I'm really confused. You are running an RTC with the 32k
xtal,
> fair
> > enough. But your earlier messages seem to imply that you turn off
> this
> > oscillator and then when you get a wakeup you start the
oscillator
> back
> > up again. There doesn't seem to be any purpose for the 32k xtal
if
> you
> > are turning it off at any time, you are losing all RTC function
> then.
> >
> > Either you NEED the 32k xtal reference or you DON'T. If you do
then
> > there is more to your application then you have stated. But
either
> way
> > you have enough choices so far to make a decision.
> >
> > *Peter*
> >
> > ow_tong_peow wrote:
> >
> > >Dear Peter,
> > >
> > > Yes, the IRC time is really short. I love it. My application
> > >also has a RTC timer for counter.
> > >
> > > Is this possible?
> > >
> > >1) Start Running on IRC.
> > >
> > >2) Start RTC using 32kHz watch crystal. Interrupt at 1s
> > >
> > >3) IRC go to Total Power down mode.
> > >
> > >4) On RTC or Keypad interrupt. Wakeup, use IRC for processing.
> > >
> > >5) Go to (3).
> > >
> > >Regards,
> > >Ow Tong Peow
> > >
> > >
> >
> >
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.300 / Virus Database: 265.8.3 - Release Date: 1/31/05



Reply by ow_tong_peow February 2, 20052005-02-02

Sorry for the confusion.

I need doing this:

1) Power up, uP -> Power down mode.

2) On Keypad Interrupt (Low Level), Start RTC with 1 second interrupt.

3) Keep updating counter based on the RTC interrupt.

4) On Keypad Interrupt again (High Level),
Stop RTC.
Write counter to flash.

5) Go to Power down mode.

6) Go to Step (2).

So, now the question is:
I am supposed to be able to use IRC, with RTC using 32kHz as
reference. This is based on datasheet.

But if LPC901 goes into Power down mode, can the RTC interrupt
wakes up LPC? Tried and LPC sleeps forver.

Regards,
Ow Tong Peow

--- In lpc900_users@lpc9..., Peter Jakacki <peterjak@t...>
wrote:
> Now I'm really confused. You are running an RTC with the 32k xtal,
fair
> enough. But your earlier messages seem to imply that you turn off
this
> oscillator and then when you get a wakeup you start the oscillator
back
> up again. There doesn't seem to be any purpose for the 32k xtal if
you
> are turning it off at any time, you are losing all RTC function
then.
>
> Either you NEED the 32k xtal reference or you DON'T. If you do then
> there is more to your application then you have stated. But either
way
> you have enough choices so far to make a decision.
>
> *Peter*
>
> ow_tong_peow wrote:
>
> >Dear Peter,
> >
> > Yes, the IRC time is really short. I love it. My application
> >also has a RTC timer for counter.
> >
> > Is this possible?
> >
> >1) Start Running on IRC.
> >
> >2) Start RTC using 32kHz watch crystal. Interrupt at 1s
> >
> >3) IRC go to Total Power down mode.
> >
> >4) On RTC or Keypad interrupt. Wakeup, use IRC for processing.
> >
> >5) Go to (3).
> >
> >Regards,
> >Ow Tong Peow
> >
> > --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.8.3 - Release Date: 1/31/05



Reply by lpc2100_fan February 2, 20052005-02-02


Just wanted to confirm there is a WDT oscillator nominal 400 kHz, very
fast startup but wide tolerance (I think +/- 30 %). Use this with DIVM
and you should get very low power.

--- In lpc900_users@lpc9..., Peter Jakacki <peterjak@t...> wrote:
---snip---
> DIVM there to reduce the chip power if not the IRC power itself.
>
> I also believe that the watchdog oscillator can be used. It runs at
> 400KHz, have you considered this?
>
----snip--------



Reply by Peter Jakacki February 2, 20052005-02-02
Now I'm really confused. You are running an RTC with the 32k xtal, fair
enough. But your earlier messages seem to imply that you turn off this
oscillator and then when you get a wakeup you start the oscillator back
up again. There doesn't seem to be any purpose for the 32k xtal if you
are turning it off at any time, you are losing all RTC function then.

Either you NEED the 32k xtal reference or you DON'T. If you do then
there is more to your application then you have stated. But either way
you have enough choices so far to make a decision.

*Peter*

ow_tong_peow wrote:

>Dear Peter,
>
> Yes, the IRC time is really short. I love it. My application
>also has a RTC timer for counter.
>
> Is this possible?
>
>1) Start Running on IRC.
>
>2) Start RTC using 32kHz watch crystal. Interrupt at 1s
>
>3) IRC go to Total Power down mode.
>
>4) On RTC or Keypad interrupt. Wakeup, use IRC for processing.
>
>5) Go to (3).
>
>Regards,
>Ow Tong Peow


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.3 - Release Date: 1/31/05


Reply by ow_tong_peow February 2, 20052005-02-02

Dear Peter,

Yes, the IRC time is really short. I love it. My application
also has a RTC timer for counter.

Is this possible?

1) Start Running on IRC.

2) Start RTC using 32kHz watch crystal. Interrupt at 1s

3) IRC go to Total Power down mode.

4) On RTC or Keypad interrupt. Wakeup, use IRC for processing.

5) Go to (3).

Regards,
Ow Tong Peow --- In lpc900_users@lpc9..., Peter Jakacki <peterjak@t...>
wrote:
> Yes, have you measured the IRC startup time? It should be extremely
> short, certainly way less than the crystal option. There is still
the
> DIVM there to reduce the chip power if not the IRC power itself.
>
> I also believe that the watchdog oscillator can be used. It runs at
> 400KHz, have you considered this?
>
> It would be so easy if your system knew the battery was or needed
to be
> replaced then it could do a single flash write, but not in the real
> world. Any capacitor that you place across the battery to maintain
the
> RAM would introduce leakage itself but it might be worth exploring.
>
> Utilizing a modified counter update routine which uses consecutive
blank
> locations in the sector would cut the flash access time in half (no
> erase needed). Once the sector is full then you can update a normal
> counter location then an erase operation can be performed and you
start
> again. It's a bit like counting by writing strokes for each item
then
> crossing through them when you get to five except in this case you
count
> 256 before you "cross" them.
>
> *Peter* > ow_tong_peow wrote:
>
> >Dear Peter,
> >
> > Yes, I could use IRC for a very fast start up and do some quick
> >computation. But, the current consumption during active mode is
more
> >than 1mA. I am also concern on the current consumption when
writing
> >to the Flash during active mode.
> >
> > I could accept it if the wake up time is < 100ms. 2sec wake up
> >time would not be acceptable.
> >
> > I need to write to the Flash, so that when the battery is
changed,
> >I can still read back my last counter value.
> >
> > The battery has to last for a year, assuming 100 wakeup per day.
> >
> >Ow Tong Peow.
> >
> > --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.8.3 - Release Date: 1/31/05



Reply by Peter Jakacki February 1, 20052005-02-01
Yes, have you measured the IRC startup time? It should be extremely
short, certainly way less than the crystal option. There is still the
DIVM there to reduce the chip power if not the IRC power itself.

I also believe that the watchdog oscillator can be used. It runs at
400KHz, have you considered this?

It would be so easy if your system knew the battery was or needed to be
replaced then it could do a single flash write, but not in the real
world. Any capacitor that you place across the battery to maintain the
RAM would introduce leakage itself but it might be worth exploring.

Utilizing a modified counter update routine which uses consecutive blank
locations in the sector would cut the flash access time in half (no
erase needed). Once the sector is full then you can update a normal
counter location then an erase operation can be performed and you start
again. It's a bit like counting by writing strokes for each item then
crossing through them when you get to five except in this case you count
256 before you "cross" them.

*Peter* ow_tong_peow wrote:

>Dear Peter,
>
> Yes, I could use IRC for a very fast start up and do some quick
>computation. But, the current consumption during active mode is more
>than 1mA. I am also concern on the current consumption when writing
>to the Flash during active mode.
>
> I could accept it if the wake up time is < 100ms. 2sec wake up
>time would not be acceptable.
>
> I need to write to the Flash, so that when the battery is changed,
>I can still read back my last counter value.
>
> The battery has to last for a year, assuming 100 wakeup per day.
>
>Ow Tong Peow.


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.3 - Release Date: 1/31/05


Reply by ow_tong_peow February 1, 20052005-02-01

Dear Peter,

Yes, I could use IRC for a very fast start up and do some quick
computation. But, the current consumption during active mode is more
than 1mA. I am also concern on the current consumption when writing
to the Flash during active mode.

I could accept it if the wake up time is < 100ms. 2sec wake up
time would not be acceptable.

I need to write to the Flash, so that when the battery is changed,
I can still read back my last counter value.

The battery has to last for a year, assuming 100 wakeup per day.

Ow Tong Peow.

--- In lpc900_users@lpc9..., Peter Jakacki <peterjak@t...>
wrote:
> I'm a little confused. Why does your application need a crystal?
All you
> need to do is to wake-up, update a counter, then go back to sleep.
The
> IRC uses only 256 clocks for start-up and then the system screams
> through a short bit of code, then goes to sleep. Surely this
constitutes
> ultra-low-power operation. Waiting around for crystal oscillators
to
> stabilise surely consumes power, even if it does eventually run at
32KHz.
>
> Also, why are you writing to Flash when you have a perfectly good
> battery-backed RAM?
>
> *Peter*
>
> ow_tong_peow wrote:
>
> >Dear Peter,
> >
> > My application is running off a battery CR1220. The constant
> >output current is 0.1mA, which is very low. Capacity is 35mA. My
> >team then decide on using the external 32kHz watch crystal, since
it
> >is cheap and easy to get.
> >
> > Currently, we are using the breadboard, so the crystal
> >performance may degrade. Well, I have tried using external
crystal
> >of 3Mhz, and LPC901 wakes up very fast (<10ms). Looks like I have
to
> >go and buy a 32kHz crystal to test again.
> >
> >
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.8.3 - Release Date: 1/31/05



Reply by Peter Jakacki February 1, 20052005-02-01
I'm a little confused. Why does your application need a crystal? All you
need to do is to wake-up, update a counter, then go back to sleep. The
IRC uses only 256 clocks for start-up and then the system screams
through a short bit of code, then goes to sleep. Surely this constitutes
ultra-low-power operation. Waiting around for crystal oscillators to
stabilise surely consumes power, even if it does eventually run at 32KHz.

Also, why are you writing to Flash when you have a perfectly good
battery-backed RAM?

*Peter*

ow_tong_peow wrote:

>Dear Peter,
>
> My application is running off a battery CR1220. The constant
>output current is 0.1mA, which is very low. Capacity is 35mA. My
>team then decide on using the external 32kHz watch crystal, since it
>is cheap and easy to get.
>
> Currently, we are using the breadboard, so the crystal
>performance may degrade. Well, I have tried using external crystal
>of 3Mhz, and LPC901 wakes up very fast (<10ms). Looks like I have to
>go and buy a 32kHz crystal to test again.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.3 - Release Date: 1/31/05


Reply by ow_tong_peow February 1, 20052005-02-01

Dear Peter,

My application is running off a battery CR1220. The constant
output current is 0.1mA, which is very low. Capacity is 35mA. My
team then decide on using the external 32kHz watch crystal, since it
is cheap and easy to get.

Currently, we are using the breadboard, so the crystal
performance may degrade. Well, I have tried using external crystal
of 3Mhz, and LPC901 wakes up very fast (<10ms). Looks like I have to
go and buy a 32kHz crystal to test again.

//---------------------

Dear Bob,
Yes, good idea! At the moment, IRC power is not needed, I will try
to use IDLE mode with largest DIVM = 0xFF. On KBI, DIVM = 0x00.

LOL! Sounds interesting. Haven't done this before. Will let you
know the result.

My application is really simple. Just a counter that starts and
stops on a keypad interrupt. And also store the counter into the
Flash, so that on next power up, the counter can be recalled and
carry on incrementing.
--- In lpc900_users@lpc9..., "lpc2100_fan" <lpc2100_fan@y...>
wrote:
>
> Hi Ow Tong Peow,
>
> what about the following setup. You use the 32 kHz crystal as system
> clock and leave it on all the time (not the IRC, consumes more power
> because it is faster). You can even use the DIVM divider to reduce
the
> power consumption while running from 32 kHz. If you need the
> processing power, you can switch the clock to the IRC, this is very
> fast afaik 2 cycles of the 32 kHz clock. Now you have 7.373 MHz
> processing power.
> Are you using the 32 kHz in connection with the real time clock or
is
> the performance of 16 KIPS (16000 instrcutions per second) enough?
>
> Would be interested to learn more about your application because we
> use devices of the LPC900 family in low power applications too.
>
> Cheers, Bob
>
> --- In lpc900_users@lpc9..., Peter Jakacki <peterjak@t...>
wrote:
> > Unless you had the datasheet on the crystal it's hard to say. But
some
> > things you need to "watch" for (unintentional pun) is to avoid
> excessive
> > heat when soldering and make sure that there is no flux residue
around
> > the oscillator connections. The heat can really degrade the
crystal and
> > the flux is conductive enough especially in these sensitve low-
power
> > circuits.
> >
> > 100ms is still sounding hopeful. Seeing that you turn off the
> > oscillator, does your application really need the crystal? Can
you just
> > run with the IRC?
> >
> > BTW, I haven't used the LPC900s "yet".
> >
> > *Peter*
> >
> >
> > ow_tong_peow wrote:
> >
> > >Thanks Peter. I certainly doesn't know this before. Bad low
current
> > >watch crystal!!
> > >
> > >If I replaced it with a normal 32kHz crystal, will the wakeup
time
> > >improve? Better to know before rushing to the Electronics store
to
> > >get it. I am trying to get a response time in 100ms or less.
> > >
> > >Thanks,
> > >Ow Tong Peow
> > >
> > >
> >
> >
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.300 / Virus Database: 265.8.3 - Release Date: 1/31/05