# LPC23xx

**URL:** <https://forums.freertos.org/t/lpc23xx/2891>\
**Category:** Kernel\
**Created:** [November 19, 2012, 2:42pm UTC](https://forums.freertos.org/t/lpc23xx/2891 "2012-11-19T14:42:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 19, 2012, 2:42pm UTC](https://forums.freertos.org/t/lpc23xx/2891/1 "2012-11-19T14:42:35Z")

</div>

**[oxo147](https://sourceforge.net/u/oxo147/)** wrote on [Monday, November 19, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/7ea7f3b7/#6ad7):

I’m just starting a new project with freertos on LPC2387, Code Red tools. I’ve used their wizard to make a new shell freertos project.

It builds and loads fine, but vectors to program abort

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LDR&nbsp;&nbsp; pc,\_pabt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // program abort

when portRESTORE\_CONTEXT()

in

vPortISRStartFirstTask() is called.

It’s using freertos v 7.0.1

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [November 19, 2012, 3:19pm UTC](https://forums.freertos.org/t/lpc23xx/2891/2 "2012-11-19T15:19:19Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, November 19, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/7ea7f3b7/#eb1b):

As your project was created by somebody else’s tool I can’t support it directly, but suspect your problem will be that the MCU is in the wrong mode.&nbsp; Make sure the MCU is in Supervisor mode when main() is called.

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 19, 2012, 3:57pm UTC](https://forums.freertos.org/t/lpc23xx/2891/3 "2012-11-19T15:57:37Z")

</div>

**[oxo147](https://sourceforge.net/u/oxo147/)** wrote on [Monday, November 19, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/7ea7f3b7/#2781):

Thanks for the fast reply Richard, but I’ve already tried that.

main is called:-

```
        LDR r3, .def__main
        CMP r3, #0
        BEQ .newlib_main
        LDR r10,=__main
        B .call_app
.newlib_main:
        LDR r10,=main
.call_app:
		// Change to user mode (interrupts enabled) before calling main application
        //MSR CPSR_c,#MODE_USR
        // change to Supervisor mode
        msr CPSR_c, #MODE_SVC|I_BIT|F_BIT
        MOV lr,pc
        BX r10 // enter main() - could be ARM or Thumb
```

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 21, 2012, 3:08pm UTC](https://forums.freertos.org/t/lpc23xx/2891/4 "2012-11-21T15:08:41Z")

</div>

**[oxo147](https://sourceforge.net/u/oxo147/)** wrote on [Wednesday, November 21, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/7ea7f3b7/#1086):

So, I am over that problem, but now I have that the ticks are not being incremented. Where are the interrupts re-enabled after the disable in&nbsp; vTaskStartScheduler?

Is it the portRESTORE\_CONTEXT in vPortISRStartFirstTask?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 21, 2012, 3:12pm UTC](https://forums.freertos.org/t/lpc23xx/2891/5 "2012-11-21T15:12:07Z")

</div>

**[davedoors](https://sourceforge.net/u/davedoors/)** wrote on [Wednesday, November 21, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/7ea7f3b7/#c8de):

All the ports disable interrupts before starting the scheduler, then automatically enable them as the context of the first task to run is restored.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 21, 2012, 4:48pm UTC](https://forums.freertos.org/t/lpc23xx/2891/6 "2012-11-21T16:48:58Z")

</div>

**[oxo147](https://sourceforge.net/u/oxo147/)** wrote on [Wednesday, November 21, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/7ea7f3b7/#a656):

This is frustrating. 😉 … as always in embedded …

So the code is running, and I can break in and it’s in the idle task. looks good.

But the xTickCount is not incrementing. So, check the timer setup. That’s correct and the TCR is changing.

VICIrqStatus is 0x10, which means that the interrupt is triggered but not serviced.

cpsr is 0x6000001f, which I interpret to mean that the interrupts are enabled.

So what could be wrong??

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [November 21, 2012, 7:29pm UTC](https://forums.freertos.org/t/lpc23xx/2891/7 "2012-11-21T19:29:04Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Wednesday, November 21, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/7ea7f3b7/#2520):

If interrupts are not disabled, then it sounds like the tick interrupt is simply not executing for some reason.&nbsp; Put a break point in the vPreemptiveTick() function (portISR.c).&nbsp; If it never gets hit, but other interrupts are executing, then check the function vPreemptiveTick() (port.c) is correct for your derivative of the chip.

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 23, 2012, 9:02am UTC](https://forums.freertos.org/t/lpc23xx/2891/8 "2012-11-23T09:02:56Z")

</div>

**[oxo147](https://sourceforge.net/u/oxo147/)** wrote on [Friday, November 23, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/7ea7f3b7/#648d):

It’s all working now. The interrupt issue turned out to be a problem with the Red Probe debug pod.
