Skip to content

Commit 4915338

Browse files
fdcavalcantixiaoxiang781216
authored andcommitted
xtensa/esp32s2: fix for timers and watchdog init on startup
1 parent 2e884cb commit 4915338

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

arch/xtensa/src/esp32s2/esp32s2_tim.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
#include "hardware/esp32s2_systimer.h"
4040
#include "hardware/esp32s2_tim.h"
4141

42+
#include "soc/periph_defs.h"
43+
#include "esp_private/periph_ctrl.h"
44+
4245
/****************************************************************************
4346
* Pre-processor Definitions
4447
****************************************************************************/
@@ -1254,6 +1257,15 @@ struct esp32s2_tim_dev_s *esp32s2_tim_init(int timer)
12541257
#endif
12551258
}
12561259

1260+
if (tim->gid == GROUP0)
1261+
{
1262+
periph_module_enable(PERIPH_TIMG0_MODULE);
1263+
}
1264+
else
1265+
{
1266+
periph_module_enable(PERIPH_TIMG1_MODULE);
1267+
}
1268+
12571269
/* Verify if it is in use */
12581270

12591271
if (tim->inuse == false)

arch/xtensa/src/esp32s2/esp32s2_wdt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
#include "hardware/esp32s2_rtccntl.h"
3939
#include "hardware/esp32s2_tim.h"
4040

41+
#include "soc/periph_defs.h"
42+
#include "esp_private/periph_ctrl.h"
43+
4144
/****************************************************************************
4245
* Pre-processor Definitions
4346
****************************************************************************/
@@ -1042,6 +1045,7 @@ struct esp32s2_wdt_dev_s *esp32s2_wdt_init(enum esp32s2_wdt_inst_e wdt_id)
10421045
}
10431046
else
10441047
{
1048+
periph_module_enable(PERIPH_TIMG1_MODULE);
10451049
wdt->inuse = true;
10461050
}
10471051

0 commit comments

Comments
 (0)