Merge branch 'fix/hfp_pcm_api_set_v5.3' into 'release/v5.3'

fix(bt/bluedroid): Add PCM configuration about pcm frame sync signal shape (backport v5.3)

See merge request espressif/esp-idf!32483
This commit is contained in:
Jiang Jiang Jian 2024-08-21 17:27:14 +08:00
commit 808950a25a
5 changed files with 35 additions and 7 deletions

@ -1 +1 @@
Subproject commit b814f26bbb3d726418c0f80f9f91153dfd978f85
Subproject commit 70337acad449a838ebe8e49b92e201a82bcb9773

View File

@ -55,7 +55,7 @@ extern "C" {
*
* @note Please do not modify this value.
*/
#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x20240315
#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x20240722
/**
* @brief Bluetooth Controller mode
@ -202,6 +202,7 @@ the adv packet will be discarded until the memory is restored. */
.ble_sca = CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF, \
.pcm_role = CONFIG_BTDM_CTRL_PCM_ROLE_EFF, \
.pcm_polar = CONFIG_BTDM_CTRL_PCM_POLAR_EFF, \
.pcm_fsyncshp = 0, \
.hli = BTDM_CTRL_HLI, \
.dup_list_refresh_period = SCAN_DUPL_CACHE_REFRESH_PERIOD, \
.ble_scan_backoff = BTDM_CTRL_SCAN_BACKOFF_UPPERLIMITMAX, \
@ -253,6 +254,7 @@ typedef struct {
uint8_t ble_sca; /*!< BLE low power crystal accuracy index. Configurable in menuconfig */
uint8_t pcm_role; /*!< PCM role (master & slave). Configurable in menuconfig */
uint8_t pcm_polar; /*!< PCM polar trig (falling clk edge & rising clk edge). Configurable in menuconfig */
uint8_t pcm_fsyncshp; /*!< Physical shape of the PCM Frame Synchronization signal (stereo mode & mono mode). Configurable in menuconfig */
bool hli; /*!< True if using high level interrupt; false otherwise. Configurable in menuconfig */
uint16_t dup_list_refresh_period; /*!< Scan duplicate filtering list refresh period in seconds. Configurable in menuconfig */
bool ble_scan_backoff; /*!< True if BLE scan backoff is enabled; false otherwise. Configurable in menuconfig */

View File

@ -43,6 +43,19 @@ The default configuration is `PCM`, if you want to use `vHCI` you should configu
`Component config --> Bluetooth --> Bluedroid Options --> Hands Free/Handset Profile --> audio(SCO) data path --> HCI`.
#### PCM Signal Configurations
PCM Signal supports two configurations in menuconfig: PCM Role, PCM Polar.
- PCM Role: PCM role can be configured as PCM master or PCM slave. The default configuration is `Master`, you can change the PCM role in `menuconfig` path:
`Component config --> Bluetooth --> Controller Options --> PCM Signal Config(Role and Polar) --> PCM Role`
- PCM Polar: PCM polarity can be configured as Falling Edge or Rising Edge. The default configuration is `Falling Edge`, you can change the PCM polar in `menuconfig` path:
`Component config --> Bluetooth --> Controller Options --> PCM Signal Config(Role and Polar) --> PCM Polar`
The default configuration of PCM frame synchronization signal is `Stereo mode(Dual channel)`. FSYNC and DOUT signals both change simultaneously on the edge of CLK. The FSYNC signal continues until the end of the current channel-data transmission. As is shown in the figure ![Stereo](image/Channel_Mode.png)
The latest version of esp-idf master branch can configure three different forms(Stereo mode, Mono mode 1, Mono mode 2).
### Codec Choice
ESP32 supports two types of codec for HFP audio data: `CVSD` and `mSBC`.
@ -75,7 +88,7 @@ See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/l
## Example Output
When you flash and monitor this example, the commands help table prints the following log at the very begining:
When you flash and monitor this example, the commands help table prints the following log at the very beginning:
```
Type 'help' to get the list of commands.

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -45,6 +45,19 @@ The default configuration is `PCM`, if you want to use `vHCI` you should configu
`Component config --> Bluetooth --> Bluedroid Options --> Hands Free/Handset Profile --> audio(SCO) data path --> HCI`.
#### PCM Signal Configurations
PCM Signal supports two configurations in menuconfig: PCM Role, PCM Polar.
- PCM Role: PCM role can be configured as PCM master or PCM slave. The default configuration is `Master`, you can change the PCM role in `menuconfig` path:
`Component config --> Bluetooth --> Controller Options --> PCM Signal Config(Role and Polar) --> PCM Role`
- PCM Polar: PCM polarity can be configured as Falling Edge or Rising Edge. The default configuration is `Falling Edge`, you can change the PCM polar in `menuconfig` path:
`Component config --> Bluetooth --> Controller Options --> PCM Signal Config(Role and Polar) --> PCM Polar`
The default configuration of PCM frame synchronization signal is `Stereo mode(Dual channel)`. FSYNC and DOUT signals both change simultaneously on the edge of CLK. The FSYNC signal continues until the end of the current channel-data transmission. As is shown in the figure ![Stereo](../hfp_ag/image/Channel_Mode.png)
The latest version of esp-idf master branch can configure three different forms(Stereo mode, Mono mode 1, Mono mode 2).
### Codec Choice
ESP32 supports two types of codec for HFP audio data: `CVSD` and `mSBC`.
@ -53,7 +66,7 @@ ESP32 supports two types of codec for HFP audio data: `CVSD` and `mSBC`.
`Component config --> Bluetooth --> Bluedroid Options --> Wide Band Speech`.
Switching on the `Wide Band Speech` means that the prefered codec is `mSBC`, but which one is actually being used also depends on the `Data Path` configuration.
Switching on the `Wide Band Speech` means that the preferred codec is `mSBC`, but which one is actually being used also depends on the `Data Path` configuration.
- If you choose `PCM` for datapath, you can only use `CVSD` and hardware is responsible for the codec job. In the meanwhile, you cannot use `mSBC` by switching `Wide Band Speech` on, because the `mSBC` is implemented in the Bluedroid (Bluetooth Host Stack) by software.
@ -77,7 +90,7 @@ See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/l
## Example Output
When you run this example, the explain prints the following at the very begining:
When you run this example, the explain prints the following at the very beginning:
```
Type 'help' to get the list of commands.
@ -167,7 +180,7 @@ I (133262) BT_HF: --audio state disconnected
- Reject an incoming call
- Disable the voice recognition
#### Choise of Codec
#### Choice of Codec
ESP32 supports both CVSD and mSBC codec. HF Unit and AG device determine which codec to use by exchanging features during service level connection. The choice of codec also depends on the your configuration in `menuconfig`.
@ -268,7 +281,7 @@ I (293172) BT_HF: APP HFP event: AT_RESPONSE
I (293172) BT_HF: --AT response event, code 0, cme 0
E (293702) BT_BTM: btm_sco_connected, handle 181
I (293702) BT_HF: APP HFP event: AUDIO_STATE_EVT
I (293702) BT_HF: --audio state connecte
I (293702) BT_HF: --audio state connected
```
#### Query Current Operator Name