I try to configure the eFlexPWM on a #i.MXRT166 to generate a simple PWM to control LCD-backlight via the K3 pin in my application. I use PWM3.Submodule 1 and have set up the standalone config tool (Ver15) to route A,1 to the K3 pin and set the pin to ouput.
Still I have no PWM signal on the K3 pin?
So then I checked that the PWM was running by setting up interrupts on VAL2 and VAL3 and then set the K3 pin manually via GPIO2.12 from the ISR. Then I have PWM on K3.
But I want to offload the MCU and route the signal directly from PWM3.SM1.A to K3.
When stepping through the generated init-code I saw that the OUTEN bit was not configured and initialized by the config tool, so I try to call add PWM_OutputEnable(PWM3_PERIPHERAL, kPWM_PwmA, kPWM_Module_1) manually. But still no PWM.
Any idea what I have missed out?
Regards
Lars Magne
I have played with the "Output active level" to verify that the mapping between PWM3,A,1 and the K3 pin is ok. What I see is that the K3 pin switch to the opposite level than the Output active level setting. So the pin is set to the inactive level.
I have also verified that if I reconfigure the K3 pin to GPIO2-12 and set the pin on interrupt compare on VAL2 and clear the pin on VAL3 the the output follow the duty-cycle from the PWM.
So now I just need the "magic setting" to make the K3 pin follow the PWM3,A,1 without help from an interrupt....
Anyone that knows how?
Hi,
Thank you so much for your interest in our products and for using our community.
Assuming that you are taking about the RT1166, I recommend you to take as reference the SDK example evkmimxrt1160_pwm_cm7, which shows how to configure multiples PWM signals from different submodules of PWM1. You just need to try with the PWM3.
Hope it helps you.
Have a nice day!
just a small correction to a typo in my previous message: It is still K3 (GPIO_EMC_B2_02) and not K4 pin that I try to map to the output of sub-module 1 channel A in PWM 3.
I have tried both with peripheral configuration in MCUEXpresso config tool and with example code from NXP, but with the same result.
It must be a small but important detail I have missed out!?