Reply by Micah Caudle August 19, 20062006-08-19
This is off the top of my head so take it with a grain
of salt but I have 2 thoughts about this besides
Jeff's idea which certainly does need to be checked.
You may have enabled INTM too early. If you are using
DSP/BIOS at all, I seem to recall it being a 'no no'
to enable interrupts with INTM in main(). That is
something that DSP/BIOS does for you after everything
in main() or called from main() runs and returns and
then DSP/BIOS does it's own setup stuff and enables
INTM. If you are enabling interrupts in main(), main()
could be getting interrupted before it completes so
all your intitialization stuff would not complete and
you wouldn't want that. Check on that. The other
thought is that it looks strange that you are messing
with the timer control reg's in the isr. I just don't
think that is necessary. doesn't the timer
automatically reset itself and start running again
after it's interrupt is flagged? Maybe after the
initial timer configuration and starting, you should
just leave those registers alone. Also keep an eye on
the IFR to make sure the interrupt is getting flagged
at all and make sure it's not accidentally getting
cleared before the isr runs or anything silly like
that. Hope that helps.
-Micah

>
> 1a. 5402 - GPIO Problem
> Posted by: "vijay_asm" v...@yahoo.com
> vijay_asm
> Date: Fri Aug 18, 2006 5:11 am (PDT)
>
> I work on 5402 DSP. I face a problem in I/O. 5402
> has HPIport which
> can also be used as IO Port. I am using this port as
> Output.
>
> The problem is Iam able to write to the IO in Main
> loop, but is ISR
> the port is not in control. I written a toggling
> code, the pins
> toggled well in mainloop, but the same didnt work in
> ISR.
>
> I Tried both Asm and C, no use. in asm, i tried
> different
> instructions to write to the pin, it worked only in
> main loop.
>
> This applied for all 8 I/Os.
>
> The interrupt i use is Timer 0
>
> THis is the flow of my code.
>
> ----------------------
> I/O Init:-
> Config the GPIOCR direction
> ----------------------
> Timer Init:-
> Enable Global interrupts at INTM
> Enable Timer 0 interupt at IMR
> Stop the Timer - TCR
> Load TIM with timer reload value
> Start the timer
> ----------------------
> ISR:-
> Stop the Timer
>
> Read the port
> Compliment it
> Write back
>
> Load the TIM with timer reload
> Start the timer
> Return
> ----------------------
>
> Anyone has an idea why is it so?
>
> Note:I have grounded the HPIENA pin in DSP, to
> disable the HPI
> Functionality[as per datasheet]
>
> Thanks,
> Vijay
>

__________________________________________________
Reply by Jeff Brower August 18, 20062006-08-18
Vijay-

> I work on 5402 DSP. I face a problem in I/O. 5402 has HPIport which
> can also be used as IO Port. I am using this port as Output.
>
> The problem is Iam able to write to the IO in Main loop, but is ISR
> the port is not in control. I written a toggling code, the pins
> toggled well in mainloop, but the same didnt work in ISR.
>
> I Tried both Asm and C, no use. in asm, i tried different
> instructions to write to the pin, it worked only in main loop.

My first guess is that your ISR code did not actually run. Did you use CCS and set a
breakpoint to make sure you are inside the ISR?

-Jeff

> This applied for all 8 I/Os.
>
> The interrupt i use is Timer 0
>
> THis is the flow of my code.
>
> ----------------------
> I/O Init:-
> Config the GPIOCR direction
> ----------------------
> Timer Init:-
> Enable Global interrupts at INTM
> Enable Timer 0 interupt at IMR
> Stop the Timer - TCR
> Load TIM with timer reload value
> Start the timer
> ----------------------
> ISR:-
> Stop the Timer
>
> Read the port
> Compliment it
> Write back
>
> Load the TIM with timer reload
> Start the timer
> Return
> ----------------------
>
> Anyone has an idea why is it so?
>
> Note:I have grounded the HPIENA pin in DSP, to disable the HPI
> Functionality[as per datasheet]
>
> Thanks,
> Vijay
Reply by vijay_asm August 18, 20062006-08-18
I work on 5402 DSP. I face a problem in I/O. 5402 has HPIport which
can also be used as IO Port. I am using this port as Output.

The problem is Iam able to write to the IO in Main loop, but is ISR
the port is not in control. I written a toggling code, the pins
toggled well in mainloop, but the same didnt work in ISR.

I Tried both Asm and C, no use. in asm, i tried different
instructions to write to the pin, it worked only in main loop.

This applied for all 8 I/Os.

The interrupt i use is Timer 0

THis is the flow of my code.

----------------------
I/O Init:-
Config the GPIOCR direction
----------------------
Timer Init:-
Enable Global interrupts at INTM
Enable Timer 0 interupt at IMR
Stop the Timer - TCR
Load TIM with timer reload value
Start the timer
----------------------
ISR:-
Stop the Timer

Read the port
Compliment it
Write back

Load the TIM with timer reload
Start the timer
Return
----------------------

Anyone has an idea why is it so?

Note:I have grounded the HPIENA pin in DSP, to disable the HPI
Functionality[as per datasheet]

Thanks,
Vijay