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

Error on arm64 system #562

Open hbtecSZE opened 1 year ago

hbtecSZE commented 1 year ago

Hi

I try to get this running on a Raspberry Pi 4 with Debian 11.6 64bit (5.10.0-20-arm64). I followed the steps on https://abyz.me.uk/rpi/pigpio/download.html.

When I try to start the Daemon with sudo pigpiod I get the following error:

2023-02-15 14:09:28 initPeripherals: mmap gpio failed (Operation not permitted) Can't initialise pigpio library

I found the issue https://github.com/joan2937/pigpio/issues/259 which sounded very similar to my problem. Even tho I use version 79 this problem persists.

I also try to add iomem=relaxed strict-devmem=0 to my /boot/firmware/cmdline.txt file and after a reboot and sudo pigpiod, I got the error:

2023-02-15 14:30:16 initAllocDMAMem: mbox open failed(No such device or address) Can't initialise pigpio library

So it looks like there is a problem with the memory handling on an arm64 system? Is there something I missed, or is it not possible to run this on my system?

Thanks

guymcswain commented 1 year ago

I can't think of a reason why it is failing. Is this a fresh install of the OS? If so, you already had v79 included in the distro. If you want the very latest you need to:

wget https://github.com/joan2937/pigpio/archive/refs/heads/develop.zip
unzip develop.zip
cd pigpio-develop
make
sudo make install

... although I don't think this is likely to fix your problem, but worth a try.

hbtecSZE commented 1 year ago

It is a fresh installation of the OS, but I already set up and installed some additional Software. Maybe also to Mention: I have an RTC already running on the GPIOs. I had the same Situation with Raspbian, and it worked without problems.

I will try the develop Version later and keep you updated.

EDIT 2023-02-17: I uninstalled the current version (sudo make uninstall in the folder) and installed the develop Version like @guymcswain mentioned with the same result as before...

hbtecSZE commented 1 year ago

Apparently the issue is that pigiod is using an interface (/dev/vcio) which doesn't exist on Debian.

Marsu31 commented 1 year ago

Same problem. Tested with the develop branch. My kernel : Linux xxxxxx 5.10.0-22-arm64 #1 SMP Debian 5.10.178-3 (2023-04-22) aarch64 GNU/Linux

sudo pigpiod -a1 -g

2023-05-19 18:32:46 initAllocDMAMem: dmaIBus[1059]=E286A000
2023-05-19 18:32:46 initClock: mainClock=1
2023-05-19 18:32:46 initClock: PCM PLLD divi=375 divf=0 mash=0 bits=10
2023-05-19 18:32:46 initHWClk: ctl=38 div=39 src=6 /I=375 /f=0 M=0
2023-05-19 18:32:46 initPCM: bits=10
Erreur de segmentation

sudo pigpiod -a1 -t0 -g

2023-05-19 18:33:55 initAllocDMAMem: dmaIBus[1059]=D419C000
2023-05-19 18:33:55 initClock: mainClock=1
2023-05-19 18:33:55 initClock: PWM PLLD divi=375 divf=0 mash=0 bits=10
2023-05-19 18:33:55 initHWClk: ctl=40 div=41 src=6 /I=375 /f=0 M=0
2023-05-19 18:33:55 initPWM: bits=10
Erreur de segmentation

sudo pigpiod -a2 -g

2023-05-19 18:32:24 initPeripherals: DMA #7 @ FFFFB40D1700
2023-05-19 18:32:24 initPeripherals: debug reg is 10018700
2023-05-19 18:32:24 initAllocDMAMem: 
2023-05-19 18:32:24 initAllocDMAMem: bmillis=120 mics=5 bblk=20 bcyc=1600
2023-05-19 18:32:24 initAllocDMAMem: mbox open failed(No such device or address)
2023-05-19 18:32:24 initReleaseResources: 
Can't initialise pigpio library

I checked it find the right processor and memory addresses :

2023-05-19 18:33:55 initInitialise: 
2023-05-19 18:33:55 gpioHardwareRevision: 
2023-05-19 18:33:55 gpioHardwareRevision: searching /proc/device-tree for revision
2023-05-19 18:33:55 gpioHardwareRevision: revision=c03111
2023-05-19 18:33:55 gpioHardwareRevision: pi_peri_phys=fe000000
2023-05-19 18:33:55 gpioHardwareRevision: pi_dram_bus=c0000000
2023-05-19 18:33:55 gpioHardwareRevision: pi_mem_flag=4
Marsu31 commented 1 year ago

I used gdb to trace the failure of the pigpiod command with arguments -a1 -t0 -g :

Program received signal SIGSEGV, Segmentation fault.
0x0000fffff7eeb46c in initPWM (bits=10) at pigpio.c:7901
7901       dmaIVirt[0]->periphData = 1;

Hope it helps !