Have a problem using the Nextion 4.3" screen with a modified fish tank code (that use the Arduino Nextion libraries) on a Ideaduino UNO. First, the Arduino code basically does what I want it to do. It simply trigger a couple of led's and display temperature, so that part is good, more or less...
This problem only occur when I power on the system.
I have programmed the Nextion to show a boot up screen (page 0) for 2.5 sec before it automatically open the main screen (page 1) with the buttons. So with the Nextion editor, for page 0, I set preinitialize event to:
delay=2500 page 1
This works perfect if I only connect power to the screen. So far so good.
But when I connect the Nextion to the UNO, and power it all up, page 0 stays on for 2.5 sec, as it supposed to, but for some weird reason, the screen briefly jump over to page 1, only for a few miliseconds, and then it jump back to page 0 for another 2.5 sec, before it finally goes to page 1 again and stays there. Everything is now up and running and can be used as normal.
In a attempt to stop this momentary jump to page 1 and back to page 0 again, I even tried adding three identical boot-up screens with shorter delays, on page 0, page 1 and page 2, and put the main screen on page 3. But even then it jumps to the main screen for a few miliseconds, then go through all the boot up screens another round before it settles.
Any ideas how to solve this?
how do you power your Nextion? Also from your UNO?
It seems, that the power crash one time until became stable ... means the Nextion just reboot one time ...
Use an external power supply for your Nextion, don't forget connect gnd betwern Nextion and UNO ...
the described behave, "jump back to page0" after a few ms, was indeed no jump back, it was just a reboot ...
You did the right observation, but the wrong conclusion ... :-)
a reboot is a reboot. The question is, what caused this reboot. I am not aware of any software-command, which would cause this in general. If so, a few 1000 other Arduino users would have the exact same issue. But it seems you are alone with this ...
Can you really 100% exclude, that it is
- neither the power supply
- nor any kind of short circuit on any side
- shortcircuit on any part which is RXpin related
- cable side
- UNO side
- cold soldering of any connection
- bad crimping of cable
that's all what come to mind immediately ...
Another point is, this behave comes up immediatelly after plain connect the RX line, you even don't use the line for any transfer at this point of boot time. Or do you send any directly after power-on? At exactly the timeframe where the reboot happens? If not, it also has nothing to do with your code-side.
use the attach file to post the hmi and the ino sketch
First, thank you to both!
Need to clarify that the reboot of the screen, (if it actually is a reboot?) only happens when I reboot/pull the power and plug it in again on the UNO with the screen connected. So this basically only happens on a "cold" start. When the system is up and running, I can leave it on for whatever length of time without any issues.
I have set page 0 with a 2.5 sec delay, then it's goes to page 1. Again, this setup works perfect without the nextion library, or without RX connected, or with only power to the screen. (I don't have any other MCU's, so I can't currently test it with something else)
But hooked up to the UNO, using the code below, I get a 2.5 sec delay, a quick flash over to page one, back to page 0, another 2.5 sec delay, and then back to page 1, This momentary flash to page 1, always goes away if I just unplug the yellow RX wire during boot. Have tried 5 volt USB, computer, phone charger, and 12 volt DC plug, no change.
I also did another test. If I only press the reset button on the UNO (without unplugging the power) the screen works like it's supposed to. It goes back to page 0, delay and back to page 1, no flashes.
The files attached.
This is not a hardware issue. This is a software issue.
Specifically, this is a conflict between the MCU being in control versus the Nextion Device.
The IteadLib is generally installed in your Documents\Arduino\libraries folder.
Reviewing your Arduino code, you call nexInit(); in setup
.. nexInit() as defined in NexHardware.cpp issues a bkcmd=1 and page 0
Reviewing your test1.HMI you call delay=2500 and page 1 in preinitialize.
So you are observing that it is doing exactly as instructed and this result is expected.
Thank you so much Patrick! I just removed nexInit(); and now everything start up without any unwanted page flashes :) I also tried to edit the NexHardware.cpp and that had the same effect. The Arduino code is basically a copy and paste job, and my programming "skills" are currently 4 days old, so i'm not that surprised I didn't notice the problem.
Thank Gerry - he was the one told me about this.