Sign in

username:

password:



Not a member?

Search code-comp



Search tips

Subscribe to code-comp



code-comp by Keywords

ARM7 | BIOS | Bug | EVM | JTAG | Linker | LOG_printf | McBSP | Profiling | Relocation | RTDX | Simulator | Target | Watch

Ads

Discussion Groups

Discussion Groups | Code-Composer | Re: Re: Re: Halt and wake-up periodically

Technical discussions about Code Composer Studio.

  

Post a new Thread

Halt and wake-up periodically - mi19890 - Mar 21 7:17:37 2007



Hi all,
I'm trying to save power in my dsk6713: my main objective is to=20
periodically wake up the CPU after having processed some data and=20
then halted. I know there are two main options:

1. Idle loop with more than six NOP instructions between the=20
label and the branch instruction. Assembler code:

.global _halt

_halt:
L1:=09
	IDLE
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP=09=09=09=09=09
=09=09=20
	.end

2. Power Down Modes: in my case PD1 which can be wake up by a=20
periodical interruption (following spru728c instructions). Assembler=20
code:

.global _halt

.text
N  	.set   	2400h	  ;PD1 Wake by an enabled interrupt.

_halt:=09
	MVC 	CSR,B0     ; B0 <-- CSR
	MVK 	N,B1
	OR	B0,B1,B0   ; B0 <-- B0 + N

	B 	NextInst   ; branch does not effect program flow, but
	NOP 		   ; hides the move to the CSR in the delay
			   ; slots

	MVC 	B0,CSR	   ; power-down mode set by this instruction

	NOP=09=09
	NOP=09=09
	NOP=09=09

NextInst:=20
        NOP=09=09
	NOP	5	   ; CPU notifies power-down logic to=20=20
                           ; initiate power down
=09=09=09=09
	.end	           ; normal program execution resumed here

I have to say that I call this assembler functions from C coded=20
applications when the data processing finishes. My doubts are:

1. In general for both solutions: How can I assign ONE specific=20
periodic interruption (for example timer's) to the PD1 or the idle=20
option so it wakes up ONLY by that interruption?

2. For Idle Solution: I have realized that it doesn=B4t matter=20
how many NOPs I put between the label and the branch instruction=20
(even anyone), because the behaviour is the same: it halts and wakes=20
up when any interruption occurs.

3. For PD solution: When I try the PD1 option, the power down=20
is not set (it doesn=B4t halt). In fact, the value of the CSR register=20
changes to its original value just after the MVC instruction, and=20
when the assembler routine finishes it returns to the main threads=20
although any interruption occurs.

Thank you very much in advance,=20
King regards

Miguel =C1ngel

=20


(You need to be a member of code-comp -- send a blank email to code-comp-subscribe@yahoogroups.com )

Re: Halt and wake-up periodically - Jeff Brower - Mar 21 12:06:39 2007

Miguel-

> 3. For PD solution: When I try the PD1 option, the power down
> is not set (it doesnīt halt). In fact, the value of the CSR register
> changes to its original value just after the MVC instruction, and
> when the assembler routine finishes it returns to the main threads
> although any interruption occurs.

How are you determining the CPU didn't halt?  Do you have CCS + JTAG connected?  I would guess
that if JTAG is active,
all bets are off for power-down logic.

-Jeff

> I'm trying to save power in my dsk6713: my main objective is to
> periodically wake up the CPU after having processed some data and
> then halted. I know there are two main options:
>
> 1. Idle loop with more than six NOP instructions between the
> label and the branch instruction. Assembler code:
>
> .global _halt
>
> _halt:
> L1:
> 	IDLE
> 	NOP
> 	NOP
> 	NOP
> 	NOP
> 	NOP
> 	NOP
>
> 	.end
>
> 2. Power Down Modes: in my case PD1 which can be wake up by a
> periodical interruption (following spru728c instructions). Assembler
> code:
>
> .global _halt
>
> .text
> N  	.set   	2400h	  ;PD1 Wake by an enabled interrupt.
>
> _halt:
> 	MVC 	CSR,B0     ; B0 <-- CSR
> 	MVK 	N,B1
> 	OR	B0,B1,B0   ; B0 <-- B0 + N
>
> 	B 	NextInst   ; branch does not effect program flow, but
> 	NOP 		   ; hides the move to the CSR in the delay
> 			   ; slots
>
> 	MVC 	B0,CSR	   ; power-down mode set by this instruction
>
> 	NOP
> 	NOP
> 	NOP
>
> NextInst:
>         NOP
> 	NOP	5	   ; CPU notifies power-down logic to
>                            ; initiate power down
>
> 	.end	           ; normal program execution resumed here
>
> I have to say that I call this assembler functions from C coded
> applications when the data processing finishes. My doubts are:
>
> 1. In general for both solutions: How can I assign ONE specific
> periodic interruption (for example timer's) to the PD1 or the idle
> option so it wakes up ONLY by that interruption?
>
> 2. For Idle Solution: I have realized that it doesnīt matter
> how many NOPs I put between the label and the branch instruction
> (even anyone), because the behaviour is the same: it halts and wakes
> up when any interruption occurs.
>
> 3. For PD solution: When I try the PD1 option, the power down
> is not set (it doesnīt halt). In fact, the value of the CSR register
> changes to its original value just after the MVC instruction, and
> when the assembler routine finishes it returns to the main threads
> although any interruption occurs.
>
> Thank you very much in advance,
> King regards
>
> Miguel Ángel



(You need to be a member of code-comp -- send a blank email to code-comp-subscribe@yahoogroups.com )

Re: Re: Halt and wake-up periodically - mi19...@yahoo.es - Mar 23 12:56:35 2007

>
> Jeff-
> 
> > How are you determining the CPU didn't halt?  Do you have CCS + JTAG connected?  I
would guess that if JTAG is active,
> all bets are off for power-down logic.
> 

I have CCS3.1 and it communicates with the dsk6713 through an embedded JTAG emulator with a USB
host interface, I donīt use the external JTAG connector.

I assumed that the CPU is halted when it stops in the MVC instruction or the IDLE one (it only
stops in the IDLE option until ANY interruption happens) when I'm doing the
"Debug-->Step Into" option of CCS but I didnīt realize that it wouldnīt work if
the JTAG is active. In that case: How can I determine that it is halted? In fact, the USB must
be plug-in to download and execute the program in the DSK.

And, How can I assign one and only one specific interruption to make it wake up?

Thank you very much for your time, best regards
- Miguel



(You need to be a member of code-comp -- send a blank email to code-comp-subscribe@yahoogroups.com )

Re: Re: Re: Halt and wake-up periodically - Jeff Brower - Mar 23 23:33:24 2007

Miguel-

> > Jeff-
> >
> > > How are you determining the CPU didn't halt?  Do you have CCS + JTAG connected? 
I would guess that if JTAG is active,
> > all bets are off for power-down logic.
> > I have CCS3.1 and it communicates with the dsk6713 through an embedded
> JTAG emulator with a USB host interface, I donīt use the external
> JTAG connector.
> 
> I assumed that the CPU is halted when it stops in the MVC instruction
> or the IDLE one (it only stops in the IDLE option until ANY
> interruption happens) when I'm doing the "Debug-->Step Into" option of
> CCS but I didnīt realize that it wouldnīt work if the JTAG is active.
> In that case: How can I determine that it is halted? In fact, the USB
> must be plug-in to download and execute the program in the DSK.
> 
> And, How can I assign one and only one specific interruption to make it
> wake up?

I am not sure that JTAG activity would interfere with power-down functionality, it's
my speculation based on experience.  For instance, JTAG activity can have an effect
on McBSP operation (as an example, study the FREE and SOFT bits in McBSP registers,
associated with "HLL debugger"; i.e. JTAG).

What I suggest is that you get an external JTAG emulator and make a small program
that loops continuously, doing two things:

  -toggling a GPIO output

  -looking for a GPIO input change

The GPIO input change should cause the program to branch to your power down code, and
code immediately after the power-down (the "return code") should go back to the loop
again.  Make sure you have a clean way to toggle the GPIO input, with no bounce
(don't do it by hand).

Then, download and run this short test program inside CCS, and disconnect the JTAG
emulator (physically disconnect the header) while it's running.  If you are careful
and pull the header off evenly (do not pull 5V pin first) then the DSP will continue
to run.  Then toggle the GPIO input.  If you see the output stop, power-down worked.

-Jeff



(You need to be a member of code-comp -- send a blank email to code-comp-subscribe@yahoogroups.com )