Skip to content

Commit d7ad693

Browse files
martinjaegerMarek Matej
authored andcommitted
drivers: ieee802154: Add implementation for ESP32 series (DRAFT)
Draft implementation of the IEEE 802.15.4 driver using Espressif HAL. Signed-off-by: Martin Jäger <[email protected]>
1 parent 100f509 commit d7ad693

File tree

7 files changed

+799
-3
lines changed

7 files changed

+799
-3
lines changed

drivers/ieee802154/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ zephyr_library_sources_ifdef(CONFIG_IEEE802154_CC13XX_CC26XX_SUB_GHZ
1313
)
1414
zephyr_library_sources_ifdef(CONFIG_IEEE802154_CC2520 ieee802154_cc2520.c)
1515
zephyr_library_sources_ifdef(CONFIG_IEEE802154_DW1000 ieee802154_dw1000.c)
16+
zephyr_library_sources_ifdef(CONFIG_IEEE802154_ESP32 ieee802154_esp32.c)
1617
zephyr_library_sources_ifdef(CONFIG_IEEE802154_KW41Z ieee802154_kw41z.c)
1718
zephyr_library_sources_ifdef(CONFIG_IEEE802154_MCR20A ieee802154_mcr20a.c)
1819
zephyr_library_sources_ifdef(CONFIG_IEEE802154_MCXW ieee802154_mcxw.c ieee802154_mcxw_utils.c)

drivers/ieee802154/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ source "drivers/ieee802154/Kconfig.rf2xx"
8888

8989
source "drivers/ieee802154/Kconfig.dw1000"
9090

91+
source "drivers/ieee802154/Kconfig.esp32"
92+
9193
source "drivers/ieee802154/Kconfig.uart_pipe"
9294

9395
config IEEE802154_CSL_ENDPOINT

drivers/ieee802154/Kconfig.esp32

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
# Espressif ESP32 802.15.4 configuration options
2+
3+
# Copyright (c) 2024 A Labs GmbH
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
menuconfig IEEE802154_ESP32
7+
bool "ESP32 series IEEE 802.15.4 Driver"
8+
default y
9+
depends on DT_HAS_ESPRESSIF_ESP32_IEEE802154_ENABLED
10+
11+
if IEEE802154_ESP32
12+
13+
config IEEE802154_ESP32_INIT_PRIO
14+
int "ESP32 IEEE 802.15.4 initialization priority"
15+
default 80
16+
help
17+
Set the initialization priority number. Do not mess with it unless
18+
you know what you are doing.
19+
20+
# Kconfigs copied from Espressif HAL module (ESP-IDF) below
21+
22+
config IEEE802154_RX_BUFFER_SIZE
23+
int "Number of 802.15.4 receive buffers"
24+
default 20
25+
range 2 100
26+
help
27+
The number of 802.15.4 receive buffers.
28+
29+
This config is used in the Espressif HAL module.
30+
31+
choice IEEE802154_CCA_MODE
32+
prompt "Clear Channel Assessment (CCA) mode"
33+
default IEEE802154_CCA_ED
34+
help
35+
Configure the CCA mode
36+
37+
This config is used in the Espressif HAL module.
38+
39+
config IEEE802154_CCA_CARRIER
40+
bool "Carrier sense only"
41+
help
42+
Configure the CCA mode to Carrier sense only
43+
44+
config IEEE802154_CCA_ED
45+
bool "Energy above threshold"
46+
help
47+
Configure the CCA mode to Energy above threshold
48+
49+
config IEEE802154_CCA_CARRIER_OR_ED
50+
bool "Carrier sense OR energy above threshold"
51+
help
52+
Configure the CCA mode to Carrier sense OR energy above threshold
53+
54+
config IEEE802154_CCA_CARRIER_AND_ED
55+
bool "Carrier sense AND energy above threshold"
56+
help
57+
Configure the CCA mode to Carrier sense AND energy above threshold
58+
59+
endchoice # IEEE802154_CCA_MODE
60+
61+
config IEEE802154_CCA_MODE
62+
int
63+
default 0 if IEEE802154_CCA_CARRIER
64+
default 1 if IEEE802154_CCA_ED
65+
default 2 if IEEE802154_CCA_CARRIER_OR_ED
66+
default 3 if IEEE802154_CCA_CARRIER_AND_ED
67+
68+
config IEEE802154_CCA_THRESHOLD
69+
int "CCA detection threshold"
70+
range -120 0
71+
default -60
72+
help
73+
Set the CCA threshold, in dB.
74+
75+
This config is used in the Espressif HAL module.
76+
77+
config IEEE802154_PENDING_TABLE_SIZE
78+
int "Pending table size"
79+
range 1 100
80+
default 20
81+
help
82+
set the pending table size
83+
84+
config IEEE802154_MULTI_PAN_ENABLE
85+
bool "Multi-pan feature for frame filter"
86+
help
87+
Enable IEEE802154 multi-pan
88+
89+
This config is used in the Espressif HAL module.
90+
91+
config IEEE802154_TIMING_OPTIMIZATION
92+
bool "Throughput optimization"
93+
help
94+
Enabling this option increases throughput by ~5% at the expense of ~2.1k
95+
IRAM code size increase.
96+
97+
This config is used in the Espressif HAL module.
98+
99+
config IEEE802154_SLEEP_ENABLE
100+
# Todo: Remove when support safe power-down of the power domain (IDF-7317)
101+
bool "IEEE802154 light sleep"
102+
depends on PM
103+
help
104+
Enabling this option allows the IEEE802.15.4 module to be powered down during automatic
105+
light sleep, which reduces current consumption.
106+
107+
This is currently untested in Zephyr. Use with caution.
108+
109+
This config is used in the Espressif HAL module.
110+
111+
menuconfig IEEE802154_DEBUG
112+
bool "IEEE802154 Debug"
113+
help
114+
Enabling this option allows different kinds of IEEE802154 debug output.
115+
All IEEE802154 debug features increase the size of the final binary.
116+
117+
config IEEE802154_ASSERT
118+
bool "Enrich the assert information with IEEE802154 state and event"
119+
depends on IEEE802154_DEBUG
120+
default n
121+
help
122+
Enabling this option to add some probe codes in the driver, and this information
123+
will be printed when assert.
124+
125+
This config is used in the Espressif HAL module.
126+
127+
config IEEE802154_RECORD_EVENT
128+
bool "Record event information for debugging"
129+
depends on IEEE802154_DEBUG
130+
help
131+
Enabling this option to record event, when assert, the recorded event will be printed.
132+
133+
config IEEE802154_RECORD_EVENT_SIZE
134+
int "Record event table size"
135+
depends on IEEE802154_RECORD_EVENT
136+
range 1 50
137+
default 30
138+
help
139+
Set the record event table size
140+
141+
This config is used in the Espressif HAL module.
142+
143+
config IEEE802154_RECORD_STATE
144+
bool "Record state information for debugging"
145+
depends on IEEE802154_DEBUG
146+
help
147+
Enabling this option to record state, when assert, the recorded state will be printed.
148+
149+
This config is used in the Espressif HAL module.
150+
151+
config IEEE802154_RECORD_STATE_SIZE
152+
int "Record state table size"
153+
depends on IEEE802154_RECORD_STATE
154+
range 1 50
155+
default 10
156+
help
157+
Set the record state table size.
158+
159+
This config is used in the Espressif HAL module.
160+
161+
config IEEE802154_RECORD_CMD
162+
bool "Record command information for debugging"
163+
depends on IEEE802154_DEBUG
164+
help
165+
Enable this option to record the command information.
166+
167+
This config is used in the Espressif HAL module.
168+
169+
config IEEE802154_RECORD_CMD_SIZE
170+
int "Record command table size"
171+
depends on IEEE802154_RECORD_CMD
172+
range 1 50
173+
default 10
174+
help
175+
Set the record command table size.
176+
177+
This config is used in the Espressif HAL module.
178+
179+
config IEEE802154_RECORD_ABORT
180+
bool "Record abort information for debugging"
181+
depends on IEEE802154_DEBUG
182+
help
183+
Enable this option to record abort information.
184+
185+
This config is used in the Espressif HAL module.
186+
187+
config IEEE802154_RECORD_ABORT_SIZE
188+
int "Record abort table size"
189+
depends on IEEE802154_RECORD_ABORT
190+
range 1 50
191+
default 10
192+
help
193+
Set the record abort table size.
194+
195+
This config is used in the Espressif HAL module.
196+
197+
config IEEE802154_TXRX_STATISTIC
198+
bool "Record tx/rx packet information for debugging"
199+
depends on IEEE802154_DEBUG
200+
help
201+
Enable this option to record tx and rx packet information.
202+
203+
This config is used in the Espressif HAL module.
204+
205+
endif # IEEE802154_ESP32

0 commit comments

Comments
 (0)