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中断。
mcpwm 定时器无tez或tep中断
mcpwm 定时器无tez或tep中断
Last edited by suifan on Wed Jun 16, 2021 6:26 am, edited 1 time in total.
Re: mcpwm 定时器无tez或tep中断
有没有mcpwm定时器中断的列子,给发一个参考下。
Last edited by suifan on Wed Jun 16, 2021 6:26 am, edited 1 time in total.
Who is online
Users browsing this forum: No registered users and 56 guests