For DAC81404, I managed to use Arduino Uno to configure and control its voltage output.
This is code for DAC setting.
// Chip Select pinMode(DAC_SS_PIN, OUTPUT); digitalWrite(DAC_SS_PIN, HIGH); // DAC Reset pinMode(DAC_RESET_PIN, OUTPUT); digitalWrite(DAC_RESET_PIN, HIGH); /*** *** This delay is very important !!! *** ***/ delay(100); // Write write_reg(0x03, 0x04); // SPICONFIG: DEV-PWDWN=0 write_reg(0x04, 0x0); // GENCONFIG: REF-PWDWN=0 write_reg(0x09, 0x0); // DACPWDWN: DACx-PWDWN=0, x={A,B,C,D} write_reg(0x0A, 0x02); // DACx-RANGE=0b0101, i.e. +/-5V
I used write_reg(0x10, (i)%65535 ); // DAC-A to adjust channel A's voltage output.
However, when I tried to use an STM32 G431 board, I just cannot make DAC to work.
I have used PicoScope to record SPI wave forms of Uno and STM32 board as follows:
Uno SPI wave
G431 SPI wave
If look carefully, G431 signal is better than Uno since for Uno, there are spikes in CS.
For Uno, there is some gap between each byte; however for G431, there is not. Does the gap matter?