cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Observer
Observer
4,643 Views
Registered: ‎01-11-2016

Petalinux no spidev in /dev

Hi, 

I'm writing here because I have a problem with my spi. I'm working on Zybo board. I'd like to use SPI1 on my PMOD JF (MIO10...15). Unfortunatelly I don't have spidev enable in /dev. Here is my device tree structure for spi.

 

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

 What can be wrong? 

0 Kudos
Reply
7 Replies
Moderator
Moderator
4,628 Views
Registered: ‎12-04-2016

Hi

 

 

First off, Are you able to see spidev entry in sysfs? something like this:

root@linspace:~# cat /sys/bus/spi/devices/spi1.0/

 

 

You should make changes to the dts files:

 

In zynq-7000.dtsi, made status as  “okay” of spi1. I think its done in your case looks like.

 

NowiIn system-conf.dtsi, add spi1 under aliases as shown in the very last image below:

 

In system-top.dtsi, add similar to users spi devices

 

After making the above changes in dts files rebuilt the kernel images and booted it.

zynq7000.dtsi.png
system-conf.dtsi.png
systemtop.dtsi.png
0 Kudos
Reply
Observer
Observer
4,605 Views
Registered: ‎01-11-2016

Thanks for your reply. In cat /sys/bus/spi/devices I have both spi 0 and 1. I do everything what you wrote but it still doesn't work. The only difference which I have is that I put alias into the system-top.dts. System-conf.dts is automatically generated file and i 've never edit it before and always aliases included in system-top.dts worked.

0 Kudos
Reply
Moderator
Moderator
4,599 Views
Registered: ‎12-04-2016

Hi

 

Please check whether CONFIG_SPIDEV in linux kernel has been enabled?

 

 

Best Regards

Shabbir

0 Kudos
Reply
Observer
Observer
4,596 Views
Registered: ‎01-11-2016

That was a hint. Thanks a lot. I had enabled CONFG_SPI but not CONFiG_SPIDEV. 

 

I have one more question. I havo also 3 gpio pins. I can't find theirs indexes in sys/class/gpio when I want to export it. Is there any quick way to find the first index of gpio? I remember that what i do sth similar in the past I had the same problem and the idxs starts from probably 180 which was a bit strange

0 Kudos
Reply
Explorer
Explorer
2,584 Views
Registered: ‎07-05-2017

Which directory and file did you find "CONFiG_SPIDEV" I'm using Petalinux 2017.3?

0 Kudos
Reply
Explorer
Explorer
2,581 Views
Registered: ‎07-05-2017

Which directory and file is "CONFiG_SPIDEV", I'm using petalinux 2017.3?

0 Kudos
Reply
Contributor
Contributor
1,263 Views
Registered: ‎10-29-2018

Hallo aynilian,

you can find it using command

petalinux-config -c kernel  and go to Device Drivers > SPI support>User mode SPI device driver support 

active it by typing 'y'

i hope this will answer your question.

 

0 Kudos
Reply