adafruit/Adafruit_MCP4725

Synchronous messages with two boards

mitchpitch opened this issue · 1 comments

I've got two MCP4725 for driving the x and y axes of a laser galvo. During the resulting motion one axis is drifting.
The result looks like this:
galvo_02
(It seems that first the x axis is moved and after that the y axis)

I am initializing the two boards this way:

Adafruit_MCP4725 dac0;
Adafruit_MCP4725 dac1;

#define DAC_RESOLUTION    (8)
#define TWI_FREQ 400000L

dac0.begin(0x62);
dac1.begin(0x63);
TWBR = 12; // 400 khz

And i am setting the values in loop()

dac1.setVoltage(yyy, false);
dac0.setVoltage(xxx, false);

You need a dual/quad DAC with concurrent updates. I2C takes time :)