Z-Stack-firmware/coordinator/Z-Stack_3.x.0/firmware.patch

1146 lines
51 KiB
Diff
Raw Normal View History

2020-11-03 20:19:41 +01:00
From f021277dbf135d03a98fc2ae58939fc9386df139 Mon Sep 17 00:00:00 2001
From: Koen Kanters <koenkanters94@gmail.com>
Date: Mon, 31 Aug 2020 16:45:20 +0200
Subject: [PATCH 1/1] Own changes
---
.../Application/mt/mt.h | 2 +
.../Application/mt/mt_util.c | 64 +++++++++++++++++++
.../Application/mt/mt_version.c | 8 ++-
2020-11-03 20:19:41 +01:00
.../Stack/Config/preinclude.h | 46 +++++++++++++
.../Stack/Config/znp_cnf.opts | 2 +
.../Stack/af/af.c | 18 ++++--
.../Stack/sys/zglobals.c | 6 +-
.../Stack/zdo/zd_app.c | 22 +++----
.../cc13x2lp.cmd | 6 +-
2020-11-03 20:19:41 +01:00
znp_CC1352P_2_LAUNCHXL_tirtos_ccs/znp.syscfg | 30 +++++----
.../Application/mt/mt.h | 2 +
.../Application/mt/mt_util.c | 64 +++++++++++++++++++
.../Application/mt/mt_version.c | 8 ++-
2020-11-03 20:19:41 +01:00
.../Stack/Config/preinclude.h | 46 +++++++++++++
.../Stack/Config/znp_cnf.opts | 2 +
.../Stack/af/af.c | 18 ++++--
.../Stack/sys/zglobals.c | 6 +-
.../Stack/zdo/zd_app.c | 22 +++----
znp_CC2652RB_LAUNCHXL_tirtos_ccs/cc26x2lp.cmd | 12 +---
2020-11-03 20:19:41 +01:00
znp_CC2652RB_LAUNCHXL_tirtos_ccs/znp.syscfg | 30 +++++----
.../Application/mt/mt.h | 2 +
.../Application/mt/mt_util.c | 64 +++++++++++++++++++
.../Application/mt/mt_version.c | 8 ++-
2020-11-03 20:19:41 +01:00
.../Stack/Config/preinclude.h | 46 +++++++++++++
.../Stack/Config/znp_cnf.opts | 2 +
.../Stack/af/af.c | 18 ++++--
.../Stack/sys/zglobals.c | 6 +-
.../Stack/zdo/zd_app.c | 22 +++----
znp_CC26X2R1_LAUNCHXL_tirtos_ccs/cc26x2lp.cmd | 6 +-
2020-11-03 20:19:41 +01:00
znp_CC26X2R1_LAUNCHXL_tirtos_ccs/znp.syscfg | 30 +++++----
30 files changed, 504 insertions(+), 114 deletions(-)
create mode 100644 znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
2020-03-15 16:44:28 +01:00
create mode 100644 znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
create mode 100644 znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
2020-08-05 16:33:33 +02:00
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt.h b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
index 2c5073c..8732c65 100644
2020-08-05 16:33:33 +02:00
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
@@ -441,6 +441,8 @@ extern "C"
2020-08-05 16:33:33 +02:00
#define MT_UTIL_SRNG_GENERATE 0x4C
#endif
#define MT_UTIL_BIND_ADD_ENTRY 0x4D
+#define MT_UTIL_ASSOC_REMOVE 0x63 // Custom command
+#define MT_UTIL_ASSOC_ADD 0x64 // Custom command
2020-08-05 16:33:33 +02:00
#define MT_UTIL_ZCL_KEY_EST_INIT_EST 0x80
#define MT_UTIL_ZCL_KEY_EST_SIGN 0x81
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
index 90d6d4a..4d50083 100644
2020-08-05 16:33:33 +02:00
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
@@ -128,6 +128,8 @@ static void MT_UtilAPSME_LinkKeyNvIdGet(uint8_t *pBuf);
#endif //MT_SYS_KEY_MANAGEMENT
static void MT_UtilAPSME_RequestKeyCmd(uint8_t *pBuf);
static void MT_UtilAssocCount(uint8_t *pBuf);
+static void MT_UtilAssocRemove(uint8_t *pBuf);
+static void MT_UtilAssocAdd(uint8_t *pBuf);
static void MT_UtilAssocFindDevice(uint8_t *pBuf);
static void MT_UtilAssocGetWithAddress(uint8_t *pBuf);
static void MT_UtilBindAddEntry(uint8_t *pBuf);
@@ -272,6 +274,14 @@ uint8_t MT_UtilCommandProcessing(uint8_t *pBuf)
MT_UtilBindAddEntry(pBuf);
break;
+ case MT_UTIL_ASSOC_REMOVE:
+ MT_UtilAssocRemove(pBuf);
+ break;
+
+ case MT_UTIL_ASSOC_ADD:
+ MT_UtilAssocAdd(pBuf);
+ break;
+
case MT_UTIL_SYNC_REQ:
MT_UtilSync();
break;
@@ -1375,6 +1385,60 @@ static void MT_UtilAssocCount(uint8_t *pBuf)
MT_BuildAndSendZToolResponse(((uint8_t)MT_RPC_CMD_SRSP | (uint8_t)MT_RPC_SYS_UTIL), cmdId, 2, pBuf);
}
+/***************************************************************************************************
+ * @fn MT_UtilAssocRemove
+ *
+ * @brief Proxy the AssocRemove() function.
+ *
+ * @param pBuf - pointer to the received buffer
+ *
+ * @return void
+ ***************************************************************************************************/
+static void MT_UtilAssocRemove(uint8_t *pBuf)
+{
+ uint8_t cmdId;
+ uint8_t ieeeAddr[Z_EXTADDR_LEN];
+ uint8_t retValue = 0;
+
+ // parse header
+ cmdId = pBuf[MT_RPC_POS_CMD1];
+ pBuf += MT_RPC_FRAME_HDR_SZ;
+
+ /* IeeAddress */
+ OsalPort_memcpy(ieeeAddr, pBuf, Z_EXTADDR_LEN);
+
+ AssocRemove(ieeeAddr);
+
+ MT_BuildAndSendZToolResponse(((uint8_t)MT_RPC_CMD_SRSP | (uint8_t)MT_RPC_SYS_UTIL), cmdId, 1, &retValue);
+}
+
+/***************************************************************************************************
+ * @fn MT_UtilAssocAdd
+ *
+ * @brief Proxy the AssocAdd() function.
+ *
+ * @param pBuf - pointer to the received buffer
+ *
+ * @return void
+ ***************************************************************************************************/
+static void MT_UtilAssocAdd(uint8_t *pBuf)
+{
+ uint8_t cmdId;
+ uint8_t retValue = 0;
+
+ // parse header
+ cmdId = pBuf[MT_RPC_POS_CMD1];
+ pBuf += MT_RPC_FRAME_HDR_SZ;
+
+ AssocAddNew(
+ BUILD_UINT16(pBuf[Z_EXTADDR_LEN], pBuf[Z_EXTADDR_LEN + 1]),
+ pBuf,
+ pBuf[Z_EXTADDR_LEN + 2]
+ );
+
+ MT_BuildAndSendZToolResponse(((uint8_t)MT_RPC_CMD_SRSP | (uint8_t)MT_RPC_SYS_UTIL), cmdId, 1, &retValue);
+}
+
/***************************************************************************************************
* @fn MT_UtilAssocFindDevice
*
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c
2020-11-03 20:19:41 +01:00
index 63c143b..da6cb80 100644
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c
@@ -43,15 +43,21 @@
#include "zcomdef.h"
#include "mt_version.h"
2020-11-03 20:19:41 +01:00
+#define CODE_REVISION_NUMBER 20201103
+
/******************************************************************************
* CONSTANTS
*****************************************************************************/
const uint8_t MTVersionString[] = {
2, /* Transport protocol revision */
- 0, /* Product ID */
+ 1, /* Product ID */
2, /* Software major release number */
7, /* Software minor release number */
1, /* Software maintenance release number */
+ ((CODE_REVISION_NUMBER >> 0) & 0xFF),
+ ((CODE_REVISION_NUMBER >> 8) & 0xFF),
+ ((CODE_REVISION_NUMBER >> 16) & 0xFF),
+ ((CODE_REVISION_NUMBER >> 24) & 0xFF),
};
/******************************************************************************
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
new file mode 100644
2020-11-03 20:19:41 +01:00
index 0000000..80f2097
--- /dev/null
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
2020-11-03 20:19:41 +01:00
@@ -0,0 +1,46 @@
+#define MT_SYS_KEY_MANAGEMENT 1
+#define FEATURE_NVEXID 1
+
+// Save memory
+#undef NWK_MAX_BINDING_ENTRIES
+#define NWK_MAX_BINDING_ENTRIES 1
+#undef APS_MAX_GROUPS
+#define APS_MAX_GROUPS 1
+
+// Increase NV pages to 3 to allow for bigger device tables
+#undef NVOCMP_NVPAGES
+#define NVOCMP_NVPAGES 3
+
+// 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 the max number of boardcasts, the default broadcast delivery time is 3 seconds
+// with the value below this will allow for 1 broadcast every 0.15 second
+#define MAX_BCAST 30
+
+/**
+ * Enable MTO routing
+ */
+#define CONCENTRATOR_ENABLE TRUE
2020-11-03 20:19:41 +01:00
+#define CONCENTRATOR_DISCOVERY_TIME 100
+#define CONCENTRATOR_ROUTE_CACHE TRUE
+#define MAX_RTG_SRC_ENTRIES 200
2020-11-03 20:19:41 +01:00
+#define SRC_RTG_EXPIRY_TIME 2
+
+/**
+ * Scale other device tables appropriately
+ */
+#define NWK_MAX_DEVICE_LIST 50
+#define ZDSECMGR_TC_DEVICE_MAX 200
+#define MAX_NEIGHBOR_ENTRIES 20
+#define MAX_RTG_ENTRIES 100
2020-11-03 20:19:41 +01:00
+
+// From https://www.ti.com/lit/an/swra650b/swra650b.pdf?ts=1604389355381
+#define LINK_DOWN_TRIGGER 12
+#define NWK_ROUTE_AGE_LIMIT 5
+#define DEF_NWK_RADIUS 15
+#define DEFAULT_ROUTE_REQUEST_RADIUS 8
+#define ZDNWKMGR_MIN_TRANSMISSIONS 0
+#define ROUTE_DISCOVERY_TIME 13
+#define MTO_RREQ_LIMIT_TIME 5000
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts
index 6e3cb6a..1f90cc6 100644
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts
@@ -32,3 +32,5 @@
-DMT_GP_CB_FUNC
-DMT_APP_CNF_FUNC
+
2020-04-17 18:02:22 +02:00
+--preinclude=preinclude.h
\ No newline at end of file
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/af/af.c b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/af/af.c
index 3a7afa3..e3a2706 100644
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/af/af.c
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/af/af.c
@@ -407,10 +407,18 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16_t S
2020-07-21 15:23:49 +02:00
#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
+ 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 );
+ }
2020-07-21 15:23:49 +02:00
- epDesc = afFindEndPointDesc( grpEp );
if ( epDesc == NULL )
return; // Endpoint descriptor not found
@@ -457,7 +465,9 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16_t S
// if the Wildcard ProfileID is received the message should not be sent to ZDO endpoint
if ( (aff->ProfileID == epProfileID) ||
((epDesc->endPoint == ZDO_EP) && (aff->ProfileID == ZDO_PROFILE_ID)) ||
- ((epDesc->endPoint != ZDO_EP) && ( aff->ProfileID == ZDO_WILDCARD_PROFILE_ID )) )
+ ((epDesc->endPoint != ZDO_EP) && ( aff->ProfileID == ZDO_WILDCARD_PROFILE_ID )) ||
+ // Fix below is to support PGC410EU: https://github.com/Koenkk/zigbee2mqtt/issues/4055
+ ((epDesc->endPoint == 2) && ( aff->ProfileID == 0xFC01 )) )
{
// Save original endpoint
uint8_t endpoint = aff->DstEndPoint;
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
index e716024..f8d8404 100644
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
@@ -104,7 +104,7 @@ uint8_t zgSecurePermitJoin = TRUE;
2020-07-21 15:23:49 +02:00
// TC Link Key. In this scenario, if this flag is TRUE, the Trust Center will
// encrypt the outgoing NWK Key with the default TC Link Key (ZigbeeAlliance09).
// If this flag is FALSE (default), the Trust Center will not send the NWK Key at all.
-uint8_t zgAllowRejoinsWithWellKnownKey = FALSE;
2020-02-29 13:46:29 +01:00
+uint8_t zgAllowRejoinsWithWellKnownKey = TRUE; // https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/p/882650/3265311#3265311
2020-07-21 15:23:49 +02:00
//allowInstallCodes
uint8_t zgAllowInstallCodes = ZG_IC_SUPPORTED_NOT_REQUIRED;
@@ -198,7 +198,9 @@ uint8_t zgEndDeviceConfiguration = END_DEV_CONFIGURATION;
2020-07-21 15:23:49 +02:00
//
// NOTICE: Before enabling Child Aging make sure to review all the related
// definitions in this file, especially zgNwkParentInformation.
-uint8_t zgChildAgingEnable = TRUE;
2020-02-29 13:46:29 +01:00
+
+// Disable child aging, otherwise Xiaomi devices are being kicked off the network.
+uint8_t zgChildAgingEnable = FALSE;
2020-07-21 15:23:49 +02:00
//========== TouchLink NWK configuration ===============
// Values used by Router when starts a network as initiator
2020-02-29 13:46:29 +01:00
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
index 17ac2f5..9c0021b 100644
2020-02-29 13:46:29 +01:00
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
@@ -419,12 +419,11 @@ uint32_t ZDApp_event_loop( uint8_t task_id, uint32_t events )
2020-07-21 15:23:49 +02:00
ZDApp_ChangeState( DEV_ROUTER );
}
- if ( zgChildAgingEnable == TRUE )
- {
- // Once the device has changed its state to a ROUTER set the timer to send
- // Parent annce
- ZDApp_SetParentAnnceTimer();
- }
+ // As we cannot enable child aging as Xiaomi devices will drop off
+ // but we stil want to have the parent announces we always enable it here.
+ // Otherwise some end devices could be unreachable when they changed parent
+ // while the coordinator was powered off.
+ ZDApp_SetParentAnnceTimer();
}
else
{
@@ -882,12 +881,11 @@ void ZDApp_NetworkStartEvt( void )
2020-07-21 15:23:49 +02:00
bdb_reportCommissioningState(BDB_INITIALIZATION,TRUE);
}
- if ( zgChildAgingEnable == TRUE )
- {
- // Once the device has changed its state to a COORDINATOR set the timer to send
- // Parent annce
- ZDApp_SetParentAnnceTimer();
- }
+ // As we cannot enable child aging as Xiaomi devices will drop off
+ // but we stil want to have the parent announces we always enable it here.
+ // Otherwise some end devices could be unreachable when they changed parent
+ // while the coordinator was powered off.
+ ZDApp_SetParentAnnceTimer();
}
else
{
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/cc13x2lp.cmd b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/cc13x2lp.cmd
index 2b5d2ae..c12e296 100755
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/cc13x2lp.cmd
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/cc13x2lp.cmd
@@ -70,9 +70,9 @@
/* must be located at the beginning of the application. */
#define FLASH_BASE 0x00000000
-#define FLASH_SIZE 0x52000
-#define FLASH_NV_BASE 0x52000
-#define FLASH_NV_SIZE 0x4000
+#define FLASH_SIZE 0x50000
+#define FLASH_NV_BASE 0x50000
+#define FLASH_NV_SIZE 0x6000
#define FLASH_LAST_BASE 0x56000
#define FLASH_LAST_SIZE 0x2000
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/znp.syscfg b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/znp.syscfg
2020-11-03 20:19:41 +01:00
index 9680070..508b792 100644
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/znp.syscfg
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/znp.syscfg
@@ -52,6 +52,7 @@ CCFG.enableBootloaderBackdoor = true;
CCFG.dioBootloaderBackdoor = 15;
CCFG.levelBootloaderBackdoor = "Active low";
CCFG.forceVddr = true;
2020-04-17 18:02:22 +02:00
+CCFG.enableDCDC = false;
CCFG.ccfgTemplate.$name = "ti_devices_CCFGTemplate0";
rfdesign.rfDesign = "LAUNCHXL-CC1352P-2";
@@ -72,8 +73,8 @@ ECJPAKE1.$name = "CONFIG_ECJPAKE_0";
NVS1.$name = "CONFIG_NVSINTERNAL";
NVS1.internalFlash.$name = "ti_drivers_nvs_NVSCC26XX0";
-NVS1.internalFlash.regionBase = 0x52000;
-NVS1.internalFlash.regionSize = 0x4000;
2020-03-13 18:50:04 +01:00
+NVS1.internalFlash.regionBase = 0x50000;
+NVS1.internalFlash.regionSize = 0x6000;
NVS2.$name = "CONFIG_NVSEXTERNAL";
NVS2.nvsType = "External";
2020-11-03 20:19:41 +01:00
@@ -128,18 +129,19 @@ SPI1.sclkPinInstance.$name = "CONFIG_PIN_SPI_SCLK";
SPI1.misoPinInstance.$name = "CONFIG_PIN_SPI_MISO";
SPI1.mosiPinInstance.$name = "CONFIG_PIN_SPI_MOSI";
-zstack.deviceType = "znp";
-zstack.deviceTypeReadOnly = true;
-zstack.touchlink.$name = "ti_zstack_touchlink_zstack_touchlink0";
-zstack.pm.$name = "ti_zstack_pm_zstack_pm0";
-zstack.rf.$name = "ti_zstack_rf_zstack_rf0";
-zstack.rf.radioConfig.$name = "ti_devices_radioconfig_settings_ieee_15_40";
-zstack.rf.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param0";
-zstack.network.$name = "ti_zstack_network_zstack_network0";
-zstack.advanced.$name = "ti_zstack_advanced_zstack_advanced0";
-zstack.advanced.routing.$name = "ti_zstack_advanced_zstack_routing0";
-zstack.advanced.packetSending.$name = "ti_zstack_advanced_zstack_packet_sending0";
-zstack.advanced.tableSize.$name = "ti_zstack_advanced_zstack_table_size0";
+zstack.deviceType = "znp";
+zstack.deviceTypeReadOnly = true;
+zstack.touchlink.$name = "ti_zstack_touchlink_zstack_touchlink0";
+zstack.pm.$name = "ti_zstack_pm_zstack_pm0";
+zstack.rf.$name = "ti_zstack_rf_zstack_rf0";
+zstack.rf.radioConfig.$name = "ti_devices_radioconfig_settings_ieee_15_40";
+zstack.rf.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param0";
+zstack.network.$name = "ti_zstack_network_zstack_network0";
+zstack.advanced.$name = "ti_zstack_advanced_zstack_advanced0";
+zstack.advanced.routing.$name = "ti_zstack_advanced_zstack_routing0";
+zstack.advanced.packetSending.$name = "ti_zstack_advanced_zstack_packet_sending0";
+zstack.advanced.packetSending.apsAckWaitDurationPolled = 1000;
+zstack.advanced.tableSize.$name = "ti_zstack_advanced_zstack_table_size0";
/**
* Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
2020-08-05 16:33:33 +02:00
diff --git a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt.h b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
index 2c5073c..8732c65 100644
2020-08-05 16:33:33 +02:00
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
@@ -441,6 +441,8 @@ extern "C"
2020-08-05 16:33:33 +02:00
#define MT_UTIL_SRNG_GENERATE 0x4C
#endif
#define MT_UTIL_BIND_ADD_ENTRY 0x4D
+#define MT_UTIL_ASSOC_REMOVE 0x63 // Custom command
+#define MT_UTIL_ASSOC_ADD 0x64 // Custom command
2020-08-05 16:33:33 +02:00
#define MT_UTIL_ZCL_KEY_EST_INIT_EST 0x80
#define MT_UTIL_ZCL_KEY_EST_SIGN 0x81
diff --git a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
index 90d6d4a..4d50083 100644
2020-08-05 16:33:33 +02:00
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
@@ -128,6 +128,8 @@ static void MT_UtilAPSME_LinkKeyNvIdGet(uint8_t *pBuf);
#endif //MT_SYS_KEY_MANAGEMENT
static void MT_UtilAPSME_RequestKeyCmd(uint8_t *pBuf);
static void MT_UtilAssocCount(uint8_t *pBuf);
+static void MT_UtilAssocRemove(uint8_t *pBuf);
+static void MT_UtilAssocAdd(uint8_t *pBuf);
static void MT_UtilAssocFindDevice(uint8_t *pBuf);
static void MT_UtilAssocGetWithAddress(uint8_t *pBuf);
static void MT_UtilBindAddEntry(uint8_t *pBuf);
@@ -272,6 +274,14 @@ uint8_t MT_UtilCommandProcessing(uint8_t *pBuf)
MT_UtilBindAddEntry(pBuf);
break;
+ case MT_UTIL_ASSOC_REMOVE:
+ MT_UtilAssocRemove(pBuf);
+ break;
+
+ case MT_UTIL_ASSOC_ADD:
+ MT_UtilAssocAdd(pBuf);
+ break;
+
case MT_UTIL_SYNC_REQ:
MT_UtilSync();
break;
@@ -1375,6 +1385,60 @@ static void MT_UtilAssocCount(uint8_t *pBuf)
MT_BuildAndSendZToolResponse(((uint8_t)MT_RPC_CMD_SRSP | (uint8_t)MT_RPC_SYS_UTIL), cmdId, 2, pBuf);
}
+/***************************************************************************************************
+ * @fn MT_UtilAssocRemove
+ *
+ * @brief Proxy the AssocRemove() function.
+ *
+ * @param pBuf - pointer to the received buffer
+ *
+ * @return void
+ ***************************************************************************************************/
+static void MT_UtilAssocRemove(uint8_t *pBuf)
+{
+ uint8_t cmdId;
+ uint8_t ieeeAddr[Z_EXTADDR_LEN];
+ uint8_t retValue = 0;
+
+ // parse header
+ cmdId = pBuf[MT_RPC_POS_CMD1];
+ pBuf += MT_RPC_FRAME_HDR_SZ;
+
+ /* IeeAddress */
+ OsalPort_memcpy(ieeeAddr, pBuf, Z_EXTADDR_LEN);
+
+ AssocRemove(ieeeAddr);
+
+ MT_BuildAndSendZToolResponse(((uint8_t)MT_RPC_CMD_SRSP | (uint8_t)MT_RPC_SYS_UTIL), cmdId, 1, &retValue);
+}
+
+/***************************************************************************************************
+ * @fn MT_UtilAssocAdd
+ *
+ * @brief Proxy the AssocAdd() function.
+ *
+ * @param pBuf - pointer to the received buffer
+ *
+ * @return void
+ ***************************************************************************************************/
+static void MT_UtilAssocAdd(uint8_t *pBuf)
+{
+ uint8_t cmdId;
+ uint8_t retValue = 0;
+
+ // parse header
+ cmdId = pBuf[MT_RPC_POS_CMD1];
+ pBuf += MT_RPC_FRAME_HDR_SZ;
+
+ AssocAddNew(
+ BUILD_UINT16(pBuf[Z_EXTADDR_LEN], pBuf[Z_EXTADDR_LEN + 1]),
+ pBuf,
+ pBuf[Z_EXTADDR_LEN + 2]
+ );
+
+ MT_BuildAndSendZToolResponse(((uint8_t)MT_RPC_CMD_SRSP | (uint8_t)MT_RPC_SYS_UTIL), cmdId, 1, &retValue);
+}
+
/***************************************************************************************************
* @fn MT_UtilAssocFindDevice
*
2020-03-15 16:44:28 +01:00
diff --git a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c
2020-11-03 20:19:41 +01:00
index 63c143b..da6cb80 100644
2020-03-15 16:44:28 +01:00
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c
@@ -43,15 +43,21 @@
#include "zcomdef.h"
#include "mt_version.h"
2020-11-03 20:19:41 +01:00
+#define CODE_REVISION_NUMBER 20201103
+
/******************************************************************************
* CONSTANTS
*****************************************************************************/
const uint8_t MTVersionString[] = {
2, /* Transport protocol revision */
- 0, /* Product ID */
+ 1, /* Product ID */
2, /* Software major release number */
7, /* Software minor release number */
1, /* Software maintenance release number */
+ ((CODE_REVISION_NUMBER >> 0) & 0xFF),
+ ((CODE_REVISION_NUMBER >> 8) & 0xFF),
+ ((CODE_REVISION_NUMBER >> 16) & 0xFF),
+ ((CODE_REVISION_NUMBER >> 24) & 0xFF),
};
/******************************************************************************
2020-03-15 16:44:28 +01:00
diff --git a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
new file mode 100644
2020-11-03 20:19:41 +01:00
index 0000000..80f2097
2020-03-15 16:44:28 +01:00
--- /dev/null
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
2020-11-03 20:19:41 +01:00
@@ -0,0 +1,46 @@
2020-03-15 16:44:28 +01:00
+#define MT_SYS_KEY_MANAGEMENT 1
+#define FEATURE_NVEXID 1
+
+// Save memory
+#undef NWK_MAX_BINDING_ENTRIES
+#define NWK_MAX_BINDING_ENTRIES 1
+#undef APS_MAX_GROUPS
+#define APS_MAX_GROUPS 1
+
+// Increase NV pages to 3 to allow for bigger device tables
+#undef NVOCMP_NVPAGES
+#define NVOCMP_NVPAGES 3
+
+// 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 the max number of boardcasts, the default broadcast delivery time is 3 seconds
+// with the value below this will allow for 1 broadcast every 0.15 second
+#define MAX_BCAST 30
+
+/**
+ * Enable MTO routing
+ */
+#define CONCENTRATOR_ENABLE TRUE
2020-11-03 20:19:41 +01:00
+#define CONCENTRATOR_DISCOVERY_TIME 100
2020-03-15 16:44:28 +01:00
+#define CONCENTRATOR_ROUTE_CACHE TRUE
+#define MAX_RTG_SRC_ENTRIES 200
2020-11-03 20:19:41 +01:00
+#define SRC_RTG_EXPIRY_TIME 2
2020-03-15 16:44:28 +01:00
+
+/**
+ * Scale other device tables appropriately
+ */
+#define NWK_MAX_DEVICE_LIST 50
+#define ZDSECMGR_TC_DEVICE_MAX 200
+#define MAX_NEIGHBOR_ENTRIES 20
+#define MAX_RTG_ENTRIES 100
2020-11-03 20:19:41 +01:00
+
+// From https://www.ti.com/lit/an/swra650b/swra650b.pdf?ts=1604389355381
+#define LINK_DOWN_TRIGGER 12
+#define NWK_ROUTE_AGE_LIMIT 5
+#define DEF_NWK_RADIUS 15
+#define DEFAULT_ROUTE_REQUEST_RADIUS 8
+#define ZDNWKMGR_MIN_TRANSMISSIONS 0
+#define ROUTE_DISCOVERY_TIME 13
+#define MTO_RREQ_LIMIT_TIME 5000
2020-03-15 16:44:28 +01:00
diff --git a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts
index 6e3cb6a..1f90cc6 100644
2020-03-15 16:44:28 +01:00
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts
@@ -32,3 +32,5 @@
-DMT_GP_CB_FUNC
-DMT_APP_CNF_FUNC
+
2020-03-15 16:44:28 +01:00
+--preinclude=preinclude.h
\ No newline at end of file
diff --git a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/af/af.c b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/af/af.c
index 3a7afa3..e3a2706 100644
2020-03-15 16:44:28 +01:00
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/af/af.c
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/af/af.c
@@ -407,10 +407,18 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16_t S
2020-07-21 15:23:49 +02:00
#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
+ 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 );
+ }
2020-07-21 15:23:49 +02:00
- epDesc = afFindEndPointDesc( grpEp );
if ( epDesc == NULL )
return; // Endpoint descriptor not found
@@ -457,7 +465,9 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16_t S
// if the Wildcard ProfileID is received the message should not be sent to ZDO endpoint
if ( (aff->ProfileID == epProfileID) ||
((epDesc->endPoint == ZDO_EP) && (aff->ProfileID == ZDO_PROFILE_ID)) ||
- ((epDesc->endPoint != ZDO_EP) && ( aff->ProfileID == ZDO_WILDCARD_PROFILE_ID )) )
+ ((epDesc->endPoint != ZDO_EP) && ( aff->ProfileID == ZDO_WILDCARD_PROFILE_ID )) ||
+ // Fix below is to support PGC410EU: https://github.com/Koenkk/zigbee2mqtt/issues/4055
+ ((epDesc->endPoint == 2) && ( aff->ProfileID == 0xFC01 )) )
{
// Save original endpoint
uint8_t endpoint = aff->DstEndPoint;
2020-03-15 16:44:28 +01:00
diff --git a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
index e716024..f8d8404 100644
2020-03-15 16:44:28 +01:00
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
@@ -104,7 +104,7 @@ uint8_t zgSecurePermitJoin = TRUE;
2020-07-21 15:23:49 +02:00
// TC Link Key. In this scenario, if this flag is TRUE, the Trust Center will
// encrypt the outgoing NWK Key with the default TC Link Key (ZigbeeAlliance09).
// If this flag is FALSE (default), the Trust Center will not send the NWK Key at all.
-uint8_t zgAllowRejoinsWithWellKnownKey = FALSE;
2020-03-15 16:44:28 +01:00
+uint8_t zgAllowRejoinsWithWellKnownKey = TRUE; // https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/p/882650/3265311#3265311
2020-07-21 15:23:49 +02:00
//allowInstallCodes
uint8_t zgAllowInstallCodes = ZG_IC_SUPPORTED_NOT_REQUIRED;
@@ -198,7 +198,9 @@ uint8_t zgEndDeviceConfiguration = END_DEV_CONFIGURATION;
2020-07-21 15:23:49 +02:00
//
// NOTICE: Before enabling Child Aging make sure to review all the related
// definitions in this file, especially zgNwkParentInformation.
-uint8_t zgChildAgingEnable = TRUE;
2020-03-15 16:44:28 +01:00
+
+// Disable child aging, otherwise Xiaomi devices are being kicked off the network.
+uint8_t zgChildAgingEnable = FALSE;
2020-07-21 15:23:49 +02:00
//========== TouchLink NWK configuration ===============
// Values used by Router when starts a network as initiator
2020-03-15 16:44:28 +01:00
diff --git a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
index 17ac2f5..9c0021b 100644
2020-03-15 16:44:28 +01:00
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
@@ -419,12 +419,11 @@ uint32_t ZDApp_event_loop( uint8_t task_id, uint32_t events )
2020-07-21 15:23:49 +02:00
ZDApp_ChangeState( DEV_ROUTER );
}
- if ( zgChildAgingEnable == TRUE )
- {
- // Once the device has changed its state to a ROUTER set the timer to send
- // Parent annce
- ZDApp_SetParentAnnceTimer();
- }
+ // As we cannot enable child aging as Xiaomi devices will drop off
+ // but we stil want to have the parent announces we always enable it here.
+ // Otherwise some end devices could be unreachable when they changed parent
+ // while the coordinator was powered off.
+ ZDApp_SetParentAnnceTimer();
}
else
{
@@ -882,12 +881,11 @@ void ZDApp_NetworkStartEvt( void )
2020-07-21 15:23:49 +02:00
bdb_reportCommissioningState(BDB_INITIALIZATION,TRUE);
}
- if ( zgChildAgingEnable == TRUE )
- {
- // Once the device has changed its state to a COORDINATOR set the timer to send
- // Parent annce
- ZDApp_SetParentAnnceTimer();
- }
+ // As we cannot enable child aging as Xiaomi devices will drop off
+ // but we stil want to have the parent announces we always enable it here.
+ // Otherwise some end devices could be unreachable when they changed parent
+ // while the coordinator was powered off.
+ ZDApp_SetParentAnnceTimer();
}
else
{
2020-03-15 16:44:28 +01:00
diff --git a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/cc26x2lp.cmd b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/cc26x2lp.cmd
index 2b19342..b448752 100755
2020-03-15 16:44:28 +01:00
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/cc26x2lp.cmd
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/cc26x2lp.cmd
@@ -70,15 +70,9 @@
/* must be located at the beginning of the application. */
#define FLASH_BASE 0x00000000
-#ifdef ONE_PAGE_NV
-#define FLASH_SIZE 0x54000
-#define FLASH_NV_BASE 0x54000
-#define FLASH_NV_SIZE 0x2000
-#else
-#define FLASH_SIZE 0x52000
-#define FLASH_NV_BASE 0x52000
-#define FLASH_NV_SIZE 0x4000
-#endif
+#define FLASH_SIZE 0x50000
+#define FLASH_NV_BASE 0x50000
+#define FLASH_NV_SIZE 0x6000
#define FLASH_LAST_BASE 0x56000
#define FLASH_LAST_SIZE 0x2000
2020-03-15 16:44:28 +01:00
diff --git a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/znp.syscfg b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/znp.syscfg
2020-11-03 20:19:41 +01:00
index 58838a8..54012e0 100644
2020-03-15 16:44:28 +01:00
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/znp.syscfg
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/znp.syscfg
@@ -50,6 +50,7 @@ CCFG.enableBootloaderBackdoor = true;
CCFG.dioBootloaderBackdoor = 13;
CCFG.levelBootloaderBackdoor = "Active low";
CCFG.srcClkLF = "Derived from HF XOSC";
2020-04-17 18:02:22 +02:00
+CCFG.enableDCDC = false;
CCFG.ccfgTemplate.$name = "ti_devices_CCFGTemplate0";
AESCBC1.$name = "CONFIG_AESCBC_0";
@@ -68,8 +69,8 @@ ECJPAKE1.$name = "CONFIG_ECJPAKE_0";
NVS1.$name = "CONFIG_NVSINTERNAL";
NVS1.internalFlash.$name = "ti_drivers_nvs_NVSCC26XX0";
-NVS1.internalFlash.regionBase = 0x52000;
-NVS1.internalFlash.regionSize = 0x4000;
+NVS1.internalFlash.regionBase = 0x50000;
+NVS1.internalFlash.regionSize = 0x6000;
NVS2.$name = "CONFIG_NVSEXTERNAL";
NVS2.nvsType = "External";
2020-11-03 20:19:41 +01:00
@@ -122,18 +123,19 @@ SPI1.sclkPinInstance.$name = "CONFIG_PIN_SPI_SCLK";
SPI1.misoPinInstance.$name = "CONFIG_PIN_SPI_MISO";
SPI1.mosiPinInstance.$name = "CONFIG_PIN_SPI_MOSI";
-zstack.deviceType = "znp";
-zstack.deviceTypeReadOnly = true;
-zstack.touchlink.$name = "ti_zstack_touchlink_zstack_touchlink0";
-zstack.pm.$name = "ti_zstack_pm_zstack_pm0";
-zstack.rf.$name = "ti_zstack_rf_zstack_rf0";
-zstack.rf.radioConfig.$name = "ti_devices_radioconfig_settings_ieee_15_40";
-zstack.rf.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param0";
-zstack.network.$name = "ti_zstack_network_zstack_network0";
-zstack.advanced.$name = "ti_zstack_advanced_zstack_advanced0";
-zstack.advanced.routing.$name = "ti_zstack_advanced_zstack_routing0";
-zstack.advanced.packetSending.$name = "ti_zstack_advanced_zstack_packet_sending0";
-zstack.advanced.tableSize.$name = "ti_zstack_advanced_zstack_table_size0";
+zstack.deviceType = "znp";
+zstack.deviceTypeReadOnly = true;
+zstack.touchlink.$name = "ti_zstack_touchlink_zstack_touchlink0";
+zstack.pm.$name = "ti_zstack_pm_zstack_pm0";
+zstack.rf.$name = "ti_zstack_rf_zstack_rf0";
+zstack.rf.radioConfig.$name = "ti_devices_radioconfig_settings_ieee_15_40";
+zstack.rf.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param0";
+zstack.network.$name = "ti_zstack_network_zstack_network0";
+zstack.advanced.$name = "ti_zstack_advanced_zstack_advanced0";
+zstack.advanced.routing.$name = "ti_zstack_advanced_zstack_routing0";
+zstack.advanced.packetSending.$name = "ti_zstack_advanced_zstack_packet_sending0";
+zstack.advanced.packetSending.apsAckWaitDurationPolled = 1000;
+zstack.advanced.tableSize.$name = "ti_zstack_advanced_zstack_table_size0";
/**
* Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
2020-08-05 16:33:33 +02:00
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt.h b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
index 2c5073c..8732c65 100644
2020-08-05 16:33:33 +02:00
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
@@ -441,6 +441,8 @@ extern "C"
2020-08-05 16:33:33 +02:00
#define MT_UTIL_SRNG_GENERATE 0x4C
#endif
#define MT_UTIL_BIND_ADD_ENTRY 0x4D
+#define MT_UTIL_ASSOC_REMOVE 0x63 // Custom command
+#define MT_UTIL_ASSOC_ADD 0x64 // Custom command
2020-08-05 16:33:33 +02:00
#define MT_UTIL_ZCL_KEY_EST_INIT_EST 0x80
#define MT_UTIL_ZCL_KEY_EST_SIGN 0x81
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
index 90d6d4a..4d50083 100644
2020-08-05 16:33:33 +02:00
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
@@ -128,6 +128,8 @@ static void MT_UtilAPSME_LinkKeyNvIdGet(uint8_t *pBuf);
#endif //MT_SYS_KEY_MANAGEMENT
static void MT_UtilAPSME_RequestKeyCmd(uint8_t *pBuf);
static void MT_UtilAssocCount(uint8_t *pBuf);
+static void MT_UtilAssocRemove(uint8_t *pBuf);
+static void MT_UtilAssocAdd(uint8_t *pBuf);
static void MT_UtilAssocFindDevice(uint8_t *pBuf);
static void MT_UtilAssocGetWithAddress(uint8_t *pBuf);
static void MT_UtilBindAddEntry(uint8_t *pBuf);
@@ -272,6 +274,14 @@ uint8_t MT_UtilCommandProcessing(uint8_t *pBuf)
MT_UtilBindAddEntry(pBuf);
break;
+ case MT_UTIL_ASSOC_REMOVE:
+ MT_UtilAssocRemove(pBuf);
+ break;
+
+ case MT_UTIL_ASSOC_ADD:
+ MT_UtilAssocAdd(pBuf);
+ break;
+
case MT_UTIL_SYNC_REQ:
MT_UtilSync();
break;
@@ -1375,6 +1385,60 @@ static void MT_UtilAssocCount(uint8_t *pBuf)
MT_BuildAndSendZToolResponse(((uint8_t)MT_RPC_CMD_SRSP | (uint8_t)MT_RPC_SYS_UTIL), cmdId, 2, pBuf);
}
+/***************************************************************************************************
+ * @fn MT_UtilAssocRemove
+ *
+ * @brief Proxy the AssocRemove() function.
+ *
+ * @param pBuf - pointer to the received buffer
+ *
+ * @return void
+ ***************************************************************************************************/
+static void MT_UtilAssocRemove(uint8_t *pBuf)
+{
+ uint8_t cmdId;
+ uint8_t ieeeAddr[Z_EXTADDR_LEN];
+ uint8_t retValue = 0;
+
+ // parse header
+ cmdId = pBuf[MT_RPC_POS_CMD1];
+ pBuf += MT_RPC_FRAME_HDR_SZ;
+
+ /* IeeAddress */
+ OsalPort_memcpy(ieeeAddr, pBuf, Z_EXTADDR_LEN);
+
+ AssocRemove(ieeeAddr);
+
+ MT_BuildAndSendZToolResponse(((uint8_t)MT_RPC_CMD_SRSP | (uint8_t)MT_RPC_SYS_UTIL), cmdId, 1, &retValue);
+}
+
+/***************************************************************************************************
+ * @fn MT_UtilAssocAdd
+ *
+ * @brief Proxy the AssocAdd() function.
+ *
+ * @param pBuf - pointer to the received buffer
+ *
+ * @return void
+ ***************************************************************************************************/
+static void MT_UtilAssocAdd(uint8_t *pBuf)
+{
+ uint8_t cmdId;
+ uint8_t retValue = 0;
+
+ // parse header
+ cmdId = pBuf[MT_RPC_POS_CMD1];
+ pBuf += MT_RPC_FRAME_HDR_SZ;
+
+ AssocAddNew(
+ BUILD_UINT16(pBuf[Z_EXTADDR_LEN], pBuf[Z_EXTADDR_LEN + 1]),
+ pBuf,
+ pBuf[Z_EXTADDR_LEN + 2]
+ );
+
+ MT_BuildAndSendZToolResponse(((uint8_t)MT_RPC_CMD_SRSP | (uint8_t)MT_RPC_SYS_UTIL), cmdId, 1, &retValue);
+}
+
/***************************************************************************************************
* @fn MT_UtilAssocFindDevice
*
2019-09-17 19:58:24 +02:00
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c
2020-11-03 20:19:41 +01:00
index 63c143b..da6cb80 100644
2019-09-17 19:58:24 +02:00
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c
@@ -43,15 +43,21 @@
#include "zcomdef.h"
#include "mt_version.h"
2020-11-03 20:19:41 +01:00
+#define CODE_REVISION_NUMBER 20201103
+
/******************************************************************************
* CONSTANTS
*****************************************************************************/
const uint8_t MTVersionString[] = {
2, /* Transport protocol revision */
- 0, /* Product ID */
+ 1, /* Product ID */
2, /* Software major release number */
7, /* Software minor release number */
1, /* Software maintenance release number */
+ ((CODE_REVISION_NUMBER >> 0) & 0xFF),
+ ((CODE_REVISION_NUMBER >> 8) & 0xFF),
+ ((CODE_REVISION_NUMBER >> 16) & 0xFF),
+ ((CODE_REVISION_NUMBER >> 24) & 0xFF),
};
/******************************************************************************
2019-09-17 19:58:24 +02:00
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
2019-04-08 19:33:38 +02:00
new file mode 100644
2020-11-03 20:19:41 +01:00
index 0000000..80f2097
2019-04-08 19:33:38 +02:00
--- /dev/null
2019-09-17 19:58:24 +02:00
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
2020-11-03 20:19:41 +01:00
@@ -0,0 +1,46 @@
2019-04-14 14:29:56 +02:00
+#define MT_SYS_KEY_MANAGEMENT 1
+#define FEATURE_NVEXID 1
2019-09-17 19:58:24 +02:00
+
+// Save memory
+#undef NWK_MAX_BINDING_ENTRIES
+#define NWK_MAX_BINDING_ENTRIES 1
+#undef APS_MAX_GROUPS
+#define APS_MAX_GROUPS 1
+
+// Increase NV pages to 3 to allow for bigger device tables
+#undef NVOCMP_NVPAGES
+#define NVOCMP_NVPAGES 3
+
2019-09-17 19:58:24 +02:00
+// 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
2019-04-14 19:00:12 +02:00
+#define MULTICAST_ENABLED FALSE
2019-09-17 19:58:24 +02:00
+
+// Increase the max number of boardcasts, the default broadcast delivery time is 3 seconds
+// with the value below this will allow for 1 broadcast every 0.15 second
+#define MAX_BCAST 30
2019-09-17 19:58:24 +02:00
+
+/**
+ * Enable MTO routing
+ */
+#define CONCENTRATOR_ENABLE TRUE
2020-11-03 20:19:41 +01:00
+#define CONCENTRATOR_DISCOVERY_TIME 100
2019-09-17 19:58:24 +02:00
+#define CONCENTRATOR_ROUTE_CACHE TRUE
+#define MAX_RTG_SRC_ENTRIES 200
2020-11-03 20:19:41 +01:00
+#define SRC_RTG_EXPIRY_TIME 2
2019-09-17 19:58:24 +02:00
+
+/**
+ * Scale other device tables appropriately
+ */
+#define NWK_MAX_DEVICE_LIST 50
+#define ZDSECMGR_TC_DEVICE_MAX 200
+#define MAX_NEIGHBOR_ENTRIES 20
2019-09-17 19:58:24 +02:00
+#define MAX_RTG_ENTRIES 100
2020-11-03 20:19:41 +01:00
+
+// From https://www.ti.com/lit/an/swra650b/swra650b.pdf?ts=1604389355381
+#define LINK_DOWN_TRIGGER 12
+#define NWK_ROUTE_AGE_LIMIT 5
+#define DEF_NWK_RADIUS 15
+#define DEFAULT_ROUTE_REQUEST_RADIUS 8
+#define ZDNWKMGR_MIN_TRANSMISSIONS 0
+#define ROUTE_DISCOVERY_TIME 13
+#define MTO_RREQ_LIMIT_TIME 5000
2019-09-17 19:58:24 +02:00
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts
index 6e3cb6a..1f90cc6 100644
2019-09-17 19:58:24 +02:00
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts
@@ -32,3 +32,5 @@
-DMT_GP_CB_FUNC
-DMT_APP_CNF_FUNC
+
2020-04-17 18:02:22 +02:00
+--preinclude=preinclude.h
\ No newline at end of file
2019-09-17 19:58:24 +02:00
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/af/af.c b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/af/af.c
index 3a7afa3..e3a2706 100644
2019-09-17 19:58:24 +02:00
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/af/af.c
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/af/af.c
@@ -407,10 +407,18 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16_t S
2020-07-21 15:23:49 +02:00
#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
+ 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 );
+ }
2020-07-21 15:23:49 +02:00
- epDesc = afFindEndPointDesc( grpEp );
if ( epDesc == NULL )
return; // Endpoint descriptor not found
@@ -457,7 +465,9 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16_t S
// if the Wildcard ProfileID is received the message should not be sent to ZDO endpoint
if ( (aff->ProfileID == epProfileID) ||
((epDesc->endPoint == ZDO_EP) && (aff->ProfileID == ZDO_PROFILE_ID)) ||
- ((epDesc->endPoint != ZDO_EP) && ( aff->ProfileID == ZDO_WILDCARD_PROFILE_ID )) )
+ ((epDesc->endPoint != ZDO_EP) && ( aff->ProfileID == ZDO_WILDCARD_PROFILE_ID )) ||
+ // Fix below is to support PGC410EU: https://github.com/Koenkk/zigbee2mqtt/issues/4055
+ ((epDesc->endPoint == 2) && ( aff->ProfileID == 0xFC01 )) )
{
// Save original endpoint
uint8_t endpoint = aff->DstEndPoint;
2019-09-17 19:58:24 +02:00
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
index e716024..f8d8404 100644
2019-09-17 19:58:24 +02:00
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
@@ -104,7 +104,7 @@ uint8_t zgSecurePermitJoin = TRUE;
2020-07-21 15:23:49 +02:00
// TC Link Key. In this scenario, if this flag is TRUE, the Trust Center will
// encrypt the outgoing NWK Key with the default TC Link Key (ZigbeeAlliance09).
// If this flag is FALSE (default), the Trust Center will not send the NWK Key at all.
-uint8_t zgAllowRejoinsWithWellKnownKey = FALSE;
2020-02-29 13:46:29 +01:00
+uint8_t zgAllowRejoinsWithWellKnownKey = TRUE; // https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/p/882650/3265311#3265311
2020-07-21 15:23:49 +02:00
//allowInstallCodes
uint8_t zgAllowInstallCodes = ZG_IC_SUPPORTED_NOT_REQUIRED;
@@ -198,7 +198,9 @@ uint8_t zgEndDeviceConfiguration = END_DEV_CONFIGURATION;
2020-07-21 15:23:49 +02:00
//
// NOTICE: Before enabling Child Aging make sure to review all the related
// definitions in this file, especially zgNwkParentInformation.
-uint8_t zgChildAgingEnable = TRUE;
2020-02-29 13:46:29 +01:00
+
+// Disable child aging, otherwise Xiaomi devices are being kicked off the network.
+uint8_t zgChildAgingEnable = FALSE;
2020-07-21 15:23:49 +02:00
//========== TouchLink NWK configuration ===============
// Values used by Router when starts a network as initiator
2020-02-29 13:46:29 +01:00
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
index 17ac2f5..9c0021b 100644
2020-02-29 13:46:29 +01:00
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
@@ -419,12 +419,11 @@ uint32_t ZDApp_event_loop( uint8_t task_id, uint32_t events )
2020-07-21 15:23:49 +02:00
ZDApp_ChangeState( DEV_ROUTER );
}
- if ( zgChildAgingEnable == TRUE )
- {
- // Once the device has changed its state to a ROUTER set the timer to send
- // Parent annce
- ZDApp_SetParentAnnceTimer();
- }
+ // As we cannot enable child aging as Xiaomi devices will drop off
+ // but we stil want to have the parent announces we always enable it here.
+ // Otherwise some end devices could be unreachable when they changed parent
+ // while the coordinator was powered off.
+ ZDApp_SetParentAnnceTimer();
}
else
{
@@ -882,12 +881,11 @@ void ZDApp_NetworkStartEvt( void )
2020-07-21 15:23:49 +02:00
bdb_reportCommissioningState(BDB_INITIALIZATION,TRUE);
}
- if ( zgChildAgingEnable == TRUE )
- {
- // Once the device has changed its state to a COORDINATOR set the timer to send
- // Parent annce
- ZDApp_SetParentAnnceTimer();
- }
+ // As we cannot enable child aging as Xiaomi devices will drop off
+ // but we stil want to have the parent announces we always enable it here.
+ // Otherwise some end devices could be unreachable when they changed parent
+ // while the coordinator was powered off.
+ ZDApp_SetParentAnnceTimer();
}
else
{
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/cc26x2lp.cmd b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/cc26x2lp.cmd
index e3fea91..b448752 100755
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/cc26x2lp.cmd
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/cc26x2lp.cmd
@@ -70,9 +70,9 @@
/* must be located at the beginning of the application. */
#define FLASH_BASE 0x00000000
-#define FLASH_SIZE 0x52000
-#define FLASH_NV_BASE 0x52000
-#define FLASH_NV_SIZE 0x4000
+#define FLASH_SIZE 0x50000
+#define FLASH_NV_BASE 0x50000
+#define FLASH_NV_SIZE 0x6000
#define FLASH_LAST_BASE 0x56000
#define FLASH_LAST_SIZE 0x2000
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/znp.syscfg b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/znp.syscfg
2020-11-03 20:19:41 +01:00
index a44107b..722142c 100644
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/znp.syscfg
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/znp.syscfg
@@ -49,6 +49,7 @@ CCFG.enableBootloader = true;
CCFG.enableBootloaderBackdoor = true;
CCFG.dioBootloaderBackdoor = 13;
CCFG.levelBootloaderBackdoor = "Active low";
2020-04-17 18:02:22 +02:00
+CCFG.enableDCDC = false;
CCFG.ccfgTemplate.$name = "ti_devices_CCFGTemplate0";
AESCBC1.$name = "CONFIG_AESCBC_0";
@@ -67,8 +68,8 @@ ECJPAKE1.$name = "CONFIG_ECJPAKE_0";
NVS1.$name = "CONFIG_NVSINTERNAL";
NVS1.internalFlash.$name = "ti_drivers_nvs_NVSCC26XX0";
-NVS1.internalFlash.regionBase = 0x52000;
-NVS1.internalFlash.regionSize = 0x4000;
2020-03-13 18:50:04 +01:00
+NVS1.internalFlash.regionBase = 0x50000;
+NVS1.internalFlash.regionSize = 0x6000;
NVS2.$name = "CONFIG_NVSEXTERNAL";
NVS2.nvsType = "External";
2020-11-03 20:19:41 +01:00
@@ -121,18 +122,19 @@ SPI1.sclkPinInstance.$name = "CONFIG_PIN_SPI_SCLK";
SPI1.misoPinInstance.$name = "CONFIG_PIN_SPI_MISO";
SPI1.mosiPinInstance.$name = "CONFIG_PIN_SPI_MOSI";
-zstack.deviceType = "znp";
-zstack.deviceTypeReadOnly = true;
-zstack.touchlink.$name = "ti_zstack_touchlink_zstack_touchlink0";
-zstack.pm.$name = "ti_zstack_pm_zstack_pm0";
-zstack.rf.$name = "ti_zstack_rf_zstack_rf0";
-zstack.rf.radioConfig.$name = "ti_devices_radioconfig_settings_ieee_15_40";
-zstack.rf.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param0";
-zstack.network.$name = "ti_zstack_network_zstack_network0";
-zstack.advanced.$name = "ti_zstack_advanced_zstack_advanced0";
-zstack.advanced.routing.$name = "ti_zstack_advanced_zstack_routing0";
-zstack.advanced.packetSending.$name = "ti_zstack_advanced_zstack_packet_sending0";
-zstack.advanced.tableSize.$name = "ti_zstack_advanced_zstack_table_size0";
+zstack.deviceType = "znp";
+zstack.deviceTypeReadOnly = true;
+zstack.touchlink.$name = "ti_zstack_touchlink_zstack_touchlink0";
+zstack.pm.$name = "ti_zstack_pm_zstack_pm0";
+zstack.rf.$name = "ti_zstack_rf_zstack_rf0";
+zstack.rf.radioConfig.$name = "ti_devices_radioconfig_settings_ieee_15_40";
+zstack.rf.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param0";
+zstack.network.$name = "ti_zstack_network_zstack_network0";
+zstack.advanced.$name = "ti_zstack_advanced_zstack_advanced0";
+zstack.advanced.routing.$name = "ti_zstack_advanced_zstack_routing0";
+zstack.advanced.packetSending.$name = "ti_zstack_advanced_zstack_packet_sending0";
+zstack.advanced.packetSending.apsAckWaitDurationPolled = 1000;
+zstack.advanced.tableSize.$name = "ti_zstack_advanced_zstack_table_size0";
/**
* Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
--
2020-07-21 15:23:49 +02:00
2.24.3 (Apple Git-128)