Questions tagged [sysfs]

16 questions
8
votes
1 answer

GPIO callbacks in any language

I know the linux kernel has a language agnostic GPIO interface through /sys/class/gpio which can be manipulated with echo, cat, etc. How can this be used to create event driven callbacks programmatically? Part of the reason for this question is…
goldilocks
  • 60,325
  • 17
  • 117
  • 234
2
votes
1 answer

Raspberry GPIO button sysfs

I am trying to connect a button to my raspberry pi 3 (model B). I want to do it via the sysfs approach. Here is a picture or my small circuit: It cannot be simpler: the black wire is connected to a GROUND pin and to the breadboard. The white wire…
Gru-gru
  • 151
  • 6
2
votes
1 answer

Configure Alt GPIO using sysFS

I have a Model B Revision 1.0 + ECN0001 that I am making a program in C to read and control a HCTL-2022 Quadrature Decoder using the GPIOs by way of sysfs. It's working great, but now I would like to provide the a clock using one of the GPIOs alt…
hoss
  • 123
  • 5
2
votes
1 answer

Intermittent access errors when writing to GPIO using SYSFS and Ruby

I am using Ruby to drive output GPIO pins using the old SYSFS pseudo-filesystem interface, and am regularly encountering intermittent Errno::EACCES: Permission denied @ rb_sysopen errors. My user is a member of the gpio group. The pseudofiles…
Dan
  • 125
  • 6
2
votes
4 answers

Using GPIO PWM with sysfs

I'm able to write to GPIO pins with sysfs with the standard commands like echo "1" > /sys/class/gpio/gpio6/value, but that only turns the pin on or off. I tried echo "0.5" > /sys/class/gpio/gpio6/value and echo "50%" > /sys/class/gpio/gpio6/value…
Synetech
  • 131
  • 1
  • 5
2
votes
0 answers

EasyDriver stepper motor through sysfs not moving

I'm trying to activate a stepper motor using easydriver from here https://www.schmalzhaus.com/EasyDriver/Examples/EasyDriverExamples.html using sysfs and C, but it doesn't move. I connected my circuit like that but with a raspberry pi, code is…
Cris
  • 121
  • 2
1
vote
2 answers

Is there a way to use interrupt-driven GPIO input through the sysfs interface without a race condition?

I want to use the GPIO pins to wait for a button-press without using a CPU spin loop. My preferred way of using the GPIO pins is via the sysfs interface at /sys/class/gpio, but it seems to me that there is an inherent race condition in doing so.…
Dolda2000
  • 111
  • 1
  • 4
1
vote
1 answer

Overclocking - CPU Frequency Measurement Accuracy: vcgencmd vs cpuinfo_cur_freq

As a follow-up to this question: Raspberry Pi B+ Overclocking: Force Turbo not working I had trouble getting force turbo to work. I was using the command: sudo vcgencmd measure_clock arm to get the current frequency of the pi both in idle and when…
user123456098
  • 350
  • 4
  • 19
1
vote
1 answer

Troubleshooting PWM via sysfs

Recently, I've discovered that I can use the sysfs to control the pwm of my raspberry pi 5. (I don't know about any libraries that are supported buy the pi-5 and can control pwm hardware.) Upon trying to test out the pwm by making an LED 50%…
Matthew Moller
  • 75
  • 1
  • 12
0
votes
2 answers

Interfaces besides sysfs for GPIO programing in C

I am writing GPIO functions in C using standard libraries that come with the raspberry pi, and do not require installing other libraries such as wiringpi. So I have been using stdlib.h and stdio.h, and writing, and reading the files that describe…
j0h
  • 2,508
  • 6
  • 27
  • 36
0
votes
1 answer

Sysfs integration with python code - permissions issue

I’ve had a lot of issues regarding the sysfs interface recently, and unfortunately, I’ve got another unrelated one. I’m trying to integrate the sysfs gpio interface into my python3 code. This is because I find sysfs to be a more all rounded module…
Matthew Moller
  • 75
  • 1
  • 12
0
votes
2 answers

Only 1 PWM pin working when controlling via sysfs

I’m using sysfs to control my rpi5’s pwm andI’m having an issue where only one of my pwm pins is outputting a value (The pin that is working is gpio 18/physical pin 12/pwm2). In the pinout.xyz page, it shows that physical pins 12/32/33/35 have built…
Matthew Moller
  • 75
  • 1
  • 12
0
votes
1 answer

How to get temperature and humidity data from a Sensiron SHT3X

The more I read, the more confused I become... I have a SHT30 Temperature And Humidity Sensor. I bought it from Adafroot some time ago, but never found a real use for it. Now that Raspberry Pi has evolved to 'bookworm', the Linux kernel is at ver…
Seamus
  • 23,558
  • 5
  • 42
  • 83
0
votes
1 answer

sysfs pwm: corresponding pins and LED driving

Using a Raspberry Pi 3B+ with Linux raspberrypi 5.10.103-v7+ #1529 SMP Tue Mar 8 12:21:37 GMT 2022 armv7l GNU/Linux I would like to drive an LED with pwm. There are two couples of GPIO pins which also support pwm: according to this page, they are…
BowPark
  • 101
  • 2
0
votes
0 answers

sysfs blocks gpio pins after one minute from restart

I am using Raspberry pi 4b with Linux raspberrypi 5.10.63-v7l+. I am writing simple userspace program for control one GPIO by ioctl() (in my case GPIO 13 for example). However program responses: Device or resource busy when I try to handle it. The…
1
2