Yahoo Groups archive

Lpc2000

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

Thread

LPC2129 timer0 Startup problem

LPC2129 timer0 Startup problem

2006-04-23 by arm_newbie

Hello,
i have the Olimex LPC-P2129 Development-Board, and I use the Keil 
µVision3 IDE (Demo Version). 
My problem ist the Timer0 interrupt. Everytime I want to built my 
program, I get the message
- assembling Startup.s…
- Startup.s (368): error: A1516E: Bad symbol `TimerInterrupt0', not 
defined or external
what is the Problem?
I have in my main.c a part named "void TimerInterrupt0()", at this 
part of the Program should be jumped if the timer0 interrupt is 
active. 

Startup.s.:
stmfd   r13!, {r12, r14}     ; save r12 & r14 */
mrs     r12, spsr               ; save the spsr  */
stmfd   r13!, {r12}              
msr     cpsr_c, #0x93           ; switch to Supervisor mode */  
stmfd   r13!, {r0-r3, r14}      ; save Supervisor mode registers */   
msr     cpsr_c, #0x13           ; enable interrupts */
bl      TimerInterrupt0         ; go handle the interrupt, this
                                ;is declared in TIMER.C */ 
msr     cpsr_c, #0x93           ; disable interrupts */ 
ldmfd   r13!, {r0-r3, r14}   ; restore Supervisor mode registers */   
msr     cpsr_c, #0x92           ; switch back to irq mode */
ldmfd   r13!, {r12}             ; restore spsr */
msr     spsr_cxsf, r12
ldmfd   r13!, {r12, r14}        ; restore r12 & r14 */
stmfd   r13!, {r0-r1}            ; save r0 & r1 */
ldr     r0, =VICVectAddr0        ; update VIC */
mov     r1, #0xff
str     r1, [r0]
ldmfd   r13!, {r0-r1}            ; restore r0 & r1 */
subs    pc, lr, #0x4             ; return from the interrupt */

main.c:
void TimerInterrupt0() 
{
   // Write the values out to the LEDs...
   	unsigned int green  = 0x00002000;
	unsigned int yellow = 0x00001000;
			
			IOSET0 = yellow;  	
			IOSET0 = green;

   // Wait for half the timer period...
   while (*(volatile unsigned long *)TIMER0_TC < 
(ulGlobalMaxTimer0Value / 2));

   // Clear the interrupt bit within the IR register...
   *(volatile unsigned long *)TIMER0_IR = 0xFF;
}


Thanks for our help
Bye Christian

Re: LPC2129 timer0 Startup problem

2006-04-24 by atmelbr

Hi,
   Why you need to put timer interrupt on startup ?
Write your interrupt using C language.

void TimerInterrupt0 (void) __irq
{
...
}

Or put on startup

EXTERN CODE32 (TimerInterrupt0?A)
Show quoted textHide quoted text
>
> Hello,
> i have the Olimex LPC-P2129 Development-Board, and I use the Keil 
> µVision3 IDE (Demo Version). 
> My problem ist the Timer0 interrupt. Everytime I want to built my 
> program, I get the message
> - assembling Startup.s

> - Startup.s (368): error: A1516E: Bad symbol `TimerInterrupt0', not 
> defined or external
> what is the Problem?
> I have in my main.c a part named "void TimerInterrupt0()", at this 
> part of the Program should be jumped if the timer0 interrupt is 
> active. 
> 
> Startup.s.:
> stmfd   r13!, {r12, r14}     ; save r12 & r14 */
> mrs     r12, spsr               ; save the spsr  */
> stmfd   r13!, {r12}              
> msr     cpsr_c, #0x93           ; switch to Supervisor mode */  
> stmfd   r13!, {r0-r3, r14}      ; save Supervisor mode registers */   
> msr     cpsr_c, #0x13           ; enable interrupts */
> bl      TimerInterrupt0         ; go handle the interrupt, this
>                                 ;is declared in TIMER.C */ 
> msr     cpsr_c, #0x93           ; disable interrupts */ 
> ldmfd   r13!, {r0-r3, r14}   ; restore Supervisor mode registers */   
> msr     cpsr_c, #0x92           ; switch back to irq mode */
> ldmfd   r13!, {r12}             ; restore spsr */
> msr     spsr_cxsf, r12
> ldmfd   r13!, {r12, r14}        ; restore r12 & r14 */
> stmfd   r13!, {r0-r1}            ; save r0 & r1 */
> ldr     r0, =VICVectAddr0        ; update VIC */
> mov     r1, #0xff
> str     r1, [r0]
> ldmfd   r13!, {r0-r1}            ; restore r0 & r1 */
> subs    pc, lr, #0x4             ; return from the interrupt */
> 
> main.c:
> void TimerInterrupt0() 
> {
>    // Write the values out to the LEDs...
>    	unsigned int green  = 0x00002000;
> 	unsigned int yellow = 0x00001000;
> 			
> 			IOSET0 = yellow;  	
> 			IOSET0 = green;
> 
>    // Wait for half the timer period...
>    while (*(volatile unsigned long *)TIMER0_TC < 
> (ulGlobalMaxTimer0Value / 2));
> 
>    // Clear the interrupt bit within the IR register...
>    *(volatile unsigned long *)TIMER0_IR = 0xFF;
> }
> 
> 
> Thanks for our help
> Bye Christian
>

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.