mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
Merge branch 'bugfix/example_docs_support_esp32s31_v6.1' into 'release/v6.1'
fix(bt): Modify the documents in Classic Bluetooth examples to support esp32s31 (v6.1) See merge request espressif/esp-idf!49262
This commit is contained in:
@@ -34,6 +34,8 @@ Detailed information can be viewed through the [../common/README.md](../common/R
|
||||
|
||||
### Hardware Required
|
||||
|
||||
#### ESP32
|
||||
|
||||
To play the sound, there is a need of loudspeaker and possibly an external I2S codec. Otherwise the example will only show a count of audio data packets received silently. Internal DAC can be selected and in this case external I2S codec may not be needed.
|
||||
|
||||
For the I2S codec, pick whatever chip or board works for you; this code was written using a PCM5102 chip, but other I2S boards and chips will probably work as well. The default I2S connections are shown below, but these can be changed in menuconfig:
|
||||
@@ -46,6 +48,10 @@ For the I2S codec, pick whatever chip or board works for you; this code was writ
|
||||
|
||||
If the internal DAC is selected, analog audio will be available on GPIO25 and GPIO26. The output resolution on these pins will always be limited to 8 bit because of the internal structure of the DACs.
|
||||
|
||||
#### ESP32-S31
|
||||
|
||||
The default output is idle. If I2S is used, it can be configured through menuconfig. Currently, DAC is not supported.
|
||||
|
||||
### Configure the project
|
||||
|
||||
```
|
||||
@@ -84,8 +90,8 @@ I (126697) BT_AV: Audio packet count 300
|
||||
I (128697) BT_AV: Audio packet count 400
|
||||
```
|
||||
|
||||
Also, the sound will be heard if a loudspeaker is connected and possible external I2S codec is correctly configured. For ESP32 A2DP source example, the sound is noise as the audio source generates the samples with a random sequence.
|
||||
Also, the sound will be heard if a loudspeaker is connected and possible external I2S codec is correctly configured. For [A2DP source example](../a2dp_source), the sound is noise as the audio source generates the samples with a random sequence.
|
||||
|
||||
## Troubleshooting
|
||||
* For current stage, the supported audio codec in ESP32 A2DP is SBC. SBC data stream is transmitted to A2DP sink and then decoded into PCM samples as output. The PCM data format is normally of 44.1kHz sampling rate, two-channel 16-bit sample stream. Other SBC configurations in ESP32 A2DP sink is supported but need additional modifications of protocol stack settings.
|
||||
* As a usage limitation, ESP32 A2DP sink can support at most one connection with remote A2DP source devices. Also, A2DP sink cannot be used together with A2DP source at the same time, but can be used with other profiles such as SPP and HFP.
|
||||
* At the current stage, the supported audio codecs are SBC and AAC. If the internal A2DP codec is used, only SBC is supported; if the external A2DP codec is used, both SBC and AAC are supported, which can be achieved by registering Stream Endpoints (SEPs). Additionally, both internal and external codec options can be reconfigured via API calls.
|
||||
* As a usage limitation, A2DP sink can support at most one connection with remote A2DP source devices. Also, A2DP sink cannot be used together with A2DP source at the same time, but can be used with other profiles such as SPP and HFP.
|
||||
|
||||
@@ -23,6 +23,8 @@ Detailed information can be viewed through the [../common/README.md](../common/R
|
||||
|
||||
### Hardware Required
|
||||
|
||||
#### ESP32
|
||||
|
||||
To play the sound, there is a need of loudspeaker and possibly an external I2S codec. Otherwise the example will only show a count of audio data packets received silently. Internal DAC can be selected and in this case external I2S codec may not be needed.
|
||||
|
||||
For the I2S codec, pick whatever chip or board works for you; this code was written using a PCM5102 chip, but other I2S boards and chips will probably work as well. The default I2S connections are shown below, but these can be changed in menuconfig:
|
||||
@@ -35,6 +37,10 @@ For the I2S codec, pick whatever chip or board works for you; this code was writ
|
||||
|
||||
If the internal DAC is selected, analog audio will be available on GPIO25 and GPIO26. The output resolution on these pins will always be limited to 8 bit because of the internal structure of the DACs.
|
||||
|
||||
#### ESP32-S31
|
||||
|
||||
The default output is idle. If I2S is used, it can be configured through menuconfig. Currently, DAC is not supported.
|
||||
|
||||
### Configure the project
|
||||
|
||||
```
|
||||
|
||||
@@ -12,7 +12,7 @@ This is the example of using Advanced Audio Distribution Profile (A2DP) APIs to
|
||||
|
||||
### Hardware Required
|
||||
|
||||
This example is able to run on any commonly available ESP32 development board, and is supposed to connect to [A2DP sink example](../a2dp_sink_stream) in ESP-IDF.
|
||||
This example is able to run on any commonly available ESP32 and ESP32-S31 development board, and is supposed to connect to [A2DP sink example](../a2dp_sink_stream) in ESP-IDF.
|
||||
|
||||
### Configure the project
|
||||
|
||||
@@ -84,7 +84,7 @@ I (111040) BT_AV: a2dp disconnected
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
* For current stage, the supported audio codec in ESP32 A2DP is SBC. SBC audio stream is encoded from PCM data normally formatted as 44.1kHz sampling rate, two-channel 16-bit sample data.
|
||||
* At the current stage, the supported audio codecs are SBC and AAC. If the internal A2DP codec is used, only SBC is supported; if the external A2DP codec is used, both SBC and AAC are supported, which can be achieved by registering Stream Endpoints (SEPs). Additionally, both internal and external codec options can be reconfigured via API calls.
|
||||
* The raw PCM media stream in the example is generated by a sequence of random number, so the sound played on the sink side will be piercing noise.
|
||||
* As a usage limitation, ESP32 A2DP source can support at most one connection with remote A2DP sink devices. Also, A2DP source cannot be used together with A2DP sink at the same time, but can be used with other profiles such as SPP and HFP.
|
||||
* As a usage limitation, A2DP source can support at most one connection with remote A2DP sink devices. Also, A2DP source cannot be used together with A2DP sink at the same time, but can be used with other profiles such as SPP and HFP.
|
||||
* Usually, the `ACL_CONN_NUM` is set to `2` but not `1` as one is used for a2dp connection and the other is used for avrcp connection.
|
||||
|
||||
@@ -39,16 +39,16 @@ Detailed information can be viewed through the [../common/README.md](../common/R
|
||||
|
||||
### Hardware Required
|
||||
|
||||
* An ESP32 development board
|
||||
* An ESP32 or ESP32-S31 development board
|
||||
* A SPI-interfaced LCD
|
||||
* A USB cable for power supply and programming
|
||||
|
||||
### Hardware Connection
|
||||
|
||||
The connection between ESP32 Board and the LCD is as follows:
|
||||
The connection between development board and the LCD is as follows:
|
||||
|
||||
```
|
||||
ESP32 Board LCD Screen
|
||||
Development Board LCD Screen
|
||||
+---------+ +---------------------------------+
|
||||
| | | |
|
||||
| 3V3 +--------------+ VCC +----------------------+ |
|
||||
|
||||
@@ -11,7 +11,7 @@ This is the example of using APIs to perform inquiry to search for a target devi
|
||||
|
||||
### Hardware Required
|
||||
|
||||
This example is designed to run on commonly available ESP32 development board, e.g. ESP32-DevKitC.
|
||||
This example is designed to run on commonly available ESP32 and ESP32-S31 development boards, e.g. ESP32-DevKitC and so on.
|
||||
|
||||
### Configure the project
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ This example simulates a Bluetooth HID mouse device that periodically sends repo
|
||||
|
||||
### Hardware Required
|
||||
|
||||
* This example is able to run on any commonly available ESP32 development board, e.g. ESP32-DevKitC.
|
||||
* This example is able to run on any commonly available ESP32 and ESP32-S31 development board, e.g. ESP32-DevKitC and so on.
|
||||
|
||||
* This example is supposed to connect to a Classic Bluetooth HID Host device, e.g. laptop or tablet.
|
||||
|
||||
@@ -62,9 +62,9 @@ I (3563) bt_address: my bluetooth address is 78:E3:6D:CD:02:2A
|
||||
I (3563) app_main: exiting
|
||||
```
|
||||
|
||||
The messages show the successful initialization of Bluetooth stack and HID application. ESP32 will become discoverable with the Bluetooth device name as "HID Mouse Example", by nearby Bluetooth HID Host device.
|
||||
The messages show the successful initialization of Bluetooth stack and HID application. The device will become discoverable with the Bluetooth device name as "HID Mouse Example", by nearby Bluetooth HID Host device.
|
||||
|
||||
Connect to ESP32 on the HID Host side, then finish bonding. After that the HID connection will be established. IDF monitor console will continue to print messages like:
|
||||
Connect to the device on the HID Host side, then finish bonding. After that the HID connection will be established. IDF monitor console will continue to print messages like:
|
||||
|
||||
```
|
||||
I (50663) esp_bt_gap_cb: authentication success: privacy_k65
|
||||
@@ -84,7 +84,7 @@ I (51753) esp_bt_hidd_cb: ESP_HIDD_SEND_REPORT_EVT id:0x00, type:1
|
||||
I (51803) esp_bt_hidd_cb: ESP_HIDD_SEND_REPORT_EVT id:0x00, type:1
|
||||
```
|
||||
|
||||
ESP32 will generate and send HID mouse reports periodically. On the screen of HID Host, the cursor will move horizontally from left to right and then right to left, and so on so forth.
|
||||
The device will generate and send HID mouse reports periodically. On the screen of HID Host, the cursor will move horizontally from left to right and then right to left, and so on so forth.
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
@@ -10,7 +10,7 @@ This example is to show how to use the APIs of **Logical Link Control and Adapta
|
||||
|
||||
### Hardware Required
|
||||
|
||||
This example is designed to run on commonly available ESP32 development board, e.g. ESP32-DevKitC. To operate the example, it is supposed to connect to [bt_l2cap_server example](../bt_l2cap_server) in ESP-IDF.
|
||||
This example is designed to run on commonly available ESP32 and ESP32-S31 development boards, e.g. ESP32-DevKitC and so on. To operate the example, it is supposed to connect to [bt_l2cap_server example](../bt_l2cap_server) in ESP-IDF.
|
||||
|
||||
### Configure the project
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ This example is to show how to use the APIs of **Logical Link Control and Adapta
|
||||
|
||||
### Hardware Required
|
||||
|
||||
This example is designed to run on commonly available ESP32 development board, e.g. ESP32-DevKitC. To operate the example, it should be connected to the L2CAP client running on another ESP32 board.
|
||||
This example is designed to run on commonly available ESP32 and ESP32-S31 development boards, e.g. ESP32-DevKitC and so on. To operate the example, it should be connected to the L2CAP client running on another ESP32 or ESP32-S31 board.
|
||||
|
||||
### Configure the project
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ This example is to show how to use the APIs of **Serial Port Protocol** (**SPP**
|
||||
|
||||
### Hardware Required
|
||||
|
||||
This example is designed to run on commonly available ESP32 development board, e.g. ESP32-DevKitC. To operate the example, it should be connected to an SPP Initiator running on a smartphone, a computer or on another ESP32 development board.
|
||||
This example is designed to run on commonly available ESP32 and ESP32-S31 development boards, e.g. ESP32-DevKitC and so on. To operate the example, it should be connected to an SPP Initiator running on a smartphone, a computer or on another ESP32 or ESP32-S31 development board.
|
||||
|
||||
### Configure the project
|
||||
|
||||
@@ -50,7 +50,7 @@ See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/l
|
||||
|
||||
## Example Description
|
||||
|
||||
After the program starts, the example will start an SPP acceptor. The example will calculate the data rate or just print the received data after the SPP connection is established. You can connect to the server and send data with another ESP32 development board, Android phone or computer which performs as the SPP initiator.
|
||||
After the program starts, the example will start an SPP acceptor. The example will calculate the data rate or just print the received data after the SPP connection is established. You can connect to the server and send data with another ESP32 or ESP32-S31 development board, Android phone or computer which performs as the SPP initiator.
|
||||
|
||||
## Trouble shooting
|
||||
|
||||
@@ -58,10 +58,10 @@ After the program starts, the example will start an SPP acceptor. The example wi
|
||||
|
||||
## FAQ
|
||||
Q: How to change the process of SSP?
|
||||
A: Users can set the IO Capability and Security Mask for their device (fixed Security Mode, Security Mode 4). In short, the Security Mask sets the security level for authentication stage and the IO Capability determines the way of user interaction during pairing. The default Security Mask of this demo is `ESP_SPP_SEC_AUTHENTICATE` which support MITM (Man In The Middle) protection. For more information about Security Simple Pair on ESP32, please refer to [ESP32_SSP](./ESP32_SSP.md).
|
||||
A: Users can set the IO Capability and Security Mask for their device (fixed Security Mode, Security Mode 4). In short, the Security Mask sets the security level for authentication stage and the IO Capability determines the way of user interaction during pairing. The default Security Mask of this demo is `ESP_SPP_SEC_AUTHENTICATE` which support MITM (Man In The Middle) protection. For more information about Security Simple Pair on supported chips, please refer to [ESP32_SSP](./ESP32_SSP.md).
|
||||
|
||||
|
||||
Q: How many SPP servers does ESP32 support?
|
||||
Q: How many SPP servers does esp-idf Bluedroid support?
|
||||
A: For now, the maximum number of SPP servers is 6, which is limited by the maximum number of SDP records. When the SPP server is successfully started, the unique SCN (Server Channel Number) will be mapped to the SPP server.
|
||||
|
||||
Q: Is SPP absolutely reliable?
|
||||
|
||||
@@ -9,7 +9,7 @@ This example is to show how to use the APIs of **Serial Port Protocol** (**SPP**
|
||||
|
||||
### Hardware Required
|
||||
|
||||
This example is designed to run on commonly available ESP32 development board, e.g. ESP32-DevKitC. To operate the example, you should be connect to an SPP acceptor running on a smartphone, a computer or on another ESP32 development board.
|
||||
This example is designed to run on commonly available ESP32 and ESP32-S31 development boards, e.g. ESP32-DevKitC and so on. To operate the example, you should be connect to an SPP acceptor running on a smartphone, a computer or on another ESP32 or ESP32-S31 development board.
|
||||
|
||||
### Configure the project
|
||||
1. Open the project configuration menu:
|
||||
@@ -124,13 +124,13 @@ To clearly show how the SSP aggregate with the SPP , we use the Commands and Eff
|
||||
|
||||
## FAQ
|
||||
Q: How to change the process of SSP?
|
||||
A: Users can set the IO Capability and Security Mask for their device (fixed Security Mode, Security Mode 4). In short, the Security Mask sets the security level for authentication stage and the IO Capability determines the way of user interaction during pairing. The default Security Mask of this demo is `ESP_SPP_SEC_AUTHENTICATE` which support MITM (Man In The Middle) protection. For more information about Security Simple Pair on ESP32, please refer to [ESP32_SSP](../bt_spp_acceptor/ESP32_SSP.md).
|
||||
A: Users can set the IO Capability and Security Mask for their device (fixed Security Mode, Security Mode 4). In short, the Security Mask sets the security level for authentication stage and the IO Capability determines the way of user interaction during pairing. The default Security Mask of this demo is `ESP_SPP_SEC_AUTHENTICATE` which support MITM (Man In The Middle) protection. For more information about Security Simple Pair on supported chips, please refer to [ESP32_SSP](../bt_spp_acceptor/ESP32_SSP.md).
|
||||
|
||||
Q: How can we reach the maximum throughput when using SPP?
|
||||
A: The default MTU size of classic Bluetooth SPP on ESP32 is 990 bytes, and higher throughput can be achieved in the case that data chunk size is close to the MTU size or multiple of MTU size. For example, sending 100 bytes data per second is much better than sending 10 bytes every 100 milliseconds.
|
||||
A: The default MTU size of classic Bluetooth SPP on supported chips is 990 bytes, and higher throughput can be achieved in the case that data chunk size is close to the MTU size or multiple of MTU size. For example, sending 100 bytes data per second is much better than sending 10 bytes every 100 milliseconds.
|
||||
|
||||
Q: What is the difference between the event `ESP_SPP_CONG_EVT` and the parameter `cong` of the event `ESP_SPP_WRITE_EVT`?
|
||||
A: The event `ESP_SPP_CONG_EVT` shows the changing status from `congest` to `uncongest`, or form `uncongest` to `congest`. Congestion can have many causes, such as using out of the credit which is sent by peer, reaching the high watermark of the Tx buffer, the congestion at Bluetooth L2CAP layer and so on. The parameter `cong` of the event `ESP_SPP_WRITE_EVT` shows a snapshot of the state of the flow control manager after the write operation is completed. The user needs to carefully consider retransmitting or continuing to write according to these two events. The ESP32 offers an VFS mode of SPP which hides the details of retransmitting, but it will block the caller and is not more efficient than the callback mode.
|
||||
A: The event `ESP_SPP_CONG_EVT` shows the changing status from `congest` to `uncongest`, or form `uncongest` to `congest`. Congestion can have many causes, such as using out of the credit which is sent by peer, reaching the high watermark of the Tx buffer, the congestion at Bluetooth L2CAP layer and so on. The parameter `cong` of the event `ESP_SPP_WRITE_EVT` shows a snapshot of the state of the flow control manager after the write operation is completed. The user needs to carefully consider retransmitting or continuing to write according to these two events. The stack offers a VFS mode of SPP which hides the details of retransmitting, but it will block the caller and is not more efficient than the callback mode.
|
||||
|
||||
Q: How many SPP clients does ESP32 support?
|
||||
A: The ESP32 supports maximum 8 SPP clients, which including virtual SPP connections. Virtual SPP connection means that SPP clients can connect to the different SPP servers running on the same peer device. However the number of SPP clients (excluding virtual connections) shall not exceed the number of Bluetooth ACL connections.
|
||||
Q: How many SPP client connections are supported in esp-idf Bluedroid?
|
||||
A: Esp-idf Bluedroid support a maximum of 8 SPP clients, including virtual SPP connections. Virtual SPP connection means that SPP clients can connect to the different SPP servers running on the same peer device. However the number of SPP clients (excluding virtual connections) shall not exceed the number of Bluetooth ACL connections.
|
||||
|
||||
@@ -9,7 +9,7 @@ This example is to show how to use the APIs of **Serial Port Protocol** (**SPP**
|
||||
|
||||
### Hardware Required
|
||||
|
||||
This example is designed to run on commonly available ESP32 development board, e.g. ESP32-DevKitC. To operate the example, it should be connected to an SPP Initiator running on a smartphone, a computer or on another ESP32 development board.
|
||||
This example is designed to run on commonly available ESP32 and ESP32-S31 development boards, e.g. ESP32-DevKitC and so on. To operate the example, it should be connected to an SPP Initiator running on a smartphone, a computer or on another ESP32 or ESP32-S31 development board.
|
||||
|
||||
### Configure the project
|
||||
|
||||
@@ -50,7 +50,7 @@ See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/l
|
||||
|
||||
## Example Description
|
||||
|
||||
After the program starts, the example will start an SPP acceptor. The example will print the received data after the SPP connection is established. You can connect to the server and send data with another ESP32 development board, Android phone or computer which performs as the SPP initiator.
|
||||
After the program starts, the example will start an SPP acceptor. The example will print the received data after the SPP connection is established. You can connect to the server and send data with another ESP32 or ESP32-S31 development board, Android phone or computer which performs as the SPP initiator.
|
||||
|
||||
## FAQ
|
||||
Please refer the FAQ part in the [README.md](../bt_spp_acceptor/README.md)
|
||||
@@ -9,7 +9,7 @@ This example is to show how to use the APIs of **Serial Port Protocol** (**SPP**
|
||||
|
||||
### Hardware Required
|
||||
|
||||
This example is designed to run on commonly available ESP32 development board, e.g. ESP32-DevKitC. To operate the example, you should be connect to an SPP acceptor running on a smartphone, a computer or on another ESP32 development board.
|
||||
This example is designed to run on commonly available ESP32 and ESP32-S31 development boards, e.g. ESP32-DevKitC and so on. To operate the example, you should be connect to an SPP acceptor running on a smartphone, a computer or on another ESP32 or ESP32-S31 development board.
|
||||
|
||||
### Configure the project
|
||||
1. Open the project configuration menu:
|
||||
|
||||
+1
@@ -6,6 +6,7 @@ menu "A2DP Sink Internal Codec Example Configuration"
|
||||
Select to use Internal DAC or external I2S driver
|
||||
|
||||
config EXAMPLE_A2DP_SINK_OUTPUT_INTERNAL_DAC
|
||||
depends on IDF_TARGET_ESP32
|
||||
bool "Internal DAC"
|
||||
help
|
||||
Select this to use Internal DAC sink output,
|
||||
|
||||
@@ -9,7 +9,7 @@ This example is to show how to use the APIs of Hands-Free Audio Gateway (hf_ag)
|
||||
|
||||
### Hardware Required
|
||||
|
||||
This example is designed to run on commonly available ESP32 development board, e.g. ESP32-DevKitC. To operate this example, it should be connected to a Hands-Free Client running on a Headphone/Headset or on another ESP32 development board loaded with [hfp_hf](../hfp_hf) example of ESP-IDF.
|
||||
This example is designed to run on commonly available ESP32 and ESP32-S31 development boards, e.g. ESP32-DevKitC and so on. To operate this example, it should be connected to a Hands-Free Client running on a Headphone/Headset or on another ESP32 or ESP32-S31 development board loaded with [hfp_hf](../hfp_hf) example of ESP-IDF.
|
||||
|
||||
### Configure the project
|
||||
|
||||
@@ -23,7 +23,7 @@ idf.py menuconfig
|
||||
|
||||
#### Data Path
|
||||
|
||||
ESP32 HFP supports two types of audio datapath: PCM and HCI.
|
||||
ESP32 HFP supports two types of audio datapath: PCM and HCI. Currently, ESP32-S31 HFP only supports HCI.
|
||||
|
||||
The default configuration is `PCM`, if you want to use `vHCI` you should configure the data path before building and downloading the binary.
|
||||
|
||||
@@ -35,7 +35,7 @@ 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 --> PCM`.
|
||||
|
||||
- vHCI: To use vHCI, audio data stream will be directed from Bluetooth Controller through vHCI on ESP32 and go through the Bluedroid to the Application layer. In menuconfig, you should choose vHCI in `menuconfig` path:
|
||||
- vHCI: To use vHCI, audio data stream will be directed from Bluetooth Controller through vHCI and go through the Bluedroid to the Application layer. In menuconfig, you should choose vHCI in `menuconfig` path:
|
||||
|
||||
`Component config --> Bluetooth controller --> BR/EDR Sync(SCO/eSCO) default data path --> HCI`
|
||||
|
||||
@@ -64,7 +64,7 @@ PCM Signal supports three configurations in menuconfig: PCM Role, PCM Polar and
|
||||
|
||||
### Codec Choice
|
||||
|
||||
ESP32 supports two types of codec for HFP audio data: `CVSD` and `mSBC`.
|
||||
Supported targets provide two types of codec for HFP audio data: `CVSD` and `mSBC`.
|
||||
|
||||
`CVSD` is the default setting and is also the widely used codec for voice audio. But, `mSBC` is designed to have a better voice quality through `HFP`. To select which one is in use, we provide `Wide Band Speech` item in the `menuconfig`:
|
||||
|
||||
@@ -156,12 +156,12 @@ You can type `cona` to establish the audio connection between HF Unit and AG dev
|
||||
|
||||
#### 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`.
|
||||
Supported targets support 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`.
|
||||
|
||||
Since CVSD is the default codec in HFP, we just show the scenarios using mSBC:
|
||||
|
||||
- If you enable `BT_HFP_WBS_ENABLE` in `menuconfig`, mSBC will be available.
|
||||
- If both HF Unit and AG support mSBC and `BT_HFP_WBS_ENABLE` is enabled, ESP32 chooses mSBC.
|
||||
- If both HF Unit and AG support mSBC and `BT_HFP_WBS_ENABLE` is enabled, the local device chooses mSBC.
|
||||
- If you use PCM data path, mSBC is not available.
|
||||
|
||||
### Answer or Reject an Incoming Call
|
||||
|
||||
@@ -10,4 +10,13 @@ menu "HFP Example Configuration"
|
||||
default y
|
||||
help
|
||||
Enable UART interactive console (REPL)
|
||||
|
||||
config EXAMPLE_HFP_PCM_GPIO_SUPPORTED
|
||||
bool
|
||||
default y if IDF_TARGET_ESP32
|
||||
default n
|
||||
help
|
||||
HFP PCM GPIO signal routing is only available on ESP32.
|
||||
ESP32-S31 currently supports HCI SCO data path only.
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
|
||||
#include "driver/gpio.h"
|
||||
#include "gpio_pcm_config.h"
|
||||
|
||||
#if CONFIG_EXAMPLE_HFP_PCM_GPIO_SUPPORTED
|
||||
#include "soc/gpio_reg.h"
|
||||
#include "soc/gpio_sig_map.h"
|
||||
#include "gpio_pcm_config.h"
|
||||
#include "esp_rom_gpio.h"
|
||||
#endif
|
||||
|
||||
#if CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM
|
||||
#if CONFIG_EXAMPLE_HFP_PCM_GPIO_SUPPORTED && CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM
|
||||
|
||||
#define GPIO_OUTPUT_PCM_FSYNC (25)
|
||||
#define GPIO_OUTPUT_PCM_CLK_OUT (5)
|
||||
@@ -58,7 +61,7 @@ void app_gpio_pcm_io_cfg(void)
|
||||
esp_rom_gpio_connect_in_signal(GPIO_INPUT_PCM_DIN, PCMDIN_IDX, false);
|
||||
}
|
||||
|
||||
#endif /* #if CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM */
|
||||
#endif /* CONFIG_EXAMPLE_HFP_PCM_GPIO_SUPPORTED && CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM */
|
||||
|
||||
#if ACOUSTIC_ECHO_CANCELLATION_ENABLE
|
||||
|
||||
|
||||
@@ -123,9 +123,11 @@ void app_main(void)
|
||||
/* Bluetooth device name, connection mode and profile set up */
|
||||
bt_app_work_dispatch(bt_hf_hdl_stack_evt, BT_APP_EVT_STACK_UP, NULL, 0, NULL, NULL);
|
||||
|
||||
#if CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM
|
||||
#if CONFIG_EXAMPLE_HFP_PCM_GPIO_SUPPORTED && CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM
|
||||
/* configure the PCM interface and PINs used */
|
||||
app_gpio_pcm_io_cfg();
|
||||
#elif CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM
|
||||
ESP_LOGW(BT_HF_TAG, "PCM GPIO is not supported on this chip; use HCI SCO data path");
|
||||
#endif
|
||||
|
||||
/* configure external chip for acoustic echo cancellation */
|
||||
|
||||
@@ -11,7 +11,7 @@ This demo sends back the audio data back to the HFP AG device, so you can hear y
|
||||
|
||||
### Hardware Required
|
||||
|
||||
This example is designed to run on commonly available ESP32 development board, e.g. ESP32-DevKitC. To operate it should be connected to an AG running on a smartphone or on another ESP32 development board loaded with Hands Free Audio Gateway (hfp_ag) example from ESP-IDF.
|
||||
This example is designed to run on commonly available ESP32 and ESP32-S31 development boards, e.g. ESP32-DevKitC and so on. To operate it should be connected to an AG running on a smartphone or on another ESP32 or ESP32-S31 development board loaded with Hands Free Audio Gateway (hfp_ag) example from ESP-IDF.
|
||||
|
||||
### Configure the project
|
||||
|
||||
@@ -25,7 +25,7 @@ idf.py menuconfig
|
||||
|
||||
#### Data Path
|
||||
|
||||
ESP32 HFP supports two types of audio datapath: PCM and HCI.
|
||||
ESP32 HFP supports two types of audio datapath: PCM and HCI. Currently, ESP32-S31 HFP only supports HCI.
|
||||
|
||||
The default configuration is `PCM`, if you want to use `vHCI` you should configure the data path before building and downloading the binary.
|
||||
|
||||
@@ -37,7 +37,7 @@ 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 --> PCM`.
|
||||
|
||||
- `vHCI`: To use vHCI, audio data stream will be directed from Bluetooth Controller through vHCI on ESP32 and go through the Bluedroid to the Application layer. In menuconfig, you should choose vHCI in `menuconfig`:
|
||||
- `vHCI`: To use vHCI, audio data stream will be directed from Bluetooth Controller through vHCI and go through the Bluedroid to the Application layer. In menuconfig, you should choose vHCI in `menuconfig`:
|
||||
|
||||
`Component config --> Bluetooth controller --> BR/EDR Sync(SCO/eSCO) default data path --> HCI`
|
||||
|
||||
@@ -78,7 +78,7 @@ Step to initialize PBA Client connection:
|
||||
|
||||
### Codec Choice
|
||||
|
||||
ESP32 supports two types of codec for HFP audio data: `CVSD` and `mSBC`.
|
||||
Supported targets provide two types of codec for HFP audio data: `CVSD` and `mSBC`.
|
||||
|
||||
`CVSD` is the default setting and is also the widely used codec for voice audio. But, `mSBC` is designed to have a better voice quality through `HFP`. To select which one is in use, we provide `Wide Band Speech` item in the `menuconfig` path:
|
||||
|
||||
@@ -200,12 +200,12 @@ I (133262) BT_HF: --audio state disconnected
|
||||
|
||||
#### 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`.
|
||||
Supported targets support 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`.
|
||||
|
||||
Since CVSD is the default codec in HFP, we just show the scenarios using mSBC:
|
||||
|
||||
- If you enable `BT_HFP_WBS_ENABLE` in `menuconfig`, mSBC will be available.
|
||||
- If both HF Unit and AG support mSBC and `BT_HFP_WBS_ENABLE` is enabled, ESP32 chooses mSBC.
|
||||
- If both HF Unit and AG support mSBC and `BT_HFP_WBS_ENABLE` is enabled, the local device chooses mSBC.
|
||||
- If you use PCM data path, mSBC is not available.
|
||||
|
||||
### Answer or Reject an incoming call
|
||||
|
||||
@@ -18,4 +18,13 @@ menu "HFP Example Configuration"
|
||||
default y
|
||||
help
|
||||
Enable UART interactive console (REPL)
|
||||
|
||||
config EXAMPLE_HFP_PCM_GPIO_SUPPORTED
|
||||
bool
|
||||
default y if IDF_TARGET_ESP32
|
||||
default n
|
||||
help
|
||||
HFP PCM GPIO signal routing is only available on ESP32.
|
||||
ESP32-S31 currently supports HCI SCO data path only.
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
|
||||
#include "driver/gpio.h"
|
||||
#include "gpio_pcm_config.h"
|
||||
|
||||
#if CONFIG_EXAMPLE_HFP_PCM_GPIO_SUPPORTED
|
||||
#include "soc/gpio_reg.h"
|
||||
#include "soc/gpio_sig_map.h"
|
||||
#include "gpio_pcm_config.h"
|
||||
#include "esp_rom_gpio.h"
|
||||
#endif
|
||||
|
||||
#if CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM
|
||||
#if CONFIG_EXAMPLE_HFP_PCM_GPIO_SUPPORTED && CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM
|
||||
|
||||
#define GPIO_OUTPUT_PCM_FSYNC (25)
|
||||
#define GPIO_OUTPUT_PCM_CLK_OUT (5)
|
||||
@@ -57,7 +60,7 @@ void app_gpio_pcm_io_cfg(void)
|
||||
esp_rom_gpio_connect_out_signal(GPIO_OUTPUT_PCM_DOUT, PCMDOUT_IDX, false, false);
|
||||
esp_rom_gpio_connect_in_signal(GPIO_INPUT_PCM_DIN, PCMDIN_IDX, false);
|
||||
}
|
||||
#endif /* #if CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM */
|
||||
#endif /* CONFIG_EXAMPLE_HFP_PCM_GPIO_SUPPORTED && CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM */
|
||||
|
||||
#if ACOUSTIC_ECHO_CANCELLATION_ENABLE
|
||||
|
||||
|
||||
@@ -209,9 +209,11 @@ void app_main(void)
|
||||
/* Bluetooth device name, connection mode and profile set up */
|
||||
bt_app_work_dispatch(bt_hf_client_hdl_stack_evt, BT_APP_EVT_STACK_UP, NULL, 0, NULL, NULL);
|
||||
|
||||
#if CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM
|
||||
#if CONFIG_EXAMPLE_HFP_PCM_GPIO_SUPPORTED && CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM
|
||||
/* configure the PCM interface and PINs used */
|
||||
app_gpio_pcm_io_cfg();
|
||||
#elif CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM
|
||||
ESP_LOGW(BT_HF_TAG, "PCM GPIO is not supported on this chip; use HCI SCO data path");
|
||||
#endif
|
||||
|
||||
/* configure external chip for acoustic echo cancellation */
|
||||
|
||||
Reference in New Issue
Block a user