Shop OBEX P1 Docs P2 Docs Learn Events
Propellor Icc Measurements — Parallax Forums

Propellor Icc Measurements

tomcrawfordtomcrawford Posts: 1,127
edited 2014-02-12 14:33 in Propeller 1
Here are some Icc measurements for a single 40-pin DIP Propellor. These numbers are at room temperature. A micropower 3.3V regulator with quiescent current less than 0.1 mA is used. This is a sample of one Prop with a 32K EEPROM. All numbers are mA.

I took measurements at five PLL settings because I am doing battery-powered designs and wanted to know how much power I could save at reduced clock rates. In some cases there is an order of magnitude difference between 5 MHz and 80 MHz.

A spreadsheet is attached as a pdf file.

1. Repeat waitcnt(clkfreq*5 + cnt) This was as good a baseline as I could come up with. The PROP is almost completely idle; we still see a 3:1 difference in current.
2. Repeat symbol++. Symbol is defined as a long.
3. Parallax Serial Terminal is started (in cog 1) at 9600 baud. It is likely polling to see if anything is in the buffer, cog 0 is idling.
4. Cog 0 is repeating symbol++. Every 256 passes, it calls pst.
5. A red led connected to ground via a 1Kohm resistor is switched on and off very slowly with waitcnts between. It consistently takes 1.4 mA. This would be a 1.4V drop across the resistor, suggesting a Vforward of 1.9V. I guess that sounds about right.
6. Same LED, same resistor, returned to Vcc. Exact same results
7. Same LED, same resistor, switched on and off as fast as spin can.
8. Here we have all eight cogs running, one spin, one whatever pst is written in, and six PASM. The program is attached. Cog zero starts up pst (in cog one) and then starts up six PASM cogs. From then on, it gives each PASM cog a number to fiddle with and then calls pst to display the results returned from the six PASM cogs.
Each PASM cogs initializes itself by claiming two IO pins and calculating real addresses in hub memory. At loop it polls a flag in hub memory, executes a 16 x 6 unsigned multiply, and serializes the product. I thought this would be a reasonable simulation of a busy cog.
{Object_Title_and_Purpose}


CON
        _clkmode = xtal1 + pll1x    '5 MHz times pll multiplier
        _xinfreq = 5_000_000

        NPasm = 6                        'number of PASM cogs to start 

VAR
  byte Cog
  long MyPar[4]
  byte debug, t1                    'if not zero, start up terminal
  long symbol
  long IValue[NPasm]            'input values for each cog
  long Flag[NPasm]              '<> 0 says start, =0 says done
  long Count[NPasm]              'return values from each cog
  long MasterRVal               '
   
OBJ
  pst : "Parallax Serial Terminal" 
  
PUB main

  debug := 1
  if Debug <> 0
    pst.Start (9600)                        'start up ser terminal: Note 9600 baud
    pst.str(String("hello, world   "))         'runs in cog 1
    pst.NewLine

  MasterRVal?                               'get the first random number
    
  repeat t1 from 0 to NPasm - 1             'which cog it is
    MyPar[0] := t1                          'a value, not an address
    MyPar[1] := @IValue                     'address of list of input values             
    MyPar[2] := @Flag                       'start/done flags
    Flag[t1] := 0                           'not ready to run
    MyPar[3] := @Count                      'Iterations                            
    cog := cognew(@PasmCog, @MyPar)         'start up the PASM cog
    pst.str(String("Start Cog: "))
    pst.dec(t1)
    pst.str(String("   Prop Cog Number:  "))             '
    pst.hex(Cog,1)
    pst.NewLine
    
  repeat    
    repeat t1 from 0 to NPasm - 1
      IValue[t1] := MasterRVal?               'a random long
      FLag[t1] := 1                           'tell pasm to start
    repeat while Flag[0] <> 0                 'wait here until first one is done
      pst.char(">")
    repeat t1 from 0 to NPasm - 1             'and now print the results
      pst.hex(Count[t1], 8)
      pst.str(string("  "))
    pst.newline    
     
  
     
dat                             'this is the PASM cog
PasmCog org   0
        mov AdPar,Par          'get the address of input parameters
        rdlong PasmNbr, AdPar  'this is my number
        mov Work1, PasmNbr     'get a copy
        shl Work1, #1          'times two
        add Work1, #8          'the pins begin with IO8
        mov DPMask, #1         'form the mask corresponding to my data pin
        shl DPMask, Work1      'by shifting appropriately
        andn outa, DPMask      'start out low for sure
        or dira, DPMask        'make it an output
        add Work1, #1          'to next pin number
        mov CPMask, #1         'and the mask corresponding to clock pin
        shl CPMask, Work1
        andn outa, CPMask
        or dira, CPMask
        mov Work1, PasmNbr    'get my number back
        shl Work1, #2          'multiply by four to get offset into tables            
        add AdPar, #4          'to MyPar[1] containing address of IValue list
        rdlong AdIVal, AdPar    'get it
        add AdIVal, Work1       'address of my very entry
        add AdPar, #4           'to MyPar[2] containing address of flag list
        rdlong AdFlag, AdPar    'address of flag list
        add AdFlag, Work1       'my very one
        add AdPar, #4           'to MyPar[3] containing address of return value list
        rdlong AdCnt, AdPar     'get it
        add AdCnt, Work1        'mine
loop    rdlong Work1, AdFlag    'get the flag
        test Work1, #$FF wz     'see if any bits set in the low order byte
        if_Z jmp #loop          'just wait here if not
        rdlong Work1, AdIVal    'get the input value
        mov MPlyer, Work1       'the multiplier
        andn MPlyer, FFFF       'extract, leaving in high order word
        mov MCand, Work1        'multicand
        and MCand, FFFF         'extract
        mov Prod, #0            'start out zero
        mov Work1, #16          'will look at 16 bits
mpyLp   shl Prod, #1            'shift what we have
        rol MPlyer, #1 wc       'high order bit into carry
        if_c add Prod, MCand    'add multicand if needful
        djnz Work1, #mpyLp      '16 times
        wrlong Prod, AdCnt      'store the result
        mov work1, #32          'will shift out 32 bits
shlp    rol Prod, #1 wc         'high order bit first
        if_c or outa, DPMask    'set a one
        if_nc andn outa, DPMask 'or a zero
        nop                     'simulate data setup time
        or outa, CPMask         'clock high
        nop                     'clock width
        andn outa,CPMask        'clock low
        andn outa, DPMask       'leave data low
        djnz work1, #Shlp       '32 times         
        wrlong zero, AdFlag     'only useful for first pasm cog
        jmp #loop                'and wait for another           
         
        

                  


Zero    long 0                  'zero value
FFFF    long $FFFF              'Word-size constant
AdPar   RES                     'input parameters address 
PasmNbr RES                     'what pasm number I am
AdTab   RES                     'address of beginning of return table
DPMask  RES                     'data pin mask
CPMask  RES                     'clock pin mask
Work1   RES                     'working register
AdIVal  RES                     'address of my particular input value
AdFlag  RES                     'address of my flag
AdCnt   RES                     'address of my count
MPlyer  RES                     'multiplier
MCand   RES                     'multiplicand
Prod    RES                     'product 
ICC.pdf 35.7K
Sign In or Register to comment.