Merge branch 'dev'

This commit is contained in:
Koen Kanters 2019-06-26 18:49:25 +02:00
commit c3af2364ae
19 changed files with 143 additions and 199 deletions

View File

@ -5,90 +5,107 @@ This repository contains various Z-Stack coordinator firmwares.
<table>
<tr>
<td><b>Z-Stack</b></td>
<td><b>Type</b></td>
<td><b>Device</b></td>
<td><b>Zigbee</b></td>
<td><b>Direct children</b></td>
<td><b>Source routing</b></td>
<td><b># of 3.0 devices</b></td>
<td><b>Notes</b></td>
</tr>
<tr>
<td rowspan="4">Z-Stack_Home_1.2</td>
<td rowspan="4">Default</td>
<td>CC2531</td>
<td>1.2 HA</td>
<td>25</td>
<td>No</td>
<td>-</td>
<td> </td>
<td>20</td>
<td></td>
</tr>
<tr>
<td>CC2530</td>
<td>1.2 HA</td>
<td>21</td>
<td>No</td>
<td>-</td>
<td> </td>
<td>16</td>
<td></td>
</tr>
<tr>
<td>CC2530 + CC2591</td>
<td>1.2 HA</td>
<td>21</td>
<td>No</td>
<td>-</td>
<td> </td>
<td>16</td>
<td></td>
</tr>
<tr>
<td>CC2530 + CC2592</td>
<td>1.2 HA</td>
<td>21</td>
<td>No</td>
<td>-</td>
<td> </td>
<td>16</td>
<td></td>
</tr>
<tr>
<td rowspan="3">Z-Stack_3.0.x</td>
<tr>
<td rowspan="4">Z-Stack_Home_1.2</td>
<td rowspan="4">Source routing</td>
<td>CC2531</td>
<td>3.0</td>
<td>15</td>
<td>No</td>
<td>40</td>
<td><a href="https://github.com/Koenkk/zigbee2mqtt/issues/1445">#1445</a></td>
<td>1.2 HA</td>
<td>5</td>
<td></td>
</tr>
<tr>
<td>CC2530</td>
<td>3.0</td>
<td>10</td>
<td>No</td>
<td>40</td>
<td><a href="https://github.com/Koenkk/zigbee2mqtt/issues/1445">#1445</a></td>
<td>1.2 HA</td>
<td>5</td>
<td></td>
</tr>
<tr>
<td>CC2530_CC2591</td>
<tr>
<td>CC2530 + CC2591</td>
<td>1.2 HA</td>
<td>5</td>
<td></td>
</tr>
<tr>
<td>CC2530 + CC2592</td>
<td>1.2 HA</td>
<td>5</td>
<td></td>
</tr>
<tr>
<td>Z-Stack_3.0.x</td>
<td>Default</td>
<td>CC2531</td>
<td>3.0</td>
<td>10</td>
<td>No</td>
<td>40</td>
<td><a href="https://github.com/Koenkk/zigbee2mqtt/issues/1445">#1445</a></td>
<td>15</td>
<td>
- <a href="https://github.com/Koenkk/zigbee2mqtt/issues/1445">WIP (see #1445)</a>
<br/>
- Max 40 Zigbee 3.0 devices
</td>
</tr>
<tr>
<td>Z-Stack_3.x.0</td>
<td>Default</td>
<td>CC2652R</td>
<td>3.0</td>
<td>20</td>
<td>No</td>
<td>40</td>
<td><a href="https://github.com/Koenkk/zigbee2mqtt/issues/1429">#1429</a></td>
<td>
- <a href="https://github.com/Koenkk/zigbee2mqtt/issues/1429">WIP (see #1429)</a>
<br/>
- Max 40 Zigbee 3.0 devices
</td>
</tr>
</table>
### I'm a Zigbee2mqtt users, which one should I use?
This depends:
- Zigbee 3.0 coordinators are still WIP and therefore not recommended for production.
- If you have a network of 1 - 30 devices, the Z-Stack_Home_1.2 **default** firmware is recommended.
- If you have a network of 30+ devices, the Z-Stack_Home_1.2 **source routing** firmware is recommended.
- Note that the **source routing** firmware only supports 5 direct children, therefore you need to have routers in range of the coordinator.
### Legend
- *Z-Stack:* Z-Stack is the Zigbee stack for Texas Instruments Zigbee devices
- *Type:* The source routing firmware allows the coordinator to remember the routes to the devices. Improves performance for larger (40+ nodes) networks. For more information read [Large ZigBee Networks and Source Routing
](http://cms.digi.com/resources/documentation/digidocs/90001537/references/r_large_zigbee_networks-source_routing.htm?TocPath=Working%20with%20Zigbee%7C_____14). Because of memory limitations, the number of direct children are reduced for these firmwares.
- *Device:* The Zigbee hardware
- *Zigbee:* Zigbee version, for more information read [What's New in Zigbee 3.0](http://www.ti.com/lit/an/swra615/swra615.pdf)
- *Direct children:* Number of children that directly can join the coordinator. Note that this is **not** the maximum network size. For more information, read [the Zigbee2mqtt FAQ about device limit](http://www.zigbee2mqtt.io/information/FAQ.html#i-read-that-zigbee2mqtt-has-a-limit-of-15-devices-is-this-true)
- *Source routing:* Allows the coordinator to remember the routes to the devices. Improves performance for larger (40+ nodes) networks. For more information read [Large ZigBee Networks and Source Routing
](http://cms.digi.com/resources/documentation/digidocs/90001537/references/r_large_zigbee_networks-source_routing.htm?TocPath=Working%20with%20Zigbee%7C_____14)
- *# of 3.0 devices:* Number of Zigbee 3.0 devices that can join the network. Does not apply to Zigbee 1.2 coordinator (no limit).
#### Notes
- Due to new security requirements in Zigbee 3.0, Zigbee 3.0 coordinators can only support a limited amount of Zigbee 3.0 devices. For Zigbee 1.2 coordinators there is no limit on the max number of Zigbee 3.0 devices that can join.
## Compiling the firmware
In case you want to compile the firmware yourself, you can find a `COMPILE.md` for each firmware.

Binary file not shown.

View File

@ -29,74 +29,24 @@ index 305dfc7..51d8890 100644
1, /* Software maintenance release number */
diff --git a/Application/mt/revision_info.h b/Application/mt/revision_info.h
new file mode 100644
index 0000000..37ef9f2
index 0000000..0eb55ad
--- /dev/null
+++ b/Application/mt/revision_info.h
@@ -0,0 +1,13 @@
+/*
+ * revision_info.h
+ *
+ * Created on: 8 Apr 2019
+ * Author: Koenkk
+ */
+
@@ -0,0 +1,4 @@
+#ifndef APPLICATION_MT_REVISION_INFO_H_
+#define APPLICATION_MT_REVISION_INFO_H_
+
+#define CODE_REVISION_NUMBER 20190426
+
+#endif /* APPLICATION_MT_REVISION_INFO_H_ */
+#define CODE_REVISION_NUMBER 20190515
+#endif
\ No newline at end of file
diff --git a/Stack/Config/preinclude.h b/Stack/Config/preinclude.h
new file mode 100644
index 0000000..d71d794
index 0000000..e6436c2
--- /dev/null
+++ b/Stack/Config/preinclude.h
@@ -0,0 +1,45 @@
+/**
+ * 1. There is currently an issue which doesn't allow us to scale to device
+ * tables expansively.
+ * See: http://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/p/794106/2940412#2940412
+ */
+
+/**
+ * Enable Many-To-One (MTO) Routing
+ */
+// TODO enabled this
+// #define CONCENTRATOR_ENABLE TRUE
+// #define CONCENTRATOR_DISCOVERY_TIME 60
+// #define CONCENTRATOR_ROUTE_CACHE TRUE
+// // Use 40 for now, see 1 #define MAX_RTG_SRC_ENTRIES 200
+// #define MAX_RTG_SRC_ENTRIES 40
+// #define SRC_RTG_EXPIRY_TIME 255
+
+/**
+ * Scale device tables
+ */
+// TODO enable this
+// Use default of 20, see 1 #define NWK_MAX_DEVICE_LIST 50
+// Use default of 4, see 1 #define MAX_NEIGHBOR_ENTRIES 20
+// Use default of 40, see 1 #define MAX_RTG_ENTRIES 100
+
+// Use default of 40, see 1 #define ZDSECMGR_TC_DEVICE_MAX 200
+
+/**
+ * Others
+ */
@@ -0,0 +1,3 @@
+#define INCLUDE_REVISION_INFORMATION
+#define MT_SYS_KEY_MANAGEMENT 1
+#define SECURE 1
+
+
+/**
+ * Disabling MULTICAST is required in order for proper group support.
+ * If MULTICAST is not disabled, the group adress is not included in the APS header
+ */
+#define MULTICAST_ENABLED FALSE
+
+/**
+ * Increase NWK_LINK_STATUS_PERIOD to reduce amount of messages on the network
+ */
+#define NWK_LINK_STATUS_PERIOD 60
diff --git a/Stack/Config/znp_cnf.opts b/Stack/Config/znp_cnf.opts
index 1be73a8..81f5f4e 100644
--- a/Stack/Config/znp_cnf.opts
@ -107,60 +57,3 @@ index 1be73a8..81f5f4e 100644
-DMT_APP_CNF_FUNC
+
+--preinclude=preinclude.h
diff --git a/Stack/af/af.c b/Stack/af/af.c
index d303202..55c53d4 100644
--- a/Stack/af/af.c
+++ b/Stack/af/af.c
@@ -405,10 +405,19 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16 Src
#if !defined ( APS_NO_GROUPS )
// Find the first endpoint for this group
grpEp = aps_FindGroupForEndpoint( aff->GroupID, APS_GROUPS_FIND_FIRST );
- if ( grpEp == APS_GROUPS_EP_NOT_FOUND )
- return; // No endpoint found
- epDesc = afFindEndPointDesc( grpEp );
+ if ( grpEp == APS_GROUPS_EP_NOT_FOUND ) {
+ // No endpoint found, default to endpoint 1.
+ // In the original source code there is a return here.
+ // This prevent the messags from being forwarded.
+ // For our use-case we want to capture all messages.
+ // Even if the coordinator is not in the group.
+ epDesc = afFindEndPointDesc( 1 );
+ }
+ else {
+ epDesc = afFindEndPointDesc( grpEp );
+ }
+
if ( epDesc == NULL )
return; // Endpoint descriptor not found
@@ -425,6 +434,12 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16 Src
epDesc = pList->epDesc;
}
}
+ else if ( aff->DstEndPoint == 10 || aff->DstEndPoint == 11 ) {
+ if ( (epDesc = afFindEndPointDesc( 1 )) )
+ {
+ pList = afFindEndPointDescList( epDesc->endPoint );
+ }
+ }
else if ( (epDesc = afFindEndPointDesc( aff->DstEndPoint )) )
{
pList = afFindEndPointDescList( epDesc->endPoint );
diff --git a/Stack/sys/zglobals.c b/Stack/sys/zglobals.c
index 1fb33a4..2963697 100644
--- a/Stack/sys/zglobals.c
+++ b/Stack/sys/zglobals.c
@@ -206,7 +206,11 @@ uint8 zgEndDeviceConfiguration = END_DEV_CONFIGURATION;
//
// NOTICE: Before enabling Child Aging make sure to review all the related
// definitions in this file, especially zgNwkParentInformation.
-uint8 zgChildAgingEnable = TRUE;
+
+/**
+ * Disable child agaging, otherwise Xiaomi devices are being kicked off the network.
+ */
+uint8 zgChildAgingEnable = FALSE;
//========== TouchLink NWK configuration ===============
// Values used by Router when starts a network as initiator

View File

@ -1,3 +1,18 @@
# 20190619
- Make source routing firmware identical to 20190315 MAX_STABILITY
# 20190611
- Attempt to improve source routing firmware
# 20190608
- One firmware doesn't seem to be feasible, also add source routing firmware
# 20190608
- Try with source routing disabled and more XDATA
# 20190523
- Re-enable source routing
# 20190515
- CC2530_CC2591 and CC2530_CC2592 only; fix transmit power (yes, again, finally)

View File

@ -17,8 +17,8 @@
- Depending if you want to compile the `.hex` or SBL firmware select *- ProdHex* or *- ProdSBL*
6. Right-click on your target and press options. Go to C/C++ compiler -> preprocessor. **Remove** all *Defined symbols* and depending on what you want to compile, add the following symbols to *Defined symbols*:
- Device type: `FIRMWARE_CC2530`, `FIRMWARE_CC2530_CC2591`, `FIRMWARE_CC2531` or `FIRMWARE_CC2530_CC2592`
- In case you want to compile the SBL firmware, also add `FIRMWARE_SBL`.
7. Go to General Options -> Stack/Heap -> Stack sizes -> and change XDATA to 0x400.
8. Press OK.
9. Right-click on your target and click *Rebuild all*.
10. Once finished, you can find the `CC253(0|1)ZNP-Prod.(hex|bin)` file in `Z-Stack Home 1.2.2a.44539\Projects\zstack\ZNP\CC253x\dev`.
- If you chose for *- ProdSBL* add `FIRMWARE_SBL`.
- In case you want to compile the source routing firmware, also add `SOURCE_ROUTING`.
7. Press OK.
8. Right-click on your target and click *Rebuild all*.
9. Once finished, you can find the `CC253(0|1)ZNP-Prod.(hex|bin)` file in `Z-Stack Home 1.2.2a.44539\Projects\zstack\ZNP\CC253x\dev`.

View File

@ -65,12 +65,11 @@ index 35aae57..1f8ee82 100644
diff --git a/Components/mt/revision_info.h b/Components/mt/revision_info.h
new file mode 100644
index 0000000..dea5610
index 0000000..abe513b
--- /dev/null
+++ b/Components/mt/revision_info.h
@@ -0,0 +1 @@
+#define CODE_REVISION_NUMBER 20190515
\ No newline at end of file
+#define CODE_REVISION_NUMBER 20190619
diff --git a/Components/stack/af/AF.c b/Components/stack/af/AF.c
index c6183b6..2b885b6 100644
--- a/Components/stack/af/AF.c
@ -125,18 +124,9 @@ index 242be04..cca4781 100644
/*********************************************************************
diff --git a/Projects/zstack/ZMain/TI2530ZNP/OnBoard.c b/Projects/zstack/ZMain/TI2530ZNP/OnBoard.c
index 7c6c77e..69daba2 100644
index 7c6c77e..8265ff1 100644
--- a/Projects/zstack/ZMain/TI2530ZNP/OnBoard.c
+++ b/Projects/zstack/ZMain/TI2530ZNP/OnBoard.c
@@ -24,7 +24,7 @@
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
- PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+ PROVIDED �AS IS� WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
@@ -144,8 +144,17 @@ void InitBoard( uint8 level )
#if defined CC2531ZNP
@ -157,10 +147,10 @@ index 7c6c77e..69daba2 100644
znpCfg1 = P2_0;
diff --git a/Projects/zstack/ZNP/CC253x/Source/preinclude.h b/Projects/zstack/ZNP/CC253x/Source/preinclude.h
new file mode 100644
index 0000000..f53e95a
index 0000000..5ab4fd5
--- /dev/null
+++ b/Projects/zstack/ZNP/CC253x/Source/preinclude.h
@@ -0,0 +1,93 @@
@@ -0,0 +1,123 @@
+// Shared accross all firmwares
+#define ASSERT_RESET
+
@ -174,9 +164,6 @@ index 0000000..f53e95a
+#define SECURE 1
+#define INCLUDE_REVISION_INFORMATION
+
+// Increase NWK_LINK_STATUS_PERIOD to reduce amount of messages on the network
+#define NWK_LINK_STATUS_PERIOD 60
+
+// Save memory
+#undef APS_MAX_GROUPS
+#define APS_MAX_GROUPS 1
@ -209,31 +196,52 @@ index 0000000..f53e95a
+#define HAL_ADC FALSE
+
+/**
+ * Enable MTO routing, but disable source routing.
+ * https://github.com/Koenkk/zigbee2mqtt/issues/1408
+ * Enable MTO routing/source routing
+ * Source routing could have issues: https://github.com/Koenkk/zigbee2mqtt/issues/1408
+ */
+#define CONCENTRATOR_ENABLE TRUE
+#define CONCENTRATOR_ROUTE_CACHE FALSE
+#define CONCENTRATOR_DISCOVERY_TIME 120
+#define MAX_RTG_SRC_ENTRIES 1 // Source table is not used, reduce to minimal size
+#undef MAX_RTG_ENTRIES
+#define MAX_RTG_ENTRIES 60
+#define MAX_NEIGHBOR_ENTRIES 8
+
+#define CONCENTRATOR_DISCOVERY_TIME 60
+
+#if defined SOURCE_ROUTING
+ #define CONCENTRATOR_ROUTE_CACHE TRUE
+ #define MAX_RTG_SRC_ENTRIES 40
+ #undef MAX_RTG_ENTRIES
+ #define MAX_RTG_ENTRIES 40
+ #define MAX_NEIGHBOR_ENTRIES 16
+ #define SRC_RTG_EXPIRY_TIME 0
+#else
+ #define CONCENTRATOR_ROUTE_CACHE FALSE
+ #define MAX_RTG_SRC_ENTRIES 1 // Source table is not used, reduce to minimal size
+ #undef MAX_RTG_ENTRIES
+ #define MAX_RTG_ENTRIES 30
+ #define MAX_NEIGHBOR_ENTRIES 12
+#endif
+
+// CC2531
+#if defined FIRMWARE_CC2531
+ #define CC2531ZNP
+ #define NWK_MAX_DEVICE_LIST 25
+ #define MAXMEMHEAP 3235
+
+ #if defined SOURCE_ROUTING
+ #define NWK_MAX_DEVICE_LIST 5
+ #define MAXMEMHEAP 3309
+ #else
+ #define NWK_MAX_DEVICE_LIST 20
+ #define MAXMEMHEAP 3285
+ #endif
+
+// CC2530
+#elif defined FIRMWARE_CC2530
+ #define HAL_UART_DMA_RX_MAX 128
+ #define ENABLE_MT_SYS_RESET_SHUTDOWN
+ #define ZTOOL_P1
+ #define CC2530_MK
+ #define NWK_MAX_DEVICE_LIST 21
+ #define MAXMEMHEAP 3227
+
+ #if defined SOURCE_ROUTING
+ #define NWK_MAX_DEVICE_LIST 5
+ #define MAXMEMHEAP 3189
+ #else
+ #define NWK_MAX_DEVICE_LIST 16
+ #define MAXMEMHEAP 3277
+ #endif
+
+// CC2530 + CC2591
+#elif defined FIRMWARE_CC2530_CC2591
@ -241,8 +249,14 @@ index 0000000..f53e95a
+ #define ZTOOL_P1
+ #define HAL_UART_DMA_RX_MAX 128
+ #define HAL_PA_LNA
+ #define NWK_MAX_DEVICE_LIST 21
+ #define MAXMEMHEAP 3225
+
+ #if defined SOURCE_ROUTING
+ #define NWK_MAX_DEVICE_LIST 5
+ #define MAXMEMHEAP 3187
+ #else
+ #define NWK_MAX_DEVICE_LIST 16
+ #define MAXMEMHEAP 3275
+ #endif
+
+// CC2530 + CC2592
+#elif defined FIRMWARE_CC2530_CC2592
@ -250,13 +264,18 @@ index 0000000..f53e95a
+ #define ZTOOL_P1
+ #define HAL_UART_DMA_RX_MAX 128
+ #define HAL_PA_LNA_CC2592
+ #define NWK_MAX_DEVICE_LIST 21
+ #define MAXMEMHEAP 3225
+
+ #if defined SOURCE_ROUTING
+ #define NWK_MAX_DEVICE_LIST 5
+ #define MAXMEMHEAP 3187
+ #else
+ #define NWK_MAX_DEVICE_LIST 16
+ #define MAXMEMHEAP 3275
+ #endif
+
+#endif
\ No newline at end of file
diff --git a/Projects/zstack/ZNP/Source/znp.cfg b/Projects/zstack/ZNP/Source/znp.cfg
index 7e524a9..6326400 100644
index 7e524a9..d5b88a3 100644
--- a/Projects/zstack/ZNP/Source/znp.cfg
+++ b/Projects/zstack/ZNP/Source/znp.cfg
@@ -101,4 +101,6 @@