Reply by Jeff Brower March 24, 20072007-03-24
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 dont 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 didnt realize that it wouldnt 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
Reply by mi19...@yahoo.es March 23, 20072007-03-23
>
> 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 dont 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 didnt realize that it wouldnt 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
Reply by Jeff Brower March 21, 20072007-03-21
Miguel-

> 3. For PD solution: When I try the PD1 option, the power down
> is not set (it doesnt 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 doesnt 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 doesnt 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 gel
Reply by mi19890 March 21, 20072007-03-21
Hi all,
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 doesnt 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 doesnt 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 gel