C GPIO
#12
For the sake of this discussion, lets keep it to PC4.

... I am going to post a script below written by longsleep which converts Pine GP names to their Pine GPIO number. There are three ways to number the pins on the PI bus (let's just keep the discussion there for now).

Board numbers:  the actual physical number of the pin on the pcb... 

BCM numbers:  the broadcom GPIO numbering scheme

Pine GPIO:  the numbers of the GPIO pins from the Pine perspective.

The following script will convert the name of the pin (in this case PC4) to its Pine GPIO number.  Place the code in a script called sysfs_gpio.sh   chmod it with 0754,  and run it with  ./sysfs_gpio.sh PC4   ... it will return 68.

sysfs_gpio.sh
Code:
#!/usr/bin/python3

import sys
import string

def convert(value):
    value = value.upper()
    alp = value[1]
    idx = string.ascii_uppercase.index(alp)
    num = int(value[2:], 10)
    res = idx * 32 + num
    return res

if __name__ == "__main__":
    args = sys.argv[1:]
    if not args:
        print("Usage: %s <pin>" % sys.argv[0])
        sys.exit(1)

    print("%d" % convert(args[0]))

Try activating the pin(32) , GPIO(12), PineGPIO(68) using sysfs, or using RPi.GPIO-PineA64.

If it works you know that the hardware is not at fault.  If not, there may be something wrong on your board. If it works with sysfs, then try again with your C coding.  Thank you for sharing;  I have not used C to access the GPIO on the PineA64-- very interesting.  Hopefully you will get enough of a hint about the PineA64 numbering with pin 68, PC4, GPIO(12),  pin(32)....

edit: try using 0x44 which is the hex for 68
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply


Messages In This Thread
C GPIO - by igna09 - 06-10-2016, 12:41 PM
RE: C GPIO - by martinayotte - 06-10-2016, 01:52 PM
RE: C GPIO - by igna09 - 06-10-2016, 02:16 PM
RE: C GPIO - by martinayotte - 06-10-2016, 03:10 PM
RE: C GPIO - by martind1983 - 08-24-2016, 09:55 AM
RE: C GPIO - by igna09 - 06-11-2016, 02:51 AM
RE: C GPIO - by martinayotte - 08-25-2016, 07:35 AM
RE: C GPIO - by martind1983 - 08-25-2016, 08:24 AM
RE: C GPIO - by MarkHaysHarris777 - 08-25-2016, 11:17 AM
RE: C GPIO - by martind1983 - 08-29-2016, 01:30 AM
RE: C GPIO - by martind1983 - 08-29-2016, 03:50 AM
RE: C GPIO - by MarkHaysHarris777 - 08-29-2016, 05:25 AM
RE: C GPIO - by martind1983 - 08-31-2016, 03:47 AM
RE: C GPIO - by pfeerick - 08-31-2016, 04:14 AM
RE: C GPIO - by martind1983 - 08-31-2016, 04:36 AM
RE: C GPIO - by MarkHaysHarris777 - 08-29-2016, 05:04 PM
RE: C GPIO - by MarkHaysHarris777 - 08-31-2016, 04:09 AM
RE: C GPIO - by KnReLe - 08-31-2016, 07:27 AM
RE: C GPIO - by martind1983 - 09-01-2016, 05:08 AM
RE: C GPIO - by MarkHaysHarris777 - 09-01-2016, 05:29 AM
RE: C GPIO - by martind1983 - 09-01-2016, 08:04 AM
RE: C GPIO - by KnReLe - 09-01-2016, 08:52 AM
RE: C GPIO - by martind1983 - 09-01-2016, 09:06 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  RPi.GPIO python module for Pine A64/A64+ aquilegia 98 105,738 12-15-2022, 08:40 PM
Last Post: Fadazo
  fm transmitter with gpio weasel18 2 3,831 09-10-2019, 04:28 AM
Last Post: desai_amogh
  How to use dts or other setup to declare gpio pin Interrupt (e.g. a button)? dkebler 1 2,932 06-12-2019, 10:37 AM
Last Post: dkebler
Lightbulb Sample GPIO codes highlighting RPi.GPIO-PineA64 and the PI bus MarkHaysHarris777 6 9,097 06-07-2019, 12:37 AM
Last Post: tllim
Star GPIO, SPI and I2C C++ Lib databit 7 9,214 02-04-2019, 05:45 AM
Last Post: Jeff R
Information Howto: Controlling Pine64 GPIO via the filesystem (sysfs) on linux pfeerick 4 10,339 01-24-2019, 03:36 AM
Last Post: Fifth
  GPIO and SPI SamR1 20 26,120 03-15-2018, 10:32 AM
Last Post: jomoengineer
Question GPIO shockr 7 12,385 03-11-2018, 01:52 AM
Last Post: jomoengineer
  Read GPIO problem shworker 14 17,093 08-17-2017, 01:21 PM
Last Post: martinayotte
  GPIO fiq capability joseph 3 4,968 11-10-2016, 06:07 PM
Last Post: joseph

Forum Jump:


Users browsing this thread: 1 Guest(s)