BU2505FV DAC - working example

Hi everyone! I'd like to be the first one to post about the BU2505-FV DAC. It's been days of headaches, and this is the resulting function and SPI Settings that worked for me:

#define LD 10 // just define any digital pin. 

SPISettings spisettings(14000000, LSBFIRST, SPI_MODE0);

static void BU2505FV_set_channel(uint16_t channel_n, uint16_t val_n) {

  uint16_t val_10bit = (val_n & 0x3FF) << 6;
  uint16_t channel = channel_n << 2;

  uint16_t message = (val_10bit | channel);

  SPI.beginTransaction(spisettings);

  SPI.transfer16(message);

  digitalWrite(LD, HIGH);
  for (volatile int i = 0; i < 10; i++) {}
  digitalWrite(LD, LOW);

  SPI.endTransaction();
}

I'm using a raspberry Pi Pico, so my SPI speed might not work on slower devices.
This device with this code seems to be extremely sensitive to SPI signal noise. I'm trying to figure out how to improve it, in software and in hardware.

Have fun!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.