SysFs GPIO Access

Topics about the Software of Revolution Pi
Post Reply
mujtabachang
Posts: 1
Joined: 08 Jun 2017, 03:58

SysFs GPIO Access

Post by mujtabachang »

Hello everybody,

I have few questions to ask, before I decide to buy Rev Pi.

Question 1: Does the Rev Pi support SysFs GPIO Pin access (https://www.kernel.org/doc/Documentation/gpio/sysfs.txt) ?
I want to use 4-Diac ( https://eclipse.org/4diac/ ) on Rev Pi. 4-Diac runs FORTE, which requires SysFs GPIO pin access.

Question 2: How does the Rev Pi access the GPIO pins? Do I have to buy separate I/O module for that?

Question 3: Can I access GPIO pins as I would normally do in Python, with some code like this?

Code: Select all

# External module imports
import RPi.GPIO as GPIO
import time

# Pin Definitons:
pwmPin = 18 # Broadcom pin 18 (P1 pin 12)
ledPin = 23 # Broadcom pin 23 (P1 pin 16)
butPin = 17 # Broadcom pin 17 (P1 pin 11)

dc = 95 # duty cycle (0-100) for PWM pin

# Pin Setup:
GPIO.setmode(GPIO.BCM) # Broadcom pin-numbering scheme
GPIO.setup(ledPin, GPIO.OUT) # LED pin set as output
GPIO.setup(pwmPin, GPIO.OUT) # PWM pin set as output
pwm = GPIO.PWM(pwmPin, 50)  # Initialize PWM on pwmPin 100Hz frequency
GPIO.setup(butPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) # Button pin set as input w/ pull-up

# Initial state for LEDs:
GPIO.output(ledPin, GPIO.LOW)
pwm.start(dc)

print("Here we go! Press CTRL+C to exit")
try:
    while 1:
        if GPIO.input(butPin): # button is released
            pwm.ChangeDutyCycle(dc)
            GPIO.output(ledPin, GPIO.LOW)
        else: # button is pressed:
            pwm.ChangeDutyCycle(100-dc)
            GPIO.output(ledPin, GPIO.HIGH)
            time.sleep(0.075)
            GPIO.output(ledPin, GPIO.LOW)
            time.sleep(0.075)
except KeyboardInterrupt: # If CTRL+C is pressed, exit cleanly:
    pwm.stop() # stop PWM
    GPIO.cleanup() # cleanup all GPIO

Thanks.
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41

Re: SysFs GPIO Access

Post by volker »

Generally said: No you do not have GPIO Access because GPIOs of the Broadcom do not deliver EN61131-2 compatible IO signals and would not allow any modular concept of a PLC. Please read the English blog where we have explained our hardware concept in detail. E.g. you questions are answered here.
https://revolution.kunbus.com/revpi-core-part-ii/
Unser RevPi Motto: Don't just claim it - make it!
schneiben
Posts: 3
Joined: 13 Jul 2017, 09:37

Re: SysFs GPIO Access

Post by schneiben »

Hi,

We are currently working on porting FORTE (4DIAC RTE) on the Revolution Pi, such that you can access the IOs (e.g., DI, DO or DIO RevPi module) directly in 4DIAC.

The Solution will be available in the near future :-)

Best,
Ben
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41

Re: SysFs GPIO Access

Post by volker »

HI,
that sounds wonderful! Please let us all know about your proceedings and we will try to support you as much as we can to make that a success! How about visiting the RevPi Day on 28th September in Bremen to show your results by then?
Unser RevPi Motto: Don't just claim it - make it!
Post Reply