This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OpenPlotter RPI 4 and hat
#11
(2025-11-12, 10:04 PM)seandepagnier Wrote: what happens if you stop pypilot hat:

sudo systemctl stop pypilot_hat

then run it from the console:
sudo pypilot_hat

and post the output?  I am wondering if it is using the wrong lcd driver.  Otherwise it could be defective lcd..  Can you connect to localhost:33333 in a browser?
I am going through this step by step as I want this resolved once and for all.  This has been a two year process and so far to no avail.

I reloaded all software and started over.  On running pypilot from Openplotter, Pypilot 4.0.11opens.  Sometimes IMU is detected, on this occasion, IMU is not detected. I checked "Enable Hat Control and clicked the configure button which resulted in the program locking up resulting in rebooting and starting over.

After rebooting, I ran "sudo pypilot .hat from the terminal, resulting in "command not found"  Apparently, pypilot.hat is not loaded.

Next step?

Best regards, Steve
Reply
#12
(2025-11-23, 03:48 PM)ssth@yahoo.com Wrote:
(2025-11-12, 10:04 PM)seandepagnier Wrote: what happens if you stop pypilot hat:

sudo systemctl stop pypilot_hat

then run it from the console:
sudo pypilot_hat

and post the output?  I am wondering if it is using the wrong lcd driver.  Otherwise it could be defective lcd..  Can you connect to localhost:33333 in a browser?
I am going through this step by step as I want this resolved once and for all.  This has been a two year process and so far to no avail.

I reloaded all software and started over.  On running pypilot from Openplotter, Pypilot 4.0.11opens.  Sometimes IMU is detected, on this occasion, IMU is not detected. I checked "Enable Hat Control and clicked the configure button which resulted in the program locking up resulting in rebooting and starting over.

After rebooting, I ran "sudo pypilot .hat from the terminal, resulting in "command not found"  Apparently, pypilot.hat is not loaded.

Next step?

Best regards, Steve

There is apparently a problem with the Hat and pin 17 on my R pI 4. Edge Detection Following is a description of my steps using Copilot.

Library mismatch PyPilot HAT may still be using legacy RPi.GPIO calls, which rely on /sys/class/gpio. On newer Raspberry Pi OS builds, GPIO is exposed via /dev/gpiochip* and managed by libgpiod. Edge detection often fails if the library isn’t updated.

Double export conflict If PyPilot HAT tries to export GPIO17 via /sys/class/gpio while libgpiod already owns it, you’ll see “failed to add edge detection” even though gpioinfo shows it unused.

Electrical state Edge detection requires a stable signal. If GPIO17 is floating (no pull-up/down resistor), the library may refuse to register interrupts. You can test by enabling a pull-up:

bash
gpio -g mode 17 up
? Next diagnostic step
Try edge detection outside PyPilot:

bash
sudo gpiomon gpiochip0 17
If this works (you see events when toggling the pin), then the kernel and hardware are fine → the issue is in PyPilot HAT’s code or its use of RPi.GPIO.

If this fails, then the kernel/device tree is blocking edge detection → likely an overlay or driver conflict.

⚡ Practical path forward
If gpiomon succeeds → patch PyPilot HAT to use libgpiod instead of RPi.GPIO.

If gpiomon fails → check /boot/config.txt for overlays using GPIO17 (it’s often tied to hardware functions like UART or special HAT pins).

Would you like me to walk you through patching PyPilot HAT’s Python code to use libgpiod for edge detection, or focus on checking overlays in /boot/config.txt to rule out conflicts on GPIO17?

sudo gpiomon gpiochip0 17
Running

bash
sudo gpiomon gpiochip0 17
is the right way to test whether edge detection works at the kernel level. Here’s what to expect and how to interpret it:

? What happens
If successful, gpiomon will sit and wait silently.

When you physically toggle GPIO17 (for example, press a button wired to that pin, or jumper it to 3.3V/ground), it will print a line like:

Code
event: FALLING EDGE timestamp: 123456789
event: RISING EDGE timestamp: 123456790
If it immediately errors out (e.g., “Operation not permitted” or “Failed to request event”), then the kernel is blocking edge detection on that pin.

✅ How to test
Make sure you have something connected to GPIO17 that can change state (button, jumper wire).

If the pin is floating, enable a pull-up/down first:

bash
gpio -g mode 17 up
or

bash
gpio -g mode 17 down
Trigger the pin by connecting it to ground or 3.3V depending on your setup. Watch for events in the terminal.

? Interpreting results
Events appear → The kernel and hardware are fine. PyPilot HAT’s failure is due to its GPIO library (likely RPi.GPIO vs libgpiod mismatch).

No events, but no error → The pin is floating; you need a proper pull-up/down or hardware signal.

Immediate error → Overlay or driver conflict; something in /boot/config.txt may be reserving GPIO17.
Reply
#13
Reloaded previous SD card that had obtained IMU data

Pypilot 4.0.11
Enable Autopilot
X Enable HAT Control
pypilot version: .056
Detected IMU: ICM-29848
Detected Hardware 0.5

Autopilot service enabled

Backlight on LCD display works. No LCD data presented

Unable to set up Localhost 33333

pi@pi:~ $ system stop pypilot_hat
bash: system: command not found
pi@pi:~ $ sudo pypilot_hat
hat start 517.793774636
have gpio for raspberry pi
hat import done 517.847420954
loading config file: /root/.pypilot/hat.conf
write config .bak
host localhost 517.850071595
failed to read config file: /root/.pypilot/pypilot_client.conf [Errno 2] No such file or directory: '/root/.pypilot/pypilot_client.conf'
loaded device tree hat config 517.850893019
failed to find firmware [Errno 2] No such file or directory: '/root/.pypilot/firmware'
WARNING Failed to add edge detection on pin 17
retrying to setup gpio with edge detect.
Reply
#14
system is not a command, it is systemctl. So first

sudo systemctl stop pypilot_hat

As for the display, what if you explicity pass the lcd driver:
sudo pypilot_hat jlx12864

Maybe spi is not enabled?

It might be easier to run tinypilot image on a pi zero, this way all the configuration is automatic, just put the image on sd card and apply power. If you try to just use whatever operating system on a pi 4 or 5 all the hardware has to be configured correctly and there are a lot of manual steps.
Reply
#15
Sean,

The last time we communicated last year, you were in the process of evaluating your pypilot hat on a R Pi 5 using OpenPlotter
I am still having the same problems as before. I am running OpenCpn 5.8.4 on the R Pi 5.  The hat display is backlit, but no data is shown.
The blue LED on the hat recognizes wireless transmissions but does not act on them.  It even blinks on signals from my tv remote.
All of my other OpenCpn tools work fine, remote instrument data, GPS data, and general charting functions.

Please respond with any modifications that you have found that get the hat running properly on the pi.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)