What's the clock source of the timer group?
Posted: Fri Jun 24, 2022 5:18 am
I'm trying to get an accurate timer or counter for my project. Now I'm using ccount and ccompare as the timer, but find it has a periodical variation (0.75Hz), which should be caused by the voltage variation due to WiFi power consumption changing.
So I'm thinking if the timer group can use the external oscillator as the clock source, which should be more accurate than PLL clock. I checked the technical reference manual, according to the section on the Clock System and Peripheral Clock (as attached below), the clock source of the timer group can only be APB_CLK, which comes from CPU_CLK. CPU_CLK could be derived from the external oscillator, but with the external oscillator, the CPU frequency can only be < 40 MHz, which is too slow.
So it seems if I run ESP32 at 240 MHz, the clock source of the timer group has to be the internal PLL clock; If I want to use the external oscillator, the CPU frequency has to be < 40MHz. Is my understanding correct? If that's true, it's really a bad news to me. Is there any workaround to have both 240MHz CPU frequency and timer with the external oscillator? Or is it theoretically impossible since the 480M PLL clock can not synchronize with the 40M oscillator clock?
So I'm thinking if the timer group can use the external oscillator as the clock source, which should be more accurate than PLL clock. I checked the technical reference manual, according to the section on the Clock System and Peripheral Clock (as attached below), the clock source of the timer group can only be APB_CLK, which comes from CPU_CLK. CPU_CLK could be derived from the external oscillator, but with the external oscillator, the CPU frequency can only be < 40 MHz, which is too slow.
So it seems if I run ESP32 at 240 MHz, the clock source of the timer group has to be the internal PLL clock; If I want to use the external oscillator, the CPU frequency has to be < 40MHz. Is my understanding correct? If that's true, it's really a bad news to me. Is there any workaround to have both 240MHz CPU frequency and timer with the external oscillator? Or is it theoretically impossible since the 480M PLL clock can not synchronize with the 40M oscillator clock?