Per-Mattias Nordkvist

  • Posts

    17
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Per-Mattias Nordkvist got a reaction from tkaiser in Controlling GPIO on OrangePi Zero Plus 2 (for newbies)   
    I just wanted to share some instructions on how to control all GPIO pins on the OrangePi Zero Plus 2 board. These instructions are meant for newbies but it can be extremely helpful if you are new to Armbian, OPI and GPIO. At least it would have been for me. 
     
    There is a total of 17 different pins to control according to the schematic below. These pins are highlighted in blue numbers that indicate what GPIO port they are available at. Use these numbers in order to know that pins to control. Look for instructions further down. 
     

     
    First off some basics: 
    Activate a pin by exporting it. For example. In order to activate IO-0 run: echo "352" > /sys/class/gpio/export Set the direction of the port.  echo "out" > /sys/class/gpio/gpio352/direction Turn it on: echo "1" > /sys/class/gpio/gpio352/value Turn it off: echo "0" > /sys/class/gpio/gpio352/value  
    To figure out what number to use for each pin follow the schematics above or read from the list below. I really have not figured out wether it is safe to control all pins(and not just IO-pins) for output but it seems to work when I verify with a voltmeter. These pins were identified using the official schematic for the board: http://linux-sunxi.org/File:ORANGE_PI-ZERO-PLUS2_V1_0.pdf
     
    If you are interested to learn how pins are identified based on the schematic please dig deeper into these files in the GIT repo: 
    https://github.com/armbian/linux/blob/sun8i/drivers/pinctrl/pinctrl-sunxi.h
    https://github.com/armbian/linux/blob/sun8i/arch/arm/mach-sunxi/include/mach/pinctrl.h
     
    GPIO Table
    SDA = 12
    SCL = 11
    IO-GCLK = 6
    IO-0 = 352
    IO-2 = 353
    IO-3 = 3
    SPI1-MOSI = 15
    SPI1-MISO = 16
    SPI1-CLK = 14
    TXD0 = 15
    RXD0 = 16
    IO-1 = 107
    IO-4 = 19
    IO-5 = 18
    IO-6 = 2
    SPI-CE0 = 13
    SPI-CE1 = 110
     
    I hope this helps someone. 
  2. Like
    Per-Mattias Nordkvist got a reaction from tkaiser in Controlling GPIO on OrangePi Zero Plus 2 (for newbies)   
    I just wanted to share some instructions on how to control all GPIO pins on the OrangePi Zero Plus 2 board. These instructions are meant for newbies but it can be extremely helpful if you are new to Armbian, OPI and GPIO. At least it would have been for me. 
     
    There is a total of 17 different pins to control according to the schematic below. These pins are highlighted in blue numbers that indicate what GPIO port they are available at. Use these numbers in order to know that pins to control. Look for instructions further down. 
     

     
    First off some basics: 
    Activate a pin by exporting it. For example. In order to activate IO-0 run: echo "352" > /sys/class/gpio/export Set the direction of the port.  echo "out" > /sys/class/gpio/gpio352/direction Turn it on: echo "1" > /sys/class/gpio/gpio352/value Turn it off: echo "0" > /sys/class/gpio/gpio352/value  
    To figure out what number to use for each pin follow the schematics above or read from the list below. I really have not figured out wether it is safe to control all pins(and not just IO-pins) for output but it seems to work when I verify with a voltmeter. These pins were identified using the official schematic for the board: http://linux-sunxi.org/File:ORANGE_PI-ZERO-PLUS2_V1_0.pdf
     
    If you are interested to learn how pins are identified based on the schematic please dig deeper into these files in the GIT repo: 
    https://github.com/armbian/linux/blob/sun8i/drivers/pinctrl/pinctrl-sunxi.h
    https://github.com/armbian/linux/blob/sun8i/arch/arm/mach-sunxi/include/mach/pinctrl.h
     
    GPIO Table
    SDA = 12
    SCL = 11
    IO-GCLK = 6
    IO-0 = 352
    IO-2 = 353
    IO-3 = 3
    SPI1-MOSI = 15
    SPI1-MISO = 16
    SPI1-CLK = 14
    TXD0 = 15
    RXD0 = 16
    IO-1 = 107
    IO-4 = 19
    IO-5 = 18
    IO-6 = 2
    SPI-CE0 = 13
    SPI-CE1 = 110
     
    I hope this helps someone. 
  3. Like
    Per-Mattias Nordkvist got a reaction from tkaiser in Controlling GPIO on OrangePi Zero Plus 2 (for newbies)   
    I just wanted to share some instructions on how to control all GPIO pins on the OrangePi Zero Plus 2 board. These instructions are meant for newbies but it can be extremely helpful if you are new to Armbian, OPI and GPIO. At least it would have been for me. 
     
    There is a total of 17 different pins to control according to the schematic below. These pins are highlighted in blue numbers that indicate what GPIO port they are available at. Use these numbers in order to know that pins to control. Look for instructions further down. 
     

     
    First off some basics: 
    Activate a pin by exporting it. For example. In order to activate IO-0 run: echo "352" > /sys/class/gpio/export Set the direction of the port.  echo "out" > /sys/class/gpio/gpio352/direction Turn it on: echo "1" > /sys/class/gpio/gpio352/value Turn it off: echo "0" > /sys/class/gpio/gpio352/value  
    To figure out what number to use for each pin follow the schematics above or read from the list below. I really have not figured out wether it is safe to control all pins(and not just IO-pins) for output but it seems to work when I verify with a voltmeter. These pins were identified using the official schematic for the board: http://linux-sunxi.org/File:ORANGE_PI-ZERO-PLUS2_V1_0.pdf
     
    If you are interested to learn how pins are identified based on the schematic please dig deeper into these files in the GIT repo: 
    https://github.com/armbian/linux/blob/sun8i/drivers/pinctrl/pinctrl-sunxi.h
    https://github.com/armbian/linux/blob/sun8i/arch/arm/mach-sunxi/include/mach/pinctrl.h
     
    GPIO Table
    SDA = 12
    SCL = 11
    IO-GCLK = 6
    IO-0 = 352
    IO-2 = 353
    IO-3 = 3
    SPI1-MOSI = 15
    SPI1-MISO = 16
    SPI1-CLK = 14
    TXD0 = 15
    RXD0 = 16
    IO-1 = 107
    IO-4 = 19
    IO-5 = 18
    IO-6 = 2
    SPI-CE0 = 13
    SPI-CE1 = 110
     
    I hope this helps someone.