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.

CC2564C: Using PLC (packet loss concealment) for NBS

Part Number: CC2564C

Hi to all

According to datasheet, cc2564c can use PLC for both WBS (16K) and NBS (8K).

PLC work for WBS correctly but when I try to change PCM clock from 8K to 16K on MCU side and also config cc2564c by "HCI_VS_Write_CODEC_Config (0xFD06)", sample rate conversion not work correctly and audio speed increased wrongly. I can't find example for this option. any body can help me how using PLC for NBS?

Thanks

  • Hi Li,

    You mention that PLC works for WBS correctly but that the sample rate and audio speed are incorrect at 16 kHz PCM clock. Do you mean that PLC works correctly for NBS (8 kHz)? 

    Can you take firmware logs to see if you are able to view messages like "PLC initialize"?

    Thanks,
    Jacob

  • Jacob,

    For clarify my first post

    case 1- WBS, 16 K PCM, audio speed is OK, PLC (AVPR) working on packet loss

    case 2 - NBS, 8 K PCM, audio speed is OK, PLC (AVPR) NOT working on packet loss

    case 3 -  NBS, 16 K PCM, audio speed is increased, PLC (AVPR) NOT working on packet loss

    According to cc2564c datasheet, "PLC support added for NBS (8 kHz) when working at 16-kHz PCM clock" but i can't active PLC for NBS by changing MCU PCM clock and config AVPR using "HCI_VS_Write_CODEC_Config (0xFD06)" command 

    I can't find example or document about this feature 

    thanks

  • Hi Li,

    We do not offer documentation on this feature. Are you able to share firmware and HCI logs so that we can see if PLC is initialized for NBS?

    Best,
    Jacob 

  • Hi Jacob

    Thanks but I check TX_DBG pin firmware log and seem PLC not initialized i try to follow M's method 

    https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/879289/cc2564c-phone-audio-pops-heard-from-headset/3301619#3301619

    but 16K bandwidth refused by phone. according to HFP spec 8K bandwidth is maximum for WBS and NBS (consider compression ratio)

    I continue testing. please let me know if you or Michael have suggestion

    Thanks

  • Hi Li,

    I'll respond here tomorrow.

    Thanks,
    Jacob

  • Hi Li,

    Can you let me know the steps you have tried to enable PLC on NBS so far? Are you using HCI_VS_WBS_Associate (0xFD78) for WBS?

    Thanks,
    Jacob

  • Hi Jacob,

    Thanks for your reply

    For NBS:

    1 - Set MCU PCM (master) config to 16K 

    2 - set voice and air coding setting: HCI_Write_Voice_Setting(BluetoothStackID, (HCI_VOICE_SETTING_INPUT_DATA_FORMAT_2_COMPLEMENT | HCI_VOICE_SETTING_INPUT_SAMPLE_SIZE_16_BIT | HCI_VOICE_SETTING_AIR_CODING_FORMAT_CVSD), &Status);

    3 - disable WBS by WBS_DISASSOCIATE_COMMAND (0xFD79)

    4 - CC2564c (slave) codec config to 16K by VS_WRITE_CODEC_CONFIG_COMMAND

    PLC not initialized and audio speed changed wrongly 

    For WBS:

    1 - Set MCU PCM (master) config to 16K 

    2 - set voice and air coding setting: HCI_Write_Voice_Setting(BluetoothStackID, (HCI_VOICE_SETTING_INPUT_DATA_FORMAT_2_COMPLEMENT | HCI_VOICE_SETTING_INPUT_SAMPLE_SIZE_16_BIT | HCI_VOICE_SETTING_AIR_CODING_FORMAT_NONE), &Status)

    3 - enable WBS by WBS_ASSOCIATE_COMMAND (0xFD78)

    4 - CC2564c (slave) codec config to 16K by VS_WRITE_CODEC_CONFIG_COMMAND

    attached file related to NBS

    NBS_4.rar

    Best regards

  • Hi Li,

    For your WBS case, do you see PLC initialized in the logs?

    How did you enable AVPR in your NBS case?

    Thanks,
    Jacob

  • Hi Jacob,

    For your WBS case, do you see PLC initialized in the logs?

    Yes

    For WBS, PLC initialized and "use plc" for packet loss reported on log 

    How did you enable AVPR in your NBS case?

    Yes

    After start up, download AVPR patch and enable AVPR. below screenshot related to attached log on previous post and indicate AVPR enabled successfully 

    I think routing NBS to AVPR for sample rate conversion and PLC not related to remote device SCO config but according to Michael's post, SCO setup must changed.

    below screenshot is show SCO config for NBS

    Thanks

  • Hi Li,

    but 16K bandwidth refused by phone. according to HFP spec 8K bandwidth is maximum for WBS and NBS (consider compression ratio)

    In your WBS case, does the phone accept the 16K bandwidth?

    Another idea I had is to change the codec. The mSBC codec seems to support 16K based on the HFP spec:

    Can you try to set the codec to be mSBC with HCI_Write_Voice_Setting?

    Thanks,
    Jacob

  • Hi Jacob,

    Another idea I had is to change the codec. The mSBC codec seems to support 16K based on the HFP spec

    CVSD is mandatory and can't force remote device to use mSBC instead of CVSD. 

    mSBC sample rate is 16K but bandwidth is 8K (audio sampled by 16K and compressed before transmit by 8K bandwidth on SCO)

    Can you try to set the codec to be mSBC with HCI_Write_Voice_Setting?

    I try to change voice setting and update this post, but from remote device side CVSD codec must be used

    please let me know if any suggestion

    thanks

  • Hey Li,

    I'll reach out to another team member who may be able to help us enable PLC for NBS.

    Thanks,
    Jacob

  • Jacob,

    Thanks for your support

  • Hi Jacob,

    I still working on issue and also check this post

    Thanks

  • Hi Li,

    For WBS:

    1 - Set MCU PCM (master) config to 16K 

    2 - set voice and air coding setting: HCI_Write_Voice_Setting(BluetoothStackID, (HCI_VOICE_SETTING_INPUT_DATA_FORMAT_2_COMPLEMENT | HCI_VOICE_SETTING_INPUT_SAMPLE_SIZE_16_BIT | HCI_VOICE_SETTING_AIR_CODING_FORMAT_NONE), &Status)

    3 - enable WBS by WBS_ASSOCIATE_COMMAND (0xFD78)

    4 - CC2564c (slave) codec config to 16K by VS_WRITE_CODEC_CONFIG_COMMAND

    attached file related to NBS

    Can you take firmware and HCI logs for the WBS case like you did for the NBS case? I want to compare messages to see where the PLC initialization is failing.

    Thanks,
    Jacob

  • Hi Jacob,

    full log related to WBS attached

    WBS_4.rar

    Thanks

  • Hi Li,

    Thanks, I'll follow up here soon.

    Best,
    Jacob

  • Hi Li,

    I will be out on vacation next week, but will ask another team member to take a look at this while I am out.

    Best,
    Jacob

  • Hi Jacob,

    Thanks for your support 

  • Hi Li,

    When working with NBS at 8kHz, are you: 

    - Enabling AVPR via the patch described by Michael's post?

    - Changing the sampling rate of the eSCO to 16kHz? Or is it left at 8kHz?

    - Setting the PCM interface to be at 16kHz audio?

    Thanks,

    -Ryan 

  • Hi Ryan,

    Enabling AVPR via the patch described by Michael's post?

    Yes

    After start up, download AVPR patch and enable AVPR. below screenshot related to attached log on previous post (NBS_4.rar) and indicate AVPR enabled successfully 

    Changing the sampling rate of the eSCO to 16kHz? Or is it left at 8kHz?

    eSCO bandwidth left at 8KHz (sample rate change to 16kHz) 

    I try to change eSCO bandwidth to 16K according to Michael's post by "HCI_Setup_Synchronous_Connection" command after eSCO connection complete 

    but 16k refused by phone. I check HFP spec and see bandwidth is 8K for NBS and WBS (consider compression)

    Setting the PCM interface to be at 16kHz audio?

    Yes 

    PCM change to 16KHz for MCU side and CC256x

    Thanks

  • Hey Li,

    I am back from vacation and will answer your latest query in a day or two.

    Thanks,
    Jacob

  • Hi Jacob,

    Thanks for update state

    I test HCI_VS_Set_Narrow_Band_Voice_Path ("0xFD94") command but received error (invalid HCI command)

    Best regards

  • Ok thanks for the update, I should have more information soon.

    Best,
    Jacob

  • Hi Li,

    I'm continuing to look into this issue to see if there is another command you need to call to enable PLC on NBS. 

    Can you share any errors or warnings you receive when you say "connection refused by phone"? 

    but 16k refused by phone

    Thanks,
    Jacob

  • As another test, can you try executing these commands without step 3 to enable NBS from before without running the WBS_Dissassociate command?

    For NBS:

    1 - Set MCU PCM (master) config to 16K 

    2 - set voice and air coding setting: HCI_Write_Voice_Setting(BluetoothStackID, (HCI_VOICE_SETTING_INPUT_DATA_FORMAT_2_COMPLEMENT | HCI_VOICE_SETTING_INPUT_SAMPLE_SIZE_16_BIT | HCI_VOICE_SETTING_AIR_CODING_FORMAT_CVSD), &Status);

    3 - disable WBS by WBS_DISASSOCIATE_COMMAND (0xFD79)

    4 - CC2564c (slave) codec config to 16K by VS_WRITE_CODEC_CONFIG_COMMAND

    When you run the above commands (without step 3) do you see these messages?

    Thanks,
    Jacob

  • Hi Jacob,

    Can you share any errors or warnings you receive when you say "connection refused by phone"?

    need to check again but in the response to HCI_Setup_Synchronous_Connection (16k bandwidth) commands, phone return "Insufficient Resources" or "invalid parameter". after receiving this return value i'm worry about using custom eSCO/SCO config because of compatibility issue for phones with different OS, Bluetooth stack and Bluetooth chip

    As another test, can you try executing these commands without step 3 to enable NBS from before without running the WBS_Dissassociate command?

    I'm out of office, I'll test two scenario without running the WBS_Dissassociate command and update this post

    0 - power up 

    1 - Set MCU PCM (master) config to 16K 

    2 - set voice and air coding setting: HCI_Write_Voice_Setting(BluetoothStackID, (HCI_VOICE_SETTING_INPUT_DATA_FORMAT_2_COMPLEMENT | HCI_VOICE_SETTING_INPUT_SAMPLE_SIZE_16_BIT | HCI_VOICE_SETTING_AIR_CODING_FORMAT_CVSD), &Status);

    3 - CC2564c (slave) codec config to 16K by VS_WRITE_CODEC_CONFIG_COMMAND

    and

    0 - enable WBS by WBS_ASSOCIATE_COMMAND (0xFD78) from last WBS SCO connection

    1 - Set MCU PCM (master) config to 16K 

    2 - set voice and air coding setting: HCI_Write_Voice_Setting(BluetoothStackID, (HCI_VOICE_SETTING_INPUT_DATA_FORMAT_2_COMPLEMENT | HCI_VOICE_SETTING_INPUT_SAMPLE_SIZE_16_BIT | HCI_VOICE_SETTING_AIR_CODING_FORMAT_CVSD), &Status);

    3 - CC2564c (slave) codec config to 16K by VS_WRITE_CODEC_CONFIG_COMMAND

    Thanks for your time

  • Hi Li,

    If you can take firmware logs just as before when sending these commands, that will help me further identify the issue.

    Thanks,
    Jacob

  • Hi Jacob,

    Can you share any errors or warnings you receive when you say "connection refused by phone"? 

    Try to change TX/RX bandwidth to 16000 (0x3e80)

    Invalid LMP parameter returned

    full log attached

    NBS_5_16000Bandwidth.rar

    Best regards

  • Jacob, 

    full log attached but on both case plc not work and audio speed is wrong

    0 - power up 

    1 - Set MCU PCM (master) config to 16K 

    2 - set voice and air coding setting: HCI_Write_Voice_Setting(BluetoothStackID, (HCI_VOICE_SETTING_INPUT_DATA_FORMAT_2_COMPLEMENT | HCI_VOICE_SETTING_INPUT_SAMPLE_SIZE_16_BIT | HCI_VOICE_SETTING_AIR_CODING_FORMAT_CVSD), &Status);

    3 - CC2564c (slave) codec config to 16K by VS_WRITE_CODEC_CONFIG_COMMAND

    NBS_withoutDisableWBS.rar

    0 - enable WBS by WBS_ASSOCIATE_COMMAND (0xFD78) from last WBS SCO connection

    1 - Set MCU PCM (master) config to 16K 

    2 - set voice and air coding setting: HCI_Write_Voice_Setting(BluetoothStackID, (HCI_VOICE_SETTING_INPUT_DATA_FORMAT_2_COMPLEMENT | HCI_VOICE_SETTING_INPUT_SAMPLE_SIZE_16_BIT | HCI_VOICE_SETTING_AIR_CODING_FORMAT_CVSD), &Status);

    3 - CC2564c (slave) codec config to 16K by VS_WRITE_CODEC_CONFIG_COMMAND

    (PLC initialize related to first WBS connection)

    2021.LMP_Power_test_2.rar

    Thanks

  • Thanks Li I will review these logs.

    Best,
    Jacob

  • OK Jacob,

    Thanks

  • Hi Li,

    Sorry for the delay on this thread. I will follow up by tomorrow early next week.

    Best,
    Jacob

    Edit: updated follow-up date

  • Hi Jacob,

    Thanks for update state

    Best regards

  • Hi Li,

    I've reviewed your logs and I see that you are still not able to initialize PLC using NBS. It looks like the AVPR is enabled successfully, but the upsampling of 8 kHz to 16 kHz is unsuccessful.

    I will try to reproduce this. In the meantime, can you test your working WBS case (with "PLC initialized" message) and then run the WBS_dissassociate command while taking logs? I'm hoping this will get us closer to the functionality you are looking for.

    Best,
    Jacob

  • Hi Jacob,

    I will try to reproduce this. In the meantime

    Thanks for your time

    can you test your working WBS case (with "PLC initialized" message) and then run the WBS_dissassociate command while taking logs?

    I test and update this post

    Best regards

  • Hi Li,

    I was able to reproduce your issue and also am unable to initialize PLC. I tried using HFPDemo_HF on the MSP432, what platform are you using? 

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/538/my_5F00_attempt_5F00_HFP_5F00_NBS.lgr

    Here are the steps I know you need to take:

    1. Enable AVPR patch download

    2. Configure 16 kHz audio to be used on the codec

    3. Comment out / remove the HFRE_HF_CODEC_NEGOTIATION_SUPPORTED_BIT on the HFRE_SUPPORTED_FEATURES

    There may still be an additional SCO audio configuration needed. Can you try these steps for now?

    Best,
    Jacob

  • Hi Jacob,

    Thanks for your support

    1. Enable AVPR patch download

    2. Configure 16 kHz audio to be used on the codec

    This steps is OK

     

    3. Comment out / remove the HFRE_HF_CODEC_NEGOTIATION_SUPPORTED_BIT on the HFRE_SUPPORTED_FEATURES

    Good idea for force remote device to use CVSD for testing

    According to Michael post and CC2564C datasheet PLC is working if sample rate conversion (16K <=> 8K) is occurred

    But I'm not sure about correct MCU PCM clock (I2S peripheral) ! 

    [Q1] Need to set 16K on PCM (I2S peripheral) of MCU or only set HCI_VS_Write_Codec_Config() and MCU remain on 8K?

    (if PCM clock is 16K and also SCO bandwidth is 16K, sample rate conversion is meaningless)

    I tried using HFPDemo_HF on the MSP432, what platform are you using? 

    I'm using STM32F7 and CC2564C

    [Q2] Can you please confirm you are using MSP432 and CC2564C?

    There may still be an additional SCO audio configuration needed. Can you try these steps for now?

    I try to using SCO API to configure and also need to working on my other application level tasks

    Thanks

  • Hi Li,

    [Q1] Need to set 16K on PCM (I2S peripheral) of MCU or only set HCI_VS_Write_Codec_Config() and MCU remain on 8K?

    I was under the assumption that the HCI_VS_Write_Codec_Config command set the MCU I2S line to be 8 kHz as well. Is PLC initialized if you also specify the STM32 I2S line to be 8 kHz?

    [Q2] Can you please confirm you are using MSP432 and CC2564C?

    Yes, I am using the MSP432 and CC2564C. But I can also test with the STM32.

    Thanks,
    Jacob

  • Hi Jacob, 

    I was under the assumption that the HCI_VS_Write_Codec_Config command set the MCU I2S line to be 8 kHz as well

    On stm32 code, VS_PCM_Codec_Config_Slave_I2S() function set cc2564x and set MCU I2S peripheral by change "register_rcc_plli2scfgr"

    /* The following function is used to initailize the I2S interface. */
    int initializeAudio(unsigned int BluetoothStackID, unsigned long Frequency)
    {
        /* some code */
    	switch(Frequency)
    	{
    		/* The I2S clock frequency = 16bits x 2ch x Frequency, in KHz, Frequency in Hz */
    		case 8000:
    			ret_val = VS_PCM_Codec_Config_Slave_I2S(BluetoothStackID, 
    				I2S_CLK_FREQ_IN_FS_8KHZ, Frequency);
    			register_rcc_plli2scfgr = (2 << 28) | (192 << 6);
    			register_spi_i2spr = (1 << 8) | 187;
    			break;
    		case 16000:
    			ret_val = VS_PCM_Codec_Config_Slave_I2S(BluetoothStackID, 
    				I2S_CLK_FREQ_IN_FS_16KHZ, Frequency);
    			register_rcc_plli2scfgr = (3 << 28) | (192 << 6);
    			register_spi_i2spr = (1 << 8) | 62;
    			break;
    		case 48000:
    			ret_val = VS_PCM_Codec_Config_Slave_I2S(BluetoothStackID, 
    				I2S_CLK_FREQ_IN_FS_48KHZ, Frequency);
    			register_rcc_plli2scfgr = (3 << 28) | (258 << 6);
    			register_spi_i2spr = SPI_I2SPR_MCKOE | (1 << 8) | 3;
    			break;
    		case 44100:
    			ret_val = VS_PCM_Codec_Config_Slave_I2S(BluetoothStackID, 
    				I2S_CLK_FREQ_IN_FS_44_1KHZ, Frequency);
    			register_rcc_plli2scfgr = (2 << 28) | (271 << 6);
    			register_spi_i2spr = SPI_I2SPR_MCKOE | (0 << 8) | 6;
    			break;
    		default:
    			Display(("\r\n Unsupported I2S Frequency !!! \r\n"));
    			ret_val = -1; 
    			return ret_val;
    	}
    	
    	if(ret_val)
    	{
    		Display(("\r\n Failed to configure the BT PCM Interface !!! \r\n"));
    		return ret_val;
    	}
    	
    	/* some code */
    	
    }

    Is PLC initialized if you also specify the STM32 I2S line to be 8 kHz?

    PLC not initialized on both MCU I2S case (16/8) but speech speed is OK on 8K and NOT OK on 16K

    But I can also test with the STM32

    If you can using STM32 we can share code for testing

    Thanks