UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Reply
Accepted Solution

Zynq Petalinux hangs on GPIO access

Scholar
Posts: 1,536
Registered: ‎09-10-2008

Re: Zynq Petalinux hangs on GPIO access

Have you gone thru this page in detail?

http://www.wiki.xilinx.com/Linux+GPIO+Driver
Observer
Posts: 15
Registered: ‎11-26-2015

Re: Zynq Petalinux hangs on GPIO access

Hello linnj 

I want to tell you some detail about my project. I want to send /receive data from Spi and GPIO, 

I was using windows 7 and centos i clone the kernal and u-bootand activate the spi

make menuconfig ->device driver ->SPI support -> then enabled xilinx SPI controller common module and user mode spi

I read in tuturail "There is no device tree generator yet for Zynq yet such that hand editing the device tree is the current method."  so i just add these line in the zynq-zed.dts and convert it into dtb

&spi0 {

status = "okay";
}

and in zynq-7000.dtsi 

spidev@0x01 {
compatible = "spidev0.2";
spi-max-frequency = <20000000>;
reg = <1>;
};

but after running the board

unnamed.png

the enviroment is like this I can see spidev after that i tried to transfer data by gpio (simplest case) but i cannot create any gpio node after the following command

root# echo 61>/sys/class/gpio/export

but no gpio connected .

someone in the forum told me that i should move to linux and use petalinux

Now I am using ubuntu 14.04 ,vivado 2015.2 and petalinux.BSP 2015.2 version and working for Xilinx Zedboard 7z020

I created my project and generate the .hdf and .bit file after that export it to SDK

 

then I create a project using defined BSP

$petalinux-create -t project -s /Downloads/Avnet-2015.2.BSP

 

get the hardware

$ petalinux-config --get-hw-description=~/my_program/my_program.sdk

 

run petalinux configuration

$petalinux-config

 

subsystem Auto hardware setting->Advance bootable image storage setting and select sd-card for boot image ,kernel image and dtb image setting

 

in the system-top.dts I add the lines

build the images

$petalinux-build

 

generate BOOT.BIN:

$petalinux-package --boot --format BIN --fsbl ~/Avnet-Digilent-ZedBoard-2015.2/images/linux/zynq_fsbl.elf --fpga ~my_program/my_program.sdk/system_wrapper_hw_platform_0/system_wrapper.bit --u-boot

 

generate rootfs.cpio with the following command because I want to boot the board with sd-card

$petalinux-package --image -c rootfs --format initramfs

 

IN the sd card copy BOOT.BIN , image.ub and system.dtb into BOOT partition and rootfs.cpio into rootfs partition then run the following command

$sudo pax -rvf rootfs.cpio

 

In the last boot the board with this sd card

and the result is, I cannot find any /dev/spidev

then i tried to check the gpio then same problem

Now you are saying to follow the

http://www.wiki.xilinx.com/Linux+GPIO+Driver

I think problem is in devicetree

should i follow this or 

http://www.wiki.xilinx.com/Build+Device+Tree+Blob

I have to make changes in after editing the system-top.dts (petalinux) or zynq-zed.dts(cent os)

which one is better?

hope you understand my problem

thanks

 

Xilinx Employee
Posts: 444
Registered: ‎03-13-2012

Re: Zynq Petalinux hangs on GPIO access


umer.sabeen wrote:

Hello

I am also using zedboard  7z020

my pl.dtsi is same like yours.

I found /sys/class/gpio/gpiochip906/ under gpiochip906

cat base
906

cat label 
zynq_gpio

cat ngpio
118

but when i am trying to generate

root@Avnet-Digilent-ZedBoard-2015_2:/sys/class/gpio# echo 65>export 

root@Avnet-Digilent-ZedBoard-2015_2:/sys/class/gpio# ls
export       gpiochip906  unexport
root@Avnet-Digilent-ZedBoard-2015_2:/sys/class/gpio# 

can you help me where i am doing mistake

thanks

Sana


With base = 906 and ngpio = 118 the valid GPIO numbers are in the range from 906 to 1023 for this GPIO device. Unless some other device is in that range, 65 is not a avlid GPIO number.

Observer
Posts: 15
Registered: ‎11-26-2015

Re: Zynq Petalinux hangs on GPIO access

thanks for your reply

it solved my problem at some extent

please have a look at the following code

root@zynq:/sys/class/gpio# echo 1018 > export 
root@zynq:/sys/class/gpio# cd gpio1018
root@zynq:/sys/class/gpio/gpio1018# echo out > direction 
root@zynq:/sys/class/gpio/gpio1018# echo 1 > value       
root@zynq:/sys/class/gpio/gpio1018# cat value 
0
root@zynq:/sys/class/gpio/gpio1018# cat direction 
out

why after echo 1 > value the value of the file is not changing at all

thanks in advance