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

petalinux not generate the required spidev

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

petalinux not generate the required spidev

Hello everyone

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

I want to send /receive data from Spi and GPIO, 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 following lines

&spi0 {
is-decoded-cs = <0>;
num-cs = <3>;
status = "okay";
spidev@0x01 {
compatible = "spidev2";
spi-max-frequency = <20000000>;
reg = <1>;
};
};
&spi1 {
is-decoded-cs = <0>;
num-cs = <3>;
status = "okay";
spidev@0x00 {
compatible = "spidev1";
spi-max-frequency = <20000000>;
reg = <1>;
};
};

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

even whatever changes I made in the sytem-top.dts after running the above commands these changes has been removed and the file name is system.dts, I also checked result is same if i am not adding the above defined lines in the system-top.dts

can anyone help me where i am doing mistake ??/

root@Avnet-Digilent-ZedBoard-2015_2:~# ls /dev/
console                   network_latency           tty16                                 tty48
cpu_dma_latency network_throughput     tty17                                 tty49
flash                       null                                  tty18                                 tty5
full                          port                                  tty19                                 tty50
iio:device0            psaux                               tty2                                   tty51
initctl                      ptmx                                tty20                                  tty52
input                       pts                                   tty21                               tty53
kmsg                      ram0                               tty22                              tty54
loop-control           ram1                              tty23                              tty55
loop0                       ram10                             tty24                             tty56
loop1                       ram11                              tty25                              tty57
loop2                       ram12                              tty26                              tty58
loop3                       ram13                              tty27                              tty59
loop4                       ram14                              tty28                              tty6
loop5                       ram15                              tty29                              tty60
loop6                       ram2                              tty3                              tty61
loop7                       ram3                              tty30                              tty62
mem                       ram4                              tty31                              tty63
memory_bandwidth ram5                              tty32                              tty7
mmcblk0                ram6                              tty33                              tty8
mmcblk0p1           ram7                              tty34                              tty9
mmcblk0p2 ram8 tty35 ttyPS0
mtab ram9 tty36 urandom
mtd0 random tty37 vcs
mtd0ro shm tty38 vcs1
mtd1 snd tty39 vcsa
mtd1ro tty tty4 vcsa1
mtd2 tty0 tty40 vga_arbiter
mtd2ro tty1 tty41 watchdog
mtd3 tty10 tty42 watchdog0
mtd3ro tty11 tty43 xdevcfg
mtdblock0 tty12 tty44 zero
mtdblock1 tty13 tty45
mtdblock2 tty14 tty46
mtdblock3 tty15 tty47

One more thing I want to check that is this kernel is working or not , I run the following commands

$ cd /sys/class/gpio

/sys/class/gpio$ echo 61>export

but no node generated for GPIO

that means it is also not working

what mistake I am doing??

thanks in advance

 

&spi0 {
is-decoded-cs = <0>;
num-cs = <3>;
status = "okay";
spidev@0x01 {
compatible = "spidev2";
spi-max-frequency = <20000000>;
reg = <1>;
};
};
&spi1 {
is-decoded-cs = <0>;
num-cs = <3>;
status = "okay";
spidev@0x00 {
compatible = "spidev1";
spi-max-frequency = <20000000>;
reg = <1>;
};
};

 

 

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

Re: petalinux not generate the required spidev

Hi,

 

I think it should be just compatible = "spidev"; in the device tree. 

 

The GPIO numbers don't necessarily match the real GPIO numbers as they get somewhat virtualized by the kernel, but I'm not seeing the gpiochip where it was either so I'm looking into the GPIO issue more.

 

Thanks

John

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

Re: petalinux not generate the required spidev

I was testing in QEMU which is not accurate in this case.

On real h/w I'm seeing the GPIO work as I thought. In /sys/class/gpio there should be a gpiochipX, in this case gpiochip906, and 906 is the base of the GPIO numbers that you should be able to export.

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

Re: petalinux not generate the required spidev

thanks for you quick reply

do you mean the code for devicetree should be

&spi0 {
is-decoded-cs = <0>;
num-cs = <3>;
status = "okay";
spidev@0x01 {
compatible = "spidev";
spi-max-frequency = <20000000>;
reg = <1>;
};

or we just need

&spi0 {
compatible = "spidev";
};

and can you please tell me How we can see gpiochip file so that i can send you.

I just want to generate a node so that i can send some data to led0

thanks

sana

 

 

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

Re: petalinux not generate the required spidev

The first device tree you show with all the properties is the one.

The GPIO chip should be there in /sys/class/gpio directory but I don't know for sure on the Zed board as I tested on the Xilinx board (702). Avnet also has community forums for help.

It looks like they are controlling the LEDs on that board from the PL soft GPIO based on the device tree.

leds_8bits: gpio@41210000 {
#gpio-cells = <2>;
compatible = "xlnx,xps-gpio-1.00.a";
gpio-controller ;
reg = <0x41210000 0x10000>;
xlnx,all-inputs = <0x0>;
xlnx,all-inputs-2 = <0x0>;
xlnx,all-outputs = <0x1>;
xlnx,all-outputs-2 = <0x0>;
xlnx,dout-default = <0x00000000>;
xlnx,dout-default-2 = <0x00000000>;
xlnx,gpio-width = <0x8>;
xlnx,gpio2-width = <0x20>;
xlnx,interrupt-present = <0x0>;
xlnx,is-dual = <0x0>;
xlnx,tri-default = <0xFFFFFFFF>;
xlnx,tri-default-2 = <0xFFFFFFFF>;
};
Observer
Posts: 15
Registered: ‎11-26-2015

Re: petalinux not generate the required spidev

thanks again

okay

I will change the devicetree code.

The second thing is I want to send data from GPIO through EMIO (right now i am sending it to LED0)

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

cat base
906
cat label 
zynq_gpio
cat ngpio
118

can you please explain it now. if you required more information let me know

thanks