UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor gordienkoa1
Visitor
1,753 Views
Registered: ‎10-25-2017

Petalinux spidev problem

Hello!

I'm working with a board zc702.
I have a problem with the spi cadence device driver. I need to run SPI (slave mode) from the user space. The top petalinux - 2016.4
I have been struggling with this for 2 weeks already. I'm in complete despair.
I reread all kinds of topics and guides and topics on this forum, but I can not find a solution.

My connection scheme:

I just hooked spi0 and spi1 through EMIO and pulled everything out

BD.png

config_spi.png

SPI_SS_I I have fed from a logical "one" (some kind of bug).

I exported the design and on a virtual machine with ubuntu added hardware to the petalinux build project.


I connect the paths to installed petalinux and sdk (I forgot to tell you I do not know in linux how to register these paths in bashrc, therefore I enter them every time)

 

#############################################################
# path to configuration files
source ~ / Programs / opt / pkg / petalinux / settings.sh
source ~ / Programs / opt / SDK / 2016.4 / settings64.sh

 

#############################################################

I create a project petalinux from the downloaded from the site xilinx bsp:

cd ~ / Programs /
petalinux-create -t project -s ./xilinx-zc702-v2016.4-final1.bsp

 

#############################################################

I go to this project:
cd ~ / Programs / xilinx-zc702-2016.4

 

#############################################################

I copy the folder with hardware that I exported from the vivado to the current project

cp -r ../hw ./

 

#############################################################

configure it hardware

there is a menuconfig in it I do not do anything right away

petalinux-config --get-hw-description hw/

 

#############################################################

configure the kernel

petalinux-config -c kernel

 

#############################################################

appears menuconfig

menuconfig.png

I go to device drivers - >> spi support and turn on the mode user mode device driver support

then go to the folder ./project-spec/meta-user/recipes-kernel/linux/linux-xlnx and open the file user_2017-12-14-11-20-00.cfg in it I see that SPIDEV is added.

after_config_kernel.png

 

 

#############################################################

I read on the forum that I need after this to configure the device tree

device_tree.png device_tree2.png

apparently from previous versions that something has changed, the structure of the files has become another previously referred to as subsystems, now there is no such folder. Device tree is located in several places, I only change ./components/plnx_workspace/device-tree-generation/

 

I change only system_top.dts, adding a spi1 device.

system-top.dts.png

 

#############################################################

I run the build

petalinux-build

 

#############################################################

next I do the packaging necessary files
petalinux-package --boot --force --format BIN --fsbl ./images/linux/zynq_fsbl.elf --fpga ./images/linux/system_wrapper.bit --u-boot

 

#############################################################

received files image.ub and BOOT.BIN write to the SD card, insert the SD card into zc702 and boot

 

I expect to see a spidev in / dev /, but there's nothing there

boot.png

 

It is extremely important for me to access the spi device as a slave, because In our system, the exchange between the main processor and zynq is performed by spi

 

I ask the help of the community, tk. I repeat that I despaired of finding an answer.
Forgive my English is in the research stage, I used google translate.

 

0 Kudos
3 Replies
Explorer
Explorer
1,727 Views
Registered: ‎10-19-2017

Re: Petalinux spidev problem

To program SPI devices on MIO, you will indeed need to add them to the Linux device tree so PetaLinux knows how to handle them. In my example, I only emulated the Zynq with QEMU, so I am not sure if/how it would run on real hardware.

 

One important thing is that your Cadence SPI driver won't work with EMIO. This driver is meant to interface with SPI devices connected to IO in the PS. This is probably why you are not seeing a spi-dev device.

 

To interface with SPI devices/ports from the PL you might want to have a look at http://www.wiki.xilinx.com/Linux+SPI+Driver.

I have not used this driver. I am still working on getting Linux configured to communicate with the PL over DMA.

 

I do not know what language you are in, but I hope this translates well over Google.

 

0 Kudos
Visitor gordienkoa1
Visitor
1,680 Views
Registered: ‎10-25-2017

Re: Petalinux spidev problem

17.1.1 Features

Each SPI controller is configured and controlled independently, They include the following features:

Four wire bus – MOSI, MISO, SCLK, and SS
° up to 3 slave selects for master mode

Full-duplex operation offers simultaneous receive and transmit
32-bit register programming via APB slave interface
Memory mapped read/write data ports for Rx/Tx FIFOs (byte-wide)
° 128-byte read and 128-byte write FIFOs

° Programmable FIFO thresholds status and interrupts

Master I/O mode
° Manual and auto start transmission of data

° Manual and auto slave select (SS) mode

° Slave select signals can be connected directly to slave devices or expanded externally

° Programmable SS and MOSI delays

Slave I/O mode
° Programmable start detection mode

Multi-master I/O Capable
° Drives I/O buffers into 3-state if controller is not enabled

° Generates a Mode Failure interrupt when another master is detected

50 MHz SCLK clock frequency when I/O signals are routed to the MIO pins
° 25 MHz SCLK when the I/O signals are routed via the EMIO interface to the PL pins

Programmable clock phase and polarity (CPHA, CPOL)
Programmable interrupt-driven device or poll status

this is an excerpt from ug585 it says that spi can obviously be output via EMIO, but its speed will be less.

Or is it only the capabilities of the "Hardware" Cadence spi itself, and not the driver for it?

I'm confused

 

0 Kudos
Visitor gordienkoa1
Visitor
1,717 Views
Registered: ‎10-25-2017

Re: Petalinux spidev problem

17.1.1 Features
Each SPI controller is configured and controlled independently, They include the following features:
• Four wire bus – MOSI, MISO, SCLK, and SS
° up to 3 slave selects for master mode
• Full-duplex operation offers simultaneous receive and transmit
• 32-bit register programming via APB slave interface
• Memory mapped read/write data ports for Rx/Tx FIFOs (byte-wide)
° 128-byte read and 128-byte write FIFOs
° Programmable FIFO thresholds status and interrupts
• Master I/O mode
° Manual and auto start transmission of data
° Manual and auto slave select (SS) mode
° Slave select signals can be connected directly to slave devices or expanded externally
° Programmable SS and MOSI delays
• Slave I/O mode
° Programmable start detection mode
• Multi-master I/O Capable
° Drives I/O buffers into 3-state if controller is not enabled
° Generates a Mode Failure interrupt when another master is detected
• 50 MHz SCLK clock frequency when I/O signals are routed to the MIO pins
° 25 MHz SCLK when the I/O signals are routed via the EMIO interface to the PL pins
• Programmable clock phase and polarity (CPHA, CPOL)
• Programmable interrupt-driven device or poll status

this is from TRM ug 585 on ZYNQ.

Or is it only the capabilities of the "Hardware" Cadence spi itself, and not the driver for it?

I'm confused

0 Kudos