Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,74 @@ power if DTIM is short as the DTIM is determined by the access point.

During ping operation power consumption should drop from 90-100mA to 30-40mA.

ble
---

This configuration is used to enable the Bluetooth Low Energy (BLE) of
ESP32-C6 chip.

To test it, just run the following commands below.

Confirm that bnep interface exist::

nsh> ifconfig
bnep0 Link encap:UNSPEC at DOWN mtu -9
inet addr:0.0.0.0 DRaddr:0.0.0.0 Mask:0.0.0.0

Get basic information from it::

nsh> bt bnep0 info
Device: bnep0
BDAddr: 8c:bf:ea:b3:4c:ea
Flags: 0000
Free: 20
ACL: 20
SCO: 0
Max:
ACL: 24
SCO: 0
MTU:
ACL: 70
SCO: 70
Policy: 0
Type: 0

Start the scanning process::

nsh> bt bnep0 scan start

Wait a little bit before stopping it.

Then after some minutes stop it::

nsh> bt bnep0 scan stop

Get the list of BLE devices found around you::

nsh> bt bnep0 scan get
Scan result:
1. addr: d7:c4:e6:xx:xx:xx type: 0
rssi: -62
response type: 4
advertiser data: 10 09 4d 69 20 XX XX XX XX XX XX XX XX XX XX 20 e
2. addr: cb:23:18:xx:xx:xx type: 0
rssi: -60
response type: 0
advertiser data: 02 01 06 1b ff XX XX XX ff ff ff ff ff ff ff ff 8
3. addr: cb:23:18:xx:xx:xx type: 0
rssi: -60
response type: 4
advertiser data: 10 09 4d 69 20 XX XX XX XX XX XX XX XX XX XX 20 e
4. addr: d7:c4:e6:xx:xx:xx type: 0
rssi: -62
response type: 0
advertiser data: 02 01 06 1b ff XX XX XX ff ff ff ff ff ff ff ff e
5. addr: d7:c4:e6:xx:xx:xx type: 0
rssi: -62
response type: 4
advertiser data: 10 09 4d 69 20 XX XX XX XX XX XX XX XX XX XX 20 e
nsh>

bmp180
------

Expand Down
2 changes: 1 addition & 1 deletion Documentation/platforms/risc-v/esp32c6/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ Peripheral Support NOTES
============== ======= ====================
ADC Yes Oneshot and internal temperature sensor
AES Yes
Bluetooth No
Bluetooth Yes
CAN/TWAI Yes
DMA Yes
ECC No
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,74 @@ autopm
This configuration makes the device automatically enter the low power consumption mode
when in the idle state, powering off the cpu and other peripherals.

ble
---

This configuration is used to enable the Bluetooth Low Energy (BLE) of
ESP32-H2 chip.

To test it, just run the following commands below.

Confirm that bnep interface exist::

nsh> ifconfig
bnep0 Link encap:UNSPEC at DOWN mtu -9
inet addr:0.0.0.0 DRaddr:0.0.0.0 Mask:0.0.0.0

Get basic information from it::

nsh> bt bnep0 info
Device: bnep0
BDAddr: 58:41:81:40:02:08
Flags: 0000
Free: 20
ACL: 20
SCO: 0
Max:
ACL: 24
SCO: 0
MTU:
ACL: 70
SCO: 70
Policy: 0
Type: 0

Start the scanning process::

nsh> bt bnep0 scan start

Wait a little bit before stopping it.

Then after some minutes stop it::

nsh> bt bnep0 scan stop

Get the list of BLE devices found around you::

nsh> bt bnep0 scan get
Scan result:
1. addr: d7:c4:e6:xx:xx:xx type: 0
rssi: -62
response type: 4
advertiser data: 10 09 4d 69 20 XX XX XX XX XX XX XX XX XX XX 20 e
2. addr: cb:23:18:xx:xx:xx type: 0
rssi: -60
response type: 0
advertiser data: 02 01 06 1b ff XX XX XX ff ff ff ff ff ff ff ff 8
3. addr: cb:23:18:xx:xx:xx type: 0
rssi: -60
response type: 4
advertiser data: 10 09 4d 69 20 XX XX XX XX XX XX XX XX XX XX 20 e
4. addr: d7:c4:e6:xx:xx:xx type: 0
rssi: -62
response type: 0
advertiser data: 02 01 06 1b ff XX XX XX ff ff ff ff ff ff ff ff e
5. addr: d7:c4:e6:xx:xx:xx type: 0
rssi: -62
response type: 4
advertiser data: 10 09 4d 69 20 XX XX XX XX XX XX XX XX XX XX 20 e
nsh>

bmp180
------

Expand Down
2 changes: 1 addition & 1 deletion Documentation/platforms/risc-v/esp32h2/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ Peripheral Support NOTES
============== ======= ====================
ADC Yes Oneshot and internal temperature sensor
AES Yes
Bluetooth No
Bluetooth Yes
CAN/TWAI Yes
DMA Yes
DS No
Expand Down
8 changes: 6 additions & 2 deletions arch/risc-v/src/common/espressif/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ if(CONFIG_ESPRESSIF_WIRELESS)
list(APPEND SRCS esp_wifi_api.c)
list(APPEND SRCS esp_wlan_netdev.c)
endif()
list(APPEND SRCS esp_wifi_utils.c)
if(NOT CONFIG_ARCH_CHIP_ESP32H2)
list(APPEND SRCS esp_wifi_utils.c)
endif()
endif()

if(CONFIG_ESP_MCPWM)
Expand Down Expand Up @@ -221,7 +223,7 @@ if(DEFINED ENV{ESP_HAL_3RDPARTY_VERSION})
CACHE STRING "ESP HAL 3rdparty version")
else()
set(ESP_HAL_3RDPARTY_VERSION
e8d8638febf5310bf5b8f9bd04cf7fab9e9a4cb0
0eb59f7e02a4735f2b9a78797e691b66740fcadb
CACHE STRING "ESP HAL 3rdparty version")
endif()

Expand Down Expand Up @@ -321,6 +323,8 @@ if(NOT IS_DIRECTORY "${ESP_HAL_3RDPARTY_REPO}")
COMMAND
git submodule --quiet update --init --depth=1 components/esp_phy/lib
components/esp_wifi/lib components/bt/controller/lib_esp32c3_family
components/bt/controller/lib_esp32c6/esp32c6-bt-lib
components/bt/controller/lib_esp32h2/esp32h2-bt-lib
components/esp_coex/lib
WORKING_DIRECTORY ${ESP_HAL_3RDPARTY_REPO}
RESULT_VARIABLE GIT_SUBMODULE_RESULT)
Expand Down
2 changes: 1 addition & 1 deletion arch/risc-v/src/common/espressif/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2062,7 +2062,7 @@ config ESPRESSIF_WIFI

config ESPRESSIF_BLE
bool "BLE"
depends on ARCH_CHIP_ESP32C3
depends on !ARCH_CHIP_ESP32P4
default n
select ESPRESSIF_WIRELESS
---help---
Expand Down
8 changes: 5 additions & 3 deletions arch/risc-v/src/common/espressif/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ ifeq ($(CONFIG_ESPRESSIF_WIRELESS),y)
CHIP_CSRCS += esp_wifi_api.c
CHIP_CSRCS += esp_wlan_netdev.c
endif
CHIP_CSRCS += esp_wifi_utils.c
ifneq ($(CONFIG_ARCH_CHIP_ESP32H2),y)
CHIP_CSRCS += esp_wifi_utils.c
endif
endif

ifeq ($(CONFIG_ESP_MCPWM),y)
Expand Down Expand Up @@ -233,7 +235,7 @@ endif

ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty
ifndef ESP_HAL_3RDPARTY_VERSION
ESP_HAL_3RDPARTY_VERSION = e8d8638febf5310bf5b8f9bd04cf7fab9e9a4cb0
ESP_HAL_3RDPARTY_VERSION = 0eb59f7e02a4735f2b9a78797e691b66740fcadb
endif

ifndef ESP_HAL_3RDPARTY_URL
Expand Down Expand Up @@ -283,7 +285,7 @@ endif
ifeq ($(CONFIG_ESPRESSIF_WIRELESS),y)
ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
$(Q) echo "Espressif HAL for 3rd Party Platforms: initializing submodules..."
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update --init $(GIT_DEPTH_PARAMETER) components/esp_phy/lib components/esp_wifi/lib components/bt/controller/lib_esp32c3_family components/esp_coex/lib
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update --init $(GIT_DEPTH_PARAMETER) components/esp_phy/lib components/esp_wifi/lib components/bt/controller/lib_esp32c3_family components/bt/controller/lib_esp32c6/esp32c6-bt-lib components/bt/controller/lib_esp32h2/esp32h2-bt-lib components/esp_coex/lib
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls reset --quiet --hard
endif
$(Q) echo "Applying patches..."
Expand Down
80 changes: 75 additions & 5 deletions arch/risc-v/src/common/espressif/Wireless.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,86 @@ target_include_directories(

nuttx_add_extra_library(
${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/lib/${CHIP_SERIES}/libphy.a
${ESP_HAL_3RDPARTY_REPO}/components/esp_coex/lib/${CHIP_SERIES}/libcoexist.a
${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/lib/${CHIP_SERIES}/libmesh.a)
${ESP_HAL_3RDPARTY_REPO}/components/esp_coex/lib/${CHIP_SERIES}/libcoexist.a)

if(NOT CONFIG_ARCH_CHIP_ESP32H2)
nuttx_add_extra_library(
${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/lib/${CHIP_SERIES}/libmesh.a
${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/lib/${CHIP_SERIES}/libespnow.a)
endif()

# ##############################################################################
# ESP32-C6 / ESP32-H2 BLE host and controller sources
# ##############################################################################

if((CONFIG_ARCH_CHIP_ESP32C6 OR CONFIG_ARCH_CHIP_ESP32H2)
AND CONFIG_ESPRESSIF_BLE)
target_include_directories(
arch
PRIVATE
${ESP_HAL_3RDPARTY_REPO}/components/bt/common/osi/include
${ESP_HAL_3RDPARTY_REPO}/components/bt/common/tinycrypt/include
${ESP_HAL_3RDPARTY_REPO}/components/bt/common/tinycrypt/port
${ESP_HAL_3RDPARTY_REPO}/components/bt/host/nimble/nimble/porting/nimble/include
${ESP_HAL_3RDPARTY_REPO}/components/bt/host/nimble/port/include
${ESP_HAL_3RDPARTY_REPO}/components/bt/include/${CHIP_SERIES}/include
${ESP_HAL_3RDPARTY_REPO}/components/bt/porting/include
${ESP_HAL_3RDPARTY_REPO}/components/bt/porting/transport/include
${ESP_HAL_3RDPARTY_REPO}/components/esp_common/include
${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/include
${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/${CHIP_SERIES}/include
${ESP_HAL_3RDPARTY_REPO}/nuttx/src/platform/nimble/include)

set(ESP_BLE_HOST_SRCS
${ESP_HAL_3RDPARTY_REPO}/components/bt/common/tinycrypt/src/ecc.c
${ESP_HAL_3RDPARTY_REPO}/components/bt/common/tinycrypt/src/ecc_dh.c
${ESP_HAL_3RDPARTY_REPO}/components/bt/common/tinycrypt/src/ecc_platform_specific.c
${ESP_HAL_3RDPARTY_REPO}/components/bt/common/tinycrypt/port/esp_tinycrypt_port.c
${ESP_HAL_3RDPARTY_REPO}/components/bt/common/tinycrypt/src/sha256.c
${ESP_HAL_3RDPARTY_REPO}/components/bt/common/tinycrypt/src/utils.c
${ESP_HAL_3RDPARTY_REPO}/components/bt/porting/mem/bt_osi_mem.c
${ESP_HAL_3RDPARTY_REPO}/components/bt/porting/mem/os_msys_init.c
${ESP_HAL_3RDPARTY_REPO}/components/bt/porting/transport/src/hci_transport.c
${ESP_HAL_3RDPARTY_REPO}/components/bt/porting/transport/driver/vhci/hci_driver_standard.c
${ESP_HAL_3RDPARTY_REPO}/components/bt/controller/${CHIP_SERIES}/ble.c
${ESP_HAL_3RDPARTY_REPO}/components/bt/controller/${CHIP_SERIES}/bt.c
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_security/ecc_hal.c
${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/src/btbb_init.c
${ESP_HAL_3RDPARTY_REPO}/nuttx/src/platform/nimble/src/npl_os.c)

target_sources(arch PRIVATE ${ESP_BLE_HOST_SRCS})

target_compile_definitions(arch PRIVATE ESP_PLATFORM=1)

if(CONFIG_ARCH_CHIP_ESP32H2)
target_sources(
arch
PRIVATE
${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/src/lib_printf.c
${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/src/phy_common.c
${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/src/phy_init_esp32hxx.c)
endif()
endif()

# ##############################################################################
# BLE prebuilt libraries (Wireless.mk lines 30-32, 65-72; chip Make.defs)
# ##############################################################################

if(CONFIG_ESPRESSIF_BLE)
nuttx_add_extra_library(
${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/lib/${CHIP_SERIES}/libbtbb.a)

if(CONFIG_ARCH_CHIP_ESP32C3)
nuttx_add_extra_library(
${ESP_HAL_3RDPARTY_REPO}/components/bt/controller/lib_esp32c3_family/esp32c3/libbtdm_app.a
${ESP_HAL_3RDPARTY_REPO}/components/bt/controller/lib_esp32c3_family/${CHIP_SERIES}/libbtdm_app.a
)
elseif(CONFIG_ARCH_CHIP_ESP32C6)
nuttx_add_extra_library(
${ESP_HAL_3RDPARTY_REPO}/components/bt/controller/lib_esp32c6/esp32c6-bt-lib/esp32c6/libble_app.a
)
elseif(CONFIG_ARCH_CHIP_ESP32H2)
nuttx_add_extra_library(
${ESP_HAL_3RDPARTY_REPO}/components/bt/controller/lib_esp32h2/esp32h2-bt-lib/libble_app.a
)
endif()
endif()
Expand All @@ -57,8 +128,7 @@ if(CONFIG_ESPRESSIF_WIFI)
nuttx_add_extra_library(
${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/lib/${CHIP_SERIES}/libcore.a
${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/lib/${CHIP_SERIES}/libnet80211.a
${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/lib/${CHIP_SERIES}/libpp.a
${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/lib/${CHIP_SERIES}/libespnow.a)
${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/lib/${CHIP_SERIES}/libpp.a)
if(CONFIG_WPA_WAPI_PSK)
nuttx_add_extra_library(
${ESP_HAL_3RDPARTY_REPO}/components/esp_wifi/lib/${CHIP_SERIES}/libwapi.a)
Expand Down
Loading
Loading