Does someone has got a small example about howto communicate via SPI to a device? What is to do?
Does someone has got a small example about howto communicate via SPI to a device? What is to do?
Can you be a bit more specific? Is this for Zynq? If so, are you trying to use a PS or a PL peripheral? Is there a particular piece of hardware that you are targeting?
Bryan
Yep it is for the MicroZed, accessing from PS (Linux) an external chip. This can be for instance an temperature sensor with SPI interface. A generic approach would be best, so that I can access all kind of SPI devices.
Some of our partners provide Pmods with devices that you can easily connect to Avnet boards. One partner is Maxim. Take a look at the MAX31723PMB1# Pmod -- http://www.maximintegrated.com/en/products/analog/sensors-and-sensor-interface/MAX31723PMB1.html
It's a SPI-based temperature sensor. They have support for ZedBoard, but hopefully it's not too difficult to port over to MicroZed. Do you have an FMC or IO Carrier to give access to the PL I/Os?
Click on the Design Resources tab to find the designs.
Bryan
Thank for this links - idea is good. But this is for ISE and rather complex stuff. I do have a MicroZed I/O Carrier board.
I think, the simpliest way is use a spidev driver, as there is already an example in kernel.
So I included SPIDEV into kernel configuration. Nevertheless there is no /dev/spi* device to see. I checked the devicetree. In the section
tps7_axi_interconnect_0: amba@0 {
there are two spi nodes:
ttps7_spi_0: ps7-spi@e0006000 {
tttclock-names = "ref_clk", "pclk", "aper_clk";
tttclocks = <&clkc 25>, <&clkc 34>, <&clkc 34>;
tttcompatible = "xlnx,zynq-spi-r1p6", "xlnx,ps7-spi-1.00.a";
tttinterrupt-parent = <&ps7_scugic_0>;
tttinterrupts = <0 26 4>;
tttnum-chip-select = <4>;
tttreg = <0xe0006000 0x1000>;
ttt#address-cells = <1>;
ttt#size-cells = <0>;
tt} ;
ttps7_spi_1: ps7-spi@e0007000 {
tttclock-names = "ref_clk", "pclk", "aper_clk";
tttclocks = <&clkc 26>, <&clkc 35>, <&clkc 35>;
tttcompatible = "xlnx,zynq-spi-r1p6", "xlnx,ps7-spi-1.00.a";
tttinterrupt-parent = <&ps7_scugic_0>;
tttinterrupts = <0 49 4>;
tttnum-chip-select = <4>;
tttreg = <0xe0007000 0x1000>;
ttt#address-cells = <1>;
ttt#size-cells = <0>;
tt} ;
But this seems to be not enough to get an spi device running.
I found a few discussions that might be helpful:
https://forums.xilinx.com/t5/Embedded-Linux/How-to-use-XPS-SPI-core-driver-in-linux/td-p/73313
https://forums.xilinx.com/t5/Embedded-Linux/linux-SPI-for-zynq/td-p/417133
http://www.wiki.xilinx.com/Linux+SPI+Driver
Bryan