cancel
Showing results for 
Search instead for 
Did you mean: 

Bluetooth SDK

AlGo_4347736
New Contributor II

Hello!

I use an example from the AG library and I can't connect a wide-band headset to my application.

Narrow band headsets work fine - there is audio.

But when I connect the wideband - there is no audio.

Would you like to see if I am using the wrong settings? Or the chip simply does not support the wideband?

/*

* Create SCO connection as an originator or an acceptor

*/

void hfp_ag_sco_create( hfp_ag_session_cb_t *p_scb, BOOLEAN is_orig )

{

    //wiced_bt_dev_status_t   status;

    wiced_bt_sco_params_t   params = hf_control_esco_params;

    /* remove listening SCO */

    if ( p_scb->sco_idx != BTM_INVALID_SCO_INDEX )

        wiced_bt_sco_remove( p_scb->sco_idx );

    /* Attempt to use eSCO if remote host supports HFP >= 1.5 */

    if ( is_orig )

    {

        if (p_scb->retry_with_sco_only)

        {

            p_scb->retry_with_sco_only = WICED_FALSE;

            params.packet_types        = BTM_SCO_LINK_ONLY_MASK;

        }

        else

        {

#if (BTM_WBS_INCLUDED == TRUE)

            if ( p_scb->peer_supports_msbc && !p_scb->msbc_selected )

            {

                /* Send +BCS to the peer and start a 3-second timer waiting for AT+BCS */

                hfp_ag_send_BCS_to_hf (p_scb);

                wiced_start_timer (&p_scb->cn_timer, 3);

                return;

            }

            /* If WBS is negotiated, override the necessary defaults */

            if ( p_scb->msbc_selected )

            {

                params.use_wbs        = WICED_TRUE;

                params.max_latency    = 13;

                params.retrans_effort = BTM_ESCO_RETRANS_QUALITY;

                params.packet_types   = ( BTM_SCO_PKT_TYPES_MASK_EV3     |  /* EV3 + 2-EV3 */

                                        BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |

                                        BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |

                                        BTM_SCO_PKT_TYPES_MASK_NO_3_EV5 );

                BT_Trace(BT_RES_WICED_USE_WBS);

            }

            else

                BT_Trace(BT_RES_WICED_USE_NBS);

#endif

            /* Igf setup fails, fall back to regular SCO */

            p_scb->retry_with_sco_only = WICED_TRUE;

        }

        wiced_bt_sco_create_as_initiator( p_scb->hf_addr, &p_scb->sco_idx, &params );

    }

    else

    {

        p_scb->retry_with_sco_only = WICED_FALSE;

        wiced_bt_sco_create_as_acceptor( &p_scb->sco_idx );

    }

    WICED_BT_TRACE( "hfp_ag_sco_create  is_orig: %u   sco_idx: 0x%0x  status:0x%x retry_with_sco_only: %u\n",

                    is_orig, p_scb->sco_idx, status, p_scb->retry_with_sco_only );

}

0 Likes
5 Replies
AlGo_4347736
New Contributor II

A small clarification for the question:

Narrow band headsets work fine - PCM is sent off the chip.

But when I connect the wideband  - PCM is not sent off the chip.

0 Likes
SheetalJ
Moderator
Moderator

Hi AlGo_4347736​,

The clock settings for both narrow band and wide band are different. Please check PCM/I2S Clock setting in CYW20706  for details on the same.

0 Likes
AlGo_4347736
New Contributor II

Thanks! I saw this document.

"This is taken care by the WICED Stack. You just need to enable or disable WBS in the application project" - This is what was done.

I get here by the logs:

            if ( p_scb->msbc_selected )

            {

                params.use_wbs        = WICED_TRUE;

                params.max_latency    = 13;

                params.retrans_effort = BTM_ESCO_RETRANS_QUALITY;

                params.packet_types   = ( BTM_SCO_PKT_TYPES_MASK_EV3     |  /* EV3 + 2-EV3 */

                                        BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |

                                        BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |

                                        BTM_SCO_PKT_TYPES_MASK_NO_3_EV5 );

                BT_Trace(BT_RES_WICED_USE_WBS);

            }

Or do you have to change the frequency? How can I do this?

Setting pins:

   wiced_hal_gpio_select_function(WICED_P04, WICED_PCM_CLK_I2S_CLK);

   wiced_hal_gpio_select_function(WICED_P07, WICED_PCM_OUT_I2S_DO);

   wiced_hal_gpio_select_function(WICED_P10, WICED_PCM_IN_I2S_DI);

   wiced_hal_gpio_select_function(WICED_P06, WICED_PCM_SYNC_I2S_WS);

0 Likes
AlGo_4347736
New Contributor II

Configure the PCM like this:

wiced_hal_pcm_config_t pcmConfig;

memset(&pcmConfig, 0, sizeof(pcmConfig));

pcmConfig.mode = WICED_HAL_PCM_MODE;

pcmConfig.role = WICED_HAL_PCM_MASTER;

pcmConfig.pcm_param.fillData = WICED_HAL_PCM_FILL_0S;

pcmConfig.pcm_param.frame_type = WICED_HAL_PCM_FRAME_TYPE_SHORT;

pcmConfig.pcm_param.lsbFirst = WICED_HAL_PCM_MSB_FIRST;

pcmConfig.pcm_param.rightJustify = WICED_HAL_PCM_ENABLE_RIGHT_JUSTIFY;

wiced_hal_set_pcm_config (&pcmConfig);

0 Likes
AlGo_4347736
New Contributor II

BluetoothWidebandPcm.png

With the logic analyzer we have seen that the PCM bit-clock and frame-sync is generated as expected by the BT-chip also in wide-band. PCM samples are also transmitted from the codec to the BT-chip correctly. But for some reason the samples are coded and sent from the BT-chip to the headset. No pcm samples coming from the BT-chip can be seen on the bus. Probably something is missing in the PCM routing inside the BT-chip or codec negotiation with the headset.

0 Likes