Start a new topic

Problems with the Nextion and Mega

Hello,

i want to test the example compText, but my serial output gives me back


recvRetCommandFinished err

recvRetCommandFinished err

setup done


for the example i use TX on pin 1 and RX on pin 2 


Greets 


1.Download the hmi file to your nextion by nextion editor with a usb-ttl board.

2.Download the ino file source code to your arduino mega.

3.Conect nextion display and mega:

                            TX     →   RX2

                            RX     →   TX2

4.If you use arduino UNO, there is no "db_serial".

on arduino mega i have
NexConfig.h #define nexSerial Serial2
and connect

                            TX     →   RX2

                            RX     →   TX2


yes i still get the problem :

recvRetCommandFinished err
recvRetCommandFinished err
setup done


using CompText example ?


i tried all the other TX/RX option and they all generate the same problem. ? Is my screen defective ?

I have the same problem!!!! Any solution??

I am also getting this error. I get a TX light on the Arduino but no RX. Get similar errors on any example I try. is my screen's COM port faulty?

 

txt
(832 Bytes)
J Bennett I was having the same problem. It turns out that i need to tie the ground of power supply for the hmi and arduino together.

3 people like this

Thanks for your reply Bryan. I am new to Arduino and was following old documentation in regards adding libraries to the IDE. I manually added the nextion library to the library folder in ProgramFiles (x86)\Arduino\libraries. After adding the library the proper way ( using the IDE ) I noticed they get saved in MyDocuments\Arduino. After saving the project to a folder within this directory all worked. The library within ProgramFiles (x86) is read only and didn't add the nextion library properly and therefore couldn't see the "Nextion.H" include. Thanks for the advice though as I will be needing to do this by the end of my project.

Hi guys Was anyone able to figure out how to make it work? I have the same problem. I am using nextion 5" and arduino Mega. I tried everyrhing that is suggested but no way to make it work. The weirdest is that with Arduino Nano it works perfectly connected to pins 0 and 1, rx and tx. Thanks Filipe
Use the Serial2 on the Atmel 2560, that's works I've need also some times to find the right information, but the Display was already new for me.

Hi I cant make this work either on a Mega

I can write to Nextion but not read


Is there a way to assign nextion to Serial2 on mega?


SoftwareSerial nextion(19,18);// Nextion TX to pin 19 and RX to pin 18 of Mega

Nextion myNextion(nextion, 9600); //create a Nextion object named myNextion using the nextion serial port @ 9600bps

I didn't use the SW Serial. About problems with the Nextion Master Library from the GIT, I use the released version 0.7 ( uncomfortable there are not all functions included like Nex. Number). I load only the tft via SD to the Display, connect the Display RX-TX / TX-RX to the Serial 2 Pins from the Mega and it's works. (You can see also the initialize Command with an OK or Error in the Serial Monitor) only the nextion. h is included, the init Command was send and the speed is set to 115200. If you. like, I can copy the necessary part of the code in the evening.

I solved this problem see on YouTube

I have the problem too.  The solition "operr" suggested on youTube did not work for me, as my nexconfig.h uses HMSERIAL for use with Arduino Uno board.

Tried the YouTube. Any fix to this. It is driving me insane. Is there an issue with the Nextion. Has it failed. I have two Mega boards. Both are not RX in. The TX for buttons are working from the Nextion. Just not the RX back to the Nextion Is there anyway to resent the Nextion or test the RX / TX with a fail safe scratch and tft file Thanks Ben.

I was able to get my nextion projects to work well, after I switched to using MEGA 2560 boards, which I need for reliable hardware UART to the Nextion, debugging my code, and easily re-upload new .ino projects.  What you are doing with TWO mega boards - I do not know, but doubles your troubleshooting errors, maybe try one board get it to work first.


I had to build my own debugging and test interface shield between the Arduino 2560 and the Nextion, since I constantly re-adjust my code and re-test it.  That means making a hardware switch to change the pins from Nextion to Arduino, - to an FTDI usb serial port where I could update the Nextion firmware.  Without that, you have to pull pins off a breadboard every time you want to change code and debug.


To assign "serial2" to nextion:


 

#define nexSerial Serial2

nexSerial.begin(9600); // Nextion terminal
  
nexInit();

 For the random "recvRetCommandFinished err" problems, is a timing issue.  My code was busy processing data for something else and aparently the nextion got impatient waiting for reply, or something technical.  I troubleshoot those issues by isolating my code to a small project and testing each function and each line of code to nail down the "ERR".  If you specify where exactly you get the problems in this forum on a new thread, I am sure someone can help.