![]() |
|
OpenPlotter RPI 4 and hat - Printable Version +- OpenMarine (https://forum.openmarine.net) +-- Forum: Pypilot (https://forum.openmarine.net/forumdisplay.php?fid=17) +--- Forum: General discussion (https://forum.openmarine.net/forumdisplay.php?fid=18) +--- Thread: OpenPlotter RPI 4 and hat (/showthread.php?tid=6512) Pages:
1
2
|
RE: OpenPlotter RPI 4 and hat - ssth@yahoo.com - 2025-11-23 (2025-11-12, 10:04 PM)seandepagnier Wrote: what happens if you stop pypilot hat: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 RE: OpenPlotter RPI 4 and hat - ssth@yahoo.com - 2025-11-25 (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: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. 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. RE: OpenPlotter RPI 4 and hat - ssth@yahoo.com - 2025-11-30 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. RE: OpenPlotter RPI 4 and hat - seandepagnier - 2025-12-06 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. RE: OpenPlotter RPI 4 and hat - ssth@yahoo.com - 2026-05-16 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. |