Yahoo Groups archive

Lpc2000

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

Message

Strange timer problem

2005-03-30 by peterburdine

I'm using the Keil's compiler and I'm trying to setup a system clock
that increments every 5ms.  I am doing this by having a unsigned long
int that gets incremented on the timer interrupt.  The timer also
resets when the interrupt occurs.  The problem is this seems to
somehow corrupt a few registers every once in a while and will
generally end up in a data abort.  I believe the timer must be the
cause because if I remove it, I no longer have these problems. 

I'd appreciate any suggestions.

The applicable code is listed here:

unsigned long int getTickCounter (void);
void T0_ISR (void) __arm __fiq;
unsigned long int tickCount = 0;



	T0MR0 = PCLK/200; // Every 50ms
	T0IR = 0xF;	// Clear Interrupts on MR0	
	T0MCR = 0x03;  // Reset and Interrupt on MR0
	VICIntEnable = 1 << 4;
	VICVectAddr3 = (unsigned long)T0_ISR;
	VICVectCntl3 = 0x20 | 4;
	T0TCR = 0x2;	// Reset the timer
	T0TCR = 0x1;	// Start the timer


void T0_ISR(void) __arm __fiq {
	tickCount++;

	// Clear Interrupts
	VICVectAddr = 0;
	T0IR = 0x1;	
}


This is a very useful function!
void DAbt_Handler(void) __arm __irq {
	Uint32 i;	
	// Grab the return address (location where mem access failed)
	__asm	{STAV R14, R0, i};
	printf("*****Data abort occured 0x%x *****", i);
	// Now just spin
	while(1);
}

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.