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 862 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
Parents
  • 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
Reply
  • 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
Children
No Data
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