MCU: ESP32C3
Board: ESP32C3 Dev Module
Arduion: 2.3.2
Using an I2C DAC MCP4725 with timer, can't begin the timer. Seperately using the DAC or timer is OK. Maybe the timer0 is conflicted with I2C. But I can't specify the timer with the new timer API.
Only one parameter in the new timerbegin API:
timerBegin
This function is used to configure the timer. After successful setup the timer will automatically start.
hw_timer_t * timerBegin(uint32_t frequency);
frequency select timer frequency in Hz. Sets how quickly the timer counter is “ticking”.
This function will return timer structure if configuration is successful. If NULL is returned, error occurs and the timer was not configured.
I moved your topic to a more appropriate forum category @franklinhahaha6666.
The Nano ESP32 category you chose is only used for discussions directly related to the Arduino Nano ESP32 board.
In the future, please take the time to pick the forum category that best suits the subject of your question. There is an "About the _____ category" topic at the top of each category that explains its purpose.
Hi
I need timer driving interrupt for more precise timing control
The code can be compiled correctly, but the timer can't be initialized after the init of I2C
First, I'm going to guess that the problem isn't a hardware conflict but attempting to do I2C I/O inside an ISR.
Second, your timer interval is 50,000 microseconds. There are several ways you can achieve that period on an EPS32 without using timer interrupts.
Third, have you established that you can performed the desired MCP4725 operations at a rate of 20/second (given the speed that you're running the I2C Bus, the size of the data being transferred over the bus, and the MCP4725's conversion speed / latency)?