I am using the following code and when I am probing pin 13(SCK), I can't see any clock signal in the oscilloscope.
#include <SPI.h>
int SCS=10;
int SI=11;
int SCLK=13;
int EXTCOMIN=4;
void setup()
{
pinMode(SCS,OUTPUT);
pinMode(EXTCOMIN,OUTPUT);
pinMode(SCLK,OUTPUT);
digitalWrite(SCS,HIGH);
tone(EXTCOMIN,50);
SPI.setClockDivider(SPI_CLOCK_DIV16);
SPI.begin();
}
void loop()
{
}
1 Answer 1
(META: This question has been answered in the comment section of the question itself. (And I'm also unable to comment to say that he should answer his own question...) That's why I'm putting this answer here.)
You might want to look into the basics of SPI, the clock will only oscillate when there is an actual data transaction in progress. (This will prevent desynchronisation by a bit. And will make both sides know when data is being send. Often along with a SS) You can check this by continiously sending something in your code and then probe the clock pin with an ossciloscope.
You might want to accept this as an answer, so that nobody it's clear this question is already answered.
SPI.transfer()
.