Skip to main content
Share Your Experience: Take the 2024 Developer Survey
4 votes
Accepted

Using GPIO PWM with sysfs

To use pwm, you need to use the pwm interface at /sys/class/pwm, not the gpio interface. Here is the relevant documentation. The startup would be something like export 1 > /sys/class/pwm/pwmchip0/0/...
PMF's user avatar
  • 896
3 votes

Interfaces besides sysfs for GPIO programing in C

The sysfs system filesystem access to the GPIO is all that is provided as a standard library from Linux. There are dozens of third party libraries. See http://elinux.org/RPi_GPIO_Code_Samples for ...
joan's user avatar
  • 71.1k
3 votes

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

You should probably think about migrating to the new gpiochip interface for any new software. One improvement is that it gives you the likely time of GPIO level changes. I have done pretty much what ...
joan's user avatar
  • 71.1k
3 votes
Accepted

Raspberry GPIO button sysfs

I think I know what went wrong. I did the same circuit as the one pictured in Mosmas' post here, except that I used a 1k resistor. It divided the voltage too much and so the pin was not reading a ...
Gru-gru's user avatar
  • 151
2 votes
Accepted

Intermittent access errors when writing to GPIO using SYSFS and Ruby

Most likely a timing problem. There are race conditions with the sysfs. You need to wait for Linux to set the GPIO to output mode before writing to the GPIO.
joan's user avatar
  • 71.1k
1 vote

sysfs pwm: corresponding pins and LED driving

PWM0 is GPIO 12 or 18 (as the link you posted shows). The same signal can be on either or both. You only need 1 channel to control a LED. It is unclear how you plan to use PWM (there are only a few ...
Milliways's user avatar
  • 60.3k
1 vote

Translate GPIO pwm commands to linux sysfs interface

The sysfs provides no PWM support. You will have to write your own software to switch the GPIO on/off with appropriate delays. To find the frequency and dutycycle of those pwm commands you could use ...
joan's user avatar
  • 71.1k
1 vote

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

Yes, there is a simple bash way for GPIO interrupt controlled read via sysfs interface: echo 4 > /sys/class/gpio/export echo in > /sys/class/gpio/gpio4/direction echo both > /sys/class/gpio/...
gbslack's user avatar
  • 11
1 vote

Interfaces besides sysfs for GPIO programing in C

AFAIK WiringPi should be included in latest Raspbian. If you have the gpio utility it is there (as gpio is a WiringPi utility).
Milliways's user avatar
  • 60.3k
1 vote
Accepted

Overclocking - CPU Frequency Measurement Accuracy: vcgencmd vs cpuinfo_cur_freq

The vcgencmd command is the more accurate one as the vcgencmd command takes the reading from the firmware and the cpuinfo_cur_freq takes the reading from the kernel. The problem with using ...
user123456098's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible