System crashes with change of variable size

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

System crashes with change of variable size

849件の閲覧回数
lpcware
NXP Employee
NXP Employee
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

ラベル(1)
0 件の賞賛
返信
5 返答(返信)

826件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by andrejvrecer on Wed Dec 17 10:17:23 MST 2014
Hi all,

dis some more tests and because all of this made no sense I replaced processor on my board. All is working now ok so it seams there was some "hardware" bug inside processor :(

Thank you for your help now lets go back to work :)

Andrej
0 件の賞賛
返信

826件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by andrejvrecer on Tue Dec 16 23:17:39 MST 2014
Did you try with 7.2 or 7.5?

I would also say that something overwrites but when using array of 128 x 80 all is ok, when using smaller (128x20) is causing problems :( and even if I write only to first field and not to all array.

I am making more examples now with 7.5 and more or less all code started to work on xpresso board but not on my so I think I will replace processor on my board.

Andrej
0 件の賞賛
返信

826件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Tue Dec 16 15:46:06 MST 2014

Quote: andrejvrecer
I can tell how system crashes but you can easyly try it.



Nope  :p

Working without problems here. With and without optimization and even after filling this array  :((

Could be useful if you post your project....

BTW: From your description I would guess that your code is somewhere using this array with 128x80 and overwriting something else...
0 件の賞賛
返信

826件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by andrejvrecer on Tue Dec 16 12:02:36 MST 2014
Hi,

At this moment I am downloading 7.5 version (I am using 7.2) I can tell how system crashes but you can easyly try it.

Have tried to open lpcOpen project lpc15xx usbd_rom_cdc and compile it, put it on test board and it works. After adding to the top of cdc_main.c file this:

#define FRAME_BUFFER_WIDTH   128
#define FRAME_BUFFER_HEIGHT  80

//Frame buffer is 128pix wide and 80pix height.
static uint16_t frameBuffer[FRAME_BUFFER_WIDTH * FRAME_BUFFER_HEIGHT];

it increased bss size and it still works. Then changing frame buffer height to 20
#define FRAME_BUFFER_HEIGHT  20

it stoped working. USB VCOM is not detected anymore on Windows PC. Nothing happens.

bss size is correct, flash code didn't change so all this make no sense. Will report back what is status with Xpresso v7.5

Andrej
0 件の賞賛
返信

826件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Tue Dec 16 10:47:32 MST 2014
What do you mean "crashes". Explain exactly what is happening and then we might be able to help you debug it...
0 件の賞賛
返信