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.

Enable PCM audio path on wl1831 with Bluez5 and PulseAudio6

Other Parts Discussed in Thread: WL1831

Hi all.


I am working on a custom board based on Freescale iMX6 and Wl1831 to realize an audio streaming application. Host processor is connect to bluetooth chip via UART HCI and also uses PCM lines to connect to wl1831 codec as suggested by TI hardware guide. The problem is that wl1831 PCM is not moving any clock/FSync line. I would like to stream audio from host processor to wl1831 using PCM interface.


My setup is the following:

- bluez 5.31

- pulseaudio 6.0

- ti wl18xx driver and firmware 8.5R, TIInit_11.8.32.bts file

- kernel 3.0.35, with alsa support and bt-sco audio codec

With such setup, I am able to pair and connect to heasets or any mobile phone with HFP/HSP. So I think Bluetooth stack is ok, firmware file is fine and driver is working ok.

After connection to such devices with A2DP profile, when I try to play a sample file via paplay, the command stucks, as if the output is not produced waiting for something. Indeed, I checked with oscilloscope that wl1831 codec is not moving clock line, which is needed by bt-sco card codec driver to send PCM samples, since host processor is configured in PCM slave mode.

* Question: can you please confirm that wl1831 is configured as PCM master by default?

I think it is, because if I enable loopback mode and see clock generate, but when I disable loopback mode it stops. So I need your confirmation.

* Question: why wl1831 is not generating clock during bluetooth connection to headsets? Can you confirm that PCM audio path is enabled by default?

Thanks for help.

  • Hi,

    For A2DP, the audio data is over HCI - so you won't see any activity on the PCM lines.

    For HFP audio, please see: processors.wiki.ti.com/.../CC256x_VS_HCI_Commands (I know this is for CC256x, but the command holds good for WiLink8 as well).

    You need to send this command to the device to use the PCM interface.

    Regards,
    Gigi Joseph.
  • Hi Gigi.

    Thank you for prompt reply. I have some questions:

    * Can you please describe difference between A2DP and HFP, shortly? I thought they are the same, used for headsets.
    * About A2DP, is it possible to use PCM lines, somehow?
    * About HFP and HCI_VS_Write_CODEC_Config command:
    ** do you confirm that without this command PCM is silent, while giving it PCM becomes master active?
    ** how can I read current configuration?
    ** which values do you suggest for typical application?


    Sorry for all these questions, but this part is not well documented on TI wiki.
  • Hi Gigi.


    One more information: if headset only provides HFP/HSP profiles, I able not able to connect to it. I hope it helps you understanding my problem.

    Waiting for your kind reply about my previous post.


    Thank you,

    Federico

  • Hi Federico,

    * Yes, both are used for Headsets. A2DP is used for media streaming and HFP is used for call audio
    * There is an option, it is called Assisted A2DP (A3DP - TI specific). But I'm not sure if the device supports it. Let me check on this and get back. But in this case, stack modification will be required
    * Yes, depending on "Clock direction" parameter in the command, the device will be master/slave.
    * I don't think there is an option to "Read" - the stack is writing it in the first place.
    * It depends on your PCM interface. Clock rate?Fsync? etc.

    Regards,
    Gigi Joseph.
  • Hi Gigi.


    Since A2DP is already on HCI, I wonder if it is possible to have HSP/HFP on HCI too. This would avoid the problem of configuring PCM interface. So, is it possible to avoid PCM interface for headsets and use HCI instead?

    Regards,

    Federico

  • Hi Federico,

    Its possible, but why wouldn't you want to work with the PCM interface?

    In order to activate voice over HCI interface, you will need to add this command to the init script (you can either add it to your init code).

    Send_HCI_VS_Write_SCO_Configuration 0xFE10, 0x01, 120, 511, 0xFF
    Wait_HCI_Command_Complete_VS_Write_SCO_Configuration_Event 5000, any, HCI_VS_Write_SCO_Configuration, 0x00, 100, 0x0

    Other that, we require Host flow Control to be active in this mode.

    Send_HCI_Write_SCO_Flow_Control_Enable 1
    Wait_HCI_Command_Complete_Write_SCO_Flow_Control_Enable_Event 5000, any, HCI_Write_SCO_Flow_Control_Enable, 0x00

    Regards,
    Gigi Joseph.
  • Hi Gigi.

    I am facing issues with PCM, I am not able to make it work. I managed to connect to headphones after I installed ofono, but even if ofono is running and I sent the HCI command you gave me last time to program SCO codec, PCM clock lines do not move during playback.

    So, my idea is: since A2DP is already over HCI, why not using HCI also for HFP? Moreover, from sw architecture, it is better to have just 1 sink instead of 2.

    I am going to try your latest commands and let you know.

    Thank you for kind support.

    Regards,

    Federico

  • One question about your last command Flow_Control_Enable: I cannot find it in processors.wiki.ti.com/index.php,, where is it?
  • Hi,

    The parameter description is as below:

    0 - no flow control, 1 - Num Packets Completed event should include SCO information

    Regards,
    Gigi Joseph.
  • Can you please give me OCF and OGF of Enable_Flow_Control command? I am using hcitool to send commands and I cannot find the values for these field in your documentation.

    Thank you,

    Federico

  • Hi Gigi.


    Using first command 0xFE10, I managed to connect to headset and transmit audio data through SCO HCI with success! So thank you for your help.

    The problem now is that audio is really distorted: I can understand words easily, but they are pronounced too slowly and with deep voice. Question: is there any audio configuration in wl18xx for sco audio data?

    Regards,

    Federico

  • Hi Federico,

    Sorry - the "Send_HCI_Write_SCO_Flow_Control_Enable " command has opcode: 0x0c2f

    Regards,
    Gigi Joseph.