Hardware timer
Posted: Sat Mar 18, 2017 10:59 pm
CPU freq is 240MHz. Timer configuration is like the one below. I check if timer_val (from timer_get_counter_value) is larger than 36621 (36621 * 0xffff = 2 399 957 235). I believed it was 10seconds, but it seems to take more than 31 secs; why?
Are some timers used by WiFi or interface's (I2C, SPI, SDIO) drivers?
Are some timers used by WiFi or interface's (I2C, SPI, SDIO) drivers?
Code: Select all
timer_config_t config;
config.alarm_en = TIMER_ALARM_DIS;
config.counter_en = TIMER_START;
config.intr_type = TIMER_INTR_LEVEL;
config.counter_dir = TIMER_COUNT_UP;
config.auto_reload = TIMER_AUTORELOAD_DIS;
config.divider = 0xffff;
timer_init(TIMER_GROUP_0, TIMER_0, &config);
timer_start(TIMER_GROUP_0, TIMER_0);
uint64_t timer_val;
timer_get_counter_value(TIMER_GROUP_0, TIMER_0, &timer_val);
if (timer_val > 36621) { // should be 10 but is more than 31 secs
...
}