NXP LPCXpresso54S018M + Display - Review

Table of contents

RoadTest: NXP LPCXpresso54S018M + Display

Author: ss_shrenik

Creation date:

Evaluation Type: Development Boards & Tools

Did you receive all parts the manufacturer stated would be included in the package?: True

What other parts do you consider comparable to this product?: STM32F4 series

What were the biggest problems encountered?: Though demo example codes were good to start with. Getting started and then creating own project out of it takes a while, since learning curve about IDE/config is more. It can be made simpler.

Detailed Review:

Here I am with another road test review. As with all earlier road test, I try to utilize boards capabilities by creating some projects of my own, this time it's no different.


Last time I did a roadtest of MaaXboard, in which I created IoT Gateway using Mozilla Webthings.The review can be seen here MaaXBoard Single Board Computer + Accessories - Review . Now, this was a gateway to local devices and Mozilla webthings and I could control/see the status of devices over my smartphone or web. When I looked at "LPCXpresso54S018M Display" at first, then first idea came in my mind is to implement a touch controller for Mozilla Webthings Gateway.


Below was the project idea for this roadtest


1. LPCXpresso54S018M + Display will have interactive buttons that can be toggled.

2. This toggle event will be sent to the cloud/local network along with LED indication on board to know the user that the event is registered.

3. Monitor the status on cloud/mozilla webthings gateway.


Out of all of three, I modified 3rd little bit which is I sent data to Mqtt broker, which again can be easily integrated into Mozilla Webthings.


Setting up the environment

Instead of replicating details here, I am simply putting link which can be referred to setup Dev environment. The details provided on the official website are fairly usable and get things done.



Understanding of demo codes

     As it happens with any new MCU, to get familiarity with the environment specific to that MCU or Vendor, a good set of demo codes are very important. Here, for LPCXpresso54S018M we have variety of demo codes for display, peripherals, graphics library, rtos. So one can get started quickly with help of this.


Right out of the box we have demo "Spirit level" which shows on board sensors and then LED indicating the status of same. hmm, good though but not useful to me.


I was interested in a demo which will make use of Display, LVGL graphics library, LEDs, UART, for advanced use - ethernet(which i could not complete for this project, but hope to use it soon). So tested below demo codes


1. littlevgl demo - For graphics implementation

2. usart dma xfer ,serial terminal demo - For UART side implementation

3. led blink - For User LED operation



With these demo codes, I could understand how to put things together and create project that I described above. Let's deep dive into those one by one


1. LPCXpresso54S018M + Display will have interactive buttons that can be toggled

    Since, for Graphics we use LVGL library which is very well documented. It became easier to implement Toggle switches. Below is code snippet which will create two toggle switches and one status indicator


void lv_create_controller_switch(void)
    /*Create a switch and apply the styles*/
    lv_obj_t *sw1 = lv_sw_create(lv_scr_act(), NULL);
    lv_obj_align(sw1, NULL, LV_ALIGN_CENTER, 0, -50);
    lv_obj_set_event_cb(sw1, event_handler);

    /*Copy the first switch and turn it ON*/
    lv_obj_t *sw2 = lv_sw_create(lv_scr_act(), sw1);
    //lv_sw_on(sw2, LV_ANIM_ON);
    lv_obj_align(sw2, NULL, LV_ALIGN_CENTER, 0, 50);
    lv_obj_set_event_cb(sw1, event2_handler);

    lv_obj_t *status_led = lv_led_create(lv_scr_act(), NULL);
    lv_obj_align(status_led, NULL, LV_ALIGN_CENTER, 100, 0);

This basically creates an object and then aligh it to desire co-ordinates and we can add event handlers to each of these objects. The event handlers will basically call upon any event triggered after touch to the objects.




As my object was to basically to trigger and events such as LED indication and then event to cloud for some operation. I had to add event handlers as below


static void event_handler(lv_obj_t * obj, lv_event_t event)

    if(event == LV_EVENT_VALUE_CHANGED) {
        printf("SW1: %s\r\n", lv_sw_get_state(obj) ? "ON" : "OFF");

static void event2_handler(lv_obj_t * obj, lv_event_t event)
    if(event == LV_EVENT_VALUE_CHANGED) {
        printf("SW2: %s\r\n", lv_sw_get_state(obj) ? "ON" : "OFF");


As you can see, I am printing the status of toggle switching for LV_EVENT_VALUE_CHANGED and then toggling user LED's for same.


LED init code


#define LED_NUMBERS  3U
#define LED_1_ON()   LED1_ON()
#define LED_1_OFF()  LED1_OFF()
#define LED_2_ON()   LED2_ON()
#define LED_2_OFF()  LED2_OFF()
#define LED_3_ON()   LED3_ON()
#define LED_3_OFF()  LED3_OFF()

void Led_Init(void)


To confirm its working one thing comes very handy is boards "Debug Console" which can be used to add debug info which can be printed on Debug Console. See below, I used this a lot while using this board.





And also video in action below




2. This toggle event will be sent to the cloud/local network along with LED indication on board to know the user that the event is registered

Now this concludes that I am able to create toggle switches, register events, toggle status LED and then send debug events. But now I wanted to push these events to cloud. One way was to connect WiFi module through UART or use Ethernet for same. But since I wanted to create a quick demo, I took third approach is to receive events through UART and then use a python script to collect and push data using MQTT client. This further makes my job easier to connect LPC board to MaaXBoard and then push data to cloud/webthings


Below is the script to achieve the same


import serial
import paho.mqtt.client as mqtt

# The callback for when the client receives a CONNACK response from the server.

def on_connect(client, userdata, flags, rc):

    print("Connected with result code "+str(rc))

    # Subscribing in on_connect() means that if we lose the connection and

    # reconnect then subscriptions will be renewed.


# The callback for when a PUBLISH message is received from the server.

def on_message(client, userdata, msg):

    print(msg.topic+" "+str(msg.payload))

client = mqtt.Client()

client.on_connect = on_connect

client.on_message = on_message

client.connect("mqtt.eclipse.org", 1883, 60)




  ser = serial.Serial(





  ser.isOpen() # try to open port, if possible print message and proceed with 'while True:'

  print ("port is opened!")

except IOError: # if port is already opened, close it and open it again and print message



  print ("port was already open, was closed and opened again!")

while True:

    line = ser.readline()

    line = line.decode('utf-8')




And once we run the above script while connecting the LPC board sending events through UART, python script will publish these events to cloud over MQTT. I was able to receive these events on my smartphone app. See below




Problem I faced during project implementation1. Below is the error which I encountered every alternate cycle, could not find any reason. While we initiatiate Debug then I encounter "Target connection failed" and need re-initiate the process


2. The Virtual COM port disappears every time after disconnect/connect and then to get them back we need to Trigger Linkserver Probe again which brings them back image. Why I am not sure if I am missing anything.




1. This Dev board along with Display makes good choice for HMI interfaces applications which are battery powered

2. Having ethernet on board make easier IoT enablement over TCP/IP.

3. There is still room for improvement in use of IDE and its tools, such as flashing/debug attach consistency.


Hope to add further enhancement and more projects on this board.


Thank you,