Skip to content

Commit

Permalink
drivers: wifi: Add ESP8266 and ESP32 wifi modem driver
Browse files Browse the repository at this point in the history
This adds support for the Espressif ESP8266 and ESP32 devices to be used
as peripherals on a UART.

There are two main AT command versions that can be selected, 1.7 and
2.0. Since they behave a bit different it is important to select the
one that matches the used in the firmware on your device.

When downloading large amounts of data it is highly recommended to
enable CONFIG_ESP_PASSIVE_TCP and flow control on the UART so that
data is not lost due to UART speed or receive buffer size.

Currently unsupported:
- Changing UDP endpoint with a sendto()
- Bind to a specific local port
- Server socket operations, ie listen() and accept()

Official AT firmware for ESP8266 and ESP32 can be found at:
https://github.com/espressif/esp-at

Signed-off-by: Tobias Svehagen <[email protected]>
  • Loading branch information
tsvehagen authored and hakehuang committed Apr 30, 2020
1 parent 1f12d58 commit ea555f8
Show file tree
Hide file tree
Showing 9 changed files with 1,967 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/wifi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
add_subdirectory_ifdef(CONFIG_WIFI_WINC1500 winc1500)
add_subdirectory_ifdef(CONFIG_WIFI_SIMPLELINK simplelink)
add_subdirectory_ifdef(CONFIG_WIFI_ESWIFI eswifi)
add_subdirectory_ifdef(CONFIG_WIFI_ESP esp)
1 change: 1 addition & 0 deletions drivers/wifi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ config WIFI_OFFLOAD
source "drivers/wifi/winc1500/Kconfig.winc1500"
source "drivers/wifi/simplelink/Kconfig.simplelink"
source "drivers/wifi/eswifi/Kconfig.eswifi"
source "drivers/wifi/esp/Kconfig.esp"

endif # WIFI
15 changes: 15 additions & 0 deletions drivers/wifi/esp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-License-Identifier: Apache-2.0

if(CONFIG_WIFI_ESP)
zephyr_include_directories(./)

zephyr_library_include_directories(
${ZEPHYR_BASE}/drivers/modem
)

zephyr_sources(
esp.c
esp_socket.c
esp_offload.c
)
endif()
70 changes: 70 additions & 0 deletions drivers/wifi/esp/Kconfig.esp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Copyright (c) 2019 Tobias Svehagen
# SPDX-License-Identifier: Apache-2.0

menuconfig WIFI_ESP
bool "Espressif ESP8266 and ESP32 support"
select MODEM
select MODEM_CONTEXT
select MODEM_CMD_HANDLER
select MODEM_IFACE_UART
select NET_L2_WIFI_MGMT
select WIFI_OFFLOAD

if WIFI_ESP

config WIFI_ESP_NAME
string "Driver name"
default "esp-wifi-modem"

config WIFI_ESP_RX_STACK_SIZE
int "Stack size for the Espressif esp wifi driver RX thread"
default 1024
help
This stack is used by the Espressif ESP RX thread.

config WIFI_ESP_RX_THREAD_PRIORITY
int "Priority of RX thread"
default 7
help
Priority of thread used for processing RX data.

config WIFI_ESP_WORKQ_STACK_SIZE
int "Stack size for the esp driver work queue"
default 2048
help
This stack is used by the work queue to pass off net_pkt data
to the rest of the network stack, letting the rx thread continue
processing data.

config WIFI_ESP_WORKQ_THREAD_PRIORITY
int "Priority of work queue thread"
default 7
help
Priority of thread used for processing driver work queue items.

config WIFI_ESP_PASSIVE_TCP
bool "Use passive TCP"
help
This lets the ESP handle the TCP window so that data can flow
at a rate that the driver can handle. Without this, data might get
lost if the driver cannot empty the device buffer quickly enough.

choice
prompt "AT version"
default WIFI_ESP_AT_VERSION_2_0
help
Select which version of AT command set should be used.

config WIFI_ESP_AT_VERSION_1_7
bool "AT version 1.7"
help
Use AT command set version 1.7.

config WIFI_ESP_AT_VERSION_2_0
bool "AT version 2.0"
help
Use AT command set version 2.0.

endchoice

endif # WIFI_ESP
Loading

0 comments on commit ea555f8

Please sign in to comment.