mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esp_wifi: support esp32s2beta A, B and marlin3 chip
This commit is contained in:
parent
7ce75a42c7
commit
5ffb42b4dd
@ -4,6 +4,26 @@ menu "ESP32S2-specific"
|
||||
# not working so we just hide all items here
|
||||
visible if IDF_TARGET_ESP32S2BETA
|
||||
|
||||
choice ESP32S2_BETA_CHIP_VERSION
|
||||
# TODO: remove once final S2 chip is supported
|
||||
prompt "ESP32-S2 Beta chip version"
|
||||
default ESP32S2_BETA_VERSION_MARLIN3
|
||||
help
|
||||
There are three versions of ESP32-S2 beta chip with different Wi-Fi PHY: A, B and Marlin3.
|
||||
|
||||
The correct setting is required for Wi-Fi to work correctly. If unsure which version you
|
||||
have, please contact Espressif.
|
||||
|
||||
The Wi-Fi performance of Marlin3 is the best among the three versions of chip.
|
||||
|
||||
config ESP32S2_BETA_VERSION_A
|
||||
bool "Version A"
|
||||
config ESP32S2_BETA_VERSION_B
|
||||
bool "Version B"
|
||||
config ESP32S2_BETA_VERSION_MARLIN3
|
||||
bool "Version Marlin3"
|
||||
endchoice
|
||||
|
||||
choice ESP32S2_DEFAULT_CPU_FREQ_MHZ
|
||||
prompt "CPU frequency"
|
||||
default ESP32S2_DEFAULT_CPU_FREQ_160
|
||||
|
@ -38,13 +38,15 @@
|
||||
#include "esp_private/wifi_os_adapter.h"
|
||||
#include "esp_private/wifi.h"
|
||||
#include "esp_phy_init.h"
|
||||
#if CONFIG_IDF_TARGET_ESP32S2BETA
|
||||
#include "esp32s2beta/clk.h"
|
||||
#endif
|
||||
#include "driver/periph_ctrl.h"
|
||||
#include "nvs.h"
|
||||
#include "os.h"
|
||||
#include "esp_smartconfig.h"
|
||||
#include "esp_coexist_internal.h"
|
||||
#include "esp_coexist_adapter.h"
|
||||
#include "esp32s2beta/clk.h"
|
||||
|
||||
#define TAG "esp_adapter"
|
||||
|
||||
@ -437,6 +439,13 @@ static uint32_t coex_status_get_wrapper(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void coex_condition_set_wrapper(uint32_t type, bool dissatisfy)
|
||||
{
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
coex_condition_set(type, dissatisfy);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int coex_wifi_request_wrapper(uint32_t event, uint32_t latency, uint32_t duration)
|
||||
{
|
||||
#if CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE
|
||||
@ -576,7 +585,9 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
|
||||
._get_random = os_get_random,
|
||||
._get_time = get_time_wrapper,
|
||||
._random = os_random,
|
||||
#if CONFIG_IDF_TARGET_ESP32S2BETA
|
||||
._slowclk_cal_get = esp_clk_slowclk_cal_get,
|
||||
#endif
|
||||
._log_write = esp_log_write,
|
||||
._log_timestamp = esp_log_timestamp,
|
||||
._malloc_internal = malloc_internal_wrapper,
|
||||
@ -594,6 +605,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
|
||||
._modem_sleep_register = esp_modem_sleep_register,
|
||||
._modem_sleep_deregister = esp_modem_sleep_deregister,
|
||||
._coex_status_get = coex_status_get_wrapper,
|
||||
._coex_condition_set = coex_condition_set_wrapper,
|
||||
._coex_wifi_request = coex_wifi_request_wrapper,
|
||||
._coex_wifi_release = coex_wifi_release_wrapper,
|
||||
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
|
||||
|
@ -23,7 +23,20 @@ idf_build_get_property(build_dir BUILD_DIR)
|
||||
target_link_libraries(${COMPONENT_LIB} PUBLIC "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib_${idf_target}")
|
||||
|
||||
if(link_binary_libs)
|
||||
set(blobs coexist core espnow mesh net80211 phy pp rtc smartconfig)
|
||||
if(CONFIG_IDF_TARGET_ESP32)
|
||||
set(phy phy)
|
||||
elseif(CONFIG_IDF_TARGET_ESP32S2BETA)
|
||||
# TODO: remove once final S2 chip is supported
|
||||
if(CONFIG_ESP32S2_BETA_VERSION_A)
|
||||
set(phy phyA)
|
||||
elseif(CONFIG_ESP32S2_BETA_VERSION_B)
|
||||
set(phy phyB)
|
||||
elseif(CONFIG_ESP32S2_BETA_VERSION_MARLIN3)
|
||||
set(phy phy_marlin3)
|
||||
endif()
|
||||
endif()
|
||||
set(blobs coexist core espnow mesh net80211 pp rtc smartconfig ${phy})
|
||||
|
||||
foreach(blob ${blobs})
|
||||
add_library(${blob} STATIC IMPORTED)
|
||||
set_property(TARGET ${blob} PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/lib_${idf_target}/lib${blob}.a)
|
||||
@ -59,5 +72,16 @@ if(CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION)
|
||||
add_custom_target(phy_init_data ALL DEPENDS ${phy_init_data_bin})
|
||||
add_dependencies(flash phy_init_data)
|
||||
|
||||
esptool_py_flash_project_args(phy ${phy_partition_offset} ${phy_init_data_bin} FLASH_IN_PROJECT)
|
||||
# ToDo: remove once MP chip is supported
|
||||
if(CONFIG_IDF_TARGET_ESP32)
|
||||
esptool_py_flash_project_args(phy ${phy_partition_offset} ${phy_init_data_bin} FLASH_IN_PROJECT)
|
||||
elseif(CONFIG_IDF_TARGET_ESP32S2BETA)
|
||||
if(CONFIG_ESP32S2BETA_VERSION_A)
|
||||
esptool_py_flash_project_args(phyA ${phy_partition_offset} ${phy_init_data_bin} FLASH_IN_PROJECT)
|
||||
elseif(CONFIG_ESP32S2BETA_VERSION_B)
|
||||
esptool_py_flash_project_args(phyB ${phy_partition_offset} ${phy_init_data_bin} FLASH_IN_PROJECT)
|
||||
elseif(CONFIG_ESP32S2BETA_VERSION_MARLIN3)
|
||||
esptool_py_flash_project_args(phy_marlin3 ${phy_partition_offset} ${phy_init_data_bin} FLASH_IN_PROJECT)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
@ -59,6 +59,13 @@ void phy_set_wifi_mode_only(bool wifi_only);
|
||||
*/
|
||||
void coex_bt_high_prio(void);
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32S2BETA
|
||||
/**
|
||||
* @brief Open PHY and RF.
|
||||
*/
|
||||
void phy_wakeup_init(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Shutdown PHY and RF.
|
||||
*/
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 1068594fee5fd8a73b353c4e77ff3b44d111393d
|
||||
Subproject commit 1d830bc2433b6e166d23329c612db6b86aabc59b
|
@ -1 +1 @@
|
||||
Subproject commit 958c437eb1844da9725a2608be3afc500ebda688
|
||||
Subproject commit 8ea1c651254560c59f816c9d16aa71322dcd15e5
|
@ -163,6 +163,12 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, esp_phy_calibrat
|
||||
periph_module_enable(PERIPH_WIFI_BT_COMMON_MODULE);
|
||||
phy_set_wifi_mode_only(0);
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32S2BETA
|
||||
if (module == PHY_MODEM_MODULE) {
|
||||
phy_wakeup_init();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (ESP_CAL_DATA_CHECK_FAIL == register_chipv7_phy(init_data, calibration_data, mode)) {
|
||||
ESP_LOGW(TAG, "saving new calibration data because of checksum failure, mode(%d)", mode);
|
||||
#ifdef CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE
|
||||
@ -172,7 +178,9 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, esp_phy_calibrat
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
coex_bt_high_prio();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,10 +50,14 @@ Before building an ESP-IDF project, run the following command to switch the targ
|
||||
|
||||
.. important:: Running ``set-target`` will clear the project configuration and create a new empty ``sdkconfig`` file for the project. The old configuration will be saved in ``sdkconfig.old``.
|
||||
|
||||
Then configure and build the project as usual, for example::
|
||||
Then configure the project::
|
||||
|
||||
idf.py menuconfig
|
||||
|
||||
.. important:: There are 3 versions of ESP32-S2 Beta engineering sample available with different Wi-Fi PHYs. The correct setting must be chosen in the project setting ``CONFIG_ESP32S2_BETA_CHIP_VERSION`` (found under Component Config -> ESP32S2-specific) for Wi-Fi to work correctly. If the selected version doesn't match the chip then Wi-Fi performance may be very poor, or the chip may crash when initializing Wi-Fi. If unsure which version you have, please contact Espressif.
|
||||
|
||||
Build and flash the project as usual, for example::
|
||||
|
||||
idf.py -p PORT flash monitor
|
||||
|
||||
Consult the :doc:`/get-started/index` guide for more details on building and flashing an ESP-IDF project.
|
||||
|
Loading…
x
Reference in New Issue
Block a user