I was attempting to use an SPI library and DAC device (Library AD57X4) for the first time, when I realized that the Arduino UNO Pin 13 was not outputting a clock signal (something I expected it to do).
Using a serial analyzer I can sample at 16MHz, yet nothing comes out of UNO Pin 13 except maybe a very occasional noise blip. After no luck with the AD57X4 library, I wrote this simple program to try to get SPI clock signal on UNO Pin 13. Setting UNO Pin 13 to OUTPUT makes no difference.
#include <SPI.h>
void setup() {
//pinMode(13, OUTPUT);
SPI.begin();
}
void loop() {
SPI.transfer(0x00);
}
I do get a signal on UNO Pin 11 (MOSI), frequency 381 kHz. This signal is due to SPI.transfer(0x00);
, as it disappears when the line is removed. Although likely irrelevant to the question, I noticed some periodic 6us gaps every ~1ms on this UNO Pin 11 (MOSI) signal.
The Blink Example Works:
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
I tried monitoring UNO ICSP header pin 3 (SCK), however there is no signal for either the SPI or Blink programs.
UPDATE: I switched over to an Arduino NANO that I had around and was able to get this output. I expected the clock to be high frequency and continuous for SPI. The MOSI output is the same 381 kHz that I observed earlier.
#include <SPI.h>
void setup() {
pinMode(13, OUTPUT);
SPI.begin();
}
void loop() {
SPI.transfer(0x00);
}
EDIT: Here is a schematic of my circuit. I am using an EVAL-AD5754R Evaluation Board from Analog Devices. Here is a link to the AD5754 chip data sheet. I'm providing 5V power through the J7 terminal (via the UNO), and supplying the SPI connections through the J8 header. The EVAL-AD5754R board works perfectly via USB and their software, but now I am transitioning to controlling it through Arduino/SPI. As you can see I'm temporarily using a 12V battery for the analog voltage supply - this is until I build a regulated circuit. J8 DGND pins are shown unconnected on the schematic below, but I've tried connecting one of them to the UNO's GND to no effect.
This is the configuration of the linkers which act to configure the eval board:
This is an annotated table describing J8 header connections (UNO <-> EVAL-AD5754R):