joan2937 / pigpio

pigpio is a C library for the Raspberry which allows control of the General Purpose Input Outputs (GPIO).
The Unlicense
1.46k stars 410 forks source link

Problem pigpiod on RPi OS 11 (bullseye) 32bit Desktop with 2-Channel Relays Module **SOLVED** #554

Open pierol opened 1 year ago

pierol commented 1 year ago

I'm using pigpio for interfacing with Wiegand reader and a 2-Channel Relays Module. I started this project on Raspberry PI 3 B+ installing RPi OS 10 (buster) 32bit Desktop and pigpio version 79 and it operated as expected. Yesterday i configured a new Raspberry PI 3 B+ with the last recommended version RPi OS 11 (bullseye) 32bit Desktop, using the official Raspberry Pi Imager. I then installed pigpio version 79 and started at boot time as service pigpiod (sudo systemctl enable pigpiod)and the relays switch on and off continusly and i must plug off the power to stop

guymcswain commented 1 year ago

I have no idea of the problem but maybe more information may help.

What is the hardware revision? 64 or 32 bit OS? Lite or desktop?

Can you run the pigpio tests successfully?

guymcswain commented 1 year ago

FYI, to stop the service run sudo systemctl disable pigpiod followed by a power cycle if needed.

pierol commented 1 year ago

Thank you @guymcswain for your support. Here the information:

processor       : 0
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 44.80
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 44.80
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 44.80
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 44.80
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Hardware        : BCM2835
Revision        : a020d3
Serial          : 000000000e07251a
Model           : Raspberry Pi 3 Model B Plus Rev 1.3

The OS is Raspbian 11 (bullseye) 32bit Desktop. I've never run the pigpio test how can i do that ? Look below, i've done tests suggested by the library site. At the moment i've reinstalled the RPi OS 10 (buster) 32bit Desktop and all is operated as expected.

pierol commented 1 year ago

I've made some test as reported in the pigpio site.

OS release 32bit:

PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Hardware Revision:

processor       : 0
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 44.80
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 44.80
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 44.80
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 44.80
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Hardware        : BCM2835
Revision        : a020d3
Serial          : 00000000a249a97c
Model           : Raspberry Pi 3 Model B Plus Rev 1.3

This is sudo ./x_pigpio # check C I/F

Testing pigpio C I/F
pigpio version 79.
Hardware revision 10494163.
Mode/PUD/read/write tests.
TEST  1.1  PASS (set mode, get mode: 0)
TEST  1.2  PASS (set pull up down, read: 1)
TEST  1.3  PASS (set pull up down, read: 0)
TEST  1.4  PASS (write, get mode: 1)
TEST  1.5  PASS (read: 0)
TEST  1.6  PASS (write, read: 1)
PWM dutycycle/range/frequency tests.
TEST  2.1  PASS (set PWM range, set/get PWM frequency: 10)
TEST  2.2  PASS (get PWM dutycycle: 0)
TEST  2.3  PASS (set PWM dutycycle, callback: 0)
TEST  2.4  PASS (get PWM dutycycle: 128)
TEST  2.5  PASS (set PWM dutycycle, callback: 40)
TEST  2.6  PASS (set/get PWM frequency: 100)
TEST  2.7  PASS (callback: 400)
TEST  2.8  PASS (set/get PWM frequency: 1000)
TEST  2.9  PASS (callback: 4000)
TEST  2.10 PASS (get PWM range: 255)
TEST  2.11 PASS (get PWM real range: 200)
TEST  2.12 PASS (set/get PWM range: 2000)
TEST  2.13 PASS (get PWM real range: 200)
PWM/Servo pulse accuracy tests.
TEST  3.1  PASS (get servo pulsewidth: 500)
TEST  3.2  PASS (set servo pulsewidth: 40000)
TEST  3.3  PASS (get servo pulsewidth: 1500)
TEST  3.4  PASS (set servo pulsewidth: 13333)
TEST  3.5  PASS (get servo pulsewidth: 2500)
TEST  3.6  PASS (set servo pulsewidth: 8000)
TEST  3.7  PASS (set/get PWM frequency: 1000)
TEST  3.8  PASS (set PWM range: 200)
TEST  3.9  PASS (get PWM dutycycle: 20)
TEST  3.10 PASS (set PWM dutycycle: 200)
TEST  3.11 PASS (get PWM dutycycle: 40)
TEST  3.12 PASS (set PWM dutycycle: 400)
TEST  3.13 PASS (get PWM dutycycle: 60)
TEST  3.14 PASS (set PWM dutycycle: 600)
TEST  3.15 PASS (get PWM dutycycle: 80)
TEST  3.16 PASS (set PWM dutycycle: 800)
Pipe notification tests.
TEST  4.1  PASS (notify open/begin: 0)
TEST  4.2  PASS (notify pause: 0)
TEST  4.3  PASS (notify close: 0)
TEST  4.4  PASS (sequence numbers ok: 1)
TEST  4.5  PASS (gpio toggled ok: 1)
TEST  4.6  PASS (number of notifications: 80)
Waveforms & serial read/write tests.
TEST  5.1  PASS (callback, set mode, wave clear: 0)
TEST  5.2  PASS (pulse, wave add generic: 4)
TEST  5.3  PASS (wave tx repeat: 9)
TEST  5.4  FAILED got 25 (callback: 50)
TEST  5.5  PASS (wave tx stop: 0)
TEST  5.6  PASS (serial read open: 0)
TEST  5.7  PASS (wave clear, wave add serial: 3405)
TEST  5.8  PASS (wave tx start: 6811)
TEST  5.9  PASS (NOT APPLICABLE: 0)
TEST  5.10 PASS (NOT APPLICABLE: 0)
TEST  5.11 FAILED got 10 (wave tx busy, serial read: 0)
TEST  5.12 PASS (serial read close: 0)
TEST  5.13 PASS (wave get micros: 6158148)
TEST  5.14 PASS (wave get high micros: 6158148)
TEST  5.15 PASS (wave get max micros: 1800000000)
TEST  5.16 PASS (wave get pulses: 3405)
TEST  5.17 PASS (wave get high pulses: 3405)
TEST  5.18 PASS (wave get max pulses: 12000)
TEST  5.19 PASS (wave get cbs: 6810)
TEST  5.20 PASS (wave get high cbs: 6810)
TEST  5.21 PASS (wave get max cbs: 25016)
TEST  5.22 PASS (wave create pad, count==1, wid==: 0)
TEST  5.23 PASS (wave create pad, count==2, wid==: 1)
TEST  5.24 PASS (delete wid==0 success: 0)
TEST  5.25 PASS (No more CBs using wave create: -67)
TEST  5.26 PASS (wave create pad, count==3, wid==: 0)
TEST  5.27 PASS (wave chain [1,0]: 0)
TEST  5.28 PASS (callback count==: 5)
Trigger tests
TEST  6.1  PASS (gpio trigger count: 5)
TEST  6.2  PASS (gpio trigger pulse length: 150)
Watchdog tests.
TEST  7.1  PASS (set watchdog on count: 39)
TEST  7.2  PASS (set watchdog off count: 0)
Bank read/write tests.
TEST  8.1  PASS (read bank 1: 0)
TEST  8.2  PASS (read bank 1: 33554432)
TEST  8.3  PASS (clear bank 1: 0)
TEST  8.4  PASS (set bank 1: 1)
TEST  8.5  PASS (read bank 2: 0)
TEST  8.6  PASS (clear bank 2: 0)
TEST  8.7  PASS (NOT APPLICABLE: 0)
TEST  8.8  PASS (set bank 2: 0)
TEST  8.9  PASS (NOT APPLICABLE: 0)
Script store/run/status/stop/delete tests.
TEST  9.1  PASS (store/run script: 100)
TEST  9.2  PASS (run script/script status: 201)
TEST  9.3  PASS (run/stop script/script status: 110)
TEST  9.4  PASS (delete script: 0)

this is ./x_pigpiod_if2 # check C I/F to daemon:

Connected to pigpio daemon (0).

Testing pigpiod C I/F 2
pigpio version 79.
Hardware revision 10494163.
Mode/PUD/read/write tests.
TEST  1.1  PASS (set mode, get mode: 0)
TEST  1.2  PASS (set pull up down, read: 1)
TEST  1.3  PASS (set pull up down, read: 0)
TEST  1.4  PASS (write, get mode: 1)
TEST  1.5  PASS (read: 0)
TEST  1.6  PASS (write, read: 1)
TEST  1.7  PASS (pigpio_start with non-default arguments: 31)
PWM dutycycle/range/frequency tests.
TEST  2.1  PASS (set PWM range, set/get PWM frequency: 10)
TEST  2.2  PASS (get PWM dutycycle: 0)
TEST  2.3  PASS (set PWM dutycycle, callback: 0)
TEST  2.4  PASS (get PWM dutycycle: 128)
TEST  2.5  PASS (set PWM dutycycle, callback: 40)
TEST  2.6  PASS (set/get PWM frequency: 100)
TEST  2.7  PASS (callback: 400)
TEST  2.8  PASS (set/get PWM frequency: 1000)
TEST  2.9  PASS (callback: 4000)
TEST  2.10 PASS (get PWM range: 255)
TEST  2.11 PASS (get PWM real range: 200)
TEST  2.12 PASS (set/get PWM range: 2000)
TEST  2.13 PASS (get PWM real range: 200)
PWM/Servo pulse accuracy tests.
TEST  3.1  PASS (get servo pulsewidth: 500)
TEST  3.2  PASS (set servo pulsewidth: 40000)
TEST  3.3  PASS (get servo pulsewidth: 1500)
TEST  3.4  PASS (set servo pulsewidth: 13333)
TEST  3.5  PASS (get servo pulsewidth: 2500)
TEST  3.6  PASS (set servo pulsewidth: 8000)
TEST  3.7  PASS (set/get PWM frequency: 1000)
TEST  3.8  PASS (set PWM range: 200)
TEST  3.9  PASS (get PWM dutycycle: 20)
TEST  3.10 PASS (set PWM dutycycle: 200)
TEST  3.11 PASS (get PWM dutycycle: 40)
TEST  3.12 PASS (set PWM dutycycle: 400)
TEST  3.13 PASS (get PWM dutycycle: 60)
TEST  3.14 PASS (set PWM dutycycle: 600)
TEST  3.15 PASS (get PWM dutycycle: 80)
TEST  3.16 PASS (set PWM dutycycle: 800)
Pipe notification tests.
TEST  4.1  PASS (notify open/begin: 0)
TEST  4.2  PASS (notify pause: 0)
TEST  4.3  PASS (notify close: 0)
TEST  4.4  PASS (sequence numbers ok: 1)
TEST  4.5  PASS (gpio toggled ok: 1)
TEST  4.6  PASS (number of notifications: 80)
Waveforms & serial read/write tests.
TEST  5.1  PASS (callback, set mode, wave clear: 0)
TEST  5.2  PASS (pulse, wave add generic: 4)
TEST  5.3  PASS (wave tx repeat: 9)
TEST  5.4  FAILED got 26 (callback: 50)
TEST  5.5  PASS (wave tx stop: 0)
TEST  5.6  PASS (serial read open: 0)
TEST  5.7  PASS (wave clear, wave add serial: 3405)
TEST  5.8  PASS (wave tx start: 6811)
TEST  5.9  PASS (callback: 0)
TEST  5.10 FAILED got 1740 (wave tx busy, callback: 1702)
TEST  5.11 FAILED got -142 (wave tx busy, serial read: 0)
TEST  5.12 PASS (serial read close: 0)
TEST  5.13 PASS (wave get micros: 6158148)
TEST  5.14 PASS (wave get high micros: 6158148)
TEST  5.15 PASS (wave get max micros: 1800000000)
TEST  5.16 PASS (wave get pulses: 3405)
TEST  5.17 PASS (wave get high pulses: 3405)
TEST  5.18 PASS (wave get max pulses: 12000)
TEST  5.19 PASS (wave get cbs: 6810)
TEST  5.20 PASS (wave get high cbs: 6810)
TEST  5.21 PASS (wave get max cbs: 25016)
TEST  5.22 PASS (wave create pad, count==1, wid==: 0)
TEST  5.23 PASS (wave create pad, count==2, wid==: 1)
TEST  5.24 PASS (delete wid==0 success: 0)
TEST  5.25 PASS (No more CBs using wave create: -67)
TEST  5.26 PASS (wave create pad, count==3, wid==: 0)
TEST  5.27 PASS (wave chain [1,0]: 0)
TEST  5.28 PASS (callback count==: 5)
Trigger tests.
TEST  6.1  PASS (gpio trigger count: 5)
TEST  6.2  PASS (gpio trigger pulse length: 150)
Watchdog tests.
TEST  7.1  PASS (set watchdog on count: 39)
TEST  7.2  PASS (set watchdog off count: 0)
Bank read/write tests.
TEST  8.1  PASS (read bank 1: 0)
TEST  8.2  PASS (read bank 1: 33554432)
TEST  8.3  PASS (clear bank 1: 0)
TEST  8.4  PASS (set bank 1: 1)
TEST  8.5  PASS (read bank 2: 0)
TEST  8.6  PASS (clear bank 2: 0)
TEST  8.7  PASS (clear bank 2: -42)
TEST  8.8  PASS (set bank 2: 0)
TEST  8.9  PASS (set bank 2: -42)
Script store/run/status/stop/delete tests.
TEST  9.1  PASS (store/run script: 100)
TEST  9.2  PASS (run script/script status: 201)
TEST  9.3  PASS (run/stop script/script status: 410)
TEST  9.4  PASS (delete script: 0)

Test ./x_pigpio.py # check Python I/F to daemon something wrong:

Connected to pigpio daemon.

Testing pigpio Python module 1.78
Python 3.9.2 (default, Mar 12 2021, 04:06:34)  [GCC 10.2.1 20210110]
pigpio version 79.
Hardware revision 10494163.
Mode/PUD/read/write tests.
TEST  1.1  PASS (set mode, get mode: 0)
TEST  1.2  PASS (set pull up down, read: 1)
TEST  1.3  PASS (set pull up down, read: 0)
TEST  1.4  PASS (write, get mode: 1)
TEST  1.5  PASS (read: 0)
TEST  1.6  PASS (write, read: 1)
PWM dutycycle/range/frequency tests.
TEST  2.1  PASS (set PWM range, set/get PWM frequency: 10)
TEST  2.2  PASS (get PWM dutycycle: 0)
TEST  2.3  PASS (set PWM dutycycle, callback: 0)
TEST  2.4  PASS (get PWM dutycycle: 128)
TEST  2.5  PASS (set PWM dutycycle, callback: 40)
TEST  2.6  PASS (set/get PWM frequency: 100)
TEST  2.7  PASS (callback: 400)
TEST  2.8  PASS (set/get PWM frequency: 1000)
TEST  2.9  PASS (callback: 4000)
TEST  2.10 PASS (get PWM range: 255)
TEST  2.11 PASS (get PWM real range: 200)
TEST  2.12 PASS (set/get PWM range: 2000)
TEST  2.13 PASS (get PWM real range: 200)
PWM/Servo pulse accuracy tests.
TEST  3.1  PASS (get servo pulsewidth: 500)
TEST  3.2  PASS (set servo pulsewidth: 40000)
TEST  3.3  PASS (get servo pulsewidth: 1500)
TEST  3.4  PASS (set servo pulsewidth: 13333)
TEST  3.5  PASS (get servo pulsewidth: 2500)
TEST  3.6  PASS (set servo pulsewidth: 8000)
TEST  3.7  PASS (set/get PWM frequency: 1000)
TEST  3.8  PASS (set PWM range: 200)
TEST  3.9  PASS (get PWM dutycycle: 20)
TEST  3.10 PASS (set PWM dutycycle: 200)
TEST  3.11 PASS (get PWM dutycycle: 40)
TEST  3.12 PASS (set PWM dutycycle: 400)
TEST  3.13 PASS (get PWM dutycycle: 60)
TEST  3.14 PASS (set PWM dutycycle: 600)
TEST  3.15 PASS (get PWM dutycycle: 80)
TEST  3.16 PASS (set PWM dutycycle: 800)
Pipe notification tests.
TEST  4.1  PASS (notify open/begin: 0)
TEST  4.2  PASS (notify pause: 0)
TEST  4.3  PASS (notify close: 0)
TEST  4.4  PASS (sequence numbers ok: 1)
TEST  4.5  PASS (gpio toggled ok: 1)
TEST  4.6  PASS (number of notifications: 80)
Waveforms & bit bang serial read/write tests.
TEST  5.1  PASS (callback, set mode, wave clear: 0)
TEST  5.2  PASS (pulse, wave add generic: 4)
TEST  5.3  PASS (wave send repeat: 9)
TEST  5.4  FAILED got 26 (callback: 50)
TEST  5.5  PASS (wave tx stop: 0)
TEST  5.6  PASS (serial read open: 0)
TEST  5.7  PASS (wave clear, wave add serial: 3405)
TEST  5.8  PASS (wave send once: 6811)
TEST  5.9  PASS (callback: 0)
TEST  5.10 FAILED got 1737 (wave tx busy, callback: 1702)
bytearray(b'\x98\x80\xf8\x98\xfe\x9e~\x06\x98\x98\xe6\xf8\x06\x18~\x80\x9ef\x06\x98~\x86\x9e\xf8\x9e`fx\x18\x06\x98\x9ex\x06\x98\x9ef\x86\xf8\x06\x18x\x86\x9e\x1e\xe6\xe0\xe6\x9e\xf8\x9e`fx\xf8\x9e`\x86\x06\xe6\x98\x06\x06xf\x06\x98x\xe0\x9e\xfe\x9e\x18f\x9e\xfe\x9ef\xe6\xf8\x06\x98\xf8f~\xe6\x9e\xe6\x9ef\x86\xf8\x06\x18\xe0f\x06\x18~\x80\x9e\x86\x9e\x1e\x06\x98\xf8f~\xf8\x9e\x00\x98\x9ex\x06\x98x\xe6\x9e\x18\xe6\xe6\xe6~\x98\x80\x06\x86\x9e`\x06\x98\x80\x06\x9e\xe0\x9e\x00\x18~\x80\x9ef\x06\x98\xe0\x06\x9e\xfe\x9ef\x06x\x1e\x06\x18~\x80\x9e\x06\x06~\x00\x18\x9e\xfe\x9ef\x86\xf8\xe6\x18`\x06\x98\xe6\x06\xe6\x9e\xf8\x9e\x00\x98\x9ef\x86\xf8\x06\x18\x9e\xfe\x9ef\xe6\xf8fx\x98\x80\x86\x98\xf8\x9e\x00\x18~\x80\x9ef\x06\x18xffx\x00\x06\x18\xe0\xe6\x9e\x1e\xe6\x9e\xe6\x9e\x00\x98\x9ex\x06\x18~\x80\x9ef\x06\x98\x9e\x1efx\x06\x86\x9e\x00\x18\xe0f~\x18f\x9ef\x06x\xf8\x86\x98\x80\xf8\x98\xfe\x9e~\x06\x98\x80\x86\xf8fx\x00\x98\x9ef\x86\xf8\x06\x18\xe0\x86\xf8\xe6\x9e~\xe6\xf8\x06\x18\xe0\xe6\x9ef\x86\x9e`\x06\x98~\x86\x9e`\x06\x9e\x00\x18~\x86\x9e\x1e\x06~\xfe\x9e\x18f\x9e\xfe\x9ef\xe6\xf8\x06\x98~\x18fx\x06\x06~\x80\x9e\x1e\xe6~\x98\x80\xfe\x98f\x86\xf8\x06\x18\xe0\x86\xf8f~\x86\x9e\x1efx`\x06\x98\x80\x86\xf8f\x9e\x1e\x06\x18\x9ef\x86\x9e~\x06\x98\xe6\x06\x06\x18x\xfe\x9e\x18\x06\x98\x9e\xe6\x9e\xf8\x9eff\x9ef\x86\x9e`\xe6\xf8\xe6~\x98\x80\xfe\x98f\x86\xf8\x06\x98\xf8\x06~f\x86\xf8\x86\x9e\x00\x98\x80\x06\x9e\x06\x86\xf8f~\xe6\x9e\x1e\x06\x98\xe0\x06\x9e\x06\x86\x9e~fx`\x06\x18~\xfe\x9e\x00\x98\x9efx\x18\x86\xf8f\x06\x98\x9efxf\x06~\x86\x9e\xf8\x9e~\xe6\xf8\x06\x86\x98\x80\xfe\x98f\x86\xf8\x06\x18x\x18fx\x06\x06xxf~\xe0\x9e\x00\x98\x9ef\x86\xf8\xe6\xe0\x06\x9ef\xe6\xf8\x06\x18~\xfe\x9e\x00\x18xf\x06\x9e\x86\x9e~\x06\x9e`\x86xf\x06\x9e\x00\x98\x9efx\x06\xe6\xf8f~\x18fx\x1e\x86\x86\x98\x80~\x86\xf8f\x9e\xe6\x9e\xe6\x86xf\x9e\x1ef\xe6xf\x06x\x00\x98~\x06\x86\xf8\x06\x18\x9e\x06\x06~\x80\x9e\x00\x98\xf8f\x9e\xfe\x9e\xfe\x9e`\x06\x9e~\x18x\x00\x18\x9e\x86\x9e\x1e\x06\x98~\x18f\x9e\xf8\x9e\x9e\x9e\xe0\x9ef\x06x\x00\x18x\x18\xe6\x9e\xf8\x9e`\xe6~\x98\x80\x06\x86\x9e`\x06\x18\x9e\xfe\x9e~\x06\x86\x00\x98\x98\x86\x9e\x1e\x06~ff\x06x\x00\x98\x9ex\x06\x98\x9e\xe6\x9ef\x86\x9e`f\x9e\xf8\x9e~\x06\x18\xe0f\x86\xf8\x06xf\x06x\x00\x98\xf8\x06~ffx`\xe6\xf8\x86\x06`f\x9e\x00\x18x\x18f\x9e~\x06\x9e`\x06\x18~\x80\x9ef\x06\x98\xf8\xe6\x9ef\x06\x9e\x1e\x06\x98\x9ex\x06\x18xff\x86\xf8\x86xf\x06\x9e\x00\x98\x80\x06xxfx\x18\xe6\xf8f\x86\xf8f\x9ef\xe6\xf8\x06\x86\x98\x80\x80\x98f\x06\x98\xe0f\x06fx\x18\xe6\xf8\x06\x18\x9e\x86\x9e\xe6\x9e\x18\x06\x9e\x86\x06\x98\x98\x86\x9e\x00\x98\x80\x06\x18\x9e\x06\x06x\x86\xe6\x18\x1e\x06\x98\xe0\x06\x9e\x06f\x9e\x18fx\x18\x86\x06`f\x9e\x00\x18~\x80\x9ef\x06\x18\x9e\x06\xe6\xf8\xe6\xe0f\x9exf\x9e\xfe\x9ef\xe6\xf8\x06\x18\x06\x9eff\xe6\xf8f\x9e\xf8\x9e~\x06\x98\x9ex\x06\x98\x80\x06\x18\x9ef\x06~f\x86\x86\x98\x80') bytearray(b"\nNow is the winter of our discontent\nMade glorious summer by this sun of York;\nAnd all the clouds that lour\'d upon our house\nIn the deep bosom of the ocean buried.\nNow are our brows bound with victorious wreaths;\nOur bruised arms hung up for monuments;\nOur stern alarums changed to merry meetings,\nOur dreadful marches to delightful measures.\nGrim-visaged war hath smooth\'d his wrinkled front;\nAnd now, instead of mounting barded steeds\nTo fright the souls of fearful adversaries,\nHe capers nimbly in a lady\'s chamber\nTo the lascivious pleasing of a lute.\n")
TEST  5.11 FAILED got 0 (wave tx busy, serial read: 1)
TEST  5.12 PASS (serial read close: 0)
TEST  5.13 PASS (wave get micros: 6158148)
TEST  5.14 PASS (NOT APPLICABLE: 0)
TEST  5.15 PASS (wave get max micros: 1800000000)
TEST  5.16 PASS (wave get pulses: 3405)
TEST  5.17 PASS (NOT APPLICABLE: 0)
TEST  5.18 PASS (wave get max pulses: 12000)
TEST  5.19 PASS (wave get cbs: 6810)
TEST  5.20 PASS (NOT APPLICABLE: 0)
TEST  5.21 PASS (wave get max cbs: 25016)
TEST  5.22 PASS (wave clear: 0)
TEST  5.23 PASS (pulse, wave add generic: 4)
TEST  5.24 PASS (wave create: 0)
TEST  5.25 PASS (wave send repeat: 9)
TEST  5.26 FAILED got 26 (callback: 50)
TEST  5.27 PASS (wave tx stop: 0)
TEST  5.28 PASS (wave add serial: 3405)
TEST  5.29 PASS (wave create: 1)
TEST  5.30 PASS (wave send once: 6811)
TEST  5.31 PASS (callback: 0)
TEST  5.32 PASS (wave tx busy, callback: 1702)
TEST  5.33 PASS (wave delete: 0)
TEST  5.34 PASS (wave create and pad, wid==: 0)
TEST  5.35 PASS (wave create and pad, wid==: 1)
TEST  5.36 PASS (delete wid==0 success: 0)
TEST  5.37 PASS (No more CBs using wave create: -67)
TEST  5.38 PASS (wave create pad, count==3, wid==: 0)
TEST  5.39 PASS (wave chain [1,0]: 0)
TEST  5.40 PASS (callback count==: 10)
Trigger tests.
TEST  6.1  PASS (gpio trigger count: 5)
TEST  6.2  PASS (gpio trigger pulse length: 150)
Watchdog tests.
TEST  7.1  PASS (set watchdog on count: 39)
TEST  7.2  PASS (set watchdog off count: 0)
Bank read/write tests.
TEST  8.1  PASS (read bank 1: 0)
TEST  8.2  PASS (read bank 1: 33554432)
TEST  8.3  PASS (clear bank 1: 0)
TEST  8.4  PASS (set bank 1: 1)
TEST  8.5  PASS (read bank 2: 0)
TEST  8.6  PASS (clear bank 2: 0)
TEST  8.7  PASS (clear bank 2: -42)
TEST  8.8  PASS (set bank 2: 0)
TEST  8.9  PASS (set bank 2: -42)
Script store/run/status/stop/delete tests.
TEST  9.1  PASS (store/run script: 100)
TEST  9.2  PASS (run script/script status: 201)
TEST  9.3  PASS (run/stop script/script status: 110)
TEST  9.4  PASS (delete script: 0)
Wavechains & filter tests.
TEST 13.1  PASS (callback, set mode, wave clear: 0)
TEST 13.2  PASS (pulse, wave add generic: 6)
TEST 13.3  PASS (clear glitch filter: 0)
TEST 13.4  PASS (clear noise filter: 0)
TEST 13.5  PASS (wave chain: 0)
TEST 13.6  PASS (wave chain, tally: 2688)
TEST 13.7  FAILED got 2688 (glitch filter, wave chain, tally: 1792)
TEST 13.8  FAILED got 1792 (glitch filter, wave chain, tally: 896)
TEST 13.9  FAILED got 1792 (glitch filter, wave chain, tally: 0)
TEST 13.10 FAILED got 750 (noise filter, wave chain, tally: 1500)
TEST 13.11 PASS (noise filter, wave chain, tally: 750)
TEST 13.12 FAILED got 13 (noise filter, wave chain, tally: 0)
TEST 13.13 PASS (wave delete: 0)

Test ./x_pigs # check pigs I/F to daemon :

Testing pigpio pigs
pigpio version 79
BC1 ok
BC2 ok
BR1 ok
BR2 ok
BS1 ok
BS2 ok
HELP ok
HWVER ok
MICS ok
MILS ok
MODEG ok
MODES ok
NO(0) ok
NB(0) ok
NP(0) ok
NC(0) ok
PFG-a ok
PFG-b ok
PFS-a ok
PFS-b ok
PRG-a ok
PRG-b ok
PROC(0) ok
PROCR(0) ok
PROCP(0) ok
PROCS(0) ok
PROCD(0) ok
PRRG ok
PRS-a ok
PRS-b ok
PRS-c ok
PRS-d ok
PUD-a ok
PUD-b ok
PUD-c ok
PUD-d ok
PUD-e ok
PWM-a ok
GDC-a ok
PWM-b ok
GDC-b ok
PWM-c ok
GDC-c ok
PWM-d ok
READ-a ok
READ-b ok
READ-c ok
READ-d ok
READ-e ok
SERVO-a ok
GPW-a ok
SERVO-b ok
GPW-b ok
SERVO-c ok
GPW-c ok
SERVO-d ok
SLR-a ok
SLR-b ok
SLR-c ok
SLR-d ok
WVCRE ok
SLR-e ok
SLR-f fail with [23 230 158 134 6 24 158 6 102 158 102 6 152 152 230 248 6 24 230 230 158 6 134 158]
SLR-g ok
TICK ok
TRIG-a ok
TRIG-b ok
TRIG-c ok
TRIG-d ok
WDOG-a ok
WDOG-b ok
WRITE-a ok
WRITE-b ok
WRITE-c ok
WRITE-d ok
WVCLR ok
WVAS ok
WVAG ok
WVCRE ok
WVTX ok
WVBSY-a ok
WVBSY-b ok
WVHLT ok
WVBSY-c ok
WVTXR ok
WVBSY-d ok
WVHLT ok
WVBSY-e ok
WVSC-a ok
WVSC-b ok
WVSC-c ok
WVSM-a ok
WVSM-b ok
WVSM-c ok
WVSP-a okTesting pigpio pipe I/F
pigpio version 79
BC1 ok
BC2 ok
BR1 ok
BR2 ok
BS1 ok
BS2 ok
HELP-a ok
HELP-b ok
HWVER ok
MICS ok
MILS ok
MODEG ok
MODES ok
NO(0) ok
NB(0) ok
NP(0) ok
NC(0) ok
PFG-a ok
PFG-b ok
PFS-a ok
PFS-b ok
PRG-a ok
PRG-b ok
PROC(0) ok
PROCR(0) ok
PROCP(0) ok
PROCS(0) ok
PROCD(0) ok
PRRG ok
PRS-a ok
PRS-b ok
PRS-c ok
PRS-d ok
PUD-a ok
PUD-b ok
PUD-c ok
PUD-d ok
PUD-e ok
PWM-a ok
GDC-a ok
PWM-b ok
GDC-b ok
PWM-c ok
GDC-c ok
PWM-d ok
READ-a ok
READ-b ok
READ-c ok
READ-d ok
READ-e ok
SERVO-a ok
GPW-a ok
SERVO-b ok
GPW-b ok
SERVO-c ok
GPW-c ok
SERVO-d ok
SLR-a ok
SLR-b ok
SLR-c ok
SLR-d ok
WVCRE ok
SLR-e ok
SLR-f fail with (23 230 158 134 6 24 158 6 102 158 102 6 152 152 230 248 6 24 230 230 158 6 134 158)
SLR-g ok
TICK ok
TRIG-a ok
TRIG-b ok
TRIG-c ok
TRIG-d ok
WDOG-a ok
WDOG-b ok
WRITE-a ok
WRITE-b ok
WRITE-c ok
WRITE-d ok
WVCLR ok
WVAS ok
WVAG ok
WVCRE ok
WVTX ok
WVBSY-a ok
WVBSY-b ok
WVHLT ok
WVBSY-c ok
WVTXR ok
WVBSY-d ok
WVHLT ok
WVBSY-e ok
WVSC-a ok
WVSC-b ok
WVSC-c ok
WVSM-a ok
WVSM-b ok
WVSM-c ok
WVSP-a ok
WVSP-b ok
WVSP-c ok
WVSP-b ok
WVSP-c ok
WVCAP-a ok
WVCAP-b ok
WVCAP-c ok
ERROR: No more CBs for waveform
WVCAP-d ok
WVCAP-e ok

Test ./x_pipe # check pipe I/F to daemon:

Testing pigpio pipe I/F
pigpio version 79
BC1 ok
BC2 ok
BR1 ok
BR2 ok
BS1 ok
BS2 ok
HELP-a ok
HELP-b ok
HWVER ok
MICS ok
MILS ok
MODEG ok
MODES ok
NO(0) ok
NB(0) ok
NP(0) ok
NC(0) ok
PFG-a ok
PFG-b ok
PFS-a ok
PFS-b ok
PRG-a ok
PRG-b ok
PROC(0) ok
PROCR(0) ok
PROCP(0) ok
PROCS(0) ok
PROCD(0) ok
PRRG ok
PRS-a ok
PRS-b ok
PRS-c ok
PRS-d ok
PUD-a ok
PUD-b ok
PUD-c ok
PUD-d ok
PUD-e ok
PWM-a ok
GDC-a ok
PWM-b ok
GDC-b ok
PWM-c ok
GDC-c ok
PWM-d ok
READ-a ok
READ-b ok
READ-c ok
READ-d ok
READ-e ok
SERVO-a ok
GPW-a ok
SERVO-b ok
GPW-b ok
SERVO-c ok
GPW-c ok
SERVO-d ok
SLR-a ok
SLR-b ok
SLR-c ok
SLR-d ok
WVCRE ok
SLR-e ok
SLR-f fail with (23 230 158 134 6 24 158 6 102 158 102 6 152 152 230 248 6 24 230 230 158 6 134 158)
SLR-g ok
TICK ok
TRIG-a ok
TRIG-b ok
TRIG-c ok
TRIG-d ok
WDOG-a ok
WDOG-b ok
WRITE-a ok
WRITE-b ok
WRITE-c ok
WRITE-d ok
WVCLR ok
WVAS ok
WVAG ok
WVCRE ok
WVTX ok
WVBSY-a ok
WVBSY-b ok
WVHLT ok
WVBSY-c ok
WVTXR ok
WVBSY-d ok
WVHLT ok
WVBSY-e ok
WVSC-a ok
WVSC-b ok
WVSC-c ok
WVSM-a ok
WVSM-b ok
WVSM-c ok
WVSP-a ok
WVSP-b ok
WVSP-c ok
guymcswain commented 1 year ago

Thank you for the test results!

So, it appears that waveforms are broken in this bullseye release. If you could help nail this down further with: cat /etc/debian_version and uname -a

Waveforms is essentially the same as pwm (DMA based control). Can we confirm that your application is using a DMA based control API? That would be nice to know there is consistency between the test failures and your application behavior.

pierol commented 1 year ago

Hi @guymcswain thank you for your support. Here the results. cat /etc/debian_version: 11.5 uname -a: Linux UC19Domotica 5.15.76-v7+ #1597 SMP Fri Nov 4 12:13:17 GMT 2022 armv7l GNU/Linux

To test the behavior:

  1. I've enable the pigpiod to start at boot time: sudo systemctl enable pigpiod.
  2. Then in /etc/rc.local i put this init code for the two GPIO i used:

     if [ "$_IP" ]; then
       printf "My IP address is %s\n" "$_IP"
     fi
     export PYTHONPATH=/home/ingegnosi/sanpietro
     /usr/bin/python3 /home/ingegnosi/sanpietro/sanpietroInit.py
    
     exit 0
  3. The sanpietroInit.py (The relays are LOW level trigger):
         import RPi.GPIO as GPIO
         if __name__ == '__main__':
             # Set each pin as an output and make it low:
             GPIO.setmode(GPIO.BCM)
             GPIO.setup(27, GPIO.OUT)
             GPIO.output(27, GPIO.HIGH)
             GPIO.setup(22, GPIO.OUT)
             GPIO.output(22, GPIO.HIGH)
  4. During the boot of the system the relays switch on and off continusly and i must plug off the power to stop or do a sudo systemctl disable pigpiod after disconneted the GPIO to the relays module and making a power cicle.

I use the pigpio interface in another python service (for interfacing with Wiegand reader e the Relays Module) i coded but the problems come out just doing the point from 1. to 3. without run this service.

guymcswain commented 1 year ago

From the above code snippet, it looks like you are only using gpio read and write APIs. Those APIs have nothing to do with the DMA. The basic tests above indicate basic gpio read write are working - Test suite 1.x - so this is inconsistent with your application failures.

It would be good to know if GPIO is using glitch or noise filtering which does rely on DMA samples and would presumably fail since Test suite 13.x shows failures in this area.

Another thing just caught my eye. You say the OS is Raspbian 11 and not Raspberry Pi OS. If that is correct, can you test with the official RPi OS.

I won't be able to run any testing until around mid-January as all my devices are currently "in production".

pierol commented 1 year ago

I created the SD card for raspberry using the official way with the Raspberry Pi Imager and I’ve choose the recommended 32 bit OS image so is the Raspberry Pi Official OS. The problem come out just booting with the configuration i explained without executing my code

guymcswain commented 1 year ago

My misunderstanding, I thought they were separate variants. I would prefer to change the title to RPi OS 11 in this case.

pierol commented 1 year ago

I will change the title as you suggested

guymcswain commented 1 year ago

In case of a conflict with audio please try the following:

Background: Audio may use PWM hardware registers which conflict with pigpio. RPi OS 11 release notes mention: "Modifications to HDMI audio output selection to support the above".

pierol commented 1 year ago

Thank you @guymcswain for your suggestions. The tests i've reported above has been done in that condiftions:

guymcswain commented 1 year ago

@pierol , thank you for your patience.

I don't have my hardware freed up yet to do any testing. However, I recently did a search on the raspberrypi.com forums and found an issue that may be related to yours. Here is a link to that thread.

It would be interesting to see if your problem goes away when changing to the Lite OS version of Bulleye. Seeing that you are running your testing remotely perhaps this could be a long term workaround for your situation.

pierol commented 1 year ago

@guymcswain Thank you for your support. Yes it seems to be the same issue. I've done the same config (RPi OS 11 32 bit Desktop) with a Raspberry Pi 4B 2G and all operate as expected without the problem. In the forum one says it has the problem even on rpi4 but he has installed a RPi OS 11 64bit Desktop.

guymcswain commented 1 year ago

Please try the following:

// Create a drop-in file for pigpiod.service:
// note: automatically creates '/etc/systemd/system/pigpiod.service.d/override.conf'
# sudo systemctl edit pigpiod

// Add this content to the file:
[Install]
WantedBy=
WantedBy=default.target

After this it should restart the daemon or it will prompt you to do so.

pierol commented 1 year ago

Sorry @guymcswain I should add this

[Install]
WantedBy=
WantedBy=default.target

or this:

[Install]
WantedBy=default.target

In both versions the problem persist, at boot time le relay flashes continuesly

guymcswain commented 1 year ago

You need both statements. The first overrides the existing setting then the second sets the new setting.

On Fri, Jan 20, 2023 at 2:16 PM Piero Longhetto @.***> wrote:

Sorry @guymcswain https://github.com/guymcswain I should add this

[Install] WantedBy= WantedBy=default.target

or this:

[Install] WantedBy=default.target

— Reply to this email directly, view it on GitHub https://github.com/joan2937/pigpio/issues/554#issuecomment-1398883333, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHDHTDACE5MLLZ63VXJ7H6LWTLXAZANCNFSM6AAAAAATMNP66M . You are receiving this because you were mentioned.Message ID: @.***>

pierol commented 1 year ago

@pierol , thank you for your patience.

I don't have my hardware freed up yet to do any testing. However, I recently did a search on the raspberrypi.com forums and found an issue that may be related to yours. Here is a link to that thread.

It would be interesting to see if your problem goes away when changing to the Lite OS version of Bulleye. Seeing that you are running your testing remotely perhaps this could be a long term workaround for your situation.

Yes i can confirm that with RPi OS 11 Lite bullseye the problem disappears

pierol commented 1 year ago

You need both statements. The first overrides the existing setting then the second sets the new setting.

I tried with this:

[Install]
WantedBy=
WantedBy=default.target

but the problem persists

guymcswain commented 1 year ago

I'm got my pi3b+ (a020d3) with a fresh install of RPi OS 32 bit desktop:

cat /etc/debian_version
11.6

I tried to reproduce the experiments on the raspberrypi forum, using an LED on gpio 17, but so far I'm not able to reproduce the flashing behavior. However, I have experienced the system to hang on reboot occasionally. The screen goes blank, and I cannot do any debug at that point.

Do you have any suggestions on how to reproduce the erratic gpio behavior? Which gpio pins are used in your script?

Meanwhile, I'm researching how to make the daemon start later in the boot process.

guymcswain commented 1 year ago

Ok, I think I understand how to get the pigpiod service to start later in the boot sequence. But first, I should explain why: My theory is that pigpiod service is starting too soon and possibly conflicting with another process that is touching peripheral registers that pigpio also uses.

  1. Since we previously changed the pigpiod.service on your system, we need to revert back to the original by doing: sudo systemctl revert pigpiod
  2. List the service file using systemctl cat pigpiod and it should look like this:
    # /lib/systemd/system/pigpiod.service
    [Unit]
    Description=Daemon required to control GPIO pins via pigpio
    [Service]
    ExecStart=/usr/bin/pigpiod -l
    ExecStop=/bin/systemctl kill pigpiod
    Type=forking
    [Install]
    WantedBy=multi-user.target
  3. Create a drop-in override file to modify the pigpiod service. sudo systemctl edit pigpiod
  4. Add these lines:
    [Unit]
    Requires=default.target
    After=default.target
  5. sudo systemctl daemon-reload
  6. Verify the service is still enabled by sudo systemctl status pigpiod
  7. If it is not, then enable it by sudo systemctl enable pigpiod
  8. sudo reboot

Please let me know if your script is now functioning properly. Also, verify that pigpiod.service is running near the end of the boot sequence. To do so, run systemd-analyze blame (you may need to apt install systemd-analyze). In the output from this command you should see 'pigpiod.service' listed near the end of the boot sequence. On my system it shows up after 'nfs-config.service'.

pierol commented 1 year ago

After done the steps you suggested the deamon doesn't start at boot time. Here le output of some commands:

  1. systemctl cat pigpiod:
    
    # /lib/systemd/system/pigpiod.service
    [Unit]
    Description=Daemon required to control GPIO pins via pigpio
    [Service]
    ExecStart=/usr/bin/pigpiod -l
    ExecStop=/bin/systemctl kill pigpiod
    Type=forking
    [Install]
    WantedBy=multi-user.target

/etc/systemd/system/pigpiod.service.d/override.conf

[Unit] Requires=default.target After=default.target


2.  `sudo systemctl status pigpiod`:

● pigpiod.service - Daemon required to control GPIO pins via pigpio Loaded: loaded (/lib/systemd/system/pigpiod.service; enabled; vendor prese> Drop-In: /etc/systemd/system/pigpiod.service.d └─override.conf Active: inactive (dead)


3.  If i make a `ps -aux | grep pigpiod` the proccess doesn't appear.
4. ` systemd-analyze blame` the pigpiod doesn't appear

9.191s hciuart.service 3.930s rc-local.service 2.534s dev-mmcblk0p2.device 2.467s fstrim.service 2.082s raspi-config.service 1.678s udisks2.service 1.578s ModemManager.service 1.286s cups.service 1.183s ssh.service 1.133s plymouth-read-write.service 1.118s glamor-test.service 1.045s avahi-daemon.service 998ms rng-tools-debian.service 891ms keyboard-setup.service 842ms networking.service 815ms systemd-timesyncd.service 793ms polkit.service 786ms systemd-logind.service 735ms dphys-swapfile.service 697ms e2scrub_reap.service 686ms gldriver-test.service 656ms lightdm.service 649ms user@1000.service 608ms systemd-udev-trigger.service 490ms dhcpcd.service 485ms systemd-journal-flush.service 472ms systemd-udevd.service 454ms systemd-fsck@dev-disk-by\x2dpartuuid-5c76fb9e\x2d01.service 446ms systemd-fsck-root.service 445ms systemd-journald.service 403ms wpa_supplicant.service 346ms systemd-tmpfiles-setup-dev.service 345ms packagekit.service 343ms modprobe@drm.service 310ms rsyslog.service 237ms rpi-eeprom-update.service 234ms modprobe@fuse.service 213ms bluetooth.service 208ms systemd-remount-fs.service 201ms systemd-modules-load.service 200ms systemd-tmpfiles-setup.service 186ms fake-hwclock.service 185ms systemd-update-utmp.service 162ms dev-mqueue.mount 157ms run-rpc_pipefs.mount 154ms modprobe@configfs.service 151ms sys-kernel-debug.mount 145ms sys-kernel-tracing.mount 133ms systemd-user-sessions.service 124ms kmod-static-nodes.service 121ms systemd-random-seed.service 103ms systemd-sysusers.service

guymcswain commented 1 year ago

The service is dead. Make sure you reloaded the systemd daemon - step 4. Then do step 7 for good measure.

pierol commented 1 year ago

I did step 4. and step 5.

guymcswain commented 1 year ago

Something strange between your system and mine: On my system 'rc-local.service' runs late in the sequence. On your system it the second in sequence! Or maybe I don't understand the sequence - maybe its in reverse time? But it seems that rc-local.service should run near the end of the boot sequence.

The times listed are not the sequence but the amount of time taken for the service to execute. My bad.

guymcswain commented 1 year ago

I can only suggest to power down then check the listing and the status on pigpiod.service.

pierol commented 1 year ago

It seems that making the override break somthing and the deamon doesn't start anymore. If i make a sudo systemctl revert pigpiod and after sudo systemctl daemon-reload and sudo systemctl enable pigpiod the daemon started and the problem appears.

guymcswain commented 1 year ago

You can edit the complete file skipping the override by doing sudo systemctl edit pigpiod --full. Then when you systemctl cat pigpiod it will only show the service file under /etc/systemd/system (not /lib/systemd/system).

/etc/systemd/system/pigpiod.service should look like this:

[Unit]
Description=Daemon required to control GPIO pins via pigpio
Requires=default.target
After=default.target
[Service]
ExecStart=/usr/bin/pigpiod -l
ExecStop=/bin/systemctl kill pigpiod
Type=forking
[Install]
WantedBy=multi-user.target

Or just create a text file name pigpiod.service and copy it into /etc/systemd/system directly yourself.

And finally, sudo systemctl daemon-reload is important.

pierol commented 1 year ago

There is something wrong with these two line in the file pigpiod.service inside /etc/systemd/system:

Requires=default.target
After=default.target

When i remove them the deamon started when i insert them the daemon doesn't started at boot time. Making the procedure, after modify the file, of

  1. sudo systemctl daemon-reload
  2. sudo systemctl enable pigpiod
pierol commented 1 year ago

I'm got my pi3b+ (a020d3) with a fresh install of RPi OS 32 bit desktop:

cat /etc/debian_version
11.6

I tried to reproduce the experiments on the raspberrypi forum, using an LED on gpio 17, but so far I'm not able to reproduce the flashing behavior. However, I have experienced the system to hang on reboot occasionally. The screen goes blank, and I cannot do any debug at that point.

Do you have any suggestions on how to reproduce the erratic gpio behavior? Which gpio pins are used in your script?

Meanwhile, I'm researching how to make the daemon start later in the boot process.

To reproduce the problem, after enabled the pigpiod deamon at boot time, try to set a GPIO (in my case GPIO 27) even after the boot. When you try to se the GPIO the operate green led of the raspberry pi flashes

guymcswain commented 1 year ago

Does journalctl -u pigpiod show any problem?

pierol commented 1 year ago

No, this is when started without that two mentionted lines

-- Boot 8e59563b9f0a49508d75998b0f96cefe --
Jan 22 21:25:06 raspberrypi systemd[1]: Starting Daemon required to control GPIO pins via pigpio...
Jan 22 21:25:06 raspberrypi systemd[1]: Started Daemon required to control GPIO pins via pigpio.
guymcswain commented 1 year ago

On boot-up, my system occasionally hangs with a black screen (I don't have remote login enabled). When this happens, I have to cycle power to try again to boot. When my system does boot successfully, I can control either gpio 17 or 27 normally. So, it seems I cannot reproduce the behavior of the erratic gpio but I have an unstable system in that it will not boot-up on occasion. I think my system behavior may just be a different manifestation of the same problem - that pigpiod is conflicting with another service during boot-up.

When I include the changes to the pigpiod.service as described above, I have a stable system.

The question is why your system will NOT accept the modified pigpiod.service.

I'm using pigpio for interfacing with Wiegand reader and a 2-Channel Relays Module.

Q1. Do you have this (Wiegand reader ...) running as a service from boot-up? If so please show the content of that service file.

Q2. With the original pigpiod.service file, what is the output from systemd-analyze critical-chain

Q3. With the original pigpiod.service file, what is the output from systemd-analyze critical-chain pigpiod.service

pierol commented 1 year ago

Answer to your question:

guymcswain commented 1 year ago

I think your rc-local.service has a dependency on pigpiod (via import RPi.GPIO) and is waiting for the socket to open. But when we make pigpiod wait until after default.target (equivalent to graphical.target on desktop) the socket will never open.

guymcswain commented 1 year ago

rc-local.service runs before the graphical.target. Your script needs to run after graphical.target. I've read on the forums that autostart may be what you need to use. But I would highly recommend just use a systemd service for your script.

pierol commented 1 year ago

I tried this:

The only way to stop flashing is to disable the pigpiod.service.

guymcswain commented 1 year ago

You said you could not boot with the modified pigpiod.service I proposed. So now you are saying it boots but doesn't solve the "flashing" issue (after you have disabled your lines in /etc/rc.local)?

guymcswain commented 1 year ago

You can create a systemd service file similar to this:

[Unit]
Description=Your Python script
After=pigpiod.service

[Service]
ExecStart=/usr/bin/python3 /home/pi/sanpietro/sanpietroInit.py

[Install]
WantedBy=multi-user.target
pierol commented 1 year ago

With the modified pigpiod.service you proposed the service doesn't start. So i'm still with the original pigpiod.service file.

So now you are saying it boots but doesn't solve the "flashing" issue (after you have disabled your lines in /etc/rc.local)?

Yes, it boots with the flashing problem but not all the times: on 4 boots 2 didn't flash, 2 did flashes

pierol commented 1 year ago

If you want i can permit you to make a AnyDesk session on my desktop to see why it doesn't start

guymcswain commented 1 year ago

No thank you. But I will help you write a systemd service file.

You need to cleanly re-install RPi OS bullseye without adding services. Then make the changes to pigpiod service file. Then tell me if your system is unstable.

pierol commented 1 year ago

One question, when you've installed the RPi OS Desktop bullseye 32 bit on your 3b+ board, you made the updates ? I've always done

pierol commented 1 year ago

I found in the system log this (when i modified the pigpiod.service as you suggested):


Jan 23 20:55:22 raspberrypi systemd[1]: multi-user.target: Found ordering cycle on pigpiod.service/start
Jan 23 20:55:22 raspberrypi systemd[1]: multi-user.target: Found dependency on graphical.target/start
Jan 23 20:55:22 raspberrypi systemd[1]: multi-user.target: Found dependency on multi-user.target/start
Jan 23 20:55:22 raspberrypi systemd[1]: multi-user.target: Job pigpiod.service/start deleted to break ordering cycle starting with multi-user.target/start
guymcswain commented 1 year ago

I did a clean install then tried to reproduce the gpio 'flashing' as described on the rpi forum thread. After I couldn't reproduce it, I upgraded the OS with all the latest. After that I started to see some instability. But I can't say for certain it was due to the upgrade. In either case, after I changed the pigpiod.service I've had stability.

I saw log messages similar to what you mention above but it was after my first iteration of change to the service file. Since my last iteration those messages are no longer in the log.

Just to reiterate, the final version of the service file is:

[Unit]
Description=Daemon required to control GPIO pins via pigpio
Requires=default.target
After=default.target
[Service]
ExecStart=/usr/bin/pigpiod -l
ExecStop=/bin/systemctl kill pigpiod
Type=forking
[Install]
WantedBy=multi-user.target
pierol commented 1 year ago

Yes, is the version i'm using now but the service is deleted during the boot time for a cycle dependency.

Jan 23 21:29:14 raspberrypi systemd[1]: multi-user.target: Found ordering cycle on pigpiod.service/start
Jan 23 21:29:14 raspberrypi systemd[1]: multi-user.target: Found dependency on graphical.target/start
Jan 23 21:29:14 raspberrypi systemd[1]: multi-user.target: Found dependency on multi-user.target/start
Jan 23 21:29:14 raspberrypi systemd[1]: multi-user.target: Job pigpiod.service/start deleted to break ordering cycle starting with multi-user.target/start

I've deleted the lines in the rc.local so there is not any python script executed. Can you try to do a fresh install on your board selecting to update during the installation process ? and then modify the pigpiod.service as you suggested and see if the service started ?

guymcswain commented 1 year ago

Is this the new install?

pierol commented 1 year ago

Is this the new install?

No, at the moment i've no time to do that. It's the installation i've made yesterday.

guymcswain commented 1 year ago
sudo systemctl daemon-reload
sudo reboot

#after boot-up
systemctl cat pigpiod
systemd-analyze critical-chain pigpiod.service
pierol commented 1 year ago

systemctl cat pigpiod

[Unit]
Description=Daemon required to control GPIO pins via pigpio
Requires=default.target
After=default.target
[Service]
ExecStart=/usr/bin/pigpiod -l
ExecStop=/bin/systemctl kill pigpiod
Type=forking
[Install]
WantedBy=multi-user.target

systemd-analyze critical-chain pigpiod.service

The time when unit became active or started is printed after the "@" character.
The time the unit took to start is printed after the "+" character.

└─graphical.target @8.991s
  └─multi-user.target @8.991s
    └─ModemManager.service @7.758s +1.230s
      └─polkit.service @6.642s +1.103s
        └─basic.target @6.368s
          └─sockets.target @6.368s
            └─triggerhappy.socket @6.367s
              └─sysinit.target @6.317s
                └─systemd-timesyncd.service @5.665s +650ms
                  └─systemd-tmpfiles-setup.service @5.384s +267ms
                    └─local-fs.target @5.312s
                      └─run-user-1000.mount @11.606s
                        └─local-fs-pre.target @2.762s
                          └─systemd-tmpfiles-setup-dev.service @2.657s +103ms
                            └─systemd-sysusers.service @2.549s +102ms
                              └─systemd-remount-fs.service @2.335s +189ms
                                └─systemd-fsck-root.service @1.836s +492ms
                                  └─systemd-journald.socket @1.725s
                                    └─system.slice @938ms
                                      └─-.slice @938ms