Unofficial Nextion/TJC User Forum

Arduino and Nextion Tx/Rx ERROR

Hello Forum.

Apologies for not able to post this under right category. Because the problem i am having is very weird
okay now to the problem I am having. I could make my Arduino talk to Nextion. Like I could able to see all the sensors responding in Nextion but i couldn’t able to control the sensors connected to Arduino with the buttons in Nextion Display. mainly the touch release event buttons. There was no visible error in the code or on the nextion debugger. any one know what might be the issue or have any idea what i am talking. :sweat_smile:

Connect Serial(USB) on Arduino to your computer. Open serial monitor in Arduino IDE. Add code to write to Serial in the functions expecting data from the Nextion.

I use #define DEBUG in Arduino code to enable or disable sending data over Serial, then use code like this:
#ifdef DEBUG
Serial.print(“Ini file “);
Serial.print(filename);
Serial.println(” does not exist”);
#endif // DEBUG

p.s. Also check continuity of your cables and Tx is connected to Rx and Rx to Tx.

Thank You . I will try that. and yah the cables are all good and have a proper continuity.

But while uploading the code i am disabling the Tx of Nextion to Rx of Arduino, because if i am not doing that i am getting avrdude error in my IDE. once my code is uploaded to the arduino then i am connecting the cable back to avoid the error.

Everything depends on which Arduino you are using. There are some older ones, like the Uno and the Nano which don’t have a dedicated USB boot, but an external UART to serial converter connected in parallel to the single UART’s TX and RX pins. This has never been good practice since you simply run into conflicts during uploads or using the serial monitor with any other serial device connected to the RX and TX pins.

The solution is easy. Either use a board which has additional UARTs like the Arduino Mega where you can connect and control the Nextion on RX1 and TX1, leaving RX0 and TX0 free for the USB communication, or use one of the 32U4 or ARM based boards where the native USB port is independent of all serial ports.

1 Like

This forum is in no way affiliated with NEXTION®, ITEAD STUDIO®, TJC®, or anyone else really. All product names, logos, and brands are property of their respective owners. All company, product, and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement from the respective rights holder(s).