I am having issues with my Petalinux SPI driver.
I have successfully tested on Xilinx SDK by using one of their spi templates and it worked just fine, but when I tried to set it up on Petalinux the programs runs but it can not connect. It looks like Petalinux can not connect to the FPGA, what can I do to get it working?
This what I get after running the code:
root@pz-7020-2016-2:/bin# ./spidev_test -D /dev/spidev32766.0 --speed 10000000
spi mode: 0x0
bits per word: 8
max speed: 10000000 Hz (10000 KHz)
spidev spi32766.0: SPI transfer timed out
can't send spi message: Connection timed out
Aborted
I using PetalinuxTools16.2, and Vivado 16.2.
Click here to see my dts files, and my spidev_test.c.
Block diagram:
<html><head><title>Jive SBS</title></head>
<body><font face="arial,helvetica,sans-serif">
<b>Error</b><br><font size="-1">
An general error occurred while processing your request.
</font></font></body></html>
<html><head><title>Jive SBS</title></head> <body><font face="arial,helvetica,sans-serif"> <b>Error</b><br><font size="-1"> An general error occurred while processing your request. </font></font></body></html>
Here are the steps I have done to set the SPI driver:
-
I created a project:
-
petalinux-create --type project --template zynq --name petalinux_pz_7020 --source pz_7020_2016_2.bsp
-
-
I import my hardware:
-
petalinux-config --get-hw-description vivado_Project/vivado_pz_7020.sdk --project petalinux_pz_7020
-
-
Created an app
-
petalinux-create -t apps --name spidev --template c
-
-
I replace the content of the app spidev.c for the spidev_test.c attached to this email.
-
Enable SPI support for your kernel:
-
Navigate to Device Drivers->SPI support and make sure that Cadence SPI controller, Xilinx SPI controller command module, Xilinx Zynq QSPI controller, and User mode SPI device driver support are all enabled.
-
-
Enabled the new app
-
$ petalinux-config -c rootfs
-
Apps->spidev (Press Y to select the application)
-
-
Build petalinux image
-
petalinux-build
-
-
Package the distribution
-
petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga ../vivado_Project/impl_1/blockDesign_wrapper.bit --uboot --kernel --force
-
-
Update Firmware
-
run netboot
-
Note:
In my petalinux project under /dev ia can see spidev32766.0, and under /bin I can see spidev