About PWM duty control in i.MX6DQ.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

About PWM duty control in i.MX6DQ.

Jump to solution
696 Views
keitanagashima
Senior Contributor I

Dear All,

Hello.

We would like to generate the PWM waveform with square pulse (400kHz & duty 50%).

[NG case]

- Duty has broken by using Interrupt FIFO Empty  .

- Because the 5 [usec] delay occurs by the processing of  interrupt FIFO Empty.

[OK case]

- Don't use the Interrupt sample FIFO empty (FIE)

- PWM output controls on/off by switching EN bit in PWMCR.

[Question]

Is my below understanding right?

When output the fixed frequency & constant duty waveform, to continue to write data in FIFO(PWMSAR) isn't necessary.

One should control simply ON/OFF by the EN bit of PWMCR.

[Other information (Our steps)]

1. Writes sample data to PWSAR register four times.

2. Doesn't write it to PWSAR register in the FIFO Empty interrupt handler.

3. Write 0x78 to PWMSR.

4. Write the optimal data to PWMPR for 400KHz

5. Write 0x01 to PWMIR.

--> we got the intended output waveform (400kHz & duty 50%)

Best Regards,

Keita

Labels (3)
0 Kudos
1 Solution
439 Views
Yuri
NXP Employee
NXP Employee

Hello,

Yes, Your understanding is right :

When output the fixed frequency & constant duty waveform, to continue to write
data in FIFO(PWMSAR) isn't necessary. One can control ON/OFF by the EN bit of

PWMCR. "Users can also disable/enable the PWM if PWM would like to be stopped
and resumed with same registers configurations".


Have a great day,
Yuri

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
2 Replies
439 Views
TomE
Specialist II

Yuri is correct. You don't have to keep writing to it.


The PWM part is designed mainly to generate an AUDIO output signal. A data stream of values (decoded from an Audio stream, or a simple WAVE file) is meant to e streamed into the FIFO. This changes the duty cycle, and an external hardware low-pass filter generates an audio waveform from the varying PWM. This is the same way the Macintosh Plus generated audio back in 1984.

But this PWM controller will glitch if you try to change the duty-cycle when it doesn't have samples in the FIFO. If you only want a 50% duty-cycle waveform that you turn on and off, then this won't affect you. if you want to change the duty-cycle from say 50% to 60% (and only write the new value when it changes) it will glitch badly every now and then.

Here's the details on that problem and how to work around it:

https://community.freescale.com/thread/356855

Tom

440 Views
Yuri
NXP Employee
NXP Employee

Hello,

Yes, Your understanding is right :

When output the fixed frequency & constant duty waveform, to continue to write
data in FIFO(PWMSAR) isn't necessary. One can control ON/OFF by the EN bit of

PWMCR. "Users can also disable/enable the PWM if PWM would like to be stopped
and resumed with same registers configurations".


Have a great day,
Yuri

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos