Nextion display rtc problem

Hi guys.
I have a problem with the rtc. I'm using the nextion display NX8048K050_011. I have a page where i can see the data and time. Everything works fine in the software simulator but when I download the project i see always weird numbers in my variables. i don't understand where they come from. I added in the same page a buton to set a correct data and time but it doesn't work. it works only in the software simulator again. what's wrong?

In this page i added a timer. "tm0" with this script:

year.val=rtc0
month.val=rtc1
day.val=rtc2
hours.val=rtc3
minutes.val=rtc4
// Day of the week is stored as 0 (Sunday) to 6 (Saturday).
// For that reason we are going to write the corresponding text:
if(rtc6==0)  // if day of the week is 0
{
  tDay.txt="SUNDAY"  // write to the text the word "SUNDAY"
}else if(rtc6==1)  // if day of the week is 1
{
  tDay.txt="MONDAY"  // write to the text the word "MONDAY"
}else if(rtc6==2)  // if day of the week is 2
{
  tDay.txt="TUESDAY"  // write to the text the word "TUESDAY"
}else if(rtc6==3)  // if day of the week is 3
{
  tDay.txt="WEDNESDAY"  // write to the text the word "WEDNESDAY"
}else if(rtc6==4)  // if day of the week is 4
{
  tDay.txt="THURSDAY"  // write to the text the word "THURSDAY"
}else if(rtc6==5)  // if day of the week is 5
{
  tDay.txt="FRIDAY"  // write to the text the word "FRIDAY"
}else if(rtc6==6)  // if day of the week is 6
{
  tDay.txt="SATURDAY"  // write to the text the word "SATURDAY"
}

to set the correct values I have a button with this script:

rtc0=2017 //year
rtc1=8 //month
rtc2=28 //day
rtc3=16 //hour
rtc4=50 //minute
rtc5=36 //second

why the simulator works fine? I added the battery. nothing changed.

I see always these values:
year.val=2165
month.val=25
day.val=45
hours.val=45
minutes.val=85
tDay.txt="MONDAY"

Hello robotronico
Please can you put your HMI file into a zip file and upload it please? I'll try it on one of my Nextion displays for you. Might be a couple of days before I get time though.

Thanks,

Hi and thanks for your answer.
this is the file: link

it's okay take a look when you have time. it would be really kind of you.
Grazie :slight_smile:

I want to share also the video where i saw how to use the RTC.
I think it’s a great project: https://youtu.be/7Dkn3t_jjN8
I trid this project in local and it works. i downloaded in into my panel. i cas see always the same data and time

year=2165
monthl=25
day=45
hours=45
minutes=85

I’m wonderinf where are these numbers :confused:

Doesn't look like the clock is enabled to run.
There is a bit in register 0 I think that enables time to run.
And then other registers where the data is maintained and updated immediately following it.

CrossRoads:
Doesn't look like the clock is enabled to run.

https://datasheets.maximintegrated.com/en/ds/DS3231-DS3231S.pdf

Hi and thanks for your answer. I'm not using the module DS3231. I'm trying to use the internal RTC. it's integrated into the display actually. and I don't think it needs an abilitation or something

I've tried to download from the link but nothing happens. Please can you do as I asked and put the HMI file into a zip file and upload to this discussion. I don't usually go off this site to find stuff for answering questions.

Thanks.

Hi,
I didn’t know I could attach something here.
anyway the file is here. you should reach the page 6 and see what happens. unfortunately to reach this page you should have my arduino connected to the display… i think you can set page 6 as the first page at the power on.

Let me know if you are able to try the RTC… or I’ll modify the HMI file to let you test it.
thanks a lot for your time.

GAZEBO_800X480_9.zip (764 KB)

Hello robotronico,

I have modified your configuration, see attached.

Page 0, home
Added a button to change the page to page 6 for testing.

Page 6, time
Added a seconds display for testing, remove it later if you don’t want / need it.
Changed set1 to the current time and date for me now while I did the tests.
Removed from set 2 rtc6=0, you can’t change rtc6, it’s read only
Changed tmr0 from 50ms to 1000ms.

With those changes the seconds counts up as expected and the time and date are correct.

I suspect, but I don’t know, that the problem was having tmr0 set to 50ms. I suspect it can’t update the display fast enough if you are trying to update the display every 50ms. If you want to display seconds then probably try setting it to 200ms or maybe 500ms. If you don’t want seconds then try 1000ms for the update. I suggest you experiment with different times to see what difference they make on the display.

GAZEBO_800X480_9_PB_Edited.zip (737 KB)

Hi PerryBebbington and thanks for your help really.
I tried what you said. the simulator works perfectly. when I download the project the values are fixed as before.
always the same numbers.
year=2165
monthl=25
day=45
hours=45
minutes=85

Is it a curse?

I have noticed another weird things. when I'm in the simulator software I can send the commands to my nextion device. Well if I push page 6 on the simulator nothing happens on the panel. is it normal?
I can only reboot the device from the simulator.
I don't know what else I can do.

If you have some other ideas i'm here othewise thanks anyway for your help and your time.

I tested your configuration on an NX8048K070_11, which means I had to change the device from the NX8048K050_11 that I think you have. I changed it back before sending to you.

The configuration worked perfectly on mine for everything I tried.

To be clear when you say:

Well if I push page 6 on the simulator nothing happens on the panel. is it normal?

you mean the Page 6 button I added? That button should take you to page 6, Time in both the simulator and on the actual display. It works for me on both.

Your 'Time' button does not take you to page 6.

When I tested it I had no link to any Arduino or other host processor, so there was nothing sending data to the Nextion. All I had was power connected to with the configuration. If you've not tried that then try it to see what happens.

in order to erase all doubts i have created a simple page with tm0 and some fields to display the data and time. one button to change it.
the same result. It works only in the software simulator.

I think my hardware is not working :frowning:

test rtc_1.zip (6.74 KB)

robotronico:
I think my hardware is not working :frowning:

I fear you may be correct. Are you sure you have a NX8048K050_11 and not a NX8048T050_11, which does not have an RTC?

Sure I have the enhanced version. There is also a battery.
I'll try to use EEPROM... Just to see if something works or it's a normal version trapped in a enhanced body

This is clutching at straws but try taking out the battery. It should work without a battery, the battery is only to maintain the time when the power is off.

Also try the code and configuration in my Nextion tutorial.

Thank you PerryBebbington.
I opened a ticket on the nextion website... they should answer because it looks like an hardware problem, let's see what they say.
I'll let you know.
thanks a lot for your help and your time.
ciao

robotronico:
Thank you PerryBebbington.
thanks a lot for your help and your time.
ciao

You are welcome :slight_smile:

Hi guys,
I confirm that my panel's RTC is not working.
nextion support was good. they asked me to try many things but at the end they confirm that my panel's RTC was not initialized in a correct way or something like this.
they are going to send me a new panel.
The support was good and really fast considering that they are in China and I'm in Italy.
thanks to everybody.
ciao.

robotronico:
Nextion support was good. They asked me to try many things but at the end they confirm that my panel's RTC was not initialized in a correct way or something like this.
they are going to send me a new panel.
The support was good and really fast considering that they are in China and I'm in Italy.

Glad to hear the support was good; in the past I have read reports of their support being poor.

Hi Guys.
I received the new panel and I tested it. It works well finally.
Thanks for your support and your time.
:grinning: I'm Happy