Controlling external DACs
Posted: Tue Jun 12, 2018 1:55 pm
Hi! I'm experimenting with MCP4725 DACs over I2C. I want to use them to emit arbitrary waveforms synthesised in software.
My idea is to calculate and send the samples one by one over I2C to the DAC. I verified that the DAC is working and looks like it's playing well with https://github.com/Molorius/esp32-mcp4725.
I tried using timers (driver/timer.h) to get a stable sample frequency (like 22kHz) but whenever I call say mcp4725_set_voltage (which basically sends an I2C command) inside timer ISR the CPU resets.
What is the best way to achieve stable timing while still being able to use I2C etc. on ESP32?
My idea is to calculate and send the samples one by one over I2C to the DAC. I verified that the DAC is working and looks like it's playing well with https://github.com/Molorius/esp32-mcp4725.
I tried using timers (driver/timer.h) to get a stable sample frequency (like 22kHz) but whenever I call say mcp4725_set_voltage (which basically sends an I2C command) inside timer ISR the CPU resets.
What is the best way to achieve stable timing while still being able to use I2C etc. on ESP32?