Jump to content

OrangePi Zero cant use SPI1 pins as GPIO


mustafa_meta

Recommended Posts

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
Link to comment
Share on other sites

1 hour ago, mustafa_meta said:

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

What "cat /sys/kernel/debug/gpio" is reporting ?

Which kernel are you using ? What "uname -a" shows ?

 

BTW, "GPIO.cleanup()" is usually called when program exit, but at the beginning ...

Link to comment
Share on other sites

~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...."  ?

Link to comment
Share on other sites

7 hours ago, mustafa_meta said:

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

PA13 is SPI1_CS ... Are you sure the SPI1 is disabled ?

What "cat /proc/device-tree/soc/spi@1c69000/status" is reporting ?

Link to comment
Share on other sites

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 ? 

 

Link to comment
Share on other sites

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" ...

Link to comment
Share on other sites

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.


 

 

Link to comment
Share on other sites

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 ...

Link to comment
Share on other sites

 

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?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines