SPI

Just about everything about Red Pitaya
anto
Posts: 2
Joined: Wed Sep 10, 2014 3:13 pm

SPI

Post by anto » Thu Oct 23, 2014 10:38 am

Hi,
where can i find some instruction to connect a slave device to my Red Pitaya and communicate with it?

wa4557
Posts: 7
Joined: Thu Oct 23, 2014 9:57 pm

Re: SPI

Post by wa4557 » Wed Dec 17, 2014 12:44 pm

I'd be interested in this as well, seems funny that there's a SPI interface without any use. Where could start to develop a driver?

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: SPI

Post by Nils Roos » Sat Dec 20, 2014 12:26 am

Well, the SPI bus on the extension connector E2 is connected to the ZYNQ's SPI 1 interface, which in turn is made available to the linux kernel by the following block in the devicetree:

Code: Select all

		ps7_spi_1: ps7-spi@e0007000 {
			bus-num = <2>;
			compatible = "xlnx,ps7-spi-1.00.a";
			interrupt-parent = <&ps7_scugic_0>;
			interrupts = < 0 49 4 >;
			num-chip-select = <4>;
			reg = < 0xe0007000 0x1000 >;
			speed-hz = <166666672>;
			xlnx,has-ss0 = <0x1>;
			xlnx,has-ss1 = <0x0>;
			xlnx,has-ss2 = <0x0>;
			xlnx,spi-clk-freq-hz = <0x9ef21b0>;
		} ;
So, you would probably start by writing a module that registers a new class on this spi-bus, then searches the bus for your specific device and register itself as the driver if found.

rajat
Posts: 9
Joined: Thu Jan 08, 2015 2:35 pm

Re: SPI

Post by rajat » Fri Jan 16, 2015 12:09 pm

In place of making changes in fpga code can be write code in arm and run it to get data on fpga spi pins .........

rajat
Posts: 9
Joined: Thu Jan 08, 2015 2:35 pm

Re: SPI

Post by rajat » Fri Jan 16, 2015 12:17 pm

Can you please let me know where this code is present in the red pitaya folder that you have mentioned.

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: SPI

Post by Nils Roos » Fri Jan 16, 2015 1:19 pm

This code was from the "devicetree.dts" file that's being generated dynamically during the Red Pitaya build process.

The relevant Makefile targets are "devicetree" from RedPitaya/FPGA/release1/fpga/Makefile:

Code: Select all

devicetree:
	make -C $(SDK_DIR)/device-tree_bsp_0/ -k all
and RedPitaya/FPGA/release1/fpga/vivado/red_pitaya.sdk/SDK/SDK_Export/device-tree_bsp_0/Makefile:

Code: Select all

# Makefile generated by Xilinx SDK.

-include libgen.options

LIBRARIES = ${PROCESSOR}/lib/libxil.a
MSS = system.mss

all: libs
	@echo 'Finished building libraries'

libs: $(LIBRARIES)

$(LIBRARIES): $(MSS)
	libgen -hw ${HWSPEC}\
	       ${REPOSITORIES}\
	       -pe ${PROCESSOR} \
	       -log libgen.log \
	       $(MSS)

clean:
	rm -rf ${PROCESSOR}
The compiled devicetree is part of the ecosystem, so if you booted your Red Pitaya with the standard ecosystem, linux already knows about the SPI bus on E2.
Loading another FPGA *.bin into /dev/xdevcfg will not change this.

rajat
Posts: 9
Joined: Thu Jan 08, 2015 2:35 pm

Re: SPI

Post by rajat » Fri Jan 16, 2015 1:51 pm

Can be write data from arm processor and get the spi output on the pins....

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: SPI

Post by Nils Roos » Fri Jan 16, 2015 7:24 pm

rajat wrote:Can be write data from arm processor and get the spi output on the pins....
???
I don't understand you.

dreaguns
Posts: 4
Joined: Tue Oct 22, 2019 8:17 pm

Re: SPI

Post by dreaguns » Fri Oct 25, 2019 7:51 pm

I'm currently working on the same thing.
Is there a way to write code so that the SPI gets information as soon as the RP turns on?
I need the RP to communicate with an external device at turn on.

Petricshone
Posts: 4
Joined: Tue Sep 17, 2019 1:02 pm

Re: SPI

Post by Petricshone » Mon Oct 28, 2019 4:32 pm

great thing

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 0 guests