lpcware

emWin on MCB4357 - Can't make it work...

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by DT1 on Wed Nov 06 10:45:42 MST 2013
Hi,

Anybody managed to make emWin work on a Keil MCB4357 v1.3?

As a base, I'm using the downloaded LPCWare example named "LPC4357-EVB emWin". It uses the Lin driver and uses the SDRAM for memory. That example seems to be for another board (the Hitex one?), so I changed pin attribution for the Backlight.

Upon calling GUI_Init(), my backlight is ON, but I can't put anything on the screen...

Some functions :

{
...
        if (GUI_Init() != 0)
{
goto END;
}

// Do some drawing tests.
GUI_SetBkColor(GUI_RED);
GUI_Clear();
GUI_Delay(1000);
GUI_SetBkColor(GUI_GREEN);
GUI_Clear();
GUI_Delay(1000);
GUI_SetBkColor(GUI_BLUE);
GUI_Clear();
GUI_Delay(1000);

GUI_SetBkColor(GUI_BLACK);
GUI_Clear();
...
}




void LCD_X_Init(void)
{
int  i;

// Configure the operating mode for involved pins.
  scu_pinmux(NBSP_MCUPIN_LCD_DOTCLK_PORT,NBSP_MCUPIN_LCD_DOTCLK_PIN, MD_PUP, NBSP_MCUPIN_LCD_DOTCLK_PIN_MODE);
scu_pinmux(NBSP_MCUPIN_LCD_VSYNC_PORT, NBSP_MCUPIN_LCD_VSYNC_PIN, MD_PUP, NBSP_MCUPIN_LCD_VSYNC_PIN_MODE);
scu_pinmux(NBSP_MCUPIN_LCD_ENABLE_PORT, NBSP_MCUPIN_LCD_ENABLE_PIN, MD_PUP, NBSP_MCUPIN_LCD_ENABLE_PIN_MODE);
scu_pinmux(NBSP_MCUPIN_LCD_HSYNC_PORT, NBSP_MCUPIN_LCD_HSYNC_PIN, MD_PUP, NBSP_MCUPIN_LCD_HSYNC_PIN_MODE);
scu_pinmux(NBSP_MCUPIN_LCD_BL_EN_PORT, NBSP_MCUPIN_LCD_BL_EN_PIN, MD_PUP, NBSP_MCUPIN_LCD_BL_EN_PIN_MODE);// Used as GPIO.

scu_pinmux(NBSP_M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11_PORT, NBSP_MCUPIN_LCD_VD11_PIN,MD_PUP, NBSP_MCUPIN_LCD_VD11_PIN_MODE);
scu_pinmux(NBSP_MCUPIN_LCD_VD12_PORT, NBSP_MCUPIN_LCD_VD12_PIN, MD_PUP, NBSP_MCUPIN_LCD_VD12_PIN_MODE);
scu_pinmux(NBSP_MCUPIN_LCD_VD13_PORT, NBSP_MCUPIN_LCD_VD13_PIN, MD_PUP, NBSP_MCUPIN_LCD_VD13_PIN_MODE);
scu_pinmux(NBSP_MCUPIN_LCD_VD14_PORT, NBSP_MCUPIN_LCD_VD14_PIN, MD_PUP, NBSP_MCUPIN_LCD_VD14_PIN_MODE);
scu_pinmux(NBSP_MCUPIN_LCD_VD15_PORT, NBSP_MCUPIN_LCD_VD15_PIN, MD_PUP, NBSP_MCUPIN_LCD_VD15_PIN_MODE);
scu_pinmux(NBSP_MCUPIN_LCD_VD16_PORT, NBSP_MCUPIN_LCD_VD16_PIN, MD_PUP, NBSP_MCUPIN_LCD_VD16_PIN_MODE);
scu_pinmux(NBSP_MCUPIN_LCD_VD17_PORT, NBSP_MCUPIN_LCD_VD17_PIN, MD_PUP, NBSP_MCUPIN_LCD_VD17_PIN_MODE);
scu_pinmux(NBSP_MCUPIN_LCD_VD18_PORT, NBSP_MCUPIN_LCD_VD18_PIN, MD_PUP, NBSP_MCUPIN_LCD_VD18_PIN_MODE);
scu_pinmux(NBSP_MCUPIN_LCD_VD19_PORT, NBSP_MCUPIN_LCD_VD19_PIN, MD_PUP, NBSP_MCUPIN_LCD_VD19_PIN_MODE);
scu_pinmux(NBSP_MCUPIN_LCD_VD20_PORT, NBSP_MCUPIN_LCD_VD20_PIN, MD_PUP, NBSP_MCUPIN_LCD_VD20_PIN_MODE);
scu_pinmux(NBSP_MCUPIN_LCD_VD21_PORT, NBSP_MCUPIN_LCD_VD21_PIN, MD_PUP, NBSP_MCUPIN_LCD_VD21_PIN_MODE);
scu_pinmux(NBSP_MCUPIN_LCD_VD22_PORT, NBSP_MCUPIN_LCD_VD22_PIN, MD_PUP, NBSP_MCUPIN_LCD_VD22_PIN_MODE);
scu_pinmux(NBSP_MCUPIN_LCD_VD23_PORT, NBSP_MCUPIN_LCD_VD23_PIN, MD_PUP, NBSP_MCUPIN_LCD_VD23_PIN_MODE);

// Set direction for GPIO pins.
GPIO_SetDir(NBSP_DO_LCD_BL_EN_GPIO_PORT, GPIO_PIN_MASK(NBSP_DO_LCD_BL_EN_GPIO_PIN), NBSP_GPIO_DIR_OUTPUT);

// Delay.
for(i = 0; i < 1000000; i++);

LPC_RGU->RESET_CTRL0 = (1U << 16);
while ((LPC_RGU->RESET_ACTIVE_STATUS0 & (1U << 16)) == 0);

LPC_LCD->CTRL &= ~(1 << 0);           /* Disable LCD                        */
LPC_LCD->INTMSK = 0;                  /* Disable all interrupts             */
 
LCD_Init_CFG(LPC_LCD, (LCD_CFG_Type*)&Sharp);
LCD_SetFrameBuffer(LPC_LCD, (void*)0x28000000);
LCD_Power(LPC_LCD, ENABLE);

// Delay.
for(i = 0; i < 1000000; i++);

// Enable Backlight
GPIO_SetValue(NBSP_DO_LCD_BL_EN_GPIO_PORT, GPIO_PIN_MASK(NBSP_DO_LCD_BL_EN_GPIO_PIN));
}

Outcomes