Hello,
I want to communicate from Zynqberry with an external device through SPI. The external device is stacked on top of zynqberry on the GPIO pins. Firstly, in vivado hardware design, I selected Zynq PS and enabled SPI0 and SPI1. Then, I enabled the SPI Device drivers in petalinux kernel configuration (Cadence SPI controller, Xilinx SPI controller common module, Xilinx Zynq QSPI controller and User mode SPI device driver support are all enabled on the kernel configuration menu).
I added below entry to device tree (system-user.dtsi). The entire contents of system-user.dtsi is as below:
/include/ "system-conf.dtsi"
/ {
};
/* USB PHY */
/{
usb_phy0: usb_phy@0 {
compatible = "ulpi-phy";
#phy-cells = <0>;
reg = <0xe0002000 0x1000>;
view-port = <0x0170>;
drv-vbus;
};
};
&usb0 {
dr_mode = "host";
//dr_mode = "peripheral";
usb-phy = <&usb_phy0>;
} ;
&spi0{
#address-cells=<1>;
#size-cells=<0>;
status = "okay";
axispidevice: spidev@0 {
compatible = "spidev";
reg = <0>;
spi-max-frequency = <3125000>;
};
};
Now there is spi available at /dev/spi1.0 but, when I run my program to communicate with the external device it fails. I want to test the spi communication.
I did a loopback test by connecting the pin 19 and pin 21 (MISO and MOSI pins) and running the program which is available at this website.
https://raw.githubusercontent.com/raspberrypi/linux/rpi-3.10.y/Documentation/spi/spidev_test.cI am receiving only x"00" not the sent data.
root@arm:/home/pi/Dexter# ./spidev_test -D /dev/spidev1.0
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00
I believe the MISO and MOSI pins are the same as in raspberrypi. Please correct me if I am wrong and how can I confirm the MISO and MOSI pins in zynqberry ?
Could someone help me if the steps I followed to enable SPI is correct? or how can I check if the spi is enabled correctly or not?
Thanks in advance.