Start a new topic

Nextion/Arduino software.

Is there a way to set the baud rate faster than 9600?



Yes, when you set bauds=115200 to Nextion, it means you have set the baud as 115200, and saved it as default. Next time you power the Nextion, the value of baud will be 115200 by default.

I Know that you can set the device baud, but I was referring to the Nextion/Arduino software.

I set the baud to 57600, and was able to communicate with the device, but I can't find where to change the Arduino software to match.


Is it fixed? I've been through the 'h and 'cpp files and it makes no reference to baudrate.


Hi Mike
In the Aduino Library you have to change the value to the Nextion serial rate in the NexHardware.cpp file on line 226 nexSerial.begin(9600); -> nexSerial.begin(115200);

You can also change on line 225the debug serial speed.

Right on!


I've been looking through the files and, I guess I missed this one.


Thanks.

Changing the baud rate  would be more convenient if this variable was a #define.

Yes that's right.


I would add the following two definitions in the main program:


#define DEBUG_BAUD 115200 // baud rates 2400, 4800, 9600, 19200, 38400, 57600 and 15200 are allowed

#define NEXTION_BAUD 115200 // you have to set the same "bauds=115200" to NEXTION


In file "nexHardware.cpp" at line 225 add the following code:

#ifdef DEBUG_BAUD

   dbSerialBegin (DEBUG_BAUD);

#else

   dbSerialBegin (9600); // Default baud rate = 9600

#endif

#ifdef NEXION_BAUD

   nexSerialBegin (NEXION_BAUD);

#else

   nexSerialBegin (9600);

#endif


That's it.

Sorry my mistake


nexSerialBegin  -> nexSerial.begin

Thanks, you've been a great help.


Mike Brian

HI sorry, can someone please tell me where and how to change baud rate or use the command bauds=57600. my code works fine but as i add variables to it, the communication speed between nextion and Arduino 2560 becomes increasingly slow. The website recommends the command but need help to use it. please, can someone guide me?

changing baud rate is done as you pointed to bauds=57600

to do so chose where to do from

1) send bauds=57600ÿÿÿ from the MCU over RX/TX to Nextion

2) include bauds=57600 command in any event code


Serial slowing down is another issue inside user code.

   such causes including overloading serial, too long between code, etc

Thank you sir. just Tried and your method worked. I used the MCU over RX/TX to nextion method.

Login or Signup to post a comment