Shop OBEX P1 Docs P2 Docs Learn Events
Prop2 Clock Request — Parallax Forums

Prop2 Clock Request

pjvpjv Posts: 1,903
edited 2009-08-11 04:28 in Propeller 1
Hi All;

My needs are low power operation·-several years on two AA batteries- and require to operate very fast for·several milliseconds and then return to the lowest power setting possibe for a specified period of time, typically several minutes to 1 hour. Presently I do this with an SX chip, but with its End Of Life in sight, I'm considering the Prop. But it has a rather ugly uncertainty for timing during the low power phase where the 20KHz oscillator would be used, making that approach unsuitable.

In the new Prop2, might it be possible to have a command that causes the 20KHz oscillator to run into a counter that is gated by one clock cycle of the higher speed oscillator -presumably a crystal one-, and thereby calibrating the actual speed of the 20KHz·RC clock? The delay software could then use this factor to more closely effect the desired low power delay time, and eliminate the need and cost of an external timekeeping device?

Precision timing at very low power and the lowest possible cost seem always a difficult thing to achieve.

Also, when running on RC clocks which require no stabilization, does the start-up timer need to be as long as at present (100 mSec I believe) ??

Cheers,

Peter (pjv)
·

Comments

  • KyeKye Posts: 2,200
    edited 2009-08-10 21:05
    You could use (waitcnt) to reduce power consumption.

    The command I belive uses a pretty good percentage less power.

    For example:

    If you project monitors a button or something like that you can use (waitpeq) or (waitpne) to wait forever in a low power state until something happens.

    Or you can use waitcnt and periodically sample some type of input.

    However, you can just use a lower speed crystal if you want. The pll is optional. If you can find a low speed crystal the prop then can use that crystal. Then when something happens you can turn the pll on and speed the chip up to 16x its current speed. Then when you are done you can slow back down again.

    Using both the techniques mentioned above you should be able to reach your goal.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • pjvpjv Posts: 1,903
    edited 2009-08-10 21:28
    Hello Kye;

    I fully understand your suggestions, but they are inadequate for my needs.

    Waitcnt is exacly what I'm now using with the 20KHz oscillator, but in order to reactivate the code at a particular time one has to know ahead of time how long to wait for. And if the speed of the RC oscillator is not accurately known, then this approach cannot work.

    In order to keep the power consumption as low as possible, one needs the software to start at "just the right time" (or perhaps a millisecond or two before).

    Running on a crystal during the long delay phase (500 uA at 5 MHz) is out of the question.

    The only way to do this is with a known timing source, and hence my request for a calibration instruction/hardware.

    Cheers,

    Peter (pjv)
  • Bill HenningBill Henning Posts: 6,445
    edited 2009-08-10 21:41
    Hi Peter,

    Due to the smaller geometry process, the Prop2 will have a *much higher* leakage current, so Prop1 is more appropriate to such extremely low power applications.

    Have you considered adding an RTC chip to signal the Prop to wake up? I personally use the PCF8563 I2C RTC on Morpheus, and so far, I really like it.

    Best,

    Bill
    pjv said...
    Hi All;


    My needs are low power operation -several years on two AA batteries- and require to operate very fast for several milliseconds and then return to the lowest power setting possibe for a specified period of time, typically several minutes to 1 hour. Presently I do this with an SX chip, but with its End Of Life in sight, I'm considering the Prop. But it has a rather ugly uncertainty for timing during the low power phase where the 20KHz oscillator would be used, making that approach unsuitable.



    In the new Prop2, might it be possible to have a command that causes the 20KHz oscillator to run into a counter that is gated by one clock cycle of the higher speed oscillator -presumably a crystal one-, and thereby calibrating the actual speed of the 20KHz RC clock? The delay software could then use this factor to more closely effect the desired low power delay time, and eliminate the need and cost of an external timekeeping device?



    Precision timing at very low power and the lowest possible cost seem always a difficult thing to achieve.



    Also, when running on RC clocks which require no stabilization, does the start-up timer need to be as long as at present (100 mSec I believe) ??



    Cheers,



    Peter (pjv)
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
    Morpheus & Mem+ Advanced dual Propeller SBC with XMM and 256 Color VGA - PCB, kit, A&T available NOW!
    www.mikronauts.com - my site 6.250MHz custom Crystals for running Propellers at 100MHz
    Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
  • pjvpjv Posts: 1,903
    edited 2009-08-10 22:12
    Hi Bill;

    You are right, I now recall Chip saying the idle current was going to be higher. Bummer!

    As far as an external timer is concerned, that's what I presently do in the SX world..... using the MAXIM Clock with 2K FRAM. Works great, but a little costly, so I was hoping to influence the Prop2 design to add the calibration feature.

    Cheers,

    Peter (pjv)
  • BeanBean Posts: 8,129
    edited 2009-08-10 22:16
    Will the Prop1 work with a 32.768Khz watch xtal ?

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Does that byte of memory hold "A", 65, $41 or %01000001 ?
    Yes it does...


    ·
  • lonesocklonesock Posts: 917
    edited 2009-08-10 22:33
    Bean (Hitt Consulting) said...
    Will the Prop1 work with a 32.768Khz watch xtal ?

    Bean
    The datasheet says the XINPUT clock mode works from DC to 80MHz. That is well below the 4MHz limit for enabling the PLL, though...so you get a slow speed only. I guess you could switch to RCFAST for computation, then back to XINPUT for low-power time-keeping.

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lonesock
    Piranha are people too.
  • pjvpjv Posts: 1,903
    edited 2009-08-10 22:51
    Hi Guys;

    I suspect the prop will work with a 32K crystal, but as Jonathan said, multiplying that up by 16 is too slow for the PLL as well as for comms and other needs when executing real programs. And of course using the 12 MHz then is again unstable.

    This is all somewhat a moot point if the idle current is ugly (or in the realm of 5MHz crystal waiting operation), unless of course Chip will be shutting most silicon down while in a low power wait mode.

    Hmmmm.....

    In any case, RC calibration might still be a nice feature for some applications.

    Cheers,

    Peter (pjv)
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-08-10 22:57
    I wonder if you could use a multiplexer on XO to select which crystal to drive, if you had two of them connected to XI.

    -Phil
  • pjvpjv Posts: 1,903
    edited 2009-08-10 23:12
    Hi Phil;

    Now THERE's a drum that I would follow!!!

    Wonderful solution.

    Cheers,

    Peter (pjv)
  • James NewmanJames Newman Posts: 133
    edited 2009-08-11 00:10
    How do you know when it needs to bump up to the faster clock? You said that waitcnt doesn't work because you don't know how long you need to wait... what about WAITPEQ or WAITPNE? Same thing except it pauses cog execution until a pin condition. You could leave the prop at a decent speed, and it checks the pins every clock cycle (faster than you can do checking yourself in asm), and finally reduces power consumption for the cog by 7/8ths.
  • Bill HenningBill Henning Posts: 6,445
    edited 2009-08-11 00:53
    Hi Peter,

    That's because you chose a really nice part, with FRAM - if you don't need the fram, the DIP-8 in qty.1 at Future is $1.49, smd in large lots is even cheaper.

    The SOIC-8 PCF8583, which adds 256 bytes of battery backed ram is only $1.36 qty.1

    Best,

    Bill
    pjv said...
    Hi Bill;

    You are right, I now recall Chip saying the idle current was going to be higher. Bummer!

    As far as an external timer is concerned, that's what I presently do in the SX world..... using the MAXIM Clock with 2K FRAM. Works great, but a little costly, so I was hoping to influence the Prop2 design to add the calibration feature.

    Cheers,

    Peter (pjv)
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
    Morpheus & Mem+ Advanced dual Propeller SBC with XMM and 256 Color VGA - PCB, kit, A&T available NOW!
    www.mikronauts.com - my site 6.250MHz custom Crystals for running Propellers at 100MHz
    Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
  • localrogerlocalroger Posts: 3,452
    edited 2009-08-11 01:34
    Use two external self-contained oscillators, one very slow but more accurate than RCslow and one fast enough to drive the PLL, selected through a multiplexer by a prop pin. If the fast resonator uses too much power when it's not in use, power it from another prop pin (they can supply 40 mA).
  • CounterRotatingPropsCounterRotatingProps Posts: 1,132
    edited 2009-08-11 01:35
    Phil Pilgrim (PhiPi) said...
    I wonder if you could use a multiplexer on XO to select which crystal to drive, if you had two of them connected to XI.

    -Phil
    would there be any impact in terms of the extra trace lengths - or would the runs be short enough anyway?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • localrogerlocalroger Posts: 3,452
    edited 2009-08-11 01:50
    CRP and Phil -- I think you would have a lot of trouble selecting crystals, but if you use self-contained external oscillators at the two frequencies the problem pretty much goes away.
  • TimmooreTimmoore Posts: 1,031
    edited 2009-08-11 02:05
    How about ds1077 (http://www.sparkfun.com/commerce/product_info.php?products_id=9089) program oscillator, you can config into onboard eeprom the startup clock and then reprogram it on the fly
  • BradCBradC Posts: 2,601
    edited 2009-08-11 02:52
    James Newman said...
    How do you know when it needs to bump up to the faster clock? You said that waitcnt doesn't work because you don't know how long you need to wait... what about WAITPEQ or WAITPNE? Same thing except it pauses cog execution until a pin condition. You could leave the prop at a decent speed, and it checks the pins every clock cycle (faster than you can do checking yourself in asm), and finally reduces power consumption for the cog by 7/8ths.

    It reduces the power consumption of the cog, but you still have the overhead of the HUB and Clock circuits (which is not insignificant).

    The only way to drop the power consumption of the prop to really low values is to slow the core right down.

    2 years on a pair of Alkaline AA's (approximated as 3000mAH) is going to need a standby current of about 171uA.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lt's not particularly silly, is it?

    Post Edited (BradC) : 8/11/2009 2:57:22 AM GMT
  • pjvpjv Posts: 1,903
    edited 2009-08-11 03:19
    Hi All;

    At present my Prop idles in WAITCNT with the 20KHz clock and consumes 7 uA... a wonderfully low number. Then it goes into full speed at 5MHz crystal for about 5 mSec (I know that you're not supposed to use the crystal oscillator for 10 mSec after activating it, but looking into that, it appears to work fine if it is left for only two or 3 mSec), does its work and goes back to idle speed for a few minutes. Total power is quite low because the crystal oscillator option is disabled during this time.

    I believe if one REALLY squeezed things one might get 7 years out of the sulphur-iron lithium AA cells. Oh yeah, it also needs to operate at minus 40C. Fortunately the cells are OK with that.... not sure yet what the power impact of all the cicuitry will be.

    At present I do this with an SX (draws zero current while asleep), and wakes up from an external RTC chip. Rather costly, and I was hoping to offset the added Prop cost with eliminating that device.

    Compared to the SX, at this point I'm not sure the Prop1 reacts fast enough to do what I need, so lots of testing and brainstorming is in the offing!

    With its pending advancements, I believe Prop2 to be a good candidate (cordic rotator instruction) so I was hoping for some calibration facility on the slow RC oscillator. That is of course very dependant on the as yet unknown static leakage current.

    Cheers,

    Peter (pjv)
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-08-11 04:05
    Peter,

    Another thought: Add a cheap 6-pin PIC or 8-pin AVR, and program it to measure the width of an incoming pulse and parrot it back. Then, when the Prop is about ready to enter its manic phase, power up the little micro and send it a brief pulse from the Prop. Next, shift into high gear and measure the pulse being parroted back. The measured width is you calibration information. Finally, turn off the little micro, do the manic stuff, and shift back into low gear.

    -Phil
  • pjvpjv Posts: 1,903
    edited 2009-08-11 04:28
    Phil;

    Thanks, that would also work. and would be quite simple and cheap to boot.

    Cheers,

    Peter (pjv)
Sign In or Register to comment.