Interrupts driven UART in LPC2368

egnascimento wrote on Friday, August 14, 2009:

I don’t know what is really happening, but I’m just trying to insert serial.c (from LPC2000_GCC) in LPC2368_ECLIPSE example.

It seems to be working fine, except that after a defined number of interrupts (of PutChar in flash.c task) , the ARM freezes. It’s the same number, always! In average, 596 putchars and the program stops. If I change optmization level from 0 to 1, this number changes to 1800 putchars. Anyway, I don’t know where is the problem. Could somebody help me?

I’m using yagarto and FreeRTOS 5.4.2, last yagarto version (Binutils-2.19., Newlib-1.17.0, GCC-4.3.3, GDB-6.8.50-20080308, Insight-6.8.50-20080308) and Windows XP.

The code is in .

Thanks in advance,
Eduardo Garcia

egnascimento wrote on Saturday, August 15, 2009:

Now, I tried  change the IRQ size to 0x400 (just like boot.s in LPC2106 example) but it is not the problem.


Any ideas?

egnascimento wrote on Monday, August 17, 2009:

Unfortunatelly, not yet… I have tried the interrupts without queue functions and the result is the same. After exacts 2021 SendPutChars, or after receive 2021 characters, the firmware stop working.

I have tried with vApplicationStackOverflowHook but this function haven’t been called.

This number changes regard to optimization level. By the way, I’m using -O1 now.

IMHO, it really seems to be a stack problem because the well defined number of interrupts that causes the error. But, increasing IRQ stack in boot.s there is no changes. And if a send chars over UART0 with no interrupts, this problem doesn’t happen.

The source code now is a bit changed from the posted… but the error is the same. :frowning:

egnascimento wrote on Tuesday, August 18, 2009:

I’ve just discovered and fixed the problem.

There as a mistake in uart wrapper function prototype, so that, the real function was not a naked function. Each time that the uart_wrap function was called, the stack wasn’t recovered.

Once I declared uart wrapper function correctly, everything starts working fine.