Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Timer issues

2005-07-26 by soren_t_hansen

I'm having some problems with the timer on a lpc2132 in the following
way: I'm developing a program which I'm running from RAM while
debugging. I've set up MEMMAP=2 to remap the interrupt vectors and it
does work .... sometimes. Here goes ..

I use Eclipse with the Zylin embedded plugin. When I want to debug I
download the program and starts execution. But the first time I end up
in the DApt_Handler no matter what. Then I download the program once
more (without powercycling the board) and this time it all runs
without problems (I'm watching a global counter). If I then try to
download once more, it sometimes work and sometimes don't.
I have the ADC running at the same time and it suffers the same
problems, but if I run without the timer and just the ADC it works
like a charm. If I run the Timer without the ADC I still get the problem.

I have the following code to setup my timer:
  // 15000 counts * 1/15 MHz = 1000 uS (1 kHz)	
  T0MR0 = 14999;	   					
  
  // Interrupt and Reset on MR0   
  T0MCR = 3;                            
  
  // Timer0 Enable                
  T0TCR = 1;                 
             
  // set interrupt vector    
  VICVectAddr1 = (unsigned long)tc0;    
  
  // use it for Timer 0 Interrupt 
  VICVectCntl1 = 0x20 | 4;      
          
  // Enable Timer0 Interrupt	
  VICIntEnable |= 0x00000010;

The interrupt handler looks like this:

	void tc0 (void) __attribute__ ((interrupt ("IRQ")));    
	
	void tc0 (void)
	{
		count++;
		
		// Clear interrupt flag
	 	T0IR = 1; 
		// Acknowledge interrupt      
		VICVectAddr = 0;                              
  	}

Has anyone encountered this problem, or is able to see whats causing
the problem? I'm drawing blanks ...

Best Regards
Søren

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.