mirror of
https://github.com/apache/nuttx.git
synced 2026-05-24 07:46:16 +08:00
esp32s3: Implement the Wi-Fi/BLE coexistence
ESP32-S3 has only one 2.4 GHz ISM band RF module, which is shared by Bluetooth and Wi-Fi, so Bluetooth can’t receive or transmit data while Wi-Fi is receiving or transmitting data and vice versa. Under such circumstances, ESP32-S3 uses the time-division multiplexing method to receive and transmit packets.
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
7d605551cd
commit
01b6c87b15
@@ -472,8 +472,10 @@ endmenu # ESP32-S3 Peripheral Selection
|
||||
|
||||
menuconfig ESP32S3_WIFI_BT_COEXIST
|
||||
bool "Wi-Fi and BT coexist"
|
||||
default y if ESP32S3_WIFI && ESP32S3_BLE
|
||||
default n
|
||||
depends on ESP32S3_WIFI && ESP32S3_BLE
|
||||
select ESP32S3_WIFI_STA_DISCONNECT_PM
|
||||
|
||||
menu "SPI RAM Configuration"
|
||||
depends on ESP32S3_SPIRAM
|
||||
@@ -948,13 +950,51 @@ config ESP32S3_WIFI_SCAN_RESULT_SIZE
|
||||
|
||||
config ESP32S3_WIFI_STA_DISCONNECT_PM
|
||||
bool "Power Management for station when disconnected"
|
||||
default n
|
||||
default y
|
||||
---help---
|
||||
Select this option to enable power management for station when disconnected.
|
||||
Chip will do modem-sleep when RF module is not in use anymore.
|
||||
|
||||
config EXAMPLE_WIFI_LISTEN_INTERVAL
|
||||
choice ESP32S3_POWER_SAVE_MODE
|
||||
prompt "Wi-Fi Power save mode"
|
||||
default ESP32S3_POWER_SAVE_MIN_MODEM if ESP32S3_WIFI_BT_COEXIST
|
||||
default ESP32S3_POWER_SAVE_NONE
|
||||
---help---
|
||||
Wi-Fi supports the Modem-sleep mode which refers to the legacy power-saving mode in the IEEE 802.11 protocol.
|
||||
Modem-sleep mode works in station-only mode and the station must connect to the AP first. If the Modem-sleep
|
||||
mode is enabled, station will switch between active and sleep state periodically. In sleep state, RF, PHY and
|
||||
BB are turned off in order to reduce power consumption. Station can keep connection with AP in modem-sleep mode.
|
||||
|
||||
Modem-sleep mode includes minimum and maximum power-saving modes.
|
||||
|
||||
In minimum power-saving mode, station wakes
|
||||
up every DTIM to receive beacon. Broadcast data will not be lost because it is transmitted after DTIM.
|
||||
However, it cannot save much more power if DTIM is short for DTIM is determined by AP.
|
||||
|
||||
In maximum power-saving mode, station wakes up in every listen interval to receive beacon. This listen interval
|
||||
can be set to be longer than the AP DTIM period. Broadcast data may be lost because station may be in sleep
|
||||
state at DTIM time. If listen interval is longer, more power is saved, but broadcast data is more easy to lose.
|
||||
Listen interval can be configured by setting ESP32S3_WIFI_LISTEN_INTERVAL.
|
||||
|
||||
ESP32S3_POWER_SAVE_NONE disables Modem-sleep mode entirely. Disabling it increases power consumption, but
|
||||
minimizes the delay in receiving Wi-Fi data in real time. When Modem-sleep mode is enabled, the delay in
|
||||
receiving Wi-Fi data may be the same as the DTIM cycle (minimum power-saving mode) or the listening interval
|
||||
(maximum power-saving mode). Setting ESP32S3_POWER_SAVE_NONE is suitable when high throughput is required.
|
||||
|
||||
config ESP32S3_POWER_SAVE_NONE
|
||||
bool "No power save"
|
||||
|
||||
config ESP32S3_POWER_SAVE_MIN_MODEM
|
||||
bool "Minimum modem power saving."
|
||||
|
||||
config ESP32S3_POWER_SAVE_MAX_MODEM
|
||||
bool "Maximum modem power saving"
|
||||
|
||||
endchoice # ESP32S3_POWER_SAVE_MODE
|
||||
|
||||
config ESP32S3_WIFI_LISTEN_INTERVAL
|
||||
int "Wi-Fi listen interval"
|
||||
depends on ESP32S3_POWER_SAVE_MAX_MODEM
|
||||
default 3
|
||||
---help---
|
||||
Interval for station to listen to beacon from AP. The unit of listen interval is one beacon interval.
|
||||
|
||||
@@ -48,6 +48,7 @@ context:: chip/$(ESP_HAL_3RDPARTY_REPO)
|
||||
distclean::
|
||||
$(call DELDIR, chip/$(ESP_HAL_3RDPARTY_REPO))
|
||||
|
||||
INCLUDES += ${INCDIR_PREFIX}$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_coex$(DELIM)include
|
||||
INCLUDES += ${INCDIR_PREFIX}$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_common$(DELIM)include
|
||||
INCLUDES += ${INCDIR_PREFIX}$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)bt$(DELIM)include$(DELIM)esp32c3$(DELIM)include
|
||||
INCLUDES += ${INCDIR_PREFIX}$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_event$(DELIM)include
|
||||
@@ -103,13 +104,19 @@ INCLUDES += ${INCDIR_PREFIX}$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY
|
||||
CFLAGS += ${DEFINE_PREFIX}MBEDTLS_CONFIG_FILE="<mbedtls/esp_config.h>"
|
||||
|
||||
CHIP_CSRCS += aes.c
|
||||
CHIP_CSRCS += aria.c
|
||||
CHIP_CSRCS += bignum_core.c
|
||||
CHIP_CSRCS += bignum.c
|
||||
CHIP_CSRCS += ccm.c
|
||||
CHIP_CSRCS += cipher.c
|
||||
CHIP_CSRCS += cipher_wrap.c
|
||||
CHIP_CSRCS += cmac.c
|
||||
CHIP_CSRCS += constant_time.c
|
||||
CHIP_CSRCS += ctr_drbg.c
|
||||
CHIP_CSRCS += ecp_curves.c
|
||||
CHIP_CSRCS += ecp.c
|
||||
CHIP_CSRCS += entropy.c
|
||||
CHIP_CSRCS += gcm.c
|
||||
CHIP_CSRCS += md.c
|
||||
CHIP_CSRCS += pkcs5.c
|
||||
CHIP_CSRCS += platform_util.c
|
||||
|
||||
@@ -2663,6 +2663,10 @@ error:
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_ESP32S3_WIFI_BT_COEXIST
|
||||
coex_disable();
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -828,7 +828,7 @@ int esp_wifi_softap_rssi(struct iwreq *iwr, bool set);
|
||||
* Name: esp32s3_wifi_bt_coexist_init
|
||||
*
|
||||
* Description:
|
||||
* Initialize ESP32-C3 Wi-Fi and BT coexistance module.
|
||||
* Initialize ESP32-S3 Wi-Fi and BT coexistance module.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_ARCH_LEDS is not set
|
||||
# CONFIG_NDEBUG is not set
|
||||
# CONFIG_NSH_ARGCAT is not set
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ALLOW_BSD_COMPONENTS=y
|
||||
CONFIG_ARCH="xtensa"
|
||||
CONFIG_ARCH_BOARD="esp32s3-devkit"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_ESP32S3_DEVKIT=y
|
||||
CONFIG_ARCH_CHIP="esp32s3"
|
||||
CONFIG_ARCH_CHIP_ESP32S3=y
|
||||
CONFIG_ARCH_CHIP_ESP32S3WROOM1=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_XTENSA=y
|
||||
CONFIG_BLUETOOTH_TXCMD_PRIORITY=120
|
||||
CONFIG_BLUETOOTH_TXCONN_PRIORITY=119
|
||||
CONFIG_BOARDCTL_RESET=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||
CONFIG_BTSAK=y
|
||||
CONFIG_BTSAK_STACKSIZE=8192
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEFAULT_TASK_STACKSIZE=4096
|
||||
CONFIG_DRIVERS_BLUETOOTH=y
|
||||
CONFIG_DRIVERS_IEEE80211=y
|
||||
CONFIG_DRIVERS_WIRELESS=y
|
||||
CONFIG_ESP32S3_BLE=y
|
||||
CONFIG_ESP32S3_RT_TIMER_TASK_STACK_SIZE=4096
|
||||
CONFIG_ESP32S3_UART0=y
|
||||
CONFIG_ESP32S3_WIFI=y
|
||||
CONFIG_ESP32S3_WIFI_STATION_SOFTAP=y
|
||||
CONFIG_EXAMPLES_DHCPD=y
|
||||
CONFIG_EXAMPLES_RANDOM=y
|
||||
CONFIG_FS_LARGEFILE=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=3072
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INIT_STACKSIZE=8192
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_IOB_NBUFFERS=124
|
||||
CONFIG_IOB_THROTTLE=24
|
||||
CONFIG_MTD=y
|
||||
CONFIG_MTD_BYTE_WRITE=y
|
||||
CONFIG_MTD_PARTITION=y
|
||||
CONFIG_NAME_MAX=48
|
||||
CONFIG_NETDB_DNSCLIENT=y
|
||||
CONFIG_NETDEV_LATEINIT=y
|
||||
CONFIG_NETDEV_PHY_IOCTL=y
|
||||
CONFIG_NETDEV_WIRELESS_IOCTL=y
|
||||
CONFIG_NETINIT_DHCPC=y
|
||||
CONFIG_NETUTILS_CJSON=y
|
||||
CONFIG_NETUTILS_DHCPD=y
|
||||
CONFIG_NETUTILS_IPERF=y
|
||||
CONFIG_NET_BLUETOOTH=y
|
||||
CONFIG_NET_BROADCAST=y
|
||||
CONFIG_NET_ETH_PKTSIZE=1514
|
||||
CONFIG_NET_ICMP=y
|
||||
CONFIG_NET_ICMP_SOCKET=y
|
||||
CONFIG_NET_TCP=y
|
||||
CONFIG_NET_TCP_DELAYED_ACK=y
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NET_UDP_WRITE_BUFFERS=y
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=2048
|
||||
CONFIG_PREALLOC_MQ_MSGS=64
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_PTHREAD_MUTEX_TYPES=y
|
||||
CONFIG_RAM_SIZE=114688
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SIG_DEFAULT=y
|
||||
CONFIG_SPINLOCK=y
|
||||
CONFIG_START_DAY=6
|
||||
CONFIG_START_MONTH=12
|
||||
CONFIG_START_YEAR=2011
|
||||
CONFIG_SYSTEM_DHCPC_RENEW=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_PING=y
|
||||
CONFIG_TIMER=y
|
||||
CONFIG_TLS_NELEM=4
|
||||
CONFIG_TLS_TASK_NELEM=4
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
CONFIG_WIRELESS=y
|
||||
CONFIG_WIRELESS_BLUETOOTH=y
|
||||
CONFIG_WIRELESS_WAPI=y
|
||||
CONFIG_WIRELESS_WAPI_CMDTOOL=y
|
||||
CONFIG_WIRELESS_WAPI_STACKSIZE=8192
|
||||
@@ -50,6 +50,10 @@
|
||||
# include "esp32s3_ble.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32S3_WIFI_BT_COEXIST
|
||||
# include "esp32s3_wifi_adapter.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32S3_RT_TIMER
|
||||
# include "esp32s3_rt_timer.h"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user