08-29-2016, 05:25 AM
(This post was last modified: 08-29-2016, 05:38 AM by MarkHaysHarris777.)
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
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
... 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
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! )
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! )