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 PS SPI with strange behaviour
  • 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 Verified Answer
  • Replies 8 replies
  • Subscribers 328 subscribers
  • Views 914 views
  • Users 0 members are here
Related

PS SPI with strange behaviour

Former Member
Former Member over 12 years ago

Hey everybody,

I'd like to use the SPI in the Zynq PS just to send some data to an external peripherial, but the SPI is not behaving as it is supposed to be.
           
            
The SPI instance is used as a master with manual chip select and manual start option, a CLK-prescaler of 4 and a reference clk of 200Mhz. No interrupts are used. Right now, SPI is routed to the MIO, SS[0] is omitted as discussed here (http://www.xilinx.com/support/answers/47511.htm), instead SS[1] is used for CS. Nothing else except the Uart is enabled in the design for testing purposes.
          
              
After the CS, the CS-signal goes down as it is supposed to be.
First unusual thing: The controller is enabled and data is written to the TX register. Then, the manual start bit is set  to trigger the transfer. Now, the CLK-signal starts at a frequency of 33.3 Mhz (it is supposed to be at 200/4 = 50 MHz, acoording to the CLK-prescaler and the reference CLK). It does not change if I set another CLK-prescaler, only if I change the SPI reference clk frequency in the Zynq IP.
Second unusual thing: CLK and MOSI signal do not stop when the CS is deasserted, nor when the controller is disabled.
Third unusual thing: from the CS till the start of the CLK oscillation it takes about 500u00B5s, which in my opinion is far too long.
           
               

The control register has the right bits set, I tried using MIO and EMIO with the same results, I even build a project in PlanAhead to make sure that Vivado (I'm using 2013.2) is not the reason here.
                
            
Did anybody encounter this behaviour before? What is going wrong here? Is this a configuration problem or a problem of the hardware itself?

  • Sign in to reply
  • Cancel
  • Former Member
    0 Former Member over 12 years ago

    Are you using ES or production silicon?  Do you have a Rev C or Rev D zedboard? The 33mhz makes me think you may be on Rev C where the SDIO interface did not run at 'full speed' of 50MHz.

    Can you post your PS C code?

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

    Its indeed a Rev C board. In the meantime I was finally able to locate the error.

    Its actually two things:
    1) You have to set up the control register with a CS-value of 1111 (deselect). Only after this value has been set once, you are allowed to select the CS of your choice. Unfortunately, this appears is none of the examples.
    2) The function "XSpiPs_SetSlaveSelect(...)" of the XSpiPs-Driver seems to be corrupt. The Config Register is not updated with the right CS-value, if the CS bits have been set to 1111 before. If those bits are set manually, the device works just fine.

    Hope this will help those guys who run into similiar problems in the future :-)

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

    stephanprinz,

    Great to hear you have figured it out.  What version of the tools are you using?

    Thanks so much for posting your results/success - it really helps the community!

    -TD

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

    I use Vivado 2013.2 and SDK 14.6.

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

    took me and my partner 1 week full time to figure this out.. first it was the IDE version, then it was the libraries, even now - after we wrote out own libraries, things arent running 100% perfectly

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

    I found that steps 1 & 2 given above (by stephanprinz) were enough to get SPI over MIO working.  But for EMIO is was a different story.  Due to the issues summarized by Xilinx in AR# 47511, the appropriate SLCRs had to be written to reconfigure the EMIO mapping and thus prevent the SPI controller from resetting.  However, this should go away in production silicon (Rev D) as noted by Xilinx AR# 47916.

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

    Hello,

    I've been trying to get SPI to work on the PS as well, but had no luck with it, yet. May I ask how you configured you hardware system?

    I'm using Vivado 2013.2 and just switched on the SPI 1 peripheral, activated ss[1] and deactivated ss[0]. Set a clock speed that my slave can handle and that's it.

    The problem is that the XSpiPs_PolledTransfer() function is stuck waiting for the status register from which it reads a 0x2(?!), which doesn't sound very plausible to me.

    I'd be glad for any help with this issue.
    Regards,
    Darius

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

    I cann't use spi work.

    • 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