Nextion displays and memory sieves

You know the phrase 'memory like a sieve'? Well, that's mine. I just received a 3.2" Nextion display via Aliexpress which arrived after only a few days from China. This was to be a display for the M17 hotspot. But there were a few unexpected hurdles!

First off, I could not remember the connections from the GPIO pins of the Pi to the Nextion. It's actually really easy, pins 4, 6, 8 and 10,  but it took me an age to find that information on the web. Onthe Pi 4B the GPIO pins are numbered from the top (the opposite end from the USB and Ethernet connectors) with odd numbers on the left and even on the right. There are plenty of diagrams on the web. So pin 4, which is +5V is the second one down on the right, pin 6 is next down and 0v, then pin 8 which is transmitted data from the Pi, and pin 10 is received data to the Pi. The Nextion display came with a cable with a connector for the display. This has red for +ve, blue for data from the display, yellow for data to the display and black for 0V. So this is what I ended up with:

ItemGPIO pinNextion wire
+5V supply to Nextion4Red
0V6Black
Data to Nextion8Yellow
Data from Nextion10Blue

With all that done (I say all, it's just 4 wires!) the screen came on when the Pi was powered up. The screen displayed some default moving imagery but nothign from WPSD.

I had vague memories now that you need to stop the Pi running a login shell for the serial port. The Pi is running Bookworm, options may differ but running sudo raspi-conf and selecting 3 Interface Options and then I6 Serial Port allows one to select No for login shell and then Yes for enabling the serial port hardware. This is a vital step I had forgotten.

I set WPSD to use the attached display as /dev/ttyAMA0 and the G4KLX layout. Still nothing from WPSD.

More searching all over the place and I re-learned another vital step I had forgotten - you need to install code directly onto the Nextion screen which turns it into a display able to take data fed from the hotspot. The screen has an SD card slot specifically for this.

More searching and I found some Nextion files from G4KLX as a starter. There is a set of tft files which are the code for the Nextion and need to match the screen - NX4024T032 in my case. I downloaded this to an SD card, turned the Pi off, put the SD card in the Nextion's slot, powered the Pi and the Nextion told me the file was too old. Oh good. And all the others I found on the web failed the same way.

So the next step was to use the Nextion editor to convert the relevant HMI file to a new tft. This is Windows only software. Will it run under Wine? No!

I do not have a Windows PC. The wife's work laptop is locked down so one cannot install software - fair enough it is theirs. We had an old Windows PC that had not been powered for maybe two years so that was cobbled back together and turned on. After an age of it configuring itself and updating etc. I finally got the Nextion editor installed, loaded the HMI file, compiled it and put the resultant tft onto the SD card, repeated the Pi off, card in, Pi on sequence and it successfully loaded onto the Nextion. Rebooting revealed it is indeed working.

Now to box it all up... and make sure I never forget all of this again!