vTickISR for ARM7 (LPC2138) not OK?

kuppi wrote on Wednesday, February 20, 2008:

To completely understand my issue, may be it’s worth to have a look to my former opened thread, when i started using FreeRTOS with my ARM7 (LPC2138) board.
Title is: “ARM7 LPC2138 problem with portRESTORE_CONTEXT”
https://sourceforge.net/forum/forum.php?thread_id=1939761&forum_id=382005

To get the FreeRTOS running on my board, i need to adapt the portISR.c file. The vTickISR function needs to be modified from:
    /* Ready for the next interrupt. */
    T0_IR = portTIMER_MATCH_ISR_BIT;
    VICVectAddr = portCLEAR_VIC_INTERRUPT;

After reading the (vectored) interrupt handling section in the "LPC213x User Manual" which i downloaded from NXP website, i found out that the reset condition for interrupt is 0. So i modified the implementation to:
    /* Ready for the next interrupt. */
    T0_IR |= portTIMER_MATCH_ISR_BIT;
    T0_IR &= ~portTIMER_MATCH_ISR_BIT;
    VICVectAddr = portCLEAR_VIC_INTERRUPT;

Now the FreeRTOS is running on my board. Without the clear bit instruction (set reset condition for interrupt) the vTickISR routine is only called once.

Bye,
Kuppi…

rtel wrote on Wednesday, February 20, 2008:

That’s odd, I’ve never had a problem with this and used the code on many different LPC2000 devices.  I will look at it.  Can you provide a link to the doc you downloaded, and a page number?  Thanks.

Regards.

rtel wrote on Thursday, February 21, 2008:

From my LPC2138 manual, ref the T0_IR register:

"Interrupt Register (IR, TIMER0: T0IR - 0xE000 4000 and TIMER1: T1IR - 0xE000 8000)
The Interrupt Register consists of four bits for the match interrupts and four bits for the
capture interrupts. If an interrupt is generated then the corresponding bit in the IR will be
high. Otherwise, the bit will be low. Writing a logic one to the corresponding IR bit will reset
the interrupt. Writing a zero has no effect."

Seems writing a 1 to the register (as per the FreeRTOS.org code) is the correct operation.

Regards.

kuppi wrote on Wednesday, February 27, 2008:

At first i’ve to say that i’m sorry for the confusion. Of course Richard is right as you can see in the description of the “User Manual”:
14.5.1 Interrupt Register (IR, TIMER0: T0IR - 0xE000 4000 and TIMER1: T1IR
- 0xE000 8000)
The Interrupt Register consists of four bits for the match interrupts and four bits for the
capture interrupts. If an interrupt is generated then the corresponding bit in the IR will be
high. Otherwise, the bit will be low. Writing a logic one to the corresponding IR bit will reset the interrupt. Writing a zero has no effect.

I haven’t read the manual carefully, just had a fast overview and mis-interpreted the “Reset value”. With the “Reset value” is meant, the value which is initialized after a reset condition and not the value to reset the register. (Sorry)

My real problem was my assembler startup code. Now my ARM7 board is up and running with FreeRTOS.

Bye,
Kuppi…