Nexiton LCD Serial Prog Pass Through (Tip)

I have recently made an Infomation display for a friend using an ESP32 driving a Nexiton HMI LCD display This is the first time i have used these displays and have been impressed with the results . These are serial based displays that have a HMI that is first designed on Nexiton’s IDE desktop software and then flashed to the display via micro SD card or Uart.

After Designing the HMI , testing it on the built Simulator and then coping it to micro SD card and then copying to the display. This didn’t take long at all but if you are like me who kept noticing my miskates and wanting to make constant changes i wanted another option. For my current application i did not want to have a micro SD card slot in the encloure or remove the LCD every time i wanted to change the HMI.

I looked in to the serial Route and but currently the nextion display (basic range) does not have a built in USB to serial convertor and only having a single UART you need disconnecting from MCU every time you want to program.

After a bit of research I came across this cool ESPNEXUPLOAD library that provided library that provides a web page upload and program facility . As good as it looks It wasn’t exactly what I was looking for .

My Solution

I tried expirementing to see if i could have a mode that would pass the ESP32 USB serial straight to the nexiton display if a gpio pin is shorted to ground so can be programmed directly from nexiton editor.

  
int lcd_prog_pin = 27; GPIO connected to ground will enable passthrough !

void setup() {
    Serial.begin(57600);
     Serial2.begin(57600);
    pinMode(lcd_prog_pin, INPUT_PULLUP);
}


void loop() {

 if (digitalRead(lcd_prog_pin) == LOW) {   IF PIN 27 is shorted to GND when serial passthrough will work !

    if (Serial.available()) {     // If anything comes in Serial (USB) 
            Serial2.write(Serial.read());   // read it and send it out Serial2 (NEXITON LCD)
        }

        if (Serial2.available()) {     // If anything comes in Serial2 (NEXITON LCD)
            Serial.write(Serial2.read());   // read it and send it out Serial (USB)
        }

   else
            {
              // ****dont do anything else if loop back is running put other tasks here****

             // myNex.NextionListen();  //Example it working along side EasyNextionLibrary
             }
}





Things to note

I have set baud rate to 57600 to aviod risk of the EXP32 boot messages causing issues if set to 115200. This is no way anywhere near the speed of programming via SD card but the NEXITON Editor is clever enough only to copy changes after the inital serial upload. In the furture i may try i higher baud rate.

I have found it does work better if the passthough jumper is set and Esp32 is then Reset. I also have got the display connected in the debugger simulator and seems to work ok.

Hope this is found useful !

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.