AnsweredAssumed Answered

PWM for MX2

Question asked by Tai Nguyen on Nov 26, 2013
Latest reply on Dec 12, 2013 by jamesbone

Hello,

 

I am trying to turn on the pwm0 channel in u-boot. I follow the following articles but with limited success.

https://community.freescale.com/message/273292#273292

 

I am having the same problem as Stefan here https://community.freescale.com/thread/295562

 

Basically this is what I did:

 

1) Clear bit 29 to turn off the PWM_CLK24M_GATE.

2) Clear the last bit f the HW_PINCTRL_MUXSEL7 BANK3_PIN16 to drive PWM0.

3) Clear SFTRST and CLKGATE by clearing bits 31 and 30 of the HW_PWM_CTRL.

4) Enable PWM0 by setting bit 0 of the HW_PWM_CTRL.

5) Follow the example thread to sett the ACTIVE0 DC to 0x4B0 or 1200 tick, to make 50% DC.

6) Follow the example thread to sett the PERIOD0 to 0xB095E for 23999 or 1 period for the 24MHz clock.

 

I have a Piezo hooked up the PWM0. Stefan seems to have the same issue. His post is old so I didn't if it is proper to resurrect it. Does anyone have the same problem? Does anyone know the proper sequence to do this?

 

Here are the values of the registers when running:

 

HW_CLKCTRL_XTAL:         0x1

HW_PINCTRL_MUXSEL7: 0x3FFFFF3A

HW_PWM_CTRL:                0x3FC00001

ACTIVE0:                               0x4B0

PERIOD0:                              0xB095E

 

 

thanks,

Tai

Outcomes