Shaojun Wang

Enable MX25 PWM to output PCM data -blog archive

Discussion created by Shaojun Wang Employee on May 22, 2012

    Some customer want to use PWM module to output PCM data by connecting a low-pass filter to the PWMO pin.

    This doc provide patch and test code to enable the feature, low-pass filter conection and PCM->PWM conversion are not included.

    Since mx25 PWM clock source is 66.5MHz ipg_clk, if PCM sample rate is 11.025KHz, the PWM Period Register is set to 66.5M / 11.025K = 6031.

    The range of all the PWM data that written to PWM Sample Register are limited to 0 ~ 6032.

    0002-enable-mx25-pwm4.patch is kernel patch based on 0912 BSP, it create a char device node for PWM4. By default, FIFO empty interrupt mode is enabled, the FIFO water mark level is set 2, so during the writting, if data level in FIFO is less than 2, a FIFO Empty Interrupt would be triggerred. None Interrupt mode is also supported by comment "#define ENABLE_PWM_INTR".

    pwm_audio.c is user space test code, it configure the period of PWM4, create triangular wave data whose value is less than PWM Period Register value and send the data to PWM Sample Register.

    From R197 in cpu board, we can measure the pwm4 waveform.

Original Attachment has been moved to:

Original Attachment has been moved to: