Keeping Propeller in low-power state.
Bean
Posts: 8,129
Am I correct that this code will keep a cog in low-power state forever ?
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1st rule of finance...Don't lose money.
Never be ashamed of making an honest·profit.
Live within your means...Make do, or do without.
·
mov temp,#0 waitpne temp,temp
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1st rule of finance...Don't lose money.
Never be ashamed of making an honest·profit.
Live within your means...Make do, or do without.
·
Comments
You're correct.
But if you want to wake it from time to time just use waitcnt with some future value and a jmp to the waitcnt. It will wake it just long enough to execute the jmp and the waitcnt and has to wait again.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit some of my articles at Propeller Wiki:
MATH on the propeller propeller.wikispaces.com/MATH
pPropQL: propeller.wikispaces.com/pPropQL
pPropQL020: propeller.wikispaces.com/pPropQL020
OMU for the pPropQL/020 propeller.wikispaces.com/OMU
I need the pins to keep their state.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1st rule of finance...Don't lose money.
Never be ashamed of making an honest·profit.
Live within your means...Make do, or do without.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit some of my articles at Propeller Wiki:
MATH on the propeller propeller.wikispaces.com/MATH
pPropQL: propeller.wikispaces.com/pPropQL
pPropQL020: propeller.wikispaces.com/pPropQL020
OMU for the pPropQL/020 propeller.wikispaces.com/OMU
polls for commands or the like. Instead of spinning furiously looking at a hub memory location asking if there is more
work to do, put in a short waitcnt (say, 100 cycles or 1000 cycles or whatever works) so that cog is *actually* almost
always idle.
Since spin code (to initiate the op) probably takes hundreds of cycles anyway to set the memory location, you're
probably not dramatically decreasing the overall performance of the program, but making a cog "mostly idle" can
cut power a lot.
If this is true I may have to start over at the basics.
What do you mean by " inputs ( for that cog) "
Only one DIRA used by all cogs.
My understanding is a pin can be set to output by any cog. (Ignoring conflicts for now)
It will remain in that state until changed.
BTW, I get confused easily. Help me get back on track.
Roger
-Phil
I'm OK now.
The result would be like rokicki suggestion but better, no latency on waiting for a command and even lower power use.
I had thought this could be combined with locks so that you wait for your locked resource to become free and off you go.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
1) Cog X is about to exit and owns say 3 I/O pins which we want to preserve the state of post cogstop on X
2) Set a lock (lock A) >> prevents any other cogs from writing to the globals if they too are exiting or starting up (see step 3 below)
3) OR the contents Cog X's DIRA and OUTA with a two assigned RAM variables that are global
4) Clear lock A
5) Set a second lock (Lock >> the master cog will recognize this as a flag to update its DIRA and OUTA
6) Cog X waits for lock B to be cleared by master cog (preserve I/O state)
7) Cogstop X
8) The master cog recognizes that lock B is set and ORs the contents of its DIRA and OUTA with the two aforementioned globals
9) The master cog clears lock B (Cog X will use this to indicate it is free to stop)
>> The master cog does not have to be dedicated 100% to the above task and could spend most of its time either doing something or in a wait (power reduction)
Of course each routine designated for a cog must own certain I/O pins exclusively and regain control over those pins from the master should the particular routine be restarted again on another cog. This could be accomplished using the same locks as described above when the routine first loads.
All of this is alot of trouble (although once the code was written it would be reused in its most generic form) and could be spared if there existed global DIRA and OUTA registers...do these exist??
Post Edited (Miner_with_a_PIC) : 12/17/2009 5:59:56 PM GMT
So it could go like:
rdlong command, some_special_addres_in_hub
which does not return until sthe special address is written to. Same the other way for writes.
Or it could be mixed up with the locks some how. I'm sure Chip can think of something[noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.