warpigs330
Active member
I am working with the MCP 4728. I am using it to output control voltage for a modular synth. I am using the adafruit library to interface with it. I am basically making an LFO and am running into an issue. when I control volume with the dac I get some zipper noise when the signal moves fast. I am assuming this is based on rate at which I write to the dac, and I noticed that my code ran like 10 times faster when not writing to the dac. I built a very basic test script which times how long it takes to loop 1000 times, each loop writing to the dac. The fastest I can get it to go is ~ 1000 writes per second. Ideally I could output smooth waveforms up into audio rate. What is it about writing to i2c that slows everything down? Should I get a different dac that communicates with a different protocol?
Here is my test script.
Here is my test script.
Code:
// Basic demo for configuring the MCP4728 4-Channel 12-bit I2C DAC
#include <Adafruit_MCP4728.h>
#include <Wire.h>
Adafruit_MCP4728 mcp;
int counter = 0;
bool re = false;
void setup(void) {
Serial.begin(115200);
Serial.println("Adafruit MCP4728 test!");
// Try to initialize!
if (!mcp.begin()) {
Serial.println("Failed to find MCP4728 chip");
while (1) {
delay(10);
}
}
}
void loop() {
if(counter > 1000 && !re){
Serial.println(float(millis())/100);
re = true;
}
counter++;
mcp.fastWrite(1000,1000,1000,1000);
}