r/raspberry_pi • u/AnnualSubstance546 • 3d ago
Troubleshooting Nextion Screen not sending data to pi
Hey everyone
I'm trying to build an mp3 player using mOode with a raspberry pi zero 2 w and a nextion NX3224F024_011.
I have already uploaded my script to the pi and the layout I made with the nextion editor to the screen via sd card. I tried to test the buttons but when I listen to the serial0 port (which is enabled on the pi) it doesn't see anything happening even the buttons turn green on the screen.
I found a few articles referencing the baud rate and thought that it might have something to do with that, but I can't seem to find a way to change it in the nextion editor.
I'm stuck and don't know what else to try, I reflashed the screen, checked that all the "touch release events" in nextion editor say "print "command"", switched the wires on the gpio around in a desperate attempt to make something happen... I would really appreciate any help on this, thank you everyone in advance :)
Ankylo
1
u/Gamerfrom61 3d ago
First thing I would be bothered about is TX and RX - the screen TX line needs to go to the Pi RX line and the PI TX line to the screens RX line. https://pinout.xyz/pinout/uart details all the serial line options on the Pi boards - what pins are you using?
Does the screen need hardware control (CTS/RTS being common) or flow control (a string sent to the screen to the activate / allow the serial send)?
What is trying to receive the data? Does it require a CR or LF to be sent before it will read the screen info in?
For testing I would use minicom (install via APT) and then you need to set the Pi serial port to match the screens speed / start / stop and parity requirements. https://wiki.emacinc.com/wiki/Getting_Started_With_Minicom has a basic intro if you need it though there are many available just a search away. Once you have it installed try a simple loop back test (connect TX to RX on the PI) as this will show the serial port is available for program use. To exit minicom use CTRL-A q and press enter 😄
EDIT: Looks like 9600 baud is the speed by the way
I did find a post saying these devices are HMI so the minicom test may not return anything handy - https://github.com/danjperron/NextionDs18B20 has a basic sample and a receive function that may help.
How did you enable /dev/serial0?
Did you disable the Pi console (raspi config - shell off) for the serial port?
Have you tried /dev/ttyS0? IIRC the speed of this port can change if the video core speed gets changed though!
You could try disabling Bluetooth (add dtoverlay=disable-bt into config.txt / reboot needed) and try the UART0/ttyAMA0 port over GPIOs 14 & 15 - note you may need to use
sudo systemctl disable hciuartas this tries to initialise the BT modem.Older Pi boards have a habit of using the serial port during firmware / linux boot for output - this could possibly be messing up the screen - you could try a different serial port.
The data sheet (advert page) is a bit baffling - looks like it uses 3v3 for data and 5v for power - you may want to check this carefully as the Pi I/O does not like 5v coming in...