This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Playing a wav file with PWM via ALSA



Dear TI E2E Community,

I am using ti sdk 7 on beaglebone black, I need to play a song with PWM using ecap2_in_pwm2_out, I have verified the basic functionality of this pin using sysfs entries by changing the period & dutycycle

Finally I need to use ALSA to directly interact with this driver and output sound using these PWM pins.

Could you please kindly do the needful, how this can be achieved in ti sdk 7, as am new to this dts concept & previously worked on board files,  could you please help me out, how existing pwm driver in ti sdk 7 can be modified inorder to play a song using ALSA with PWM

As am new to ti sdk & BSPs, could you please kindly do the needful as early as possible how this can be done with the existing pwm driver in sdk 7

Awaiting for your replies

Many Thanks in advance

  • Hi Srini,

    To use ecap2_in_pwm2_out you have to initialize MCASP0_ACLKR.ecap2_in_pwm2_out or UART0_RXD.ecap2_in_pwm2_out in ecap2_in_pwm2_out mode4/3 to ecap2_in_pwm2_out. This you can make in one of the xxx.dts files (<>/linux-3.12.10-ti2013.12.01/arch/arm/boot/dts/am335x-boneblack.dts, <>/linux-3.12.10-ti2013.12.01/arch/arm/boot/dts/am335x-bone-common.dtsi). Also you can see the <>/linux-3.12.10-ti2013.12.01/arch/arm/boot/dts/am33xx.dtsi file. If you use other driver than sdk 7 audio driver you have to write it. Please could you read:
    processors.wiki.ti.com/index.php/AM335x_Audio_Driver's_Guide

    In paragraph Amixer_commands you can see what you have to write from the console to initialize audio output. I did it and with:
    #aplay xxx.wav I hear the sound.

    BR
    Ivan
  • Hi Srini,

    Also see the:
    e2e.ti.com/.../313430
    Can be help

    BR
    Ivan
  • Dear Ivan,

    I am again involved in this activity ie., ALSA to communicate with the PWM driver and output sound from the PWM output pins instead of using MCASP controller ,

    I need to generate sound using PWM output pins, ecap2_in_pwm2_out

    Could you please confirm whether the below link can be used as reference & moreover the below link is based on boardfiles & it is old linux kernel
    or
    if not, could you please suggest any other links related to beaglebone black for ti sdk 7, if you have any inorder to get ALSA to communicate with the PWM driver and output sound from the PWM output pins

    elinux.org/.../Pulse_Width_Modulation

    Kindly do the needful in supporting me w.r.t this activity

    Kindly do the needful as early as possible,

    Awaiting for your replies

    Many Thanks in advance Ivan,
  • Hi Srini,

    Yes this link you can use as reference, but you have to know that mention kernel is rather old. I'm looking for in the forum for the similar issue, but unsuccess. The closest is:
    e2e.ti.com/.../366635
    there they try to mаnage leds with PWM. Please see it and:
    Documentation/devicetree/bindings/pwm/pwm.txt

    BR
    Ivan