Merge branch 'bugfix/mcpwm-deadtime-preset-config-backport_v4.0' into 'release/v4.0'

MCPWM/deadtime: fix and sync preset deadtime modes with well-known definition (backport v4.0)

See merge request espressif/esp-idf!14625
This commit is contained in:
Michael (XIAO Xufeng) 2021-09-03 04:46:28 +00:00
commit 2b077cedb1
2 changed files with 15 additions and 15 deletions

View File

@ -203,14 +203,14 @@ typedef enum {
* @brief MCPWM deadtime types, used to generate deadtime, RED refers to rising edge delay and FED refers to falling edge delay
*/
typedef enum {
MCPWM_BYPASS_RED = 0, /*!<MCPWMXA = no change, MCPWMXB = falling edge delay*/
MCPWM_BYPASS_FED, /*!<MCPWMXA = rising edge delay, MCPWMXB = no change*/
MCPWM_ACTIVE_HIGH_MODE, /*!<MCPWMXA = rising edge delay, MCPWMXB = falling edge delay*/
MCPWM_ACTIVE_LOW_MODE, /*!<MCPWMXA = compliment of rising edge delay, MCPWMXB = compliment of falling edge delay*/
MCPWM_ACTIVE_HIGH_COMPLIMENT_MODE, /*!<MCPWMXA = rising edge delay, MCPWMXB = compliment of falling edge delay*/
MCPWM_ACTIVE_LOW_COMPLIMENT_MODE, /*!<MCPWMXA = compliment of rising edge delay, MCPWMXB = falling edge delay*/
MCPWM_ACTIVE_RED_FED_FROM_PWMXA, /*!<MCPWMXA = MCPWMXB = rising edge delay as well as falling edge delay, generated from MCPWMXA*/
MCPWM_ACTIVE_RED_FED_FROM_PWMXB, /*!<MCPWMXA = MCPWMXB = rising edge delay as well as falling edge delay, generated from MCPWMXB*/
MCPWM_BYPASS_RED = 0, /*!<MCPWMXA Out = MCPWMXA In with no delay, MCPWMXB Out = MCPWMXA In with falling edge delay*/
MCPWM_BYPASS_FED, /*!<MCPWMXA Out = MCPWMXA In with rising edge delay, MCPWMXB Out = MCPWMXB In with no delay*/
MCPWM_ACTIVE_HIGH_MODE, /*!<MCPWMXA Out = MCPWMXA In with rising edge delay, MCPWMXB Out = MCPWMXA In with falling edge delay*/
MCPWM_ACTIVE_LOW_MODE, /*!<MCPWMXA Out = MCPWMXA In with compliment of rising edge delay, MCPWMXB Out = MCPWMXA In with compliment of falling edge delay*/
MCPWM_ACTIVE_HIGH_COMPLIMENT_MODE, /*!<MCPWMXA Out = MCPWMXA In with rising edge delay, MCPWMXB = MCPWMXA In with compliment of falling edge delay*/
MCPWM_ACTIVE_LOW_COMPLIMENT_MODE, /*!<MCPWMXA Out = MCPWMXA In with compliment of rising edge delay, MCPWMXB Out = MCPWMXA In with falling edge delay*/
MCPWM_ACTIVE_RED_FED_FROM_PWMXA, /*!<MCPWMXA Out = MCPWMXB Out = MCPWMXA In with rising edge delay as well as falling edge delay*/
MCPWM_ACTIVE_RED_FED_FROM_PWMXB, /*!<MCPWMXA Out = MCPWMXB Out = MCPWMXB In with rising edge delay as well as falling edge delay*/
MCPWM_DEADTIME_TYPE_MAX,
} mcpwm_deadtime_type_t;

View File

@ -459,7 +459,7 @@ esp_err_t mcpwm_deadtime_enable(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num,
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.red_outinvert = 0; //S2
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.fed_outinvert = 0; //S3
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.red_insel = 0; //S4
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.fed_insel = 1; //S5
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.fed_insel = 0; //S5
break;
case MCPWM_BYPASS_FED:
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.b_outbypass = 1; //S0
@ -475,7 +475,7 @@ esp_err_t mcpwm_deadtime_enable(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num,
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.red_outinvert = 0; //S2
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.fed_outinvert = 0; //S3
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.red_insel = 0; //S4
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.fed_insel = 1; //S5
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.fed_insel = 0; //S5
break;
case MCPWM_ACTIVE_LOW_MODE:
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.b_outbypass = 0; //S0
@ -483,7 +483,7 @@ esp_err_t mcpwm_deadtime_enable(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num,
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.red_outinvert = 1; //S2
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.fed_outinvert = 1; //S3
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.red_insel = 0; //S4
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.fed_insel = 1; //S5
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.fed_insel = 0; //S5
break;
case MCPWM_ACTIVE_HIGH_COMPLIMENT_MODE:
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.b_outbypass = 0; //S0
@ -491,20 +491,20 @@ esp_err_t mcpwm_deadtime_enable(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num,
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.red_outinvert = 0; //S2
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.fed_outinvert = 1; //S3
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.red_insel = 0; //S4
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.fed_insel = 1; //S5
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.fed_insel = 0; //S5
break;
case MCPWM_ACTIVE_LOW_COMPLIMENT_MODE:
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.b_outbypass = 0; //S0
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.a_outbypass = 0; //S1
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.red_outinvert = 1; //S2
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.fed_outinvert = 0; //S3
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.red_insel = 1; //S4
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.red_insel = 0; //S4
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.fed_insel = 0; //S5
break;
case MCPWM_ACTIVE_RED_FED_FROM_PWMXA:
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.b_outbypass = 0; //S0
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.fed_outinvert = 0; //S3
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.red_insel = 1; //S4
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.red_insel = 0; //S4
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.a_outswap = 1; //S6
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.b_outswap = 0; //S7
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.deb_mode = 1; //S8
@ -512,7 +512,7 @@ esp_err_t mcpwm_deadtime_enable(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num,
case MCPWM_ACTIVE_RED_FED_FROM_PWMXB:
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.b_outbypass = 0; //S0
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.fed_outinvert = 0; //S3
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.red_insel = 0; //S4
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.red_insel = 1; //S4
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.a_outswap = 1; //S6
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.b_outswap = 0; //S7
MCPWM[mcpwm_num]->channel[timer_num].db_cfg.deb_mode = 1; //S8