I am in the process of writing a bootlet for a custom board with an iMX283. I need a 10kHz PWM line to charge a voltage ladder but when I try to get it working, I only see one transition on the PWM line going from high to low.
It is if I don't have the XTAL oscillator gated through to the PWM circuitry.
Has any one successfully gotten PWM to work?
I did notice that the PWM_CLK24M was gated off by default so I gated that through but still don't seem to have a clock.
Here is a code snipet of my fuction that sets up the PWM channel. along with
#define BACKLIGHT_POWER MX28_PAD_PWM4__PWM_4
mxs_iomux_setup_pad(BACKLIGHT_POWER | MXS_PAD_12MA | MXS_PAD_3V3 );
printf("\r\nHW_CLKCTRL_XTAL = %X\r\n",HW_CLKCTRL_XTAL_RD());
printf("\r\nMUXSEL7 = %X\n\r",HW_PINCTRL_MUXSEL7_RD());
// we need to setup the PWM channel
// for 10kHz pulses to charge the
// voltage tripler
BW_PWM_CTRL_SFTRST(0);
BW_PWM_CTRL_CLKGATE(0);
HW_PWM_ACTIVEn_SET(4,0x000004b0); //1200 ticks for 50% duty cycle
HW_PWM_PERIODn_SET(4,0x000b095e); // 2400-1 ticks for period
BW_PWM_CTRL_PWM4_ENABLE(1);
delay(1000);
printf("\r\nACTIVE = %X\r\n",HW_PWM_ACTIVEn_RD(4));
printf("PERIOD = %X\r\n",HW_PWM_PERIODn_RD(4));
printf("PWM_CTRL = %X\r\n",HW_PWM_CTRL_RD());
Here is the output of the above code:
HW_CLKCTRL_XTAL = 00000001
MUXSEL7 = 33FFFF3A
ACTIVE = 000004B0
PERIOD = 000B095E
PWM_CTRL = 3FC00010
Any help would be appreciated. Thanks in advance.
BW_PWM_CTRL_PWM4_ENABLE(0); just after the BW_PWM_CTRL_CLKGATE(0): line. I don't know why but it now works.