Skip to content

Timer interrupt is not working(esp32) #84339

Closed Answered by aslansq
aslansq asked this question in General
Discussion options

You must be logged in to vote

solution

#include "pcr_struct.h"
#include "pcr_reg.h"
#include "timer_group_struct.h"
#include "timer_group_reg.h"
#include "periph_defs.h"
#include <zephyr/devicetree.h>
static volatile uint32_t global_var = 0;

void timer1_setup(void) {
	REG_SET_BIT(PCR_TIMERGROUP1_CONF_REG, PCR_TG1_CLK_EN_M);
	REG_CLR_BIT(PCR_TIMERGROUP1_CONF_REG, PCR_TG1_RST_EN_M);
	printk("pcr cfg %u\n", REG_READ(PCR_TIMERGROUP1_CONF_REG));
	REG_SET_BIT(PCR_TIMERGROUP1_TIMER_CLK_CONF_REG, PCR_TG1_TIMER_CLK_EN_M);
	REG_SET_BIT(PCR_TIMERGROUP1_TIMER_CLK_CONF_REG, (1<<PCR_TG1_TIMER_CLK_SEL_S));
	printk("pcr clk cfg %u\n", REG_READ(PCR_TIMERGROUP1_TIMER_CLK_CONF_REG));

	REG_WRITE(TIMG_T0CONFIG_REG(1), 0);
	REG_SET_BIT(T…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by aslansq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant