Yahoo Groups archive

Lpc2000

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

Message

Re: Strange timer problem

2005-03-30 by Leighton Rowe

Peter,

What's your current configuration of the stack pointers (in User 
mode,IRQ,FIQ, etc.)? Chances are that the Data aborts you've been 
getting are due to stack overflows, which usually leads to the 
assembly registers having unexpected values during code execution. 
Stack Overflows are the toughest errors to catch, even when 
debugging the machine thru JTAG. 
 
Leighton

--- In lpc2000@yahoogroups.com, "peterburdine" <lordofdawn@h...> 
wrote:
> 
> I figured it out.  It didn't work as and irq, so I switched it to 
fiq
> and added VICIntSelect = 1<<4; and it seems to work just fine now. 
> Although I wonder why it didn't work as an irq.  And yes I know 
that
> when the msg was first posted I had __fiq on the ISR, that was my
> halfway between code, I had __irq on them originally.
> 
> --Peter
> 
> --- In lpc2000@yahoogroups.com, "peterburdine" <lordofdawn@h...> 
wrote:
> > 
> > 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.