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?
Controlling external DACs
-
- Posts: 9764
- Joined: Thu Nov 26, 2015 4:08 am
Re: Controlling external DACs
There are very few functions you can use inside an ISR. Your best bet is to let the ISR set a semaphore (or equivalent inter-task communication mechanism) and let a task wait on that semaphore, then send the I2C command.
Who is online
Users browsing this forum: No registered users and 142 guests