Many customers use the Nextion display in their own business projects. They may need to upload the Nextion firmware through their own MCU. Here we disclose the upload protocol and release the Arduino upload library.
Users need to know nothing about the protocol if they only upload firmware through Nextion Editor.
Step 1. Find your serial port
In order to set up a serial connection between Nextion and your MCU, first users have to find which serial port is the Nextion connected to, and figure out the connection parameters. If you know it, skip step 1.
Send an instruction string in different connection parameters.
Nextion will return data if users choose the right serial port and connection parameters.
For example, NX4024T032_011R will return below 8 group’s data. The data is separated by a comma.
Here’s the explanation.
comok: handshaking protocol is set up.
1: Nextion model with touch panel 0: Nextion model without touch panel
NX4024T032_011R: Nextoin device model
52: Firmware version
61488: MCU code
D264B8204F0E1828: Nextion device serial number
16777216: FLASH Size(byte)
Note 1: It is suggested to send an empty instruction before the connect instruction.
Note 2: Delay (1000000/baud rate)+30ms between each attempt. If users try 9600bps, they should delay by 1000000/9600+30=134ms
Step 2. Upload firmware
Now as users know the serial port and current baud rate, they can send the upload command.
filesize: fileszie of the tft file (byte)
baud: baud rate
res0: reserved, it can be filled with any ASCII character
Nextion device will return 0x05 in 500ms. Users can send tft bin file to the serial port after they receive it. Users should split the data in 4096 byte each packet. And send all the remaining data (<4096byte) in the last packet. Nextion device will return 0x05 when all data received.
To make their own upload code, users can refer to our arduino library.
We implement the upload protocol in this library.