Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

OrangePi Zero cant use SPI1 pins as GPIO

Featured Replies

I'm using OPi LTS and cant change state of PA13-14-15-16 pins.

I trying on fresh Armbian Bionic. Checked SPI is disabled.

 

Trying this code for access pins:
 

import OPi.GPIO as GPIO

pin = "PA13"

GPIO.cleanup()
GPIO.setmode(GPIO.SUNXI)
#GPIO.setwarnings(False)

GPIO.setup(pin, GPIO.OUT)
GPIO.output(pin, 1)

and take this error altrough write in code "GPIO.cleanup()"
ERROR: "UserWarning: Channel PA13 is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings."


When trying "GPIO.setwarnings (False)" before change output of pin.

 

Pin voltages when write "1" to output:

 PA13 -> 3V
 PA14 -> 3V

 PA15 -> 0.95V

 PA16 -> 3V

Pin voltages when write "0" to output:

 PA13 -> 3V
 PA14 -> 2.77V

 PA15 -> 0.78V

 PA16 -> 3V

 

How can i find problem ? What else can i do ? 

 

 

 

 

Edited by mustafa_meta

  • Author

~cat /sys/kernel/debug/gp
gpiochip0: GPIOs 0-223, parent: platform/1c20800.pinctrl, 1c20800.pinctrl:
 gpio-17  (                    |orangepi:red:status ) out lo
 gpio-20  (                    |reg_vcc_wifi        ) out hi
 gpio-110 (                    |onewire@0           ) out lo
 gpio-166 (                    |cd                  ) in  lo ACTIVE LOW
 gpio-204 (                    |usb0_id_det         ) in  hi IRQ

gpiochip1: GPIOs 352-383, parent: platform/1f02c00.pinctrl, 1f02c00.pinctrl:
 gpio-358 (                    |vdd-cpux            ) out hi
 gpio-359 (                    |reset               ) out hi ACTIVE LOW
 gpio-362 (                    |orangepi:green:pwr  ) out hi

~uname -a 
Linux orangepizero 5.4.20-sunxi #20.02.1 SMP Mon Feb 17 02:09:41 CET 2020 armv7l armv7l armv7l GNU/Linux

 

Yes "GPIO.cleanup()" work for only in used script, read it from comment now. Thanks. 

But what can i do for "UserWarning: Channel PA13 is already in use...."  ?

  • Author

I'm sure, SPI is disabled. 
"cat /proc/device-tree/soc/spi@1c69000/status" is nothing show.

I tried completely the same steps on another OPi Zero and everything okay with it.  

 

Is there storage for gpio config other than sd card?
Maybe pins damaged ? 

 

17 minutes ago, mustafa_meta said:

"cat /proc/device-tree/soc/spi@1c69000/status" is nothing show.

It should show something, but without newline, only at left of command prompt, it must be either "okay" or "disabled"

18 minutes ago, mustafa_meta said:

I tried completely the same steps on another OPi Zero and everything okay with it.

Are both boards are identical, same revision number ?

19 minutes ago, mustafa_meta said:

Is there storage for gpio config other than sd card?

I don't understand the question ...

20 minutes ago, mustafa_meta said:

Maybe pins damaged ?

I doubt, i says "already in use" ...

  • Author

Sorry for it
"cat /proc/device-tree/soc/spi@1c69000/status" report disabled.

 

Quote

Are both boards are identical, same revision number ?

No.  OPi Zero and OPi Zero LTS. I have problem with OPi Zero LTS now.  OPi Zero work fine. 

 

Quote

I don't understand the question ...

 

Is there an internal disk in the OPi card, such as eMMC flash.  I guess the answer is no.


 

 

  • Author

I ordered another one from the same board.  I try the same steps and if we succeed we can assume that gpios is damaged.

 

19 minutes ago, mustafa_meta said:

No.  OPi Zero and OPi Zero LTS. I have problem with OPi Zero LTS now.  OPi Zero work fine. 

Did you try to use the same SDCard from the working one into the other one ?

19 minutes ago, mustafa_meta said:

Is there an internal disk in the OPi card, such as eMMC flash.  I guess the answer is no.

Yes, there is a SPINOR flash, but since SPI isn't enable, it should not interfere ...

 

BTW, the whole thing remind me a 2 years old thread here :

 

Do you have UART3 overlay in /boot/armbianEnv.txt ? The PA13/PA14 pins would be in-use if UART3 is enabled ...

  • Author

 

On 3/20/2020 at 5:35 PM, martinayotte said:

BTW, the whole thing remind me a 2 years old thread here :

I was read it and sure UART is disabled.  Here is output  " cat /boot/armbianEnv.txt":
verbosity=1
logo=disabled
console=serial
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
overlays=w1-gpio
rootdev=UUID=4618846b-19e6-421b-8872-767a46ed5e1e
rootfstype=ext4
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
 

 

Now a new board is came. I tried same sd card both.  Old one still not working and new one works with same sdcard.


Few weeks before this mistake i've tried work with rc522 module on spi1 pins. I unconsciously tried everything.  If this not a software issue I think it damaged these pins. 

 

On 3/20/2020 at 5:35 PM, martinayotte said:

Yes, there is a SPINOR flash, but since SPI isn't enable, it should not interfere ...

What is SPINOR role on board? Maybe I intervened in this before?

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.