esp32 硬件定时器计数器设置向下计数,会无限重启是怎么回事?

hello_galaxy
Posts: 10
Joined: Mon Jul 19, 2021 12:20 pm

esp32 硬件定时器计数器设置向下计数,会无限重启是怎么回事?

Postby hello_galaxy » Sat Dec 17, 2022 9:13 am

环境是esp-idf v4.4.3,用的是官方的timer_group例程
修改如下
  1. timer_config_t config = {
  2.         .divider = TIMER_DIVIDER,
  3.         .counter_dir = TIMER_COUNT_DOWN,
  4.         .counter_en = TIMER_PAUSE,
  5.         .alarm_en = TIMER_ALARM_EN,
  6.         .auto_reload = auto_reload,
  7.     }; // default clock source is APB
  8.     timer_init(group, timer, &config);
  9. ...
  10.  timer_set_counter_value(group, timer, timer_interval_sec * TIMER_SCALE);

Who is online

Users browsing this forum: No registered users and 161 guests