devDucks / astroarch

ArchLinux for astrophotography - made for raspberrypis, can run also on x64 machines
MIT License
46 stars 6 forks source link

GPIO access in AstroArch and Raspberry Pi 5 #41

Open astrojolo opened 8 months ago

astrojolo commented 8 months ago

Hello,

Is there any special access I need to have for GPIO chip in Raspberry Pi 5? I have installed https://abyz.me.uk/lg/lgpio.html library that works fine for me on RPi 5 and Debian based distributions. But I cannot make it connect to GPIO under AstroArch.

Steps I made:

  1. fresh SD card flash
  2. update-astroarch done
  3. installation unzip, make, python and python3
  4. installation lgpio from sources

After that, I ran rgpdiod daemon (started ok) and tried to connect to the GPIO chip with

rgs c 1 go

with chipnr set from 0 to 5, and it always return -78 which means LG_CANNOT_OPEN_CHIP.

Many thanks in advance for any hints!

Lucas

astrojolo commented 8 months ago

Ok, the issue was a permissions to GPIO. I have added a gpio group, added astronaut user to that group and added gpio subsystem to that group as well using udev and it works now.

cat /etc/udev/rules.d/99-gpio.rules
SUBSYSTEM=="gpio", KERNEL=="gpiochip*", GROUP:="gpio", MODE:="0660"
MattBlack85 commented 8 months ago

@astrojolo thanks 🔥 will leave this around for troubleshooting

PS: I packaged astrolink4pi for Arch, I don't have your hardware yet but could you tell me if installing it with pacman leads to a working setup for your board?

Pozdro

astrojolo commented 8 months ago

I have added a section of additional tasks to make my hardware work with AstroArch: https://github.com/astrojolo/astrolink4pi?tab=readme-ov-file#astroarch-only-specific-tasks

It now works with revision 4 of hardware, however for revision 3 I need to use an SPI device, and at the moment, I cannot communicate with it even after creating a proper udev entry. I need to investigate it.

PS - thanks for the package, however I did several changes over the last few days to make my driver work with RPi5. Once I will make SPI work and have a final version I will ask you again to package it. I think you may remove the current package - sorry for that.

astrojolo commented 8 months ago

Ok, all works fine. I needed to enable SPI in /boot/config.txt: dtparam=spi=on All required steps are listed on https://github.com/astrojolo/astrolink4pi?tab=readme-ov-file#astroarch-only-specific-tasks

Thanks and congratulations on this distribution!