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
Ultra96 Hardware Design spi  cs polarity wrong on 2020.1
  • 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 1 reply
  • Subscribers 331 subscribers
  • Views 876 views
  • Users 0 members are here
Related

spi  cs polarity wrong on 2020.1

diabolo38
diabolo38 over 4 years ago

In xlnx kernel version 2018.3 spi work fine on ultra96 LS connector

simple spidev_test -D /dev/spidev0.0 -pAbc  command give expected spi waveform below

image

In 2020.1 kernel the CS is not driven the same way

same command give waveform below where cs polarity is obviously wrong

image

to get same or say expected behavior cs_high must be used that turn cs active low !

command is spidev_test -C -D /dev/spidev0.0 -p Abc

image

 

They were a lot of changes in between this version,  cadence spi driver(likley ok)  gpio bidning in dts

I think low polairty is the default a,  existing appluication and drivers shall  still work without changes

So i feel like something is wrong but what /where ?

 

notes :

-spidev_test is the tool provided as source in kernel tree  /tools/spi

-spidev may have to be enabled in kernel conf

-dts  is  modified to get the 2 LS and HS spidev usable   (this cause some ugly message as boot in 2020.1 kernel  since spidev shall not be used in dts drielcty) 

 

&spi0 { /* Low Speed connector */

spidev@0 {

compatible = "spidev" ;

spi-max-frequency = <10000000> ;

reg = <0> ;

};

};

 

 

&spi1 { /* High Speed connector */

spidev@0 {

compatible = "spidev" ;

spi-max-frequency = <10000000> ;

reg = <0> ;

};

};

  • Sign in to reply
  • Cancel
  • diabolo38
    0 diabolo38 over 4 years ago

    In between kernel 4 to 5   "cs enable"  pass to driver set_cs()  kind of change (enable mean now activate => put low)

     

    In mainline kernel the changes appeared after 5.4.0  (that is used ) but  kernel driver spi_cadence in xilinx git as of 2020.2 still not reflect that image

    so meanwhile simply apply a simple patch like below

     

    diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c

    index c36587b..14ac0fb 100644

    --- a/drivers/spi/spi-cadence.c

    +++ b/drivers/spi/spi-cadence.c

    @@ -177,7 +177,7 @@

     

      ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR);

     

    - if (!enable) {

    + if (enable) {

      /* Deselect the slave */

      ctrl_reg |= CDNS_SPI_CR_SSCTRL;

      } else {

    • 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