Hi,
In the project, LPC1788 use external SDRAM as framebuffer to drive TFT-LCD(320 x 240)。In the routines(LCD) ,there is a code snippet description:
#define LCD_VRAM_BASE_ADDR ((unsigned long)SDRAM_BASE + 0x00010000)
// Frame Base Address doubleword aligned
LPC_LCD->UPBASE = LCD_VRAM_BASE_ADDR & ~7UL ;
LPC_LCD->LPBASE = LCD_VRAM_BASE_ADDR & ~7UL ;
Now I have a confusion about the address setting,why address offset is 0x00010000。What is the consideration of this offset setting?
Hi @Mrzhong,
Could you specify what project you are using? Are you using an LPCOpen example code? Where did you find this code snippet?
Most likely, this is to offset the address into the correct section of the memory map. Please look into section 2.1 of the User Manual for more information on peripheral addressing:
https://www.nxp.com/webapp/Download?colCode=UM10470
BR,
Edwin.
Hi,
In LPCOpen example code, I didn't find example about LCD.In the website:https://www.embeddedartists.com/products/lpc1788-developers-kit/there is an example s_display_truly_lcd_32 in lpc1788_samples_150612 software resources.
In this example code,there is a code snippet description in sdram.h
#define SDRAM_SPEED SDRAM_SPEED_60
#define SDRAM_CONFIG_32BIT
#define SDRAM_SIZE 0x2000000
#define SDRAM_BASE 0xA0000000 /*CS0*/
Chapter 2: LPC178x/7x Memory map, 0xA000 0000 - 0xAFFF FFFF is Dynamic memory chip select 0 (up to 256MB).
We use RGB888 color depth and put framebuffer in external SDRAM。In the main.c , there is a code snippet description about framebuffer:
#define DISPLAY_WIDTH 240
#define DISPLAY_HEIGHT 320
...
int32_t framebuf = (int32_t)(SDRAM_BASE+0x10000);
sdram_init();
memset((void*)(framebuf), 0x00, 240*320*2);
/*dev_lcd = */truly_lcd_open(framebuf);
fblog = (COLOR_T*)framebuf;
Combined with other example code related LCD , the framebuffer was always setted equal to SDRAM_BASE plus 0x10000 no mater what the resolution of LCD is, such as 240x320, 480 x 272. My confusion is why not use SDRAM_BASE as the beginning address of frambuffer? In this scenario, the offset 0x10000 is a fixed value or a random value?