ITEADLIB_Nextion published on Particle Build

Hi, it did work. Both had the same result as page0.show();. So as a conclusion: there is no way to erase the plotted curves, just to refresh the entire page. Correct? It is pity as it make the screen flash for a moment…

@ScruffR I’m a university student trying to get my Particle Photon to communicate with my Nextion 4.3" screen. I can’t get compbutton to work-- could you please help me?

I’m using the web version of particle build. I’ve copied the compbutton.ino code from the particle library and flashed it to my proton, and have made the compbutton interface described at https://www.itead.cc/blog/an-entry-application-of-text-component-and-button-component. No matter what I do, pressing the buttons on the screen does not change the text on the screen.

I’m sorry to ask such a basic question, but I’m getting desperate for help-- any guidance you can offer would be much appreciated.

That’s a while since I last had that display out :wink:
Let me dig it up and see what’s up, but that might take a bit, since it’s rather late here in Europe :zzz: :wink:

You’re very kind. To provide a little bit more detail, here is a picture of my breadboard:

The library on the Particle library site is version 0.0.11, and that’s the code I copied and pasted into the code editor:

The code builds fine, and successfully flashes to my photon. However, when I press the + or - buttons, the 50 does not change.

Thanks again for being willing to help.

I’ve just checked and the sample works for me.
Can you send me your HMI file?

If you go to the lib and click on the GitHub icon, you can download the HMI files for each sample from there.
Or directly here https://github.com/ScruffR/ITEADLIB_Nextion/tree/master/firmware/examples/CompText
They are meant for the 3.2" displays, but you should be able to change the display with the editor.

BTW, you don’t need to copy-paste the samples. There is an USE THIS EXAMPLE button in the libraries drawer that does that for you.


Update:
Just a thought.
Have you ticked the “Send Component ID” checkbox on the two button components to produce a “Touch Release Event”?

ScruffR, thank you for the advice. I got the example to work! Downloading the HMI from the link you provided made it work. I’m very excited. I will try to figure out what was wrong with my original HMI, since I now have the example one I can compare to.

I might ask for your help again if I get stuck, but I will play with it on my own until then. Thanks again for your help!

1 Like

Hello @ScruffR itead library now has an upload protocol. This can be used to upload a tft file from the MCU. What it seems to be doing is using an SPI sd card to store the tft file on the MCU side and then upload the file to the Nextion over serial.

The documentation provided by Nextion is not enough. What do you think would be the best way to get this to work with a P1? Would really be helpful to get OTA updates working for the touchscreen in my application. I have space to add an SD card reader on the PCB presently.

I’d have to look into the docs (which usually are rather sparse and their forum mods aren’t the friendliest of types IMO either).

I’ve never gotten it to work reliably. I do have code that’s able to stream the data from a web server and into the display in real time and it updates successfully about 50% of the time. It’s still slow and enough of a pain that I don’t use it and use an SD card instead.

Here’s the code if you want to try it, however:

1 Like

What if the tft file was downloaded to an SD card first and then uploaded to the screen?

I know exactly what (and who) you mean!

It’s the serial upload to the display that’s slow, even at 115200 baud. However, putting it on an SD card or flash first may help. Also, double-buffering the data might help as well.

I know the data comes down from HTTP/TCP correctly because I can enable an md5sum on the data and it’s correct. I’ve tried different baud rates and slowing down the upload doesn’t help and makes it even more annoyingly slow.

Do you remember how slow the upload was for the CompPicture example you posted. I am using a 7" Capacitive display with pictures for all the graphics and text. The tft file is > 16MB.

The real .tft files for my displays are about 185K bytes and it took over a minute by serial at 115200 vs. a few seconds using SD card.

Thank you for your answers. I will use your library and experiment further. What i will also do i get an SD card breakout and try uploading using the library they provided.

It would be great though if either you or @ScruffR can look at the library to just confirm if i am going in the right direction with this.

Would change the SD.h to use the SDFat Library and make any other changes to support Particle.

Asking on the Itead forums as was earlier mentioned is not very helpful.

I might be wrong, but my understanding is that there is no way to write RX/TX data to SD on the Nextion displays.
I don’t really understand why ITEAD had chosen not to expose the SD interface to the Nextion application but only to the flash/boot task, but this is at least what was the case when I last looked into the topic when the Enhanced versions of the displays were released.

Their example uses a tft file saved on the SD card connected to the master MCU (Not the SD card on the Nextion). Seems like the file is sent over serial. They have not showed how that update procedure begins thereafter. I think once 0x05 is received which indicates that upload has completed sendcommand(whmi-wri filesize,baud,res0) would reset and start the update.

They have some limited documentation about it here

I built a different version of my NextionDownloadRK using double buffers. It’s in the branch dual-buffer. This uses one buffer to download the data by HTTP and another to write to serial at the same time. I was hoping that making the serial writes more consistent, instead of a delay after each 4K block would help, but it doesn’t. I still frequently get a check error after uploading by serial.

I can’t make it work, and maybe the Photon SD card to serial version like the Nextion code example will work better, but I’m not particularly hopeful as I know the data is good in my test because I calculate the md5sum on the data right before serial.write and the data is good, but the Nextion still rejects it. But the same .tft file works fine using the SD card loader, and it’s way faster.

@rickkas7, could this have to do with the issue I reported to you where Serial (and for that reason Serial1 possibly too) get affected by an open TCPClient?

I should have a shield for the sd card next week. I will let you know how it goes. Reading at what @ScruffR says in the above post I am hopeful that an SD card to tft transfer might work.