Dear Sir/mam
I have generated the code for mcu expresso lpc54608 microcontroller with rtos and emwin . and same free rtos and emwin i tried porting for project on lpc54618J512 microcontroller.
RTOS is working fine but When i try to deploy segger emwin on the target platform for LPC54618J512 microcontroller, the program is getting hung.
I tried troubleshooting the issue and found that GUI_init() function of emwin initialization is causing it to hang and the display shows distorted pixels. Please help me to fix this issue as soon as possible.
Regards
Sunny T
Hi @SunnyT
Are you using a custom board for this or are you using the OM13098? Have you tried importing another example that drives the LCD screen? This would help rule out the possibility of a faulty screen. Also, how does the code hang in the GUI_init() function? More information could be very useful.
BR,
Edwin.
Dear @EdwinHz
Thanks for your reply
we are using lpc54618j512 custom made board . so there are no example for emwin regarding this board .So i was trying out of using lpc54608/lpc54628 emwin library into my existing project on lpc54618j512.
and recently i was trying to use lpc54628 mcu expresso board emwin library and i found it is getting hung in LCD_SetSizeEx() function in LCD_X_Config() please see the code below .
/*
* Copyright (c) 2016, Freescale Semiconductor, Inc.
* Copyright 2016-2017 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "GUI.h"
#include "WM.h"
#include "GUIDRV_Lin.h"
#include "GUIDRV_FlexColor.h"
#include "board.h"
#include "fsl_lcdc.h"
#include "fsl_ctimer.h"
#include "fsl_usart.h"
#include "DIALOG.h"
#include "pin_mux.h"
#include "fsl_sctimer.h"
#include "LCD.h"
#define LCD_WIDTH 800
#define LCD_HEIGHT 600
#define LCD_BITS_PER_PIXEL 16
#define CTIMER CTIMER0 // Timer 0
#define ID_WINDOW_0 0x801
#define ID_IMAGE_0 0x802
#define ID_TEXT_0 0x803
extern uint16_t s_frameBuf0[800][600];
extern uint16_t GUI_memBuff[GUI_NUMBYTES];
//#define VRAM_ADDR (GUI_MEMORY_ADDR + GUI_NUMBYTES)
#define VRAM_SIZE (LCD_HEIGHT * LCD_WIDTH * LCD_BITS_PER_PIXEL /
/* Frame end flag. */
static volatile int32_t s_LCDpendingBuffer = -1;
void emwin_init(void);
static void cbWin(WM_MESSAGE * pMsg) ;
WM_HWIN MhWin;
extern volatile unsigned int g_Ticks;
/*******************************************************************************
* Application implemented functions required by emWin library
******************************************************************************/
/*! @brief Returns after a specified time period in milliseconds. */
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
{ FRAMEWIN_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 800, 600, 0, 0x0, 0 },
{ IMAGE_CreateIndirect, "", ID_IMAGE_0, 10, 10, 100, 100, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Om namah shivay", ID_TEXT_0, 10, 10, 100, 100, 0, 0x0, 0 }
};
static void cbWin(WM_MESSAGE * pMsg) {
WM_HWIN hItem;
WM_HWIN hWin;
hWin = pMsg->hWin;
switch (pMsg->MsgId)
{
case WM_PAINT:
GUI_Clear();
break;
case WM_INIT_DIALOG:
hItem = WM_GetDialogItem(hWin, ID_TEXT_0);
TEXT_SetFont(hItem,&GUI_Font32B_1);
TEXT_SetTextColor(hItem,GUI_BLUE);
TEXT_SetText(hItem, "Om namah shivay");
break;
default:
WM_DefaultProc(pMsg);
}
}
/*******************************************************************************
* Application implemented functions required by emWin library
******************************************************************************/
void LCD_X_Config(void)
{
status_t status;
GUI_MULTIBUF_Config(1);
USART_WriteByte(NIBP_USART,'1');USART_WriteByte(NIBP_USART,'2');
// GUI_MULTIBUF_Config(GUI_BUFFERS);
GUI_DEVICE_CreateAndLink(GUIDRV_LIN_16, GUICC_565, 0, 0);
USART_WriteByte(NIBP_USART,'3');USART_WriteByte(NIBP_USART,'4');
LCD_SetSizeEx(0,LCD_WIDTH,LCD_HEIGHT);
USART_WriteByte(NIBP_USART,'5');USART_WriteByte(NIBP_USART,'6');
LCD_SetVSizeEx(0, LCD_WIDTH, LCD_HEIGHT);
LCD_SetVRAMAddrEx(0, (void *)s_frameBuf0);
USART_WriteByte(NIBP_USART,'7');USART_WriteByte(NIBP_USART,'8');
/* Initialize LCD controller */
status = APP_LCDC_Init();
USART_WriteByte(NIBP_USART,'9');USART_WriteByte(NIBP_USART,'0');
// if (status != kStatus_Success)
// {
// PRINTF("LCD init failed\n");
// }
// assert(status == kStatus_Success);
}
int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void *p)
{
int r = 0;
LCD_X_SHOWBUFFER_INFO *pData;
switch (Cmd)
{
case LCD_X_SHOWBUFFER:
{
pData = (LCD_X_SHOWBUFFER_INFO *)p;
//
// Remember buffer index to be used by ISR
//
s_LCDpendingBuffer = pData->Index;
return 0;
}
default:
r = -1;
}
return r;
}
void GUI_X_Config(void)
{
/* Assign work memory area to emWin */
GUI_ALLOC_AssignMemory((void *)GUI_memBuff, GUI_NUMBYTES);
/* Select default font */
GUI_SetDefaultFont(GUI_FONT_6X8);
}
void GUI_X_Init(void)
{
}
/* Dummy RTOS stub required by emWin */
void GUI_X_InitOS(void)
{
}
/* Dummy RTOS stub required by emWin */
void GUI_X_Lock(void)
{
}
/* Dummy RTOS stub required by emWin */
void GUI_X_Unlock(void)
{
}
/* Dummy RTOS stub required by emWin */
U32 GUI_X_GetTaskId(void)
{
return 0;
}
void GUI_X_ExecIdle(void)
{
}
GUI_TIMER_TIME GUI_X_GetTime(void)
{
return 0;
}
void GUI_X_Delay(int Period)
{
}
void *emWin_memcpy(void *pDst, const void *pSrc, long size)
{
return memcpy(pDst, pSrc, size);
}
Please help me to fix this issue
Thanks and regards