mcpwm 定时器无tez或tep中断

suifan
Posts: 23
Joined: Mon Mar 09, 2020 10:59 am

mcpwm 定时器无tez或tep中断

Postby suifan » Tue Jun 15, 2021 9:20 am

ESP32-WROOM-32UE
comit: af8bc4c

/**
* @brief this is ISR handler function
*/
static void IRAM_ATTR isr_handler()
{
uint32_t mcpwm_intr_status;
mcpwm_intr_status = MCPWM[MCPWM_UNIT_0]->int_st.val; //Read interrupt status
tmp = mcpwm_intr_status;
MCPWM[MCPWM_UNIT_0]->int_clr.val = mcpwm_intr_status;
}

mcpwm_config_t pwm_config;
pwm_config.frequency = 5000; //frequency = 1000Hz, i.e. for every servo motor time period should be 1ms
pwm_config.cmpr_a = 50; //duty cycle of PWMxA = 0
pwm_config.cmpr_b = 50; //duty cycle of PWMxb = 0
pwm_config.counter_mode = MCPWM_UP_COUNTER;
pwm_config.duty_mode = MCPWM_DUTY_MODE_0;
mcpwm_init(MCPWM_UNIT_0, MCPWM_TIMER_0, &pwm_config); //Configure PWM0A & PWM0B with above settings
MCPWM[MCPWM_UNIT_0]->int_ena.timer0_tez_int_ena = 1;
MCPWM[MCPWM_UNIT_0]->int_ena.timer0_tep_int_ena = 1;
mcpwm_isr_register(MCPWM_UNIT_0, isr_handler, NULL, ESP_INTR_FLAG_IRAM, NULL); //Set ISR Handler
printf("TMR0TEZ intr status %d \n", tmp);

mcpwm_intr_status值一直为零,没有产生tez或tep中断。
Last edited by suifan on Wed Jun 16, 2021 6:26 am, edited 1 time in total.

suifan
Posts: 23
Joined: Mon Mar 09, 2020 10:59 am

Re: mcpwm 定时器无tez或tep中断

Postby suifan » Wed Jun 16, 2021 5:51 am

有没有mcpwm定时器中断的列子,给发一个参考下。
Last edited by suifan on Wed Jun 16, 2021 6:26 am, edited 1 time in total.

ESP_Eavo
Posts: 186
Joined: Tue Jun 08, 2021 6:23 am

Re: mcpwm 定时器无tez或tep中断

Postby ESP_Eavo » Wed Jun 16, 2021 6:26 am

您好。
可以参考下这边的示例:https://github.com/espressif/esp-idf/tr ... rals/mcpwm

suifan
Posts: 23
Joined: Mon Mar 09, 2020 10:59 am

Re: mcpwm 定时器无tez或tep中断

Postby suifan » Wed Jun 16, 2021 7:10 am

好的,感谢回复!

Who is online

Users browsing this forum: No registered users and 74 guests