I’ve been using the Nextion screen and ESP combo for a few years now and ran into an issue recently that is really breaking my brain. Hopefully it is something simple and you can set me off on the right path.
Nextion: 4.3 inch intelligent NX4827P043 (I’ve only used the 3.2in basic ones before this issue)
Controller: ESP32-S Develpoment board Ai thinker
I have set up a new project and coded both the esp and nextion using the debugger in the Nextion Editor. Everything was working great until I tried to upload the program to the HMI and use it. I had all the Serial comms going to the screen but nothing coming back. My first thought was that I’d messed something up but after laboriously checking and rechecking and swapping both screens and ESP’s out to confirm it wasn’t a defect I was still left with the same issue. So the one line that has an issue is the Nextion TX to ESP RX. These I have tried connecting with a level shifter, a series diode and directly with no difference in the behaviour.
I then connected the “problem child” communication line to a scope to find that the line is not being pulled all the way to ground. The nextion only seems to pull it to 2.5V. This means the line is varying between 3.3 and 2.5V which obvs never registers as a low on the ESP side. When the line is disconnected from the ESP it behaves normally between 5 and 0V and the exact level of the erroneous low makes me think it’s a voltage divider being created somehow.
Anything else I could check/ change?
Does anyone have a schematic for the nextion TX/RX lines?
Hoping for some insight
Thanks in advance
Perhaps the gpio that you use are pulled up.
You can try either to introduce a pull down for those gpio, or remove the pull up command or add some resistor for pulling down
Thanks for your idea. From what I understand about UART comms (especially between these devices in particular but also in general) is that they require the data lines to be pulled up. Which both devices are doing. The Nextion in the form of a pull-up to 5V and the ESP32 with a pull-up to its 3.3V line. I don’t believe you can remove the pull-up from the Nextion side but I stand to be corrected.
On my side I don’t have any physical resistor to pull up or down. I just configured serial port
Except for software upgrade that fails 100 % of the time, normal operation is perfect
It’s your ESP32 RX buffer size or baud-rates. Nextion firmware uploader is flashing chunks of 4096 bytes at time and waiting for response. So if you see no response it may be that chunk of 4096 bytes is corrupted (CRC). You may also bring here upload log from terminal. Also Nextion uploader is first searching for the Display then changes it’s baud rate (it should be same on ESP Serial and Nextion) so you need to init ESP Serial with default 9600 and choose same speed in nextion uploader. Then if you want to increase upload speed you need to recognize the changing upload speed sentence from nextion uploader and change it in ESP serial. Use NEXTION HMI UPLOAD PROTOCOL to understand the kitchen of uploading Nextion firmware.
PS. It took me 3 days to flash Nextion display by STM32 USB correctly.
I think this may help Phil but don’t think it has relevance to the original issue? However let me know if I misunderstood your post.
Hi thank you for this interesting answer.
By default UART with esp home is configured as:
rx_buffer_size (Optional, int): The size of the buffer used for receiving UART messages. Increase if you use an integration that needs to read big payloads from UART. Defaults to
Do you mean that I must add a line with 4096 ?
not add, you should replace 256 by 4096 or more. ESP has lot of memory, so it shouldn’t be a problem.
Hi this is my current UART configuration in esp home for the nextion.
###### port UART utilise pour le Nextion ######
- id: uart_2
# baud_rate: 9600
Interesting I will try today.
By the way I have to add the line as I don’t have one. Thanks
I will give the feed back later
you have. Search in *.h files. Or google it
I am not supposed to change the sources as this is compiled by ESPHOME itself
- id: uart_2
# baud_rate: 115200
- regenerate the software
- change seral speed to 9600 in the HMI configuration
- upload this tft file in the screen with the sd-card
- verify that it is now working at 9600
- try to OTA upload the same tft file and got bricked screen with an error at the end
So it does not seem to fix the issue
are you sure your display speed is 9600 baud by default?
It should as it works esp and sceeen displays what it must.
But I have a doubt between the baud and bauds parameter
Which one must I use ? Could you copy and paste this part of your configuration ?
if it worked with 115200 by default you should change it to 9600 in Nextion Editor init section part first and flash display with init.
this what I made. i just had a doubt betwwen baud and bauds for my OTA upgrade issue.
For normal usage when both esphome and nextion have the same speed, this works.
It is seems incredible for me to have 100 % failure with this xxxx OTA upgrade.
Neverthgeless I will go one with my sd card that works always