# Raspberry PI 5 GPIO

**URL:** https://discourse.julialang.org/t/raspberry-pi-5-gpio/126652
**Category:** Performance
**Created:** [March 6, 2025, 7:37pm UTC](https://discourse.julialang.org/t/raspberry-pi-5-gpio/126652 "2025-03-06T19:37:31Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Jake](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jake/32/46007_2.png) [@Jake](https://discourse.julialang.org/u/Jake)
#### Post date: [March 6, 2025, 7:37pm UTC](https://discourse.julialang.org/t/raspberry-pi-5-gpio/126652/1 "2025-03-06T19:37:31Z")

</div>

I have an application that requires a trigger signal (Just one pin going from low to high and back to low). There are several options for GPIO control in Julia but the PI 5 adds a new twist as outlined [here](https://www.i-programmer.info/programming/148-hardware/16887-raspberry-pi-iot-in-c-pi-5-memory-mapped-gpio.html) and [here](https://www.i-programmer.info/programming/148-hardware/17867-raspberry-pi-5-iot-in-c-gpio-registers.html).

The options in Julia seem to be:

BaremetalPi.jl /dev/gpiomem no PI5 support  
PiGPIO.jl pigpio daemon No PI5 support  
PiGPIOMEM.jl /dev/gpiomem No PI5 support  
PiGPIOC.jl wrappers for gpio C-interface No PI5 support  
Gpiod.jl wraps libgpiod [with PI5 Support](https://github.com/JuliaBerry/PiGPIO.jl/issues/24)

One possibility is to try using Clang to wrap [WiringPi](https://github.com/WiringPi/WiringPi) as it supports the PI 5 and see if that works. With some more reading it seems that it just calls libgpiod under the hood so we might as well use Gpiod.jl.

And some more trial and error and I find that the examples in Gpiod.jl error after I find the libgpiod.so file on my system. My version of libgpiod is 1.6.3, so I suspect that I will have to build version 2.2 as version 2 does not come as an apt package. I guess ideally Gpiod.jl would ship with a working libgpiod.so file?

I thought I would check with the community to see if I am missing something or if there are other better alternatives. @Ronis_BR, @notinaboat, @Alexander-Barth, @TheCedarPrince

---

<div class="post-metadata">

### Author: ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)
#### Post date: [March 6, 2025, 8:21pm UTC](https://discourse.julialang.org/t/raspberry-pi-5-gpio/126652/2 "2025-03-06T20:21:49Z")

</div>

Usually the most portable option is to directly use the [sysfs interface](https://www.kernel.org/doc/Documentation/gpio/sysfs.txt). Using this interface requires reading and writing special files, is well documented, and works across many different systems.

---

<div class="post-metadata">

### Author: ![Jake](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jake/32/46007_2.png) [@Jake](https://discourse.julialang.org/u/Jake)
#### Post date: [March 6, 2025, 8:50pm UTC](https://discourse.julialang.org/t/raspberry-pi-5-gpio/126652/3 "2025-03-06T20:50:23Z")

</div>

It seems sysfs is [deprecated](https://www.embeddedpi.com/documentation/gpio/using-libgpiod-as-an-alternative-to-sysfs-on-raspberry-pi) in favour of gpiod. This is not the only place I read about the deprecation.

---

<div class="post-metadata">

### Author: ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)
#### Post date: [March 6, 2025, 10:34pm UTC](https://discourse.julialang.org/t/raspberry-pi-5-gpio/126652/4 "2025-03-06T22:34:13Z")

</div>

Unfortunately I do not have access to any RPI 5. Hence, I cannot help here.

---

<div class="post-metadata">

### Author: ![Alexander-Barth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexander-barth/32/3692_2.png) [@Alexander-Barth](https://discourse.julialang.org/u/Alexander-Barth)
#### Post date: [March 7, 2025, 12:03pm UTC](https://discourse.julialang.org/t/raspberry-pi-5-gpio/126652/5 "2025-03-07T12:03:45Z")

</div>

Indeed, I used directly gpiod 2.2 rather than the version 1.6 (unlikely compatible with the current version). Compiling gpiod was rather straight forward, if I remember correctly 😃.

If somebody has time to investigate whether we can use BinaryBuilder to create the C library, that would be great.

Unfortunately, gpiod has a very minimal interface (no PWM, I2C, SPI support). Implementing these in Julia would be challenging since the garbage collector can pause a thread any time. I am still hoping that the upstream PiGPIOD will support the Raspberry Pi 5 at one point. Maybe wrapping wiringPi might actually be a better approach.

---

<div class="post-metadata">

### Author: ![Jake](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jake/32/46007_2.png) [@Jake](https://discourse.julialang.org/u/Jake)
#### Post date: [March 7, 2025, 3:25pm UTC](https://discourse.julialang.org/t/raspberry-pi-5-gpio/126652/6 "2025-03-07T15:25:35Z")

</div>

Thanks, I also opened an issue for Gpiod.jl. In there I reported on how to compile version 2.2.1. It successfully compiled but now the write function is giving me an error. From the comment above I recompiled libgpiod from version 2.2 and now all is well. Thanks for the information on the minimal interface. This is not a problem with my application but is good to know.

Since it seems that Gpiod.jl is specific to the PI and that it is specific to libgpiod version 2.2, I am wondering if we can bypass binary builder and just put the libgpiod.so file in the src directory of Gpiod. That is easy to do and will make Gpiod.jl just work.

---

<div class="post-metadata">

### Author: ![stene](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stene/32/26044_2.png) [@stene](https://discourse.julialang.org/u/stene)
#### Post date: [May 13, 2025, 6:21pm UTC](https://discourse.julialang.org/t/raspberry-pi-5-gpio/126652/7 "2025-05-13T18:21:41Z")

</div>

I made WiringPi.jl which is a wrap of WiringPi. It seems to work great, and support SPI, I2C, Hardware PWM. It also has interrupts for working with triggers. Source here: [Julia WiringPi](https://github.com/stensmo/WiringPi.jl)
