element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
Software Application Development Kernel Upgrade, broken SPI
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 3 replies
  • Subscribers 329 subscribers
  • Views 860 views
  • Users 0 members are here
Related

Kernel Upgrade, broken SPI

buckd
buckd over 9 years ago

Hi,

I am using a MicroZed 7z010 with Linux kernel 3.9.0 (xilinx-v14.6.02) from:

https://github.com/Xilinx/linux-xlnx/

I am attempting to upgrade the kernel to the latest version (4.4.0) from the same repo but it broke the SPI communication to an Analog Devices PLL that is connected.  The spidev module in the kernel is enabled, as well as all the other xilinx/zynq modules.  A C program is run, using spidev, to communicate to the PLL.

The two main issues I am seeing are:

  1.   SPI transfer timed out after every byte (either transfering the bytes one-by-one or using the C function 'SPI_IOC_MESSAGE'.
  2.   With an oscilloscope, I see that the chip-select signal starts high when rebooting the board, but then stays low after the first transfer attempt - the old kernel would return it to high.


I admit that I'm a bit new to using this technology, but I have Linux and C experience.  Things that I have attempted:

  •   Modifying the device-tree in dozens of ways
  •   Modified the SPI C code to send SPI using a number of different parameters
  •   Modified the Linux kernel module (spi.c and/or spi-cadence.c)
  •   Too much trial-and-error


The best of the outcomes would still give me those two problems mentioned above.

Is there something I'm doing wrong?

Thanks for any help!

  • Sign in to reply
  • Cancel
  • buckd
    0 buckd over 9 years ago

    Here are my device tree settings (because otherwise the first post would have been marked as SPAM):

    The old device tree looks like this (kernel 3.9.0):

            ps7-spi@e0007000 {
                #addresss-cells = <0x1>;
                #size-cells = <0x0>;
                bus-num = <0x0>;
                compatible = "xlnx,ps7-spi-1.00.a";
                interrupt-parent = <0x1>;
                interrupts = <0x0 0x31 0x4>;
                num-chip-select = <0x4>;
                reg = <0xe0007000 0x1000>;
                speed-hz = <0xf42400>;
                xlnx,has-ss0 = <0x0>;
                xlnx,has-ss1 = <0x1>;
                xlnx,has-ss2 = <0x0>;
                xlnx,spi-clk-freq-hz = <0xf42400>;

                device@0 {
                    compatible = "rohm,dh2228fv";
                    spi-max-frequency = <0x3d0900>;
                    reg = <0x0>;
                };
            };

    The new looks like this (kernel 4.4.0, I know this is very messy):

            spi@e0007000 {
                compatible = "xlnx,zynq-spi-r1p6";
                reg = <0xe0007000 0x1000>;
                interrupt-parent = <0x3>;
                interrupts = <0x0 0x31 0x4>;
                clocks = <0x1 0x1a 0x1 0x23>;
                clock-names = "ref_clk", "pclk";
                #address-cells = <0x1>;
                #size-cells = <0x0>;
                num-chip-select = <0x4>;
                num-cs = <0x4>;
                speed-hz = <0xf42400>;
                xlnx,has-ss0 = <0x0>;
                xlnx,has-ss1 = <0x1>;
                xlnx,has-ss2 = <0x0>;
                xlnx,spi-clk-freq-hz = <0xf42400>;
                
                device@0 {
                    compatible = "rohm,dh2228fv";
                    spi-max-frequency = <0x3d0900>;
                    reg = <0x0>;
                };
            };

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago

    Hey,

    I am sorry but this is not a solution to your problem but rather I hope to seek some advice from you. Since you say that your SPI interface broke with the new Kernel, I assume it was working earlier. 

    I am trying to interface an accelerometer, ADXL345 using SPI with the zedboard, with petalinux installed on it. However I am unable to do so. I do not want to sidetrack the discussion from your issue so I will not post further about my problem here however I will be extremely grateful if you could take a look at my problem at this link.

    http://zedboard.org/content/trying-interface-adxl345-using-spi

    If you do not know a possible solution can you please tell the changes you made to your device tree to enable the driver etc.

    Thanks

    Shubham Sharma

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • zedhed
    0 zedhed over 9 years ago

    Hi buckd,

    It sounds like you are using the PS SPI controller, correct?  There are a number of forum members who have struggled with that controller, one example is this thread here:

    http://zedboard.org/content/ps-spi-strange-behaviour

    I myself have had the best luck working with the Xilinx AXI Quad SPI IP to interface to SPI devices on the Pmod interfaces so I would recommend going that route.  You will consume PL resources in doing this but you will find that SPI controller to be much more flexible so you may want to consider switching to that SPI controller instead of the PS SPI controller.

    If you are using an Analog Devices peripheral, you may want to consider using the ADI SPI engine as another alternative:

    https://wiki.analog.com/resources/fpga/peripherals/spi_engine/axi

    It has its own Linux driver which ADI created to support their peripheral devices:

    https://wiki.analog.com/resources/tools-software/linux-drivers/spi/spi_engine

    One other reference which may or may not be useful to you is the "IoT Sensor Fusion Tutorials for MicroZed I/O Carrier Card" on for the MicroZed IOCC:

    http://microzed.org/support/design/1522/15

    In that design, I use a Maxim MAX31723 SPI temperature sensor Pmod and publish the data up to IBM Watson Cloud.  That sensor device is connected using the AXI Quad SPI IP in the PL along with the following devicetree entry:

    &axi_quad_spi_0 {
    t#address-cells = <1>;
    t#size-cells = <0>;

    txlnx,family = "zynq";
    txlnx,fifo-depth = <0x10>;
    txlnx,fifo-exist = <0x1>;
    txlnx,num-ss-bits = <0x1>;
    txlnx,num-transfer-bits = <0x8>;
    txlnx,sck-ratio = <0x20>;

    ttemperature:spidev@0 {
    tt#address-cells = <1>;
    tt#size-cells = <0>;
    ttcompatible = "spidev";
    ttspi-max-frequency = <3125000>;
    ttreg = <0>;   // Chip Select 0
    t};
    };

    All of the source code used to create the PetaLinux project is available on our Avnet Github software repository.

    https://github.com/Avnet/software

    Unfortunately, debugging at this level is difficult because you are to the point where you are doing kernel driver development work.

    Regards,

    -Kevin

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube