Giter Site home page Giter Site logo

Comments (9)

pgrawehr avatar pgrawehr commented on September 2, 2024

Which driver are you using? We did have confirmation that Libgpiod should work on the Raspberry Pi 5. It is expected that the RaspberryPi3Driver is not working, as that uses an interface that is not available on the Pi5.

Please show a simple example that causes the above error.

from iot.

krwq avatar krwq commented on September 2, 2024

The error message suggests that comes from Libgpiod. @jldigi40 I'm not sure the events are supported on Pi 5, I'd start with regular Read/Write before trying that. Also you might want to try to pass different gpio chip, I recall the chip might be 1 on RPi5 rather than default 0 (but I might misremember). Here's how you do that: new GpioController(PinNumberingScheme.Logical, new LibGpiodDriver(gpioChip: 1))

We should add proper support sometime in the near future so that gets picked up automatically

from iot.

jldigi40 avatar jldigi40 commented on September 2, 2024

Hello ALL,

Thanks, quick response, I had a play with recommended using LibGpiodDriver as recommended and if use LibGpiodDriver(gpioChip: 1) I get exception to creating a GpioController Object. If run LibGpiodDriver(gpioChip: 0), get no exception

var controller = new GpioController(PinNumberingScheme.Logical, new LibGpiodDriver(gpioChip: 0));
// new LibGpiodDriver(gpioChip: 0) work Pi5

//// DIO6

controller.OpenPin(24, PinMode.InputPullUp);

controller.OpenPin(24).ValueChanged += pin24Change;

Also the event handling like attach handler to 'ValueChanged' works all ok so far

I need to run some real world test simulate inputs and see if reacts correctly..... cross fingers

Just some background,

I have a PI and an Industrial IO Carrier from 'UniPi' - Product is UniPi 1.1 Lite - https://www.unipi.technology/unipi-1-1-lite-p83

It has 6 optically isolated inputs (0-24V) and 6 relays - controlled from I2C MCP 23008 chip , this I have working - ie output control ( pi3-4 and now pi 5) End project is a product dev R&D-POC for a Industrial Edge Device Handler.

I need IO to monitor machine inputs the unit will be attached too - ie legacy machinery so need to control some outputs also as well as three separate industry protocols (TCP-IP) based. Basing solution on Blazor for a Web Interface and C# backend for protocol and application Edge IO control.

from iot.

huesla avatar huesla commented on September 2, 2024

For Pi5 you have to use GPIO chip 4 instead of 0, as compared to Pi4. This is because Pi5 has a slightly different GPIO line schema. Use the gpioinfo command for more information, it comes with the libgpiod package.

from iot.

msftbot avatar msftbot commented on September 2, 2024

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

from iot.

Ellerbach avatar Ellerbach commented on September 2, 2024

[Triage] We should document how to properly run it on a RPI5. And creating a RPI5 board class for a start. Later on, we will switch to a dedicated driver, it will work the same but faster.

from iot.

PRIMETSS avatar PRIMETSS commented on September 2, 2024

Having similar issues after moving from a working to latest stable SDK & OpenWRT (musl-linux) on RiPi Compute Module 4.
'Segmentation fault' happens when assign the ValueChanged callback.
This project had been running fine with previous version(s) & GPIO buttons were working.

_gpioPinButtonUp.ValueChanged += GpioPinButtonUp_ValueChanged

Using
Dotnet SDK v8.101 (Alpine: dotnet-sdk-8.0.101-linux-musl-arm64)
OpenWRT v23.05.2 YES
Prev: (GPIO event working [hw buttons])
Dotnet v8.0.100-rc.2.23502.2
OpenWRT SNAPSHOT r24111-66f6c20e45

To replicate I build a simple console app, add dependancy System.Device.Gpio (v3.1.0, tried right back to 2.2)

Build & Run App on RPi CM4 and get "Segmentation fault" after trying to assign the call back.
image

Have also tried the LibGpiodDriver when building the GPIO controller.
using var controller = new GpioController(PinNumberingScheme.Logical, new LibGpiodDriver(0));

Did a strace and get this which might shine some light?

Looks for Library OK:
image

Fault:
image

Code:
image

Remark out the Event Callback assign, and runs as expected.
Has something change recently with assigning callbacks in dotnet or is it a kernal/linux lib issue?

Ta!

from iot.

pgrawehr avatar pgrawehr commented on September 2, 2024

@PRIMETSS That does look like some problem either with the low-level driver or with the registering of the event itself. I quickly checked, and there where no significant changes to the libgpiod driver since at least v2.1. Can you tell which version works? Or is it now failing independent of the System.Device.Gpio library version?

Edit: And please open a new issue for this. It is not related to RPI5 at all.

from iot.

PRIMETSS avatar PRIMETSS commented on September 2, 2024

Looking at the repo seems there is work underway to better handle libgpiod v1 & v2 (new)
So I added daily build feed to Nuget and tried the latest <PackageReference Include="System.Device.Gpio" Version="3.2.0-prerelease.24077.2" />

And tried with V1 & V2 (system is using/installed libgpiod v1 [libgpiod.so.2 1.6.3], v2 is libgpiod.so.3)

var LinuxLibGpioDriver = new LibGpiodDriver(gpioChip: 1, LibGpiodDriverVersion.V1);
`var LinuxLibGpioDriver = new LibGpiodDriver(gpioChip: 1, LibGpiodDriverVersion.V2);'

Same 'Segmentation fault'

@pgrawehr OK Thanks I will open another issue

from iot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.