digital io howto?

  • Hi,


    I've got the need to address an IO-Pin and switch the value from 0x00 to 0x80 (and vice versa).
    In the visual c++ sources (windows) I've got an DI01: file where I can get a handle. But what's the
    way on linux? I don't think that the gpio are the correct ones or am I false?


    Is there any example to address this usecase?


    Thanks


    Marc

  • The access to GPIOs is a standard Linux thing. For example explained here. Or simply check the section "Sysfs Interface for Userspace" in the file Documentation/gpio.txt in the kernel sources.


    So you just need the number for the GPIO in questions. And this is given in the GPIO reference card that is available for each board. For example for the PicoCOM4, you can find it in the doc directory of the V1.4 release. Or you can download it from here.


    There is also a GPIO example in the examples subdirectory of the V1.4 release that shows exactly how to use GPIOs from userspace.


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.


  • Hi,


    I've used the example in the subdirectory and adapted it to my needs but I didn't get an valid file-pointer.


    The first one is aborting immediatelly.


    When using the commandline I was successfully creating the gpio235 but I haven't found a way to use it
    with this code below. I always receive "Cannot open..."


    The /sys/class/gpio/export is only writable by root (--w-------) and the application should also run as this user, so I dont't see that's a permission issue.


    Thanks for your help.
    marc


  • Which open() call does fail? Have you modified the SYS_DIR and SYS_VAL paths to use gpio235 instead of gpio234 as in the example?


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.