Project

General

Profile

SPI on MitySOM

Added by Brian Wentworth about 8 years ago

Hi,

I am trying to communicate using the SPIM0 on the HPS with 5CSE-H4-3YA. SPIM0 HPS I/O Set 0 is selected in the QSYS project and the correct multiplexing seems to be in effect for the use of SPIM0.CLK, SPIM0.MOSI, SPIM0.MISO, SPIM0.SS0 signals. The QSYS is compiled and the exports for the pins are assigned in the top level qpf file. Project compiles. The preloader and uboot are also rebuilt using the new HPS settings and SPI is enabled in menuconfig for the kernel.

I am manually trying to add the spi0 to the device tree and cant seem to find the SPI device in the file system nor do I see anything about linux loading the SPI that has been added to the device tree during boot.

Main questions:

What is the correct way to add SPI to the device tree?
What is the file descriptor used to control the SPI?
Can I manage the SPI from command line once the file descriptor is identified?

Attached is the dts, I just removed can1 and put spi0 in its place.

Any advice on this one?

Thanks,

Brian


Replies (3)

RE: SPI on MitySOM - Added by Brian Wentworth about 8 years ago

dts attached

RE: SPI on MitySOM - Added by Daniel Vincelette about 8 years ago

Hi Brian,

The following device tree uses the SPIM perpherials: http://support.criticallink.com/gitweb/?p=linux-socfpga.git;a=blob;f=arch/arm/boot/dts/socfpga_mitysom5csx_leigh.dts;h=867961f12818e92b1dd6872fb5b05f11bbc60dea;hb=73a206bd08cc06cacc51dc21aa0e1e9751a01959

Under the SPI master is a bunch of spidev devices. spidev is a way to access the spi slaves from userspace, They would be found at /dev/spidevM.S, where M would the index of the SPI Master and S would be the index of the slave select you would like to talk to. So for SPI master 0 and slave 0, it would be /dev/spidev0.0. More info on spidev can be found here: https://www.kernel.org/doc/Documentation/spi/spidev

For accessing the spidev from command line, there are no real built in utilities that I know of. I did a quick google search and found this: https://github.com/cpb-/spi-tools, which looks promising

Dan

RE: SPI on MitySOM - Added by Brian Wentworth about 8 years ago

Thanks so much. That info provided the missing link for the Device Tree

--Brian

    (1-3/3)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)