Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IEEE 802.15.4 support for ESP32-C6 #82876

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
5 changes: 5 additions & 0 deletions boards/espressif/esp32c6_devkitc/esp32c6_devkitc.dts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
zephyr,shell-uart = &uart0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
zephyr,ieee802154 = &ieee802154;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably go to the sample overlay.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't thinks so. See previous comment.

};

aliases {
Expand Down Expand Up @@ -71,3 +72,7 @@
&wdt0 {
status = "okay";
};

&ieee802154 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This 'enable' should go into a samples/.../shell/socs/esp32c6.overlay

Copy link
Member Author

@martinjaeger martinjaeger Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't think so. It is also enabled in the board file of nrf52840dk and many other boards. The sample should just enable OpenThread via Kconfig.

status = "okay";
};
1 change: 1 addition & 0 deletions boards/espressif/esp32c6_devkitc/esp32c6_devkitc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ supported:
- counter
- entropy
- i2c
- netif:openthread
5 changes: 5 additions & 0 deletions boards/seeed/xiao_esp32c6/xiao_esp32c6.dts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
zephyr,shell-uart = &usb_serial;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
zephyr,ieee802154 = &ieee802154;
};

leds: leds {
Expand Down Expand Up @@ -76,3 +77,7 @@
pinctrl-0 = <&uart0_default>;
pinctrl-names = "default";
};

&ieee802154 {
status = "okay";
};
1 change: 1 addition & 0 deletions boards/seeed/xiao_esp32c6/xiao_esp32c6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ supported:
- spi
- entropy
- i2c
- netif:openthread
testing:
ignore_tags:
- tracing
Expand Down
1 change: 1 addition & 0 deletions drivers/ieee802154/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ zephyr_library_sources_ifdef(CONFIG_IEEE802154_CC13XX_CC26XX_SUB_GHZ
)
zephyr_library_sources_ifdef(CONFIG_IEEE802154_CC2520 ieee802154_cc2520.c)
zephyr_library_sources_ifdef(CONFIG_IEEE802154_DW1000 ieee802154_dw1000.c)
zephyr_library_sources_ifdef(CONFIG_IEEE802154_ESP32 ieee802154_esp32.c)
zephyr_library_sources_ifdef(CONFIG_IEEE802154_KW41Z ieee802154_kw41z.c)
zephyr_library_sources_ifdef(CONFIG_IEEE802154_MCR20A ieee802154_mcr20a.c)
zephyr_library_sources_ifdef(CONFIG_IEEE802154_NRF5 ieee802154_nrf5.c)
Expand Down
2 changes: 2 additions & 0 deletions drivers/ieee802154/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ source "drivers/ieee802154/Kconfig.rf2xx"

source "drivers/ieee802154/Kconfig.dw1000"

source "drivers/ieee802154/Kconfig.esp32"

source "drivers/ieee802154/Kconfig.uart_pipe"

config IEEE802154_CSL_ENDPOINT
Expand Down
205 changes: 205 additions & 0 deletions drivers/ieee802154/Kconfig.esp32
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
# Espressif ESP32 802.15.4 configuration options

# Copyright (c) 2024 A Labs GmbH
# SPDX-License-Identifier: Apache-2.0

menuconfig IEEE802154_ESP32
bool "ESP32 series IEEE 802.15.4 Driver"
default y
depends on DT_HAS_ESPRESSIF_ESP32_IEEE802154_ENABLED

if IEEE802154_ESP32

config IEEE802154_ESP32_INIT_PRIO
int "ESP32 IEEE 802.15.4 initialization priority"
default 80
help
Set the initialization priority number. Do not mess with it unless
you know what you are doing.

# Kconfigs copied from Espressif HAL module (ESP-IDF) below

config IEEE802154_RX_BUFFER_SIZE
int "Number of 802.15.4 receive buffers"
default 20
range 2 100
help
The number of 802.15.4 receive buffers.

This config is used in the Espressif HAL module.

choice IEEE802154_CCA_MODE
prompt "Clear Channel Assessment (CCA) mode"
default IEEE802154_CCA_ED
help
Configure the CCA mode

This config is used in the Espressif HAL module.

config IEEE802154_CCA_CARRIER
bool "Carrier sense only"
help
Configure the CCA mode to Carrier sense only

config IEEE802154_CCA_ED
bool "Energy above threshold"
help
Configure the CCA mode to Energy above threshold

config IEEE802154_CCA_CARRIER_OR_ED
bool "Carrier sense OR energy above threshold"
help
Configure the CCA mode to Carrier sense OR energy above threshold

config IEEE802154_CCA_CARRIER_AND_ED
bool "Carrier sense AND energy above threshold"
help
Configure the CCA mode to Carrier sense AND energy above threshold

endchoice # IEEE802154_CCA_MODE

config IEEE802154_CCA_MODE
int
default 0 if IEEE802154_CCA_CARRIER
default 1 if IEEE802154_CCA_ED
default 2 if IEEE802154_CCA_CARRIER_OR_ED
default 3 if IEEE802154_CCA_CARRIER_AND_ED

config IEEE802154_CCA_THRESHOLD
int "CCA detection threshold"
range -120 0
default -60
help
Set the CCA threshold, in dB.

This config is used in the Espressif HAL module.

config IEEE802154_PENDING_TABLE_SIZE
int "Pending table size"
range 1 100
default 20
help
set the pending table size

config IEEE802154_MULTI_PAN_ENABLE
bool "Multi-pan feature for frame filter"
help
Enable IEEE802154 multi-pan

This config is used in the Espressif HAL module.

config IEEE802154_TIMING_OPTIMIZATION
bool "Throughput optimization"
help
Enabling this option increases throughput by ~5% at the expense of ~2.1k
IRAM code size increase.

This config is used in the Espressif HAL module.

config IEEE802154_SLEEP_ENABLE
# Todo: Remove when support safe power-down of the power domain (IDF-7317)
bool "IEEE802154 light sleep"
depends on PM
help
Enabling this option allows the IEEE802.15.4 module to be powered down during automatic
light sleep, which reduces current consumption.

This is currently untested in Zephyr. Use with caution.

This config is used in the Espressif HAL module.

menuconfig IEEE802154_DEBUG
bool "IEEE802154 Debug"
help
Enabling this option allows different kinds of IEEE802154 debug output.
All IEEE802154 debug features increase the size of the final binary.

config IEEE802154_ASSERT
bool "Enrich the assert information with IEEE802154 state and event"
depends on IEEE802154_DEBUG
default n
help
Enabling this option to add some probe codes in the driver, and this information
will be printed when assert.

This config is used in the Espressif HAL module.

config IEEE802154_RECORD_EVENT
bool "Record event information for debugging"
depends on IEEE802154_DEBUG
help
Enabling this option to record event, when assert, the recorded event will be printed.

config IEEE802154_RECORD_EVENT_SIZE
int "Record event table size"
depends on IEEE802154_RECORD_EVENT
range 1 50
default 30
help
Set the record event table size

This config is used in the Espressif HAL module.

config IEEE802154_RECORD_STATE
bool "Record state information for debugging"
depends on IEEE802154_DEBUG
help
Enabling this option to record state, when assert, the recorded state will be printed.

This config is used in the Espressif HAL module.

config IEEE802154_RECORD_STATE_SIZE
int "Record state table size"
depends on IEEE802154_RECORD_STATE
range 1 50
default 10
help
Set the record state table size.

This config is used in the Espressif HAL module.

config IEEE802154_RECORD_CMD
bool "Record command information for debugging"
depends on IEEE802154_DEBUG
help
Enable this option to record the command information.

This config is used in the Espressif HAL module.

config IEEE802154_RECORD_CMD_SIZE
int "Record command table size"
depends on IEEE802154_RECORD_CMD
range 1 50
default 10
help
Set the record command table size.

This config is used in the Espressif HAL module.

config IEEE802154_RECORD_ABORT
bool "Record abort information for debugging"
depends on IEEE802154_DEBUG
help
Enable this option to record abort information.

This config is used in the Espressif HAL module.

config IEEE802154_RECORD_ABORT_SIZE
int "Record abort table size"
depends on IEEE802154_RECORD_ABORT
range 1 50
default 10
help
Set the record abort table size.

This config is used in the Espressif HAL module.

config IEEE802154_TXRX_STATISTIC
bool "Record tx/rx packet information for debugging"
depends on IEEE802154_DEBUG
help
Enable this option to record tx and rx packet information.

This config is used in the Espressif HAL module.

endif # IEEE802154_ESP32
Loading
Loading