jdugat Posted October 24, 2017 Share Posted October 24, 2017 Yes, sorry for the confusion. What would be a good one that's in the userspace already? Presently, I'm not using any of the pins that the arrow in the image below is pointing to. Link to comment Share on other sites More sharing options...
martinayotte Posted October 24, 2017 Share Posted October 24, 2017 As I said, as long as you don't use alternate mode on some pins, for example, if you don't use TWI1, then PA18/PA19 are free. Depending of your kernel type, Legacy or Mainline, you need to make sure that TWI1 isn't enabled. Link to comment Share on other sites More sharing options...
jdugat Posted October 25, 2017 Share Posted October 25, 2017 Please forgive my ignorance, but is there a way to test the availability of a of pin? Link to comment Share on other sites More sharing options...
martinayotte Posted October 25, 2017 Share Posted October 25, 2017 For some usage, doing "cat /sys/kernel/debug/gpio" will reveal if pin is in use by kernel driver. But for some other usage such as I2C/SPI, you need to inspect Legacy FEX or Mainline DT. 1 Link to comment Share on other sites More sharing options...
jdugat Posted October 26, 2017 Share Posted October 26, 2017 Looks like PA17 is not being used. I guess my next step to is figure out which connector. its assigned to. Link to comment Share on other sites More sharing options...
zador.blood.stained Posted October 26, 2017 Share Posted October 26, 2017 7 hours ago, jdugat said: Looks like PA17 is not being used. No, this lists used (claimed) GPIOs, though even this is not a complete list - some pins not listed there will be claimed in non-GPIO modes. 7 hours ago, jdugat said: I guess my next step to is figure out which connector. its assigned to. Board schematic is usually the best way to map pin headers to SoC pins, though for many boards there are existing maps in form of pictures or tables, i.e. this for Orange Pi Zero. Link to comment Share on other sites More sharing options...
martinayotte Posted October 26, 2017 Share Posted October 26, 2017 10 hours ago, jdugat said: Looks like PA17 is not being used According to your /sys/kernel/debug/gpio output, it said "in-use" for "red:status" LED... Link to comment Share on other sites More sharing options...
jdugat Posted October 26, 2017 Share Posted October 26, 2017 okay...I wasn't clear on the GPIO-17 and PA17 naming conventions. So GPIO-19 will be a better starting point for me to test with. In that case I'm going to assume that the connector.gpiolp19 would be GPIO-19? Link to comment Share on other sites More sharing options...
jdugat Posted October 26, 2017 Share Posted October 26, 2017 Zador, Thanks for your insights and the map on the gpio pins. I really appreciate the help. Link to comment Share on other sites More sharing options...
martinayotte Posted October 26, 2017 Share Posted October 26, 2017 3 hours ago, jdugat said: I'm going to assume that the connector.gpiolp19 would be GPIO-19? What is "gpiolp19" ? GPIO19=PA19=pin16 Link to comment Share on other sites More sharing options...
jdugat Posted October 27, 2017 Share Posted October 27, 2017 I was looking at one of the examples, and the connector for GPIO40 was. connector.gpio1p40, so I assumed (I know a major screw up) that's how they were mapped. I'm guessing by your reply that is not the case. Here's the code I was looking through for ideas. import os import sys if not os.getegid() == 0: sys.exit('Script must be run as root') from time import sleep from pyA20.gpio import gpio from pyA20.gpio import port from pyA20.gpio import connector __author__ = "Stefan Mavrodiev" __copyright__ = "Copyright 2014, Olimex LTD" __credits__ = ["Stefan Mavrodiev"] __license__ = "GPL" __version__ = "2.0" __maintainer__ = __author__ __email__ = "support@olimex.com" button = connector.gpio1p40 gpio.init() gpio.setcfg(led, gpio.OUTPUT) try: print ("Press CTRL+C to exit") while True: gpio.output(led, 1) print "led set 1 \r\n" sleep(2) gpio.output(led, 0) print "led set 0 \r\n" sleep(2) """ gpio.output(led, 1) sleep(0.1) gpio.output(led, 0) sleep(0.1) sleep(0.6) """ except KeyboardInterrupt: print ("Goodbye.") Link to comment Share on other sites More sharing options...
martinayotte Posted October 28, 2017 Share Posted October 28, 2017 Since Olimex-A20-Micro and OrangePiZero doesn't have common pinout, you should not rely on connectors. You should simply rely on the port like this : #!/usr/bin/python import sys, time from pyA20.gpio import gpio from pyA20.gpio import port gpio.init() gpio.setcfg(port.PA18, gpio.OUTPUT) gpio.setcfg(port.PA19, gpio.OUTPUT) while True: gpio.output(port.PA18, gpio.HIGH) gpio.output(port.PA19, gpio.LOW) time.sleep(0.25) gpio.output(port.PA18, gpio.LOW) gpio.output(port.PA19, gpio.HIGH) time.sleep(0.25) Link to comment Share on other sites More sharing options...
blprasad Posted March 28, 2018 Share Posted March 28, 2018 Hi All, I am trying to interface LCD display JHD 204A to my Orange Pi zero. My display characters on LCD display are not consistant . So I tried to verify the ouputs of correponding gpio pins. I suspect some problem at pin 13 on my Pi zero board(pin I used for LCD). The pin 13 is mapped to GPIO PA02 ,I am using gpio_lib.c for my application. Following is my test code. int main(){ sunxi_gpio_init(); sunxi_gpio_set_cfgpin(SUNXI_GPA(02), SUNXI_GPIO_OUTPUT); while(1) { sunxi_gpio_output(SUNXI_GPA(02), 1);printf(" high\n"); sleep(1); sunxi_gpio_output(SUNXI_GPA(02), 0);printf("low\n"); sleep(1); } return 0; } My preliminary observation is as following. I am testing the pin13 voltage with a multimeter. I get the reading in multimeter as nearly 3 volts during "high" then it switches back to 0 volts during "low", but this is not repetitive as it need to be. Sometimes the pin stays at 3 volts for longer duration than expected. Has anyone found similar problem with the GPIO pins while using gpio_lib.c , any help is appriciated Thanks in advance, Link to comment Share on other sites More sharing options...
billybangleballs Posted March 28, 2018 Share Posted March 28, 2018 4 hours ago, blprasad said: Hi All, I am trying to interface LCD display JHD 204A to my Orange Pi zero. My display characters on LCD display are not consistant . So I tried to verify the ouputs of correponding gpio pins. I suspect some problem at pin 13 on my Pi zero board(pin I used for LCD). The pin 13 is mapped to GPIO PA02 ,I am using gpio_lib.c for my application. Following is my test code. int main(){ sunxi_gpio_init(); sunxi_gpio_set_cfgpin(SUNXI_GPA(02), SUNXI_GPIO_OUTPUT); while(1) { sunxi_gpio_output(SUNXI_GPA(02), 1);printf(" high\n"); sleep(1); sunxi_gpio_output(SUNXI_GPA(02), 0);printf("low\n"); sleep(1); } return 0; } My preliminary observation is as following. I am testing the pin13 voltage with a multimeter. I get the reading in multimeter as nearly 3 volts during "high" then it switches back to 0 volts during "low", but this is not repetitive as it need to be. Sometimes the pin stays at 3 volts for longer duration than expected. Has anyone found similar problem with the GPIO pins while using gpio_lib.c , any help is appriciated Thanks in advance, You don't say much about the mechanics of your interfacing, are you pulling the GPIO to a known level with a resistor, or just letting it float around aimlessly, hoping that the software will be enough? The LCD will not provide enough load to provide this service. A 10k resistor between the pin and vcc or gnd will maybe cure your problem. Link to comment Share on other sites More sharing options...
blprasad Posted March 29, 2018 Share Posted March 29, 2018 16 hours ago, billybangleballs said: You don't say much about the mechanics of your interfacing, are you pulling the GPIO to a known level with a resistor, or just letting it float around aimlessly, hoping that the software will be enough? The LCD will not provide enough load to provide this service. A 10k resistor between the pin and vcc or gnd will maybe cure your problem. I am using Pi GPIOs to drive the data lines of of LCD , the following are the details how am I using the GPIOs. #define _RS SUNXI_GPA(12) #define _RW SUNXI_GPA(16) #define _E SUNXI_GPA(11) #define _D4 SUNXI_GPA(01) #define _D5 SUNXI_GPA(02) #define _D6 SUNXI_GPA(03) #define _D7 SUNXI_GPA(15) #define _LED SUNXI_GPA(06) I am connecting GPIO pins on PI directly to corresponding pins on LCD. I am using jumper wires directly to connect them.I am not using any resistors inbetween ,except for LED and contrast pins of LCD. Finally I tried to use SUNXI_GPA(14) instead of SUNXI_GPA(02) the LCD worked as expected.Now I am getting "Hellow world " displayed on my LCD correctly. I dont know what is going wrong with SUNXI_GPA(02). The connections is are almosts same as the following picture execpt the PI board (Orange Pi zero in my case) Link to comment Share on other sites More sharing options...
billybangleballs Posted March 29, 2018 Share Posted March 29, 2018 19 hours ago, blprasad said: I am using Pi GPIOs to drive the data lines of of LCD , the following are the details how am I using the GPIOs. #define _RS SUNXI_GPA(12) #define _RW SUNXI_GPA(16) #define _E SUNXI_GPA(11) #define _D4 SUNXI_GPA(01) #define _D5 SUNXI_GPA(02) #define _D6 SUNXI_GPA(03) #define _D7 SUNXI_GPA(15) #define _LED SUNXI_GPA(06) I am connecting GPIO pins on PI directly to corresponding pins on LCD. I am using jumper wires directly to connect them.I am not using any resistors inbetween ,except for LED and contrast pins of LCD. Finally I tried to use SUNXI_GPA(14) instead of SUNXI_GPA(02) the LCD worked as expected.Now I am getting "Hellow world " displayed on my LCD correctly. I dont know what is going wrong with SUNXI_GPA(02). The connections is are almosts same as the following picture execpt the PI board (Orange Pi zero in my case) https://raspberrypi.stackexchange.com/questions/4569/what-is-a-pull-up-resistor-what-does-it-do-and-why-is-it-needed I don't know if a pull-up resistor will cure your issue, or whether it is something else entirely, but it was the first thing that sprang to mind when I read your original post. Link to comment Share on other sites More sharing options...
blprasad Posted March 30, 2018 Share Posted March 30, 2018 billy thanks for your input. 1 Link to comment Share on other sites More sharing options...
Rashmi Posted April 12, 2018 Share Posted April 12, 2018 hi everyone, I am not able to find the datasheet of orange pi zero,anyone one can send me the link to download. Thank u Link to comment Share on other sites More sharing options...
billybangleballs Posted April 12, 2018 Share Posted April 12, 2018 6 minutes ago, Rashmi said: hi everyone, I am not able to find the datasheet of orange pi zero,anyone one can send me the link to download. Thank u https://linux-sunxi.org/Orange_Pi_Zero Link to comment Share on other sites More sharing options...
Rashmi Posted April 12, 2018 Share Posted April 12, 2018 6 minutes ago, billybangleballs said: https://linux-sunxi.org/Orange_Pi_Zero sorry,i am not getting any datasheet to download its like a wiki Link to comment Share on other sites More sharing options...
billybangleballs Posted April 12, 2018 Share Posted April 12, 2018 Just now, Rashmi said: sorry,i am not getting any datasheet to download its like a wiki Yeah, a wiki, http://www.orangepi.org/download/orange_pi-zero-v1_11.pdf maybe this is more like you are wanting. Link to comment Share on other sites More sharing options...
Recommended Posts