ZYNQ add SPI interface
- Open “Open Block Diagram”
- Add “AXI QUAD SPI” block
- Run “Run Conection Automation”
- Generate Bitstream
- Open “Open Implementation Design”
- Switch to “I/O Planning” and select “I/O Ports”
- Pin assign for SPI interface
- Generate Bitstream and export hardware
Customize SPI device tree for petalinux
After update HDF and execute command: petalinux-config –get-hw-description=<HDF Directory>
In components/plnx_workspace/device-tree/device-tree/pl.dtsi, will produce SPI device node automatically as below:
Modify project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi as below
Enable SPI device driver
$ petalinux-config -c kernel
Go to Device Drivers -> SPI Support -> User mode SPI device driver support and enable it.
Use spidev_test.c to verify the SPI interface.
$ ls /dev/spi*
$ gcc spidev_test.c -o spidev_test
$ ./spidev_test -D /dev/spidev1.0
沒有留言:
張貼留言