lpcware

System crashes with change of variable size

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by andrejvrecer on Tue Dec 16 10:36:33 MST 2014
Hi,

I am using LPC1549 processor.
I have put together some example code from lpcOpen (USB VCOM, ADC, DAC) All is working. Have been using VCOM for debug printouts. Now I have added TFT LCD to show some ADC data on it. All was working until I haven't use frame buffer and I draw directly to LCD memory. Then I wished to use frame buffer and problems started :(

After some research I found out there is a stack problem since stack is addressed at end of first RAM bank. I have changed in MCU setting that there is only one bank with size 0x9000 (I use LPC1549 with 36k RAM)

I have static uint16_t framebuffer[LCD_X*LCD_Y] array. LCD_X is always 128 and if I set LCD_Y to 80 all is working. (framebuffer size is 20480byte) but if I change LCD_Y size to 40 or 20 ( so less then 80), system crashes immediately even if I don't use framebuffer array at all!

What is wrong? What am I missing?

This code is working on different project with the same TFT LCD and LPC1758 with different compiler so code should be correct.

Andrej

Outcomes