Start a new topic

Get fast refresh rates while pushing data from Serial

In another post "Lee de Vries" that saved me a lot of headache. I'm getting pretty fluid refresh rates now.  In case anyone is curious; here is how:

Set the displays baud rate to 19200. There are various methods for this, if you don't know how, here is one: 

In "NexHarware.cpp" at line @232 (after     sendCommand("");      )add



Save the file. Open one of the example arduino skeches. It doesn't have to actually work. As long as there is a nexInit(); command you are fine. Upload sketch to arduino. One this is done,  Comment out the command we've just added (  //sendCommand("bauds=19200");  ) 

Change nexSerial.begin(9600); to nexSerial.begin(19200);

While you are at it comment out "dbSerialBegin"if you don't use it. 

We are done with NexHardware.cpp. Save and close. 

Open NexHardware.h.To the bottom of the file there are 3 "uint32_t timeout = " variables. Change the var to 1.

uint32_t timeout = 1

 Do this to all 3 timeouts. 

You're done. Enjoy high refresh rate. 

PS:Too high refresh might cause flickering on display. To prevent this, add a "delay(40)" in your loop. Tinker with 40 value to find out what suits you best. 

PS2: Unless you are pushing thousands of characters to display every second, I don't think baud rate higher than 19200 is necessary. Tbh even 9600 is adequate for most purposes. For experiment I've set the baud rate to 115200. With 1 ms timeout there were tons of artifacts ("w" characters added to variables). To get somewhat stable communication I had to push timeout to 50ms. Which defeats the whole purpose. 

As a sidenote, I'm using an Arduino Pro Mini with softserial. I recon if you are using UART, you could go to higher bauds without artifacts

Login or Signup to post a comment