Skip to content

Commit 4b2e4db

Browse files
authored
Merge branch 'espressif:master' into master
2 parents 67a36e4 + 7575fa0 commit 4b2e4db

File tree

77 files changed

+1093
-162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1093
-162
lines changed

Diff for: .github/workflows/build_py_tools.yml

+4-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
jobs:
1313
find-changed-tools:
1414
name: Check if tools have been changed
15-
runs-on: ubuntu-20.04
15+
runs-on: ubuntu-latest
1616
outputs:
1717
any_changed: ${{ steps.verify-changed-files.outputs.any_changed }}
1818
all_changed_files: ${{ steps.verify-changed-files.outputs.all_changed_files }}
@@ -55,7 +55,7 @@ jobs:
5555
strategy:
5656
fail-fast: false
5757
matrix:
58-
os: [windows-latest, macos-latest, ubuntu-20.04, ARM]
58+
os: [windows-latest, macos-latest, ubuntu-latest, ubuntu-24.04-arm]
5959
include:
6060
- os: windows-latest
6161
TARGET: win64
@@ -64,14 +64,12 @@ jobs:
6464
- os: macos-latest
6565
TARGET: macos
6666
SEPARATOR: ":"
67-
- os: ubuntu-20.04
67+
- os: ubuntu-latest
6868
TARGET: linux-amd64
6969
SEPARATOR: ":"
70-
- os: ARM
71-
CONTAINER: python:3.8-bullseye
70+
- os: ubuntu-24.04-arm
7271
TARGET: arm
7372
SEPARATOR: ":"
74-
container: ${{ matrix.CONTAINER }} # use python container on ARM
7573
env:
7674
DISTPATH: pytools-${{ matrix.TARGET }}
7775
PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi"
@@ -96,8 +94,6 @@ jobs:
9694
token: ${{ secrets.TOOLS_UPLOAD_PAT }}
9795
ref: ${{ github.event.pull_request.head.ref }}
9896
- name: Set up Python 3.8
99-
# Skip setting python on ARM because of missing compatibility: https://github.com/actions/setup-python/issues/108
100-
if: matrix.os != 'ARM'
10197
uses: actions/setup-python@master
10298
with:
10399
python-version: 3.8

Diff for: .github/workflows/push.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ jobs:
237237
needs.gen-chunks.outputs.build_all == 'true' ||
238238
needs.gen-chunks.outputs.build_libraries == 'true' ||
239239
needs.gen-chunks.outputs.build_idf == 'true'
240-
runs-on: ubuntu-20.04
240+
runs-on: ubuntu-latest
241241
strategy:
242242
fail-fast: false
243243
matrix:

Diff for: CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ set(ARDUINO_LIBRARY_Zigbee_SRCS
297297
libraries/Zigbee/src/ep/ZigbeeVibrationSensor.cpp
298298
libraries/Zigbee/src/ep/ZigbeeAnalog.cpp
299299
libraries/Zigbee/src/ep/ZigbeeRangeExtender.cpp
300+
libraries/Zigbee/src/ep/ZigbeeGateway.cpp
300301
)
301302

302303
set(ARDUINO_LIBRARY_BLE_SRCS

Diff for: boards.txt

+454
Large diffs are not rendered by default.

Diff for: cores/esp32/HardwareSerial.cpp

-12
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,6 @@
1111
#include "driver/uart.h"
1212
#include "freertos/queue.h"
1313

14-
#ifndef ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE
15-
#define ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE 2048
16-
#endif
17-
18-
#ifndef ARDUINO_SERIAL_EVENT_TASK_PRIORITY
19-
#define ARDUINO_SERIAL_EVENT_TASK_PRIORITY (configMAX_PRIORITIES - 1)
20-
#endif
21-
22-
#ifndef ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE
23-
#define ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE -1
24-
#endif
25-
2614
#if (SOC_UART_LP_NUM >= 1)
2715
#define UART_HW_FIFO_LEN(uart_num) ((uart_num < SOC_UART_HP_NUM) ? SOC_UART_FIFO_LEN : SOC_LP_UART_FIFO_LEN)
2816
#else

Diff for: cores/esp32/HardwareSerial.h

+12
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,27 @@ typedef enum {
9797
} hardwareSerial_error_t;
9898

9999
#ifndef ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE
100+
#ifndef CONFIG_ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE
100101
#define ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE 2048
102+
#else
103+
#define ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE CONFIG_ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE
104+
#endif
101105
#endif
102106

103107
#ifndef ARDUINO_SERIAL_EVENT_TASK_PRIORITY
108+
#ifndef CONFIG_ARDUINO_SERIAL_EVENT_TASK_PRIORITY
104109
#define ARDUINO_SERIAL_EVENT_TASK_PRIORITY (configMAX_PRIORITIES - 1)
110+
#else
111+
#define ARDUINO_SERIAL_EVENT_TASK_PRIORITY CONFIG_ARDUINO_SERIAL_EVENT_TASK_PRIORITY
112+
#endif
105113
#endif
106114

107115
#ifndef ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE
116+
#ifndef CONFIG_ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE
108117
#define ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE -1
118+
#else
119+
#define ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE CONFIG_ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE
120+
#endif
109121
#endif
110122

111123
// UART0 pins are defined by default by the bootloader.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"fqbn_append": "PartitionScheme=zigbee,ZigbeeMode=ed",
33
"requires": [
4-
"CONFIG_SOC_IEEE802154_SUPPORTED=y"
4+
"CONFIG_SOC_IEEE802154_SUPPORTED=y",
5+
"CONFIG_ZB_ENABLED=y"
56
]
67
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"fqbn_append": "PartitionScheme=zigbee,ZigbeeMode=ed",
33
"requires": [
4-
"CONFIG_SOC_IEEE802154_SUPPORTED=y"
4+
"CONFIG_SOC_IEEE802154_SUPPORTED=y",
5+
"CONFIG_ZB_ENABLED=y"
56
]
67
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"fqbn_append": "PartitionScheme=zigbee,ZigbeeMode=ed",
33
"requires": [
4-
"CONFIG_SOC_IEEE802154_SUPPORTED=y"
4+
"CONFIG_SOC_IEEE802154_SUPPORTED=y",
5+
"CONFIG_ZB_ENABLED=y"
56
]
67
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"fqbn_append": "PartitionScheme=zigbee_zczr,ZigbeeMode=zczr",
33
"requires": [
4-
"CONFIG_SOC_IEEE802154_SUPPORTED=y"
4+
"CONFIG_ZB_ENABLED=y"
55
]
66
}
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"fqbn_append": "PartitionScheme=zigbee,ZigbeeMode=ed",
33
"requires": [
4-
"CONFIG_SOC_IEEE802154_SUPPORTED=y"
4+
"CONFIG_SOC_IEEE802154_SUPPORTED=y",
5+
"CONFIG_ZB_ENABLED=y"
56
]
67
}
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"fqbn_append": "PartitionScheme=zigbee,ZigbeeMode=ed",
33
"requires": [
4-
"CONFIG_SOC_IEEE802154_SUPPORTED=y"
4+
"CONFIG_SOC_IEEE802154_SUPPORTED=y",
5+
"CONFIG_ZB_ENABLED=y"
56
]
67
}

Diff for: libraries/Zigbee/examples/Zigbee_Gateway/README.md

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Arduino-ESP32 Zigbee Gateway Example
2+
3+
This example shows how to configure Zigbee Gateway device, running on SoCs without native IEEE 802.15.4.
4+
5+
# Supported Targets
6+
7+
Currently, this example supports the following targets.
8+
9+
| Supported Targets | ESP32 | ESP32-S2 | ESP32-S3 | ESP32-C3 |
10+
| ----------------- | ----- | -------- | -------- | -------- |
11+
12+
## Hardware Required
13+
14+
* One development board (ESP32-H2 or ESP32-C6) acting as Zigbee Radio Co-processor loaded with [ot_rcp example](https://github.com/espressif/esp-idf/tree/master/examples/openthread/ot_rcp).
15+
* A USB cable for power supply and programming.
16+
* Choose another board from supported targets as Zigbee coordinator/router and upload the Zigbee_Gateway example.
17+
18+
### Configure the Project
19+
20+
Set the RCP connection (UART) by changing the `GATEWAY_RCP_UART_PORT`, `GATEWAY_RCP_RX_PIN` and `GATEWAY_RCP_TX_PIN` definition.
21+
22+
#### Using Arduino IDE
23+
24+
To get more information about the Espressif boards see [Espressif Development Kits](https://www.espressif.com/en/products/devkits).
25+
26+
* Before Compile/Verify, select the correct board: `Tools -> Board`.
27+
* Select the Coordinator Zigbee mode: `Tools -> Zigbee mode: Zigbee ZCZR (coordinator/router)`.
28+
* Select Partition Scheme for Zigbee: `Tools -> Partition Scheme: Zigbee 4MB with spiffs`.
29+
* Select the COM port: `Tools -> Port: xxx where the `xxx` is the detected COM port.
30+
* Optional: Set debug level to verbose to see all logs from Zigbee stack: `Tools -> Core Debug Level: Verbose`.
31+
32+
## Troubleshooting
33+
34+
* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`.
35+
36+
By default, the coordinator network is closed after rebooting or flashing new firmware.
37+
To open the network you have 2 options:
38+
39+
* Open network after reboot by setting `Zigbee.setRebootOpenNetwork(time);` before calling `Zigbee.begin();`.
40+
* In application you can anytime call `Zigbee.openNetwork(time);` to open the network for devices to join.
41+
42+
***Important: Make sure you are using a good quality USB cable and that you have a reliable power source***
43+
44+
* **LED not blinking:** Check the wiring connection and the IO selection.
45+
* **Programming Fail:** If the programming/flash procedure fails, try reducing the serial connection speed.
46+
* **COM port not detected:** Check the USB cable and the USB to Serial driver installation.
47+
48+
If the error persists, you can ask for help at the official [ESP32 forum](https://esp32.com) or see [Contribute](#contribute).
49+
50+
## Contribute
51+
52+
To know how to contribute to this project, see [How to contribute.](https://github.com/espressif/arduino-esp32/blob/master/CONTRIBUTING.rst)
53+
54+
If you have any **feedback** or **issue** to report on this example/library, please open an issue or fix it by creating a new PR. Contributions are more than welcome!
55+
56+
Before creating a new issue, be sure to try Troubleshooting and check if the same issue was already created by someone else.
57+
58+
## Resources
59+
60+
* Official ESP32 Forum: [Link](https://esp32.com)
61+
* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32)
62+
* ESP32-C6 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf)
63+
* ESP32-H2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf)
64+
* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
// Copyright 2025 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
/**
16+
* @brief This example demonstrates simple Zigbee Gateway functionality.
17+
*
18+
* The example demonstrates how to use Zigbee library on ESP32s to create a Zigbee Gateway, updating the time from NTP server.
19+
* The Gateway is able to communicate with Zigbee end devices and send/receive data to/from them.
20+
* The Gateway is also able to communicate with the cloud or other devices over Wi-Fi / BLE.
21+
*
22+
* Proper Zigbee mode must be selected in Tools->Zigbee mode->Zigbee ZCZR (coordinator/router)
23+
* and also the correct partition scheme must be selected in Tools->Partition Scheme->Zigbee ZCZR
24+
*
25+
* Please check the README.md for instructions and more detailed description.
26+
*
27+
* Created by Jan Procházka (https://github.com/P-R-O-C-H-Y/)
28+
*/
29+
30+
#ifndef ZIGBEE_MODE_ZCZR
31+
#error "Zigbee coordinator mode is not selected in Tools->Zigbee mode"
32+
#endif
33+
34+
#include "Zigbee.h"
35+
#include <WiFi.h>
36+
#include "time.h"
37+
#include "esp_sntp.h"
38+
39+
/* Zigbee gateway configuration */
40+
#define GATEWAY_ENDPOINT_NUMBER 1
41+
#define GATEWAY_RCP_UART_PORT UART_NUM_1 // UART 0 is used for Serial communication
42+
#define GATEWAY_RCP_RX_PIN 4
43+
#define GATEWAY_RCP_TX_PIN 5
44+
45+
ZigbeeGateway zbGateway = ZigbeeGateway(GATEWAY_ENDPOINT_NUMBER);
46+
47+
/* Wi-Fi credentials */
48+
const char *ssid = "your-ssid";
49+
const char *password = "your-password";
50+
51+
/* NTP server configuration */
52+
const char *ntpServer1 = "pool.ntp.org";
53+
const char *ntpServer2 = "time.nist.gov";
54+
const long gmtOffset_sec = 3600;
55+
const int daylightOffset_sec = 3600;
56+
const char *time_zone = "CET-1CEST,M3.5.0,M10.5.0/3"; // TimeZone rule for Europe/Rome including daylight adjustment rules (optional)
57+
58+
/* Time structure */
59+
struct tm timeinfo;
60+
61+
/********************* Arduino functions **************************/
62+
void setup() {
63+
Serial.begin(115200);
64+
65+
// Initialize Wi-Fi and connect to AP
66+
WiFi.begin(ssid, password);
67+
esp_sntp_servermode_dhcp(1); // (optional)
68+
69+
Serial.print("Connecting to WiFi");
70+
71+
while (WiFi.status() != WL_CONNECTED) {
72+
delay(500);
73+
Serial.print(".");
74+
}
75+
Serial.println("WiFi connected");
76+
77+
// Initialize Zigbee and Begin Zigbee stack
78+
// Optional: set Zigbee device name and model
79+
zbGateway.setManufacturerAndModel("Espressif", "ZigbeeGateway");
80+
zbGateway.addTimeCluster(timeinfo, gmtOffset_sec);
81+
82+
// Add endpoint to Zigbee Core
83+
Serial.println("Adding Zigbee Gateway endpoint");
84+
Zigbee.addEndpoint(&zbGateway);
85+
86+
// Optional: Open network for 180 seconds after boot
87+
Zigbee.setRebootOpenNetwork(180);
88+
89+
// Set custom radio configuration for RCP communication
90+
esp_zb_radio_config_t radio_config = ZIGBEE_DEFAULT_UART_RCP_RADIO_CONFIG();
91+
radio_config.radio_uart_config.port = GATEWAY_RCP_UART_PORT;
92+
radio_config.radio_uart_config.rx_pin = (gpio_num_t)GATEWAY_RCP_RX_PIN;
93+
radio_config.radio_uart_config.tx_pin = (gpio_num_t)GATEWAY_RCP_TX_PIN;
94+
95+
Zigbee.setRadioConfig(radio_config);
96+
97+
// When all EPs are registered, start Zigbee with ZIGBEE_COORDINATOR or ZIGBEE_ROUTER mode
98+
if (!Zigbee.begin(ZIGBEE_COORDINATOR)) {
99+
Serial.println("Zigbee failed to start!");
100+
Serial.println("Rebooting...");
101+
ESP.restart();
102+
}
103+
104+
// set notification call-back function
105+
sntp_set_time_sync_notification_cb(timeavailable);
106+
sntp_set_sync_interval(30000); // sync every 30 seconds
107+
108+
// config time zone and NTP servers
109+
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer1, ntpServer2);
110+
}
111+
112+
void loop() {
113+
// Nothing to do here in this example
114+
}
115+
116+
void printLocalTime() {
117+
if (!getLocalTime(&timeinfo)) {
118+
Serial.println("No time available (yet)");
119+
return;
120+
}
121+
Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");
122+
zbGateway.setTime(timeinfo);
123+
Serial.println("Time updated in Zigbee Gateway");
124+
}
125+
126+
// Callback function (gets called when time adjusts via NTP)
127+
void timeavailable(struct timeval *t) {
128+
Serial.println("Got time adjustment from NTP!");
129+
printLocalTime();
130+
}

Diff for: libraries/Zigbee/examples/Zigbee_Gateway/ci.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"fqbn_append": "PartitionScheme=zigbee_zczr_8MB,ZigbeeMode=zczr",
3+
"requires": [
4+
"CONFIG_ZB_ENABLED=y"
5+
],
6+
"targets": {
7+
"esp32c6": false,
8+
"esp32h2": false
9+
}
10+
}

Diff for: libraries/Zigbee/examples/Zigbee_OTA_Client/ci.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"fqbn_append": "PartitionScheme=zigbee,ZigbeeMode=ed",
33
"requires": [
4-
"CONFIG_SOC_IEEE802154_SUPPORTED=y"
4+
"CONFIG_SOC_IEEE802154_SUPPORTED=y",
5+
"CONFIG_ZB_ENABLED=y"
56
]
67
}
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"fqbn_append": "PartitionScheme=zigbee,ZigbeeMode=ed",
33
"requires": [
4-
"CONFIG_SOC_IEEE802154_SUPPORTED=y"
4+
"CONFIG_SOC_IEEE802154_SUPPORTED=y",
5+
"CONFIG_ZB_ENABLED=y"
56
]
67
}
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"fqbn_append": "PartitionScheme=zigbee,ZigbeeMode=ed",
33
"requires": [
4-
"CONFIG_SOC_IEEE802154_SUPPORTED=y"
4+
"CONFIG_SOC_IEEE802154_SUPPORTED=y",
5+
"CONFIG_ZB_ENABLED=y"
56
]
67
}

0 commit comments

Comments
 (0)