PDA

View Full Version : Simple timer code causes timeout


23bpg
01-10-2008, 10:59 PM
Part of the project I'm working on requires a timer-driven interrupt. To test the feasibility of using Timer A I wrote this short code:


unsigned long int c,s,j;

root interrupt void TimerAISR()
{
c=MS_TIMER-s;
//j=RdPortI(TACSR);
s=MS_TIMER;
}

main ()
{
s=MS_TIMER;
WrPortI(TAPR,NULL,0x01);
WrPortI(TAT7R,NULL,255);
SetVectIntern(0x0A,TimerAISR);
WrPortI(TACSR,&TACSRShadow,0x80|0x01);
WrPortI ( TACR, &TACRShadow,0x01);
while (1) printf("%ld\t%ld\n",c,j);
}



All of this compiles fine on the RCM3400 board I work with. However, the code does not execute, and an error message pops up: "While Debugging: Timeout while waiting for response from target."

On the other hand, when I declare TimerAISR() as void (as opposed to root interrupt void), everything works fine. What am I doing wrong? Or is there some hardware defect on my board?

23bpg
01-10-2008, 11:45 PM
Also, on the same board,

WrPortI(TAPR,NULL,0x00);

causes the same timeout; apparently, I can only set TAPR to 0x01 (corresponding to perclk/2) and not 0x00 (perclk).

Why?