I am using the flexPWM module of MKV561M0VLL24. I am configuring my controller with the following setting but it is not working
Note: The code is for generating a single PWM on PWM0_A2.
PWM0->OUTEN = PWM_OUTEN_PWMA_EN((1 << 2));
PWM0->SM[2].CTRL = PWM_CTRL_LDFQ(0) |
PWM_CTRL_HALF(0) |
PWM_CTRL_FULL(1) |
PWM_CTRL_PRSC(5) |
PWM_CTRL_LDMOD(1);
PWM0->SM[2].CTRL2 = PWM_CTRL2_INDEP_MASK |
PWM_CTRL2_PWM23_INIT(0) |
PWM_CTRL2_INIT_SEL(0) |
PWM_CTRL2_FRCEN(0) |
PWM_CTRL2_FORCE(0) |
PWM_CTRL2_FORCE_SEL(0) |
PWM_CTRL2_CLK_SEL(0);
PWM0->SM[2].INIT = 0;
PWM0->SM[2].VAL1 = 1999;
PWM0->SM[2].VAL0 = 999;
PWM0->SM[2].VAL2 = 0;
PWM0->SM[2].VAL3 = 599;
PWM0->MCTRL = PWM_MCTRL_LDOK((1 << 2));
PWM0->MCTRL |= PWM_MCTRL_RUN((1 << 2));
The CNT register of this channel appears to be going beyond the VAL1 limit (which shouldn't happen if values are correctly loaded) and no PWM is generated. Kindly help