Getting start with LPCXpresso54608 & emWin Graphics;

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting start with LPCXpresso54608 & emWin Graphics;

7,691 Views
ashokfair
Contributor IV

This tutorial explains some basic knowledge about drawing texts and images on  LPCXpresso54608 TFT screen using emWin library.

 

Tools Required:

->MCUXpresso IDE

->LPCXpresso54608 SDK 2.0.0

->emWin Library for MCUXpresso IDE ,It comes with SDK package (SDK_2.0.0_LPCXpresso54608\middleware\emwin_5.38\emWin_library\MCUXpresso\libemWin_M4F.a)

->Image to C code converter  (NXP-emWin538-libraries\Utility\BmpCvtNXP.exe)

 

LPCXpresso54608 Kit:

The Kit comes with default touch screen demo. you can find the user manual here 

To enable the on-board debugging (Link2) option , the Jumper [JP5] should be open.

 

Setup SDK in MCUXpresso:

Download the latest MCUXpresso from here . and install it.

Download SDK from here

The 1st thing is to add LPCXpresso54608 SDK into MCUXpresso IDE by simply dragging the zip file into SDK tab

After the installation the SDK packages will be show in the editor like below

179075_179075.jpgsdk view.jpg

next step Import the example project attached in this post,

179077_179077.jpgimport_project.jpg

one import is done, the project files will be show in the project explorer

179081_179081.jpgsource files.jpg

It has board files,drivers, emwin lib's and utilities etc,

In main_app.c Clock ,Board and LCD initialization are done before initialization the emWin lib (GUI_Init())

then clearing the screen and setting the background color using emWin prototypes.

179082_179082.jpginitgui.jpg
    /* Solid color display */
    GUI_SetBkColor(GUI_DARKCYAN);
    GUI_Clear();

Draw Text:

The emWin lib has many predefined font sizes and colors in GUI.h. In this example we going to use 3 different size fonts.

Text "LPCXpresso54608" uses "GUI_FONT_8X16X3X3"

Text "Powered by emWin" uses "GUI_FONT_8X16X2X2"  and

Text web address uses "GUI_FONT_8X10_ASCII"

you can change the font by below Api

    /* Set Font */

    GUI_SetFont(GUI_FONT_8X10_ASCII);

same way the color can be change by 

    /* Set Color*/

    GUI_GUI_SetColor(GUI_ORANGE);

To display the text in particular position the X,Y coordinates can be set by

   /* Display Text */

   GUI_DispStringAt("LPCXpresso54608",60,20);

 

Draw Image:

The emWin supports png,jpeg,bmp and other few formats

we going to see how to display the bmp bitmap on the display.

First step you need to create image data (hex data) from pictures.

Run BmpCvtNXP.exe and open the image , i used 120x60 sized png file

179083_179083.jpgbitmaptoc.jpg

in the next step convert this image to BPP 24bit format . you have many option here to convert into different formats

179087_179087.jpgbitmapformat.jpg

in the next step File->Save as Bitmap ".c" file

179088_179088.jpgbitmapfile.jpg

and now the promotion box will be displayed to choose the format , select true color 24bpp and give ok.

179089_179089.jpgseltrucolor.jpg

The C file will be generated and add to the project ,you can give rename the file/variable if required.

    /* from bm_nxp_logo_120x60.cfile*/

   extern GUI_CONST_STORAGE GUI_BITMAP bmnxp_logo_120x60;

Now you can draw the image using of below API at particular position

  /* Display Image */

    GUI_DrawBitmap(&bmnxp_logo_120x60, 180, 140);

 

finally run compile the code and flash the firmware through on-board debugging.

and now your creation will be displayed on the LCD screen.

179090_179090.jpgnxp_emwin demo.jpg

 

for queries please feel free to comment here.

 

Thanks

Ashok R

NXP Semiconductors

Original Attachment has been moved to: lpcxpresso54608_emWin_p01.zip

Labels (4)
11 Replies

4,741 Views
kshah1968
Contributor I

Hi,

I tried the same example of LPC54608 running on LPC54628 board..As explained by Ashok. 

I am getting hard fault while running beyond GUI_Init () ..I am using library and no more debugging is possible.  

I found that few header files required to be modified..no information in emWIN user manual.

Please help

Ketan

0 Kudos
Reply

4,741 Views
kshah1968
Contributor I

Hi,

I want to use the same for LPC54628 on board OM13098 ..How can we do that..?

The SDK I build for the board does not have any examples..

Please Help

0 Kudos
Reply

4,741 Views
mail8
Contributor II

HI! 

I tried 2 things in trying to get it working for my LPC54628 dev board.

Working with MCUXpresso 10.3.1 on macOS.

1) drag it to the SDK installation tab

I am getting the following error, "The following items are not supported or not valid SDKs [ .... ...emWin_p01.zip]"

2) opening it as a project; I am getting a Javascript null error when I try to update the MCU. Please see the attachment screenshot.

What am I doing wrong?

Best regards,

Raymond

0 Kudos
Reply

4,741 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Nice sharing!

4,741 Views
shuwang
Contributor I

Hi, does the emWin free for NXP MCU?

0 Kudos
Reply

4,741 Views
mr_ming
Contributor II

Thank you for your sharing!

4,741 Views
carstengroen
Senior Contributor II

Nice tutorial,

would be even nicer if it also supported Keil tools :smileyhappy:

4,741 Views
ashokfair
Contributor IV

Thanks Carsten for feedback! In upcoming days we do for Keil also. Since MCUXpresso IDE is from NXP, i had given importance to MCUXpresso IDE.

0 Kudos
Reply

4,741 Views
carstengroen
Senior Contributor II

Ashok,

how are Keil support going for this ?
It's been a little more than "a few days" now :smileyhappy:

0 Kudos
Reply

4,741 Views
carstengroen
Senior Contributor II

That sounds nice Ashok :smileyhappy:

NXP has to realise that a lot (all ?) that develops with NXP devices also uses other vendors devices once in a while and jumping from vendor A tools to Vendor B tools etc is something we like to avoid. This is the reason why we in my company (and many other devleopers) uses f.ex Keil tools, same development tools/platform for all devices (across device manufacturers).

I do of course see why NXP pushes proprietary tools, they would like to get you to stick with only their devices, but this is not how reality is :smileywink:

0 Kudos
Reply

4,741 Views
ashokfair
Contributor IV

Hi Carsten,

Yes your correct, Keil supports many number of devices from different chip manufacturers. NXP is not pushing anybody , they are having the SDK examples  for MCUXpresso IDE ,IAR & KEIL. If you're comfortable with KEIL you can continue using of it. I am comfortable with LPCXpresso IDE previously , and now it comes in the name of MCUXpresso IDE so i had given my preference to MCUXpresso IDE :smileyhappy: . And sure in upcoming as i said , i will use KEIL & IAR for some  of demos.