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!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor jadobbins
Visitor
5,529 Views
Registered: ‎08-25-2016

Zynq SPI 1 to MIO / Petalinux

I am using Vivado  2016.1 and Petalinux 2016.1 with microZed/Zynq 7000

 

In Vivado I can  configure the PS MIO to connect SPI 1 to MIO 10-15 (motivation: on the microZed board these signals go to the PMOD connector J5, this would be convenient). Note there is no PL in this project.

 

I export hardware and run Petalinux. I am able to build and boot but the SPI doesn't show up in /dev.

 

A Google search turns up numerous posts related to this but I haven't been able to apply any of them to reach a solution.

 

This seem to address my problem:

 

http://www.beyond-circuits.com/wordpress/2016/08/spi-with-petalinux-on-zynq/

 

but still no luck.

 

I'm new to the Petlinux tools so would appreciate any guidance (including suggestions for more appropriate forum if applicable)

 

Thanks.

 

Tags (3)
0 Kudos
4 Replies
Explorer
Explorer
5,520 Views
Registered: ‎04-05-2016

Re: Zynq SPI 1 to MIO / Petalinux

Did you export your design from Vivado after configuring the PS SPI to MIO?

 

And then recreate your BOOT.bin and load in onto the SD Card?

 

What does dmesg say?

 

Can you paste your DTS file?  Is it possible you haven't enabled the SPI peripheral by setting ...

 

 `enabled="okay";`

... in your DTS file?

 

-TD

0 Kudos
Community Manager
Community Manager
5,451 Views
Registered: ‎07-23-2012

Re: Zynq SPI 1 to MIO / Petalinux

Can you please share your boot log? Checking dts file would give some clue on whether the spi was enabled or not.
-----------------------------------------------------------------------------------------------
Please mark the post as "Accept as solution" if the information provided answers your query/resolves your issue.

Give Kudos to a post which you think is helpful.
0 Kudos
Visitor jadobbins
Visitor
5,425 Views
Registered: ‎08-25-2016

Re: Zynq SPI 1 to MIO / Petalinux

First, here is the relevant section of my dts (I decompiled build/linux/device-tree/system.dtb to check what is actually being used)

 

spi@e0007000 {
compatible = "xlnx,zynq-spi-r1p6";
reg = <0xe0007000 0x1000>;
status = "okay";
interrupt-parent = <0x3>;
interrupts = <0x0 0x31 0x4>;
clocks = <0x1 0x1a 0x1 0x23>;
clock-names = "ref_clk", "pclk";
#address-cells = <0x1>;
#size-cells = <0x0>;
is-decoded-cs = <0x0>;
num-cs = <0x3>;

spidev@0x00 {
compatible = "spidev";
spi-max-frequency = <0xf4240>;
reg = <0x0>;
};

spidev@0x01 {
compatible = "spidev";
spi-max-frequency = <0xf4240>;
reg = <0x1>;
};

spidev@0x02 {
compatible = "spidev";
spi-max-frequency = <0xf4240>;
reg = <0x2>;
};
};

 

And here is the boot log: 

Sending discover...
No lease, forking to background
done.
spi_on_pmod login:
U-Boot 2016.01 (Aug 29 2016 - 09:19:26 -0400)
DRAM: ECC disabled 1 GiB
MMC: sdhci@e0100000: 0
SF: Detected S25FL128S_64K with page size 256 Bytes, erase size 64 KiB, total 16 MiB
*** Warning - bad CRC, using default environment
## Error: flags type check failure for "serverip" <= "AUTO" (type: i)
himport_r: can't insert "serverip=AUTO" into hash table
In: serial
Out: serial
Err: serial
Net: ZYNQ GEM: e000b000, phyaddr -1, interface rgmii-id
eth0: ethernet@e000b000
U-BOOT for spi_on_pmod
ethernet@e000b000 Waiting for PHY auto negotiation to complete....Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 4.4.0-xilinx (jad22@lnx615.classe.cornell.edu) (gcc version 4.9.2 20140904 (prerelease) (crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09) ) #2 SMP PREEMPT Mon Aug 29 09:22:33 EDT 2016
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: spi_on_pmod
bootconsole [earlycon0] enabled
cma: Reserved 16 MiB at 0x3f000000
Memory policy: Data cache writealloc
PERCPU: Embedded 12 pages/cpu @ef7d3000 s19264 r8192 d21696 u49152
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260608
Kernel command line: console=ttyPS0,115200 earlyprintk
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 1013248K/1048576K available (4840K kernel code, 218K rwdata, 1772K rodata, 2696K init, 213K bss, 18944K reserved, 16384K cma-reserved, 245760K highmem)
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0xf0800000 - 0xff800000 ( 240 MB)
lowmem : 0xc0000000 - 0xf0000000 ( 768 MB)
pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
.text : 0xc0008000 - 0xc067d364 (6613 kB)
.init : 0xc067e000 - 0xc0920000 (2696 kB)
.data : 0xc0920000 - 0xc0956820 ( 219 kB)
.bss : 0xc0956820 - 0xc098be7c ( 214 kB)
Preemptible hierarchical RCU implementation.
Build-time adjustment of leaf fanout to 32.
RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2
NR_IRQS:16 nr_irqs:16 16
slcr mapped to f0802000
L2C: platform modifies aux control register: 0x72360000 -> 0x72760000
L2C: DT/platform modifies aux control register: 0x72360000 -> 0x72760000
L2C-310 erratum 769419 enabled
L2C-310 enabling early BRESP for Cortex-A9
L2C-310 full line of zeros enabled for Cortex-A9
L2C-310 ID prefetch enabled, offset 1 lines
L2C-310 dynamic clock gating enabled, standby mode enabled
L2C-310 cache controller enabled, 8 ways, 512 kB
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x76760001
zynq_clock_init: clkc starts at f0802100
Zynq clock init
sched_clock: 64 bits at 333MHz, resolution 3ns, wraps every 4398046511103ns
clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x4ce07af025, max_idle_ns: 440795209040 ns
clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 537538477 ns
timer #0 at f080a000, irq=17
Console: colour dummy device 80x30
Calibrating delay loop... 1332.01 BogoMIPS (lpj=6660096)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
CPU: Testing write buffer coherency: ok
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x82c0 - 0x8318
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
Brought up 2 CPUs
SMP: Total of 2 processors activated (2664.03 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor ladder
cpuidle: using governor menu
hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
hw-breakpoint: maximum watchpoint size is 4 bytes.
zynq-ocm f800c000.ocmc: ZYNQ OCM pool: 256 KiB @ 0xf0880000
zynq-pinctrl 700.pinctrl: zynq pinctrl initialized
vgaarb: loaded
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
media: Linux media interface: v0.10
Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
EDAC MC: Ver: 3.0.0
Advanced Linux Sound Architecture Driver Initialized.
clocksource: Switched to clocksource arm_global_timer
NET: Registered protocol family 2
TCP established hash table entries: 8192 (order: 3, 32768 bytes)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
UDP hash table entries: 512 (order: 2, 16384 bytes)
UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
futex hash table entries: 512 (order: 3, 32768 bytes)
jffs2: version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
bounce: pool size: 64 pages
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-241330
dma-pl330 f8003000.dmac: DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 143, base_baud = 3125000) is a xuartps
àconsole [ttyPS0] enabled
console [ttyPS0] enabled
bootconsole [earlycon0] disabled
bootconsole [earlycon0] disabled
xdevcfg f8007000.devcfg: ioremap 0xf8007000 to f086c000
[drm] Initialized drm 1.1.0 20060810
brd: module loaded
loop: module loaded
CAN device driver interface
libphy: MACB_mii_bus: probed
macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 146 (00:0a:35:00:1e:53)
macb e000b000.ethernet eth0: attached PHY driver [Marvell 88E1510] (mii_bus:phy_addr=e000b000.etherne:00, irq=-1)
e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
usbcore: registered new interface driver usb-storage
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
Xilinx Zynq CpuIdle Driver started
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
sdhci-arasan e0100000.sdhci: No vmmc regulator found
sdhci-arasan e0100000.sdhci: No vqmmc regulator found
mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using ADMA
ledtrig-cpu: registered to indicate activity on CPUs
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
NET: Registered protocol family 17
can: controller area network core (rev 20120528 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20120528)
can: broadcast manager protocol (rev 20120528 t)
can: netlink gateway (rev 20130117) max_hops=1
Registering SWP/SWPB emulation handler
hctosys: unable to open rtc device (rtc0)
ALSA device list:
No soundcards found.
Freeing unused kernel memory: 2696K (c067e000 - c0920000)
INIT: version 2.88 booting
bootlogd: cannot allocate pseudo tty: No such file or directory
Creating /dev/flash/* device nodes
random: dd urandom read with 0 bits of entropy available
Starting internet superserver: inetd.
INIT: Entering runlevel: 5
Configuring network interfaces... udhcpc (v1.23.2) started
Sending discover...
Sending discover...
Sending discover...
No lease, forking to background
done.
spi_on_pmod login:

 

What should I glean from this?

 

What I did next:

 

I noticed that 'spidev' did not appear in the buld/build.log (although 'spi_cadence' did) so I ran

 

petalinux-config -c kernel

 

and enabled 'User mode SPI device driver support', then did petalinux-build

 

Now 'spidev' appreared in build.log and on boot my SPI devices appear in /dev

 

So I am wondering if this represents the accepted solution and if so, how could I have gotten here more easily? Thanks.

0 Kudos
Visitor jadobbins
Visitor
5,418 Views
Registered: ‎08-25-2016

Re: Zynq SPI 1 to MIO / Petalinux

I should add that the new boot log (i.e. after after enableing User Mode SPI support in kernel) shows the lines:

 

spidev spi32766.0: buggy DT: spidev listed directly in DT
spidev spi32766.1: buggy DT: spidev listed directly in DT
spidev spi32766.2: buggy DT: spidev listed directly in DT

 

Is 'spidev' expected to be loaded dynamically after boot? Or is there some other interpretation?

 

 

 

 

0 Kudos