LPC2478 and J-Link debugging

jegy wrote on Saturday, April 13, 2013:


I have now FreeRTOS running on a LPC2478.
Please observe the following:

- I use IAR EW 5.4
- I use Segger J-Link Ultra JTAG debugger
- HW platform is “old”, and is known for me. It is a subset of the Olimex LPC2478-STK with a QVGA color touch screeen. It runs normally the application, with a simple scheduler and my job is now to modify the application to run under FreeRTOS.

- I have started FreeRTOS with only one appTask and the idleHook,
- I can toggle port pins in the the timerISR, in the appTask and in the idleHook for observing on an oscilloscope where the CPU time is spent.

- When the FreeRTOS application runs without debugger, everything is perfect.

- When It runs from the EW, via the JTAG, the timing is corrupted. In the J-link Control Panel, I can see that when my FreeRTOS application runs, there are several hundred times more calls bewtween the J-Link and the CPU, than when the original old application is running. I guess these calls halts/blocks the CPU.
It seems that every time the FreeRTOS shall switch task, the CPU is halted/blocked for app. 8-10ms

I guess that it has something to do with the ARM operating mode or that the J-link and FreeRTOS both makes use of the “SWI” and therefore disrupts each other 

Q1: Have you earlier seen similar behavior?

Q2: Can the “yieldfromApi” function be implemented in an other way than using the “SWI” if this is the reason for the halt/blocing the CPU?

Q3: Do you have a more simple solution?

Q4: Do you think the problem also exists if I replace the LPC2478 with the pincompaible CM-3 LPC1788?

I am not a novice in FreeRTOS, I have made several projects with AT-mega, STM32 and H8.

Best Regards,


rtel wrote on Saturday, April 13, 2013:

I have no knowledge of the internal workings of the JLink, so can only offer general suggestions:

Do you use semi-hosting?  Or have semi-hosting enabled?  (it is one of the project options, and is used to allow printf() messages to be directed to the debugger).  Semi hosting will cause a lot of debugger traffic and will definitely stall the CPU.

I think on those parts the pins used by the JTAG are multiplexed with other pin functions.  Have you set up the CPU correctly for JTAG use (ensure the same pins are not being used for any other purpose).


jegy wrote on Saturday, April 13, 2013:

Thank you for the quick answer!

The JTAG pins are reserved for only JTAG use.

I had no intentions for using semi-hosting, I don’t know why this button was checked, but now I have checked the IAR-breakpoint instead, so it no seems to be working OK, thank you!

On my oscilloscope I can see that I have a spurious time interrupt now and then, but this shuold be possible to get rid of.

Have a nice weekend