User avatar
RDK
Posts: 301
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Serial Port traffic duirng Boot-up

Sat May 02, 2020 12:15 pm

A week or so I posted a request for members that are using a Nextion HMI display with a Pi (viewtopic.php?f=29&t=272166). I got no responses from that posting.

I have furthered my experiments. The Nextion unit is a display unit which receives its instructions via a serial port. In my case it is connected to my Pi V3B: 5V and ground for power and GPIO 14 and GPIO 15 for the TxD and RxD serial pins for serial traffic. My issue is that during the Pi's boot-up, the Nextion Display is evidently receiving serial traffic from the Pi. This traffic effectively disables the display which can only be corrected by manually power cycling the display. After that it will function normally.

This Pi is running Stretch. Serial console traffic has been disabled via the Raspi-Config function. Bluetooth has been disabled in the /boot/config.txt;

Code: Select all

dtoverlay=pi3-disable-bt
and I have disabled these services:

Code: Select all

 sudo systemctl disable hciuart.service 
 sudo systemctl disable bluetooth.service
.

I have SAMBA and Apache also running on this Pi.

Can anyone suggest the source of the UART/Serial port traffic?...RDK
Last edited by RDK on Sat May 02, 2020 3:11 pm, edited 1 time in total.

User avatar
scruss
Posts: 3142
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: SerailPort traffic duirng Boot-up

Sat May 02, 2020 1:51 pm

Can you put a TTL Serial - USB adapter on the pins instead of the display, and track what the Raspberry Pi is putting out on boot? If there are no console=serial… entries in cmdline.txt, then I'm as confused as you are about why you're seeing this.

Neat device. Looks like they have tech support of their own at https://nextion.tech/
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

User avatar
RDK
Posts: 301
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Serial Port traffic duirng Boot-up

Sat May 02, 2020 3:15 pm

Thanks for the idea. I have this serial to USB adapter (DSD TECH USB to TTL Serial Adapter with FTDI FT232RL Chip) which I think is what you were suggesting. The problem is that I'm not sure what/how to use it to debug this situation. Do I need another Pi to listen to this one during boot-up or is there a better way?.....RDK

User avatar
scruss
Posts: 3142
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Serial Port traffic duirng Boot-up

Sat May 02, 2020 8:43 pm

You don't need another Raspberry Pi, just something with a USB port and a terminal program.

If you're feeling really fancy, you could get one of those cheap logic analyzers and see what the ports were sending far beyond any recognized serial protocol. They're rather good, and the software (sigrok) is free and amazing. And yes, they can turn serial port signals back into characters.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

User avatar
RDK
Posts: 301
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Serial Port traffic duirng Boot-up

Sun May 03, 2020 4:50 am

Thanks again. Excuse me for being a bit of a novice on this but, that is just what I am!!!
I have another Pi on which I can install the SIGROT software. I assume I have to modify the raspi-config setting on that Pi so it can read the serial traffic from the USB-serial device?

Life is an experiment and this is just another one in a long list.....RDK

User avatar
RDK
Posts: 301
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Serial Port traffic duirng Boot-up

Sun May 03, 2020 8:18 am

I have putty on another Pi (AKA Pi b) so I tried the following experiment:
  • 1. I attached the above USB Serial adapter to Pi b and found it in the /dev/tty as ttyUSB0
    2. I ran raspi-config on Pi b and enabled both serial options
    3. From the "Pi a" which was controlling the Nextion (that display now disconnected) I only connected pin 8 (TXD) to the USB RXD pin and pin 10 (RXD) to the USB TXD pin
    4. from a Pi b Desktop session, I started putty pointing it to /dev/ttyUSB0 and got a blank window
    5. I rebooted "Pi a". There was nothing different displayed in the putty window during or after the reboot. I did see the USB RXD light blink once.
    6. When I started the Python3 program on Pi a which usually communicates with the Nextion display, the first thing it does is read the serial port (/dev/serial0) and gets a zero length record. I am assuming that /dev/serial0 on "Pi a" was the same as was being listened to by the USB device on Pi b?
What have I done wrong or it this really telling me? Thanks....RDK

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5578
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Serial Port traffic duirng Boot-up

Sun May 03, 2020 11:02 am

RDK wrote:
Sun May 03, 2020 8:18 am
I have putty on another Pi (AKA Pi b) so I tried the following experiment:
  • 1. I attached the above USB Serial adapter to Pi b and found it in the /dev/tty as ttyUSB0
    2. I ran raspi-config on Pi b and enabled both serial options
    3. From the "Pi a" which was controlling the Nextion (that display now disconnected) I only connected pin 8 (TXD) to the USB RXD pin and pin 10 (RXD) to the USB TXD pin
    4. from a Pi b Desktop session, I started putty pointing it to /dev/ttyUSB0 and got a blank window
    5. I rebooted "Pi a". There was nothing different displayed in the putty window during or after the reboot. I did see the USB RXD light blink once.
    6. When I started the Python3 program on Pi a which usually communicates with the Nextion display, the first thing it does is read the serial port (/dev/serial0) and gets a zero length record. I am assuming that /dev/serial0 on "Pi a" was the same as was being listened to by the USB device on Pi b?
What have I done wrong or it this really telling me? Thanks....RDK
W.r.t. to 3) did you, literally, only connect pins 8 & 10. What about, the necessary, ground (0V) connection? Also have you checked that the USB TxD pin outputs 3.3V serial data levels? FWIW, see my notes about/examples of various devices I've used/checked: https://www.cpmspectrepi.uk/raspberry_p ... pters.html
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

hippy
Posts: 7368
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Serial Port traffic duirng Boot-up

Sun May 03, 2020 2:28 pm

RDK wrote:
Sun May 03, 2020 8:18 am
4. from a Pi b Desktop session, I started putty pointing it to /dev/ttyUSB0 and got a blank window
5. I rebooted "Pi a". There was nothing different displayed in the putty window during or after the reboot. I did see the USB RXD light blink once.
Temporarily enable the 'Pi a' serial port to allow login. This will cause the 'Pi a' to send a login prompt which should show on the 'Pi b' putty display. This will confirm that 'Pi b' can see what 'Pi a' is sending.

Then disable login on the 'Pi a' serial port. Run a Python test program on 'Pi a' which repeatedly sends simple "XYZZY\n" text instead of whatever Nextion commands you would be sending. That text should appear on the 'Pi b' display.

Once you know all that is working you can set about figuring out what actually happens when you power-up with your 'Pi a' to Nextion program. You may want to use something other than putty if that doesn't show non-printable characters as hexadecimal.

User avatar
RDK
Posts: 301
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Serial Port traffic duirng Boot-up

Sun May 03, 2020 6:00 pm

Trevor....OK, I'll admit it I'm new to all of this. The USB-to-Serial adapter is plugged into the Pi b and I did not think I should also have it powered from "Pi a" . Should it also be connected to the 3.3V and ground on "Pi a"?

Hippy...I will look into your ideas tomorrow.....RDK

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5578
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Serial Port traffic duirng Boot-up

Sun May 03, 2020 9:02 pm

RDK wrote:
Sun May 03, 2020 6:00 pm
Trevor....OK, I'll admit it I'm new to all of this. The USB-to-Serial adapter is plugged into the Pi b and I did not think I should also have it powered from "Pi a" . Should it also be connected to the 3.3V and ground on "Pi a"?

Hippy...I will look into your ideas tomorrow.....RDK
Not 3.3V and ground, but a (common) ground connection is needed to complete the Rx & Tx loops. Pi B will be providing 5V power via the USB connection (and, of course, ground/0V for that Pi). What you need to ensure before connecting the Rx and Tx lines (Rx on Pi A to Tx on the adapter, and Tx on Pi A to Rx on the adapter) usually via a loopback test (Rx to Tx on the adapter) is that the output, when high is not greater than 3.3V otherwise you will damage Pi A - the GPIO's of all Pi's are not 5V tolerant - hence my comments about which devices are O.K. in my webpage I linked to previously.
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
RDK
Posts: 301
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Serial Port traffic duirng Boot-up

Mon May 04, 2020 7:03 am

Trevor....Thanks for the clarification and the link. Right now the Nextion display is working correctly with "Pi a" after the last cold boot came up normally. Historically it runs for several days before becoming unresponsive (ie it stops listening to the serial traffic).

When that happens I will resume my experiments and will also hook up the ground from "Pi a" to the USB adapter. That adapter is set to 3.3v for these experiments, but when I hook up the Nextion display to "Pi a", I use the "Pi a"'s 5V pin as that is what is required to power the Nextion display. I will run a new experiment where I power the Nextion via a separate 5V 2.5A wall wart, but still attach the ground, TxD and RxD from "Pi a" for serial communications.

I will also look into Hippy's suggestions…..RDK

User avatar
RDK
Posts: 301
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Serial Port traffic duirng Boot-up

Thu May 21, 2020 7:41 am

The Nextion support has gotten back to me and have suggested that the 5v power from the Pi is not sufficient/stable enough for the display unit. They suggest powering it from a separate 5v 2.5A wall wart. That is not a problem as I have a tester plug which will separately power the display unit. One uses that when the unit is new to make sure it works and runs the diagnostics.

So my question, going back to some of Trevor's comments, how do I do this and also use the serial traffic from the Pi. Can I attach/combine both the ground from the wall wart power unit and that from the Pi? Trevor's comments seem to imply that the "Rx & Tx loops" need a common ground to complete the serial message transmissions.

Thanks....RDK

richrussell
Posts: 35
Joined: Thu Jan 16, 2020 10:52 am

Re: Serial Port traffic duirng Boot-up

Thu May 21, 2020 12:29 pm

Yes, you should connect the ground on the display to the Raspberry Pi's ground.

For serial communication to work each end need to see a voltage on a wire. With no reference point (eg ground) it can't tell whether there is a voltage or not. Consider using a voltmeter with just one lead for example.

User avatar
RDK
Posts: 301
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Serial Port traffic duirng Boot-up

Sun Jun 21, 2020 7:48 pm

Problem solved. I replaced all of the wiring between the Pi and the Nextion display and all of the issues disappeared. Thanks for your ideas and patiences...RDK

Return to “Advanced users”