element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • 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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • 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
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • 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
Arduino
  • Products
  • More
Arduino
Arduino Forum Arduino SPI
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 9 replies
  • Subscribers 402 subscribers
  • Views 814 views
  • Users 0 members are here
  • clock
  • spi
  • icsp
  • arduino
Related

Arduino SPI

Former Member
Former Member over 12 years ago

Hi I am trying to use SPI to interface with a sensor chip, but I cant get a clock signal out of my arduino micro's sck pin on the icsp header or the sck pin on the booard! Help!

 

-Omar

  • Sign in to reply
  • Cancel

Top Replies

  • Former Member
    Former Member over 12 years ago in reply to billabott +1
    Don't feel bad Billabbott, reading you is always helpful and instructive.
Parents
  • billabott
    0 billabott over 12 years ago

    My guess is that you must use a digital i/o pin to simulate a clock signal.

     

    Going to arduino.cc and looking at an example that uses


    #include <SPI.h>

     

    and supports my guess in that Digital Pin 13 is used for SCK.


    • 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 billabott

    On the Arduino Nano pin 13 and sck are the same. I looked at the schematic. But on my Micro that is not the case. I checked to see whether I am getting a clock from the crystal oscillator and I am, but I am still not able to get a clock out of either sck pin.

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

    Well, think about this; Only when the Master of the SPI is talking or listening will there be a CLK on DP13.  In other words, the program has to be running.  In particular, SPI.begin(); must have been executed.

     

    Reference Documentation for SPI is here: http://arduino.cc/en/Reference/SPI

     

    Jeremy Blum covers SPI output on this video: http://www.youtube.com/watch?v=1nO2SSExEnQ

     

    and SPI Input on this video: http://www.jeremyblum.com/2010/08/27/reacxion-build-progress/

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

    1.  Wow.  Your "nano" was made by whom?  What Atmel chip is on your "nano" board?  This is info you should have provided in you very first posting.

     

    2.  If I had known that Raivis Rengelis had already answered this same question.  I would not have bothered to answer here.

     

    3.  Multiple postings of the same question -  is abuse of your priviledges on element14 , IMO.  Don't do it, Omar.

    • 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 billabott

    Don't feel bad Billabbott, reading you is always helpful and instructive.

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

    Sorry I wont do it again. I am using an Arduino Micro. It is the Arduino Nano that has its sck pin and digital pin 13 tied together. And I have not seen the response by Ravis Rangelis.

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

    While boucing my brain off the html backboard at arduino.cc, it occurred to me that it appears you remain firmly impaled on the horns of your dillema.  Not wishing you to remain so impaled; I once again perused the contents of  http://arduino.cc/en/Reference/SPI to discover an interesting fact or two about the Slave Select pin on ATMEL's  ATMega family as implemented by the Arduino SPI library.

    Quote: "Since this library supports only master mode, this pin should be set always as OUTPUT otherwise the SPI interface could be put automatically into slave mode by hardware, rendering the library inoperative."  And according to the table located above that statement, it is revealed that pin 10 on the UNO and Duemilenove is the pin at issue.  However, on the Mega1280 and Mega2560, pin 53 is the potential trouble spot.

    ONLY one of the two examples given for SPI usage properly inform the arduino experimenter of the NEED to connect pin 10 as an output to the Chip Select or Chip Enable of the sensor IC.  In the case of the AD5206 Digital Potentiometer example, the connection is properly documented.  Whereas the Barometric Pressure Sensor example quietly deploys pin 7 of the arduino to do the work of selecting the chip.  BUT, the quote given above in this post states that the SPI library demands pin 10 be an output regardless if another output pin is actually doing the job of enabling a sensor IC of some kind.  {The webmaster@arduino.cc has been requested to modify documentation for Baro-Pressure example so users can avoid this pitfall.}

     

    More Gory Details.

     

    This phrase "rendering the library inoperative" clearly means that the SCLK will be turned OFF and the pin will change to an input pin listening for a SCLK from the SPI Master IC.  That would be arduino in SPI Slave mode, which the Library does not support.

     

    Bottom line:  If pinmode(10,Input);  is executed before? or after? SPI.begin(); then there will be no SCLK on pin 13.

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

    While boucing my brain off the html backboard at arduino.cc, it occurred to me that it appears you remain firmly impaled on the horns of your dillema.  Not wishing you to remain so impaled; I once again perused the contents of  http://arduino.cc/en/Reference/SPI to discover an interesting fact or two about the Slave Select pin on ATMEL's  ATMega family as implemented by the Arduino SPI library.

    Quote: "Since this library supports only master mode, this pin should be set always as OUTPUT otherwise the SPI interface could be put automatically into slave mode by hardware, rendering the library inoperative."  And according to the table located above that statement, it is revealed that pin 10 on the UNO and Duemilenove is the pin at issue.  However, on the Mega1280 and Mega2560, pin 53 is the potential trouble spot.

    ONLY one of the two examples given for SPI usage properly inform the arduino experimenter of the NEED to connect pin 10 as an output to the Chip Select or Chip Enable of the sensor IC.  In the case of the AD5206 Digital Potentiometer example, the connection is properly documented.  Whereas the Barometric Pressure Sensor example quietly deploys pin 7 of the arduino to do the work of selecting the chip.  BUT, the quote given above in this post states that the SPI library demands pin 10 be an output regardless if another output pin is actually doing the job of enabling a sensor IC of some kind.  {The webmaster@arduino.cc has been requested to modify documentation for Baro-Pressure example so users can avoid this pitfall.}

     

    More Gory Details.

     

    This phrase "rendering the library inoperative" clearly means that the SCLK will be turned OFF and the pin will change to an input pin listening for a SCLK from the SPI Master IC.  That would be arduino in SPI Slave mode, which the Library does not support.

     

    Bottom line:  If pinmode(10,Input);  is executed before? or after? SPI.begin(); then there will be no SCLK on pin 13.

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

    Okay I see. I also conacted Arduino, and they replied to me saying that SCK is only active when theArduino board is sending sending and recieving data. SPI.Begin intializes the clock to the devault 4Mhz but one only sees clock signal when data is being transfered. This is the reason why I was not getting any clock signla before. Thank you for the help, it is much appreciated and again sorry for anything I've done wrong as I am new to this community.

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

    Glad to have you as part of the community.  Helping new people learn the ropes is part of the process.  I am glad to know that the Arduino expert agreed with what I said in my second post.  Your inquiry made me dig around and discover a flaw in their example.  So, overall, excellent progress was made. 

     

    Challenge:  Draw your circuit up in Fritzing 0.7.11 and post a .jpg and .fzz files here.

    • 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