I'm working with a TIPD125 evaluation board populated with all recommended components from the application note (SLAU525).
I've hooked the board up to a Teensy 3.6 for SPI comms and have correctly connected a +/-15V supply to VCC/VSS and the VDD/GND is supplied from the Teensy itself. I believe this is correct.
I am able to write successfully to the DAC and I am able to generate a voltage - however, the voltage is only between 0 and 10V, not +/-10 as per the app note.
The code I'm using is as follows and just generates a simple ramp up:
#include <SPI.h>
#define DAC_SYNC_PIN 0
SPISettings settingsA(1000000, MSBFIRST, SPI_MODE2);
void setup() {
// put your setup code here, to run once:
// Initialize the SPI bus
SPI.begin();
// Set the SYNC pin
pinMode(DAC_SYNC_PIN, OUTPUT);
}
static void startSync() {
digitalWrite(DAC_SYNC_PIN, LOW);
}
static void endSync() {
digitalWrite(DAC_SYNC_PIN, HIGH);
}
static void writeValue(uint16_t val) {
uint8_t msb = ((val & 0xFF00) >> 8);
uint8_t lsb = ((val & 0x00FF) >> 8);
SPI.beginTransaction(settingsA);
startSync();
SPI.transfer(0x00);
SPI.transfer(msb);
SPI.transfer(lsb);
endSync();
SPI.endTransaction();
}
static uint16_t i = 0;
static bool up = true;
void loop() {
// put your main code here, to run repeatedly:
i += 10;
if (i > 0xFFFF)
i = 0;
writeValue(i);
}