Z-Stack-firmware/coordinator/Z-Stack_3.x.0/firmware.patch
Koen Kanters b6c3a7a8de
Z-Stack 3.x.0 20200925 firmware (#212)
* Z-Stack 3.x.0 20200831 firmware

* 20200925 firmware. https://github.com/Koenkk/zigbee2mqtt/issues/4285
2020-10-01 16:57:53 +02:00

1949 lines
85 KiB
Diff

From a8ec8cc8e5e07b58cf8d077069a9cd5f446cdecb Mon Sep 17 00:00:00 2001
From: Koen Kanters <koenkanters94@gmail.com>
Date: Mon, 31 Aug 2020 16:45:20 +0200
Subject: [PATCH] Own changes
---
.../Application/mt/mt.h | 1 +
.../Application/mt/mt_sys.c | 2 +-
.../Application/mt/mt_util.c | 32 ++
.../Application/mt/mt_version.c | 2 +-
.../Application/mt/revision_info.h | 4 +
.../Stack/Config/preinclude.h | 39 ++
.../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 +-
znp_CC1352P_2_LAUNCHXL_tirtos_ccs/znp.syscfg | 350 +++++++++---------
.../Application/mt/mt.h | 1 +
.../Application/mt/mt_sys.c | 2 +-
.../Application/mt/mt_util.c | 32 ++
.../Application/mt/mt_version.c | 2 +-
.../Application/mt/revision_info.h | 4 +
.../Stack/Config/preinclude.h | 39 ++
.../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 +-
znp_CC2652RB_LAUNCHXL_tirtos_ccs/znp.syscfg | 341 ++++++++---------
.../Application/mt/mt.h | 1 +
.../Application/mt/mt_sys.c | 2 +-
.../Application/mt/mt_util.c | 32 ++
.../Application/mt/mt_version.c | 2 +-
.../Application/mt/revision_info.h | 4 +
.../Stack/Config/preinclude.h | 39 ++
.../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 +-
znp_CC26X2R1_LAUNCHXL_tirtos_ccs/znp.syscfg | 340 ++++++++---------
36 files changed, 809 insertions(+), 630 deletions(-)
create mode 100644 znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/revision_info.h
create mode 100644 znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
create mode 100644 znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/revision_info.h
create mode 100644 znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
create mode 100644 znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/revision_info.h
create mode 100644 znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
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 e4c8212..8efa00a 100644
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
@@ -443,6 +443,7 @@ extern "C"
#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_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_sys.c b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_sys.c
index f3d45f6..d709df7 100644
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_sys.c
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_sys.c
@@ -510,8 +510,8 @@ static void MT_SysVersion(void)
uint8_t *pBuf = &verStr[sizeof(MTVersionString)];
#if (defined MAKE_CRC_SHDW) || (defined FAKE_CRC_SHDW) //built for bootloader
uint32_t sblSig;
- uint32_t sblRev;
#endif
+ uint32_t sblRev;
OsalPort_memcpy(verStr, (uint8_t *)MTVersionString, sizeof(MTVersionString));
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 b7ed73b..661e027 100644
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
@@ -151,6 +151,7 @@ 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_UtilAssocFindDevice(uint8_t *pBuf);
static void MT_UtilAssocGetWithAddress(uint8_t *pBuf);
static void MT_UtilBindAddEntry(uint8_t *pBuf);
@@ -317,6 +318,10 @@ uint8_t MT_UtilCommandProcessing(uint8_t *pBuf)
MT_UtilBindAddEntry(pBuf);
break;
+ case MT_UTIL_ASSOC_REMOVE:
+ MT_UtilAssocRemove(pBuf);
+ break;
+
#if defined ZCL_KEY_ESTABLISH
case MT_UTIL_ZCL_KEY_EST_INIT_EST:
MT_UtilzclGeneral_KeyEstablish_InitiateKeyEstablishment(pBuf);
@@ -1584,6 +1589,33 @@ 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_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
index dbe48fb..f8402cd 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
@@ -69,7 +69,7 @@
*****************************************************************************/
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 */
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/revision_info.h b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/revision_info.h
new file mode 100644
index 0000000..fac1a7e
--- /dev/null
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/revision_info.h
@@ -0,0 +1,4 @@
+#ifndef APPLICATION_MT_REVISION_INFO_H_
+#define APPLICATION_MT_REVISION_INFO_H_
+#define CODE_REVISION_NUMBER 20200925
+#endif
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
index 0000000..27496eb
--- /dev/null
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
@@ -0,0 +1,39 @@
+#define INCLUDE_REVISION_INFORMATION
+#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
+#define CONCENTRATOR_DISCOVERY_TIME 120
+#define CONCENTRATOR_ROUTE_CACHE TRUE
+#define MAX_RTG_SRC_ENTRIES 200
+#define SRC_RTG_EXPIRY_TIME 255
+
+/**
+ * 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
+#define NWK_INDIRECT_MSG_TIMEOUT 20
\ No newline at end of file
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 d809fb2..abb769e 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
@@ -93,3 +93,5 @@
/* BDB interface */
-DMT_APP_CNF_FUNC
+
+--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 a96b3cc..088df18 100644
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/af/af.c
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/af/af.c
@@ -406,10 +406,18 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16_t S
#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 );
+ }
- epDesc = afFindEndPointDesc( grpEp );
if ( epDesc == NULL )
return; // Endpoint descriptor not found
@@ -456,7 +464,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 0c62cd3..6d55ba4 100644
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
@@ -110,7 +110,7 @@ uint8_t zgSecurePermitJoin = TRUE;
// 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;
+uint8_t zgAllowRejoinsWithWellKnownKey = TRUE; // https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/p/882650/3265311#3265311
//allowInstallCodes
uint8_t zgAllowInstallCodes = ZG_IC_SUPPORTED_NOT_REQUIRED;
@@ -204,7 +204,9 @@ uint8_t zgEndDeviceConfiguration = END_DEV_CONFIGURATION;
//
// NOTICE: Before enabling Child Aging make sure to review all the related
// definitions in this file, especially zgNwkParentInformation.
-uint8_t zgChildAgingEnable = TRUE;
+
+// Disable child aging, otherwise Xiaomi devices are being kicked off the network.
+uint8_t zgChildAgingEnable = FALSE;
//========== TouchLink NWK configuration ===============
// Values used by Router when starts a network as initiator
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 a893bc3..ca57a6a 100644
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
@@ -422,12 +422,11 @@ uint32_t ZDApp_event_loop( uint8_t task_id, uint32_t events )
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
{
@@ -905,12 +904,11 @@ void ZDApp_NetworkStartEvt( void )
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 30e5847..016187a 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
index e44b370..867fac2 100644
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/znp.syscfg
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/znp.syscfg
@@ -1,185 +1,165 @@
-/*
- * Copyright (c) 2018, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-// @cliArgs --board /ti/boards/CC1352P_2_LAUNCHXL
-
-/*
- * znp.syscfg
- */
-
-/* Modules */
-var AESCBC = scripting.addModule("/ti/drivers/AESCBC");
-var AESCCM = scripting.addModule("/ti/drivers/AESCCM");
-var AESECB = scripting.addModule("/ti/drivers/AESECB");
-var device = scripting.addModule("/ti/devices/CCFG");
-var DMA = scripting.addModule("/ti/drivers/DMA");
-var ECDH = scripting.addModule("/ti/drivers/ECDH");
-var ECDSA = scripting.addModule("/ti/drivers/ECDSA");
-var ECJPAKE = scripting.addModule("/ti/drivers/ECJPAKE");
-var Button = scripting.addModule("/ti/drivers/apps/Button");
-var LED = scripting.addModule("/ti/drivers/apps/LED");
-var NVS = scripting.addModule("/ti/drivers/NVS");
-var Power = scripting.addModule("/ti/drivers/Power");
-var RF = scripting.addModule("/ti/drivers/RF");
-var SHA2 = scripting.addModule("/ti/drivers/SHA2");
-var TRNG = scripting.addModule("/ti/drivers/TRNG");
-var UART = scripting.addModule("/ti/drivers/UART");
-var zstack = scripting.addModule("/ti/zstack/zstack");
-
-
-/* Instances */
-var AESCBC1 = AESCBC.addInstance();
-var AESCCM1 = AESCCM.addInstance();
-var AESECB1 = AESECB.addInstance();
-var ECDH1 = ECDH.addInstance();
-var ECDSA1 = ECDSA.addInstance();
-var ECJPAKE1 = ECJPAKE.addInstance();
-var Button1 = Button.addInstance();
-var Button2 = Button.addInstance();
-var LED1 = LED.addInstance();
-var LED2 = LED.addInstance();
-var NVS1 = NVS.addInstance();
-var NVS2 = NVS.addInstance();
-var SHA21 = SHA2.addInstance();
-var TRNG1 = TRNG.addInstance();
-var UART1 = UART.addInstance();
-
-
-/* AESCCM */
-AESCCM1.interruptPriority = "2";
-
-
-/* AESECB */
-AESECB1.interruptPriority = "1";
-
-/* ======== RF Design ======== */
-var rfDesign = scripting.addModule("ti/devices/radioconfig/rfdesign");
-const rfDesignSettings = system.getScript("/ti/common/lprf_rf_design_settings.js").rfDesignSettings;
-for(var setting in rfDesignSettings)
-{
- rfDesign[setting] = rfDesignSettings[setting];
-}
-
-
-/* CCFG */
-const ccfgSettings = system.getScript("/ti/common/lprf_ccfg_settings.js").ccfgSettings;
-for(var setting in ccfgSettings)
-{
- device[setting] = ccfgSettings[setting];
-}
-
-
-/* Red LED */
-LED1.$name = "CONFIG_LED_RED";
-LED1.$hardware = system.deviceData.board.components.LED_RED;
-LED1.gpioPin.$name = "CONFIG_GPIO_RLED";
-LED1.gpioPin.mode = "Output";
-LED1.gpioPin.callbackFunction = "";
-LED1.gpioPin.pinInstance.$name = "CONFIG_PIN_RLED";
-
-/* Green LED */
-LED2.$name = "CONFIG_LED_GREEN";
-LED2.$hardware = system.deviceData.board.components.LED_GREEN;
-LED2.gpioPin.$name = "CONFIG_GPIO_GLED";
-LED2.gpioPin.mode = "Output";
-LED2.gpioPin.callbackFunction = "";
-LED2.gpioPin.pinInstance.$name = "CONFIG_PIN_GLED";
-
-/* Left Button */
-Button1.$name = "CONFIG_BTN_LEFT";
-Button1.$hardware = system.deviceData.board.components["BTN-1"];
-Button1.gpioPin.$name = "CONFIG_GPIO_BTN1";
-Button1.gpioPin.pull = "Pull Up";
-Button1.gpioPin.interruptTrigger = "Falling Edge";
-Button1.gpioPin.pinInstance.$name = "CONFIG_PIN_BTN1";
-
-/* Left Button */
-Button2.$name = "CONFIG_BTN_RIGHT";
-Button2.$hardware = system.deviceData.board.components["BTN-2"];
-Button2.gpioPin.$name = "CONFIG_GPIO_BTN2";
-Button2.gpioPin.pull = "Pull Up";
-Button2.gpioPin.interruptTrigger = "Falling Edge";
-Button2.gpioPin.pinInstance.$name = "CONFIG_PIN_BTN2";
-
-
-/* Internal NVS */
-NVS1.$name = "CONFIG_NVSINTERNAL";
-NVS1.nvsType = "Internal";
-NVS1.internalFlash.regionBase = 0x52000;
-NVS1.internalFlash.regionSize = 0x4000;
-
-
-/* External NVS */
-NVS2.$name = "CONFIG_NVSEXTERNAL";
-NVS2.nvsType = "External";
-NVS2.$hardware = system.deviceData.board.components.MX25R8035F;
-NVS2.externalFlash.regionBase = 0;
-NVS2.externalFlash.regionSize = 0x256000;
-NVS2.externalFlash.sectorSize = 0x1000;
-NVS2.externalFlash.verifyBufferSize = 64;
-
-
-/* External NVS SPI instance */
-var NVSSPI25XDevice1 = NVS2.externalFlash.spiFlashDevice;
-var SPI1 = NVSSPI25XDevice1.sharedSpiInstance;
-SPI1.$name = "CONFIG_SPI_0";
-SPI1.sclkPinInstance.$name = "CONFIG_PIN_SPI_SCLK";
-SPI1.misoPinInstance.$name = "CONFIG_PIN_SPI_MISO";
-SPI1.mosiPinInstance.$name = "CONFIG_PIN_SPI_MOSI";
-
-
-/* RF */
-/* if an antenna component exists, assign it to the RF instance */
-if (system.deviceData.board && system.deviceData.board.components.RF) {
- RF.$hardware = system.deviceData.board.components.RF;
-}
-
-/* Display (UART) */
-UART1.$hardware = system.deviceData.board.components.XDS110UART;
-UART1.txPinInstance.$name = "CONFIG_PIN_UART_TX";
-UART1.rxPinInstance.$name = "CONFIG_PIN_UART_RX";
-UART1.$name = "CONFIG_DISPLAY_UART";
-
-
-/* Z-Stack */
-zstack.deviceType = "znp";
-zstack.deviceTypeReadOnly = true;
-zstack.rf.rfDesign = rfDesignSettings.rfDesign;
-
-/* ======== Do device specific settings ======== */
-const deviceName = system.getScript("/ti/ti154stack/ti154stack_common.js").getLaunchPadFromDevice();
-
-/* Update LF Clock Source for CC2652RB devices */
-if(deviceName.includes("RB"))
-{
- device.srcClkLF = "Derived from HF XOSC";
-}
-
+/**
+ * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
+ * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
+ * @cliArgs --board "/ti/boards/CC1352P_2_LAUNCHXL" --product "simplelink_cc13x2_26x2_sdk@4.20.01.04"
+ * @versions {"data":"2020052512","timestamp":"2020052512","tool":"1.5.0+1397","templates":"2020052512"}
+ */
+
+/**
+ * Import the modules used in this configuration.
+ */
+const CCFG = scripting.addModule("/ti/devices/CCFG");
+const rfdesign = scripting.addModule("/ti/devices/radioconfig/rfdesign");
+const AESCBC = scripting.addModule("/ti/drivers/AESCBC");
+const AESCBC1 = AESCBC.addInstance();
+const AESCCM = scripting.addModule("/ti/drivers/AESCCM");
+const AESCCM1 = AESCCM.addInstance();
+const AESECB = scripting.addModule("/ti/drivers/AESECB");
+const AESECB1 = AESECB.addInstance();
+const DMA = scripting.addModule("/ti/drivers/DMA");
+const ECDH = scripting.addModule("/ti/drivers/ECDH");
+const ECDH1 = ECDH.addInstance();
+const ECDSA = scripting.addModule("/ti/drivers/ECDSA");
+const ECDSA1 = ECDSA.addInstance();
+const ECJPAKE = scripting.addModule("/ti/drivers/ECJPAKE");
+const ECJPAKE1 = ECJPAKE.addInstance();
+const NVS = scripting.addModule("/ti/drivers/NVS");
+const NVS1 = NVS.addInstance();
+const NVS2 = NVS.addInstance();
+const Power = scripting.addModule("/ti/drivers/Power");
+const RF = scripting.addModule("/ti/drivers/RF");
+const SHA2 = scripting.addModule("/ti/drivers/SHA2");
+const SHA21 = SHA2.addInstance();
+const TRNG = scripting.addModule("/ti/drivers/TRNG");
+const TRNG1 = TRNG.addInstance();
+const UART = scripting.addModule("/ti/drivers/UART");
+const UART1 = UART.addInstance();
+const Button = scripting.addModule("/ti/drivers/apps/Button");
+const Button1 = Button.addInstance();
+const Button2 = Button.addInstance();
+const LED = scripting.addModule("/ti/drivers/apps/LED");
+const LED1 = LED.addInstance();
+const LED2 = LED.addInstance();
+const zstack = scripting.addModule("/ti/zstack/zstack");
+
+/**
+ * Write custom configuration values to the imported modules.
+ */
+CCFG.xoscCapArray = true;
+CCFG.xoscCapArrayDelta = 0xC1;
+CCFG.enableBootloader = true;
+CCFG.enableBootloaderBackdoor = true;
+CCFG.dioBootloaderBackdoor = 15;
+CCFG.levelBootloaderBackdoor = "Active low";
+CCFG.forceVddr = true;
+CCFG.enableDCDC = false;
+CCFG.ccfgTemplate.$name = "ti_devices_CCFGTemplate0";
+
+rfdesign.rfDesign = "LAUNCHXL-CC1352P-2";
+
+AESCBC1.$name = "CONFIG_AESCBC_0";
+
+AESCCM1.$name = "CONFIG_AESCCM_0";
+AESCCM1.interruptPriority = "2";
+
+AESECB1.$name = "CONFIG_AESECB_0";
+AESECB1.interruptPriority = "1";
+
+ECDH1.$name = "CONFIG_ECDH_0";
+
+ECDSA1.$name = "CONFIG_ECDSA_0";
+
+ECJPAKE1.$name = "CONFIG_ECJPAKE_0";
+
+NVS1.$name = "CONFIG_NVSINTERNAL";
+NVS1.internalFlash.$name = "ti_drivers_nvs_NVSCC26XX0";
+NVS1.internalFlash.regionBase = 0x50000;
+NVS1.internalFlash.regionSize = 0x6000;
+
+NVS2.$name = "CONFIG_NVSEXTERNAL";
+NVS2.nvsType = "External";
+NVS2.$hardware = system.deviceData.board.components.MX25R8035F;
+NVS2.externalFlash.$name = "ti_drivers_nvs_NVSSPI25X0";
+NVS2.externalFlash.regionSize = 0x256000;
+NVS2.externalFlash.verifyBufferSize = 64;
+
+RF.$hardware = system.deviceData.board.components["SKY13317-373LF"];
+
+SHA21.$name = "CONFIG_SHA2_0";
+
+TRNG1.$name = "CONFIG_TRNG_0";
+
+UART1.$hardware = system.deviceData.board.components.XDS110UART;
+UART1.$name = "CONFIG_DISPLAY_UART";
+UART1.txPinInstance.$name = "CONFIG_PIN_UART_TX";
+UART1.rxPinInstance.$name = "CONFIG_PIN_UART_RX";
+
+Button1.$name = "CONFIG_BTN_LEFT";
+Button1.$hardware = system.deviceData.board.components["BTN-1"];
+Button1.gpioPin.$name = "CONFIG_GPIO_BTN1";
+Button1.gpioPin.pinInstance.$name = "CONFIG_PIN_BTN1";
+
+Button2.$name = "CONFIG_BTN_RIGHT";
+Button2.$hardware = system.deviceData.board.components["BTN-2"];
+Button2.gpioPin.$name = "CONFIG_GPIO_BTN2";
+Button2.gpioPin.pinInstance.$name = "CONFIG_PIN_BTN2";
+
+LED1.$name = "CONFIG_LED_RED";
+LED1.$hardware = system.deviceData.board.components.LED_RED;
+LED1.gpioPin.$name = "CONFIG_GPIO_RLED";
+LED1.gpioPin.pinInstance.$name = "CONFIG_PIN_RLED";
+
+LED2.$name = "CONFIG_LED_GREEN";
+LED2.$hardware = system.deviceData.board.components.LED_GREEN;
+LED2.gpioPin.$name = "CONFIG_GPIO_GLED";
+LED2.gpioPin.pinInstance.$name = "CONFIG_PIN_GLED";
+
+const NVSSPI25XDevice = scripting.addModule("/ti/drivers/nvs/NVSSPI25XDevice", {}, false);
+const NVSSPI25XDevice1 = NVSSPI25XDevice.addInstance({}, false);
+NVSSPI25XDevice1.$name = "CONFIG_NVS_SPI_0";
+NVS2.externalFlash.spiFlashDevice = NVSSPI25XDevice1;
+NVSSPI25XDevice1.slaveSelectGpioInstance.$name = "CONFIG_GPIO_0";
+NVSSPI25XDevice1.slaveSelectGpioInstance.pinInstance.$name = "CONFIG_PIN_0";
+
+const SPI = scripting.addModule("/ti/drivers/SPI", {}, false);
+const SPI1 = SPI.addInstance({}, false);
+SPI1.$name = "CONFIG_SPI_0";
+NVSSPI25XDevice1.sharedSpiInstance = SPI1;
+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.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";
+
+/**
+ * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
+ * version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to
+ * re-solve from scratch.
+ */
+RF.rfAntennaPin0.$suggestSolution = "DIO_28";
+RF.rfAntennaPin1.$suggestSolution = "DIO_29";
+RF.rfAntennaPin2.$suggestSolution = "DIO_30";
+UART1.uart.$suggestSolution = "UART0";
+UART1.uart.txPin.$suggestSolution = "boosterpack.4";
+UART1.uart.rxPin.$suggestSolution = "boosterpack.3";
+Button1.gpioPin.gpioPin.$suggestSolution = "boosterpack.13";
+Button2.gpioPin.gpioPin.$suggestSolution = "boosterpack.8";
+LED1.gpioPin.gpioPin.$suggestSolution = "boosterpack.39";
+LED2.gpioPin.gpioPin.$suggestSolution = "boosterpack.40";
+NVSSPI25XDevice1.slaveSelectGpioInstance.gpioPin.$suggestSolution = "boosterpack.38";
+SPI1.spi.$suggestSolution = "SSI0";
+SPI1.spi.sclkPin.$suggestSolution = "boosterpack.7";
+SPI1.spi.misoPin.$suggestSolution = "boosterpack.14";
+SPI1.spi.mosiPin.$suggestSolution = "boosterpack.15";
+SPI1.spi.dmaRxChannel.$suggestSolution = "DMA_CH3";
+SPI1.spi.dmaTxChannel.$suggestSolution = "DMA_CH4";
diff --git a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt.h b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
index e4c8212..8efa00a 100644
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
@@ -443,6 +443,7 @@ extern "C"
#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_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_sys.c b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_sys.c
index f3d45f6..d709df7 100644
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_sys.c
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_sys.c
@@ -510,8 +510,8 @@ static void MT_SysVersion(void)
uint8_t *pBuf = &verStr[sizeof(MTVersionString)];
#if (defined MAKE_CRC_SHDW) || (defined FAKE_CRC_SHDW) //built for bootloader
uint32_t sblSig;
- uint32_t sblRev;
#endif
+ uint32_t sblRev;
OsalPort_memcpy(verStr, (uint8_t *)MTVersionString, sizeof(MTVersionString));
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 b7ed73b..661e027 100644
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
@@ -151,6 +151,7 @@ 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_UtilAssocFindDevice(uint8_t *pBuf);
static void MT_UtilAssocGetWithAddress(uint8_t *pBuf);
static void MT_UtilBindAddEntry(uint8_t *pBuf);
@@ -317,6 +318,10 @@ uint8_t MT_UtilCommandProcessing(uint8_t *pBuf)
MT_UtilBindAddEntry(pBuf);
break;
+ case MT_UTIL_ASSOC_REMOVE:
+ MT_UtilAssocRemove(pBuf);
+ break;
+
#if defined ZCL_KEY_ESTABLISH
case MT_UTIL_ZCL_KEY_EST_INIT_EST:
MT_UtilzclGeneral_KeyEstablish_InitiateKeyEstablishment(pBuf);
@@ -1584,6 +1589,33 @@ 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_UtilAssocFindDevice
*
diff --git a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c
index dbe48fb..f8402cd 100644
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c
@@ -69,7 +69,7 @@
*****************************************************************************/
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 */
diff --git a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/revision_info.h b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/revision_info.h
new file mode 100644
index 0000000..fac1a7e
--- /dev/null
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Application/mt/revision_info.h
@@ -0,0 +1,4 @@
+#ifndef APPLICATION_MT_REVISION_INFO_H_
+#define APPLICATION_MT_REVISION_INFO_H_
+#define CODE_REVISION_NUMBER 20200925
+#endif
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
index 0000000..27496eb
--- /dev/null
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
@@ -0,0 +1,39 @@
+#define INCLUDE_REVISION_INFORMATION
+#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
+#define CONCENTRATOR_DISCOVERY_TIME 120
+#define CONCENTRATOR_ROUTE_CACHE TRUE
+#define MAX_RTG_SRC_ENTRIES 200
+#define SRC_RTG_EXPIRY_TIME 255
+
+/**
+ * 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
+#define NWK_INDIRECT_MSG_TIMEOUT 20
\ No newline at end of file
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 d809fb2..abb769e 100644
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts
@@ -93,3 +93,5 @@
/* BDB interface */
-DMT_APP_CNF_FUNC
+
+--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 a96b3cc..088df18 100644
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/af/af.c
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/af/af.c
@@ -406,10 +406,18 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16_t S
#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 );
+ }
- epDesc = afFindEndPointDesc( grpEp );
if ( epDesc == NULL )
return; // Endpoint descriptor not found
@@ -456,7 +464,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_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
index 0c62cd3..6d55ba4 100644
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
@@ -110,7 +110,7 @@ uint8_t zgSecurePermitJoin = TRUE;
// 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;
+uint8_t zgAllowRejoinsWithWellKnownKey = TRUE; // https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/p/882650/3265311#3265311
//allowInstallCodes
uint8_t zgAllowInstallCodes = ZG_IC_SUPPORTED_NOT_REQUIRED;
@@ -204,7 +204,9 @@ uint8_t zgEndDeviceConfiguration = END_DEV_CONFIGURATION;
//
// NOTICE: Before enabling Child Aging make sure to review all the related
// definitions in this file, especially zgNwkParentInformation.
-uint8_t zgChildAgingEnable = TRUE;
+
+// Disable child aging, otherwise Xiaomi devices are being kicked off the network.
+uint8_t zgChildAgingEnable = FALSE;
//========== TouchLink NWK configuration ===============
// Values used by Router when starts a network as initiator
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 a893bc3..ca57a6a 100644
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
@@ -422,12 +422,11 @@ uint32_t ZDApp_event_loop( uint8_t task_id, uint32_t events )
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
{
@@ -905,12 +904,11 @@ void ZDApp_NetworkStartEvt( void )
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_CC2652RB_LAUNCHXL_tirtos_ccs/cc26x2lp.cmd b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/cc26x2lp.cmd
index 2991774..1329f45 100755
--- 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
diff --git a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/znp.syscfg b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/znp.syscfg
index f5a095e..ed9b48e 100644
--- a/znp_CC2652RB_LAUNCHXL_tirtos_ccs/znp.syscfg
+++ b/znp_CC2652RB_LAUNCHXL_tirtos_ccs/znp.syscfg
@@ -1,185 +1,156 @@
-/*
- * Copyright (c) 2018, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-// @cliArgs --board /ti/boards/CC2652RB_LAUNCHXL
-
-/*
- * znp.syscfg
- */
-
-/* Modules */
-var AESCBC = scripting.addModule("/ti/drivers/AESCBC");
-var AESCCM = scripting.addModule("/ti/drivers/AESCCM");
-var AESECB = scripting.addModule("/ti/drivers/AESECB");
-var device = scripting.addModule("/ti/devices/CCFG");
-var DMA = scripting.addModule("/ti/drivers/DMA");
-var ECDH = scripting.addModule("/ti/drivers/ECDH");
-var ECDSA = scripting.addModule("/ti/drivers/ECDSA");
-var ECJPAKE = scripting.addModule("/ti/drivers/ECJPAKE");
-var Button = scripting.addModule("/ti/drivers/apps/Button");
-var LED = scripting.addModule("/ti/drivers/apps/LED");
-var NVS = scripting.addModule("/ti/drivers/NVS");
-var Power = scripting.addModule("/ti/drivers/Power");
-var RF = scripting.addModule("/ti/drivers/RF");
-var SHA2 = scripting.addModule("/ti/drivers/SHA2");
-var TRNG = scripting.addModule("/ti/drivers/TRNG");
-var UART = scripting.addModule("/ti/drivers/UART");
-var zstack = scripting.addModule("/ti/zstack/zstack");
-
-
-/* Instances */
-var AESCBC1 = AESCBC.addInstance();
-var AESCCM1 = AESCCM.addInstance();
-var AESECB1 = AESECB.addInstance();
-var ECDH1 = ECDH.addInstance();
-var ECDSA1 = ECDSA.addInstance();
-var ECJPAKE1 = ECJPAKE.addInstance();
-var Button1 = Button.addInstance();
-var Button2 = Button.addInstance();
-var LED1 = LED.addInstance();
-var LED2 = LED.addInstance();
-var NVS1 = NVS.addInstance();
-var NVS2 = NVS.addInstance();
-var SHA21 = SHA2.addInstance();
-var TRNG1 = TRNG.addInstance();
-var UART1 = UART.addInstance();
-
-
-/* AESCCM */
-AESCCM1.interruptPriority = "2";
-
-
-/* AESECB */
-AESECB1.interruptPriority = "1";
-
-/* ======== RF Design ======== */
-var rfDesign = scripting.addModule("ti/devices/radioconfig/rfdesign");
-const rfDesignSettings = system.getScript("/ti/common/lprf_rf_design_settings.js").rfDesignSettings;
-for(var setting in rfDesignSettings)
-{
- rfDesign[setting] = rfDesignSettings[setting];
-}
-
-
-/* CCFG */
-const ccfgSettings = system.getScript("/ti/common/lprf_ccfg_settings.js").ccfgSettings;
-for(var setting in ccfgSettings)
-{
- device[setting] = ccfgSettings[setting];
-}
-
-
-/* Red LED */
-LED1.$name = "CONFIG_LED_RED";
-LED1.$hardware = system.deviceData.board.components.LED_RED;
-LED1.gpioPin.$name = "CONFIG_GPIO_RLED";
-LED1.gpioPin.mode = "Output";
-LED1.gpioPin.callbackFunction = "";
-LED1.gpioPin.pinInstance.$name = "CONFIG_PIN_RLED";
-
-/* Green LED */
-LED2.$name = "CONFIG_LED_GREEN";
-LED2.$hardware = system.deviceData.board.components.LED_GREEN;
-LED2.gpioPin.$name = "CONFIG_GPIO_GLED";
-LED2.gpioPin.mode = "Output";
-LED2.gpioPin.callbackFunction = "";
-LED2.gpioPin.pinInstance.$name = "CONFIG_PIN_GLED";
-
-/* Left Button */
-Button1.$name = "CONFIG_BTN_LEFT";
-Button1.$hardware = system.deviceData.board.components["BTN-1"];
-Button1.gpioPin.$name = "CONFIG_GPIO_BTN1";
-Button1.gpioPin.pull = "Pull Up";
-Button1.gpioPin.interruptTrigger = "Falling Edge";
-Button1.gpioPin.pinInstance.$name = "CONFIG_PIN_BTN1";
-
-/* Left Button */
-Button2.$name = "CONFIG_BTN_RIGHT";
-Button2.$hardware = system.deviceData.board.components["BTN-2"];
-Button2.gpioPin.$name = "CONFIG_GPIO_BTN2";
-Button2.gpioPin.pull = "Pull Up";
-Button2.gpioPin.interruptTrigger = "Falling Edge";
-Button2.gpioPin.pinInstance.$name = "CONFIG_PIN_BTN2";
-
-
-/* Internal NVS */
-NVS1.$name = "CONFIG_NVSINTERNAL";
-NVS1.nvsType = "Internal";
-NVS1.internalFlash.regionBase = 0x52000;
-NVS1.internalFlash.regionSize = 0x4000;
-
-
-/* External NVS */
-NVS2.$name = "CONFIG_NVSEXTERNAL";
-NVS2.nvsType = "External";
-NVS2.$hardware = system.deviceData.board.components.MX25R8035F;
-NVS2.externalFlash.regionBase = 0;
-NVS2.externalFlash.regionSize = 0x256000;
-NVS2.externalFlash.sectorSize = 0x1000;
-NVS2.externalFlash.verifyBufferSize = 64;
-
-
-/* External NVS SPI instance */
-var NVSSPI25XDevice1 = NVS2.externalFlash.spiFlashDevice;
-var SPI1 = NVSSPI25XDevice1.sharedSpiInstance;
-SPI1.$name = "CONFIG_SPI_0";
-SPI1.sclkPinInstance.$name = "CONFIG_PIN_SPI_SCLK";
-SPI1.misoPinInstance.$name = "CONFIG_PIN_SPI_MISO";
-SPI1.mosiPinInstance.$name = "CONFIG_PIN_SPI_MOSI";
-
-
-/* RF */
-/* if an antenna component exists, assign it to the RF instance */
-if (system.deviceData.board && system.deviceData.board.components.RF) {
- RF.$hardware = system.deviceData.board.components.RF;
-}
-
-/* Display (UART) */
-UART1.$hardware = system.deviceData.board.components.XDS110UART;
-UART1.txPinInstance.$name = "CONFIG_PIN_UART_TX";
-UART1.rxPinInstance.$name = "CONFIG_PIN_UART_RX";
-UART1.$name = "CONFIG_DISPLAY_UART";
-
-
-/* Z-Stack */
-zstack.deviceType = "znp";
-zstack.deviceTypeReadOnly = true;
-zstack.rf.rfDesign = rfDesignSettings.rfDesign;
-
-/* ======== Do device specific settings ======== */
-const deviceName = system.getScript("/ti/ti154stack/ti154stack_common.js").getLaunchPadFromDevice();
-
-/* Update LF Clock Source for CC2652RB devices */
-if(deviceName.includes("RB"))
-{
- device.srcClkLF = "Derived from HF XOSC";
-}
-
+/**
+ * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
+ * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
+ * @cliArgs --board "/ti/boards/CC2652RB_LAUNCHXL" --product "simplelink_cc13x2_26x2_sdk@4.20.01.04"
+ * @versions {"data":"2020052512","timestamp":"2020052512","tool":"1.5.0+1397","templates":"2020052512"}
+ */
+
+/**
+ * Import the modules used in this configuration.
+ */
+const CCFG = scripting.addModule("/ti/devices/CCFG");
+const rfdesign = scripting.addModule("/ti/devices/radioconfig/rfdesign");
+const AESCBC = scripting.addModule("/ti/drivers/AESCBC");
+const AESCBC1 = AESCBC.addInstance();
+const AESCCM = scripting.addModule("/ti/drivers/AESCCM");
+const AESCCM1 = AESCCM.addInstance();
+const AESECB = scripting.addModule("/ti/drivers/AESECB");
+const AESECB1 = AESECB.addInstance();
+const DMA = scripting.addModule("/ti/drivers/DMA");
+const ECDH = scripting.addModule("/ti/drivers/ECDH");
+const ECDH1 = ECDH.addInstance();
+const ECDSA = scripting.addModule("/ti/drivers/ECDSA");
+const ECDSA1 = ECDSA.addInstance();
+const ECJPAKE = scripting.addModule("/ti/drivers/ECJPAKE");
+const ECJPAKE1 = ECJPAKE.addInstance();
+const NVS = scripting.addModule("/ti/drivers/NVS");
+const NVS1 = NVS.addInstance();
+const NVS2 = NVS.addInstance();
+const Power = scripting.addModule("/ti/drivers/Power");
+const RF = scripting.addModule("/ti/drivers/RF");
+const SHA2 = scripting.addModule("/ti/drivers/SHA2");
+const SHA21 = SHA2.addInstance();
+const TRNG = scripting.addModule("/ti/drivers/TRNG");
+const TRNG1 = TRNG.addInstance();
+const UART = scripting.addModule("/ti/drivers/UART");
+const UART1 = UART.addInstance();
+const Button = scripting.addModule("/ti/drivers/apps/Button");
+const Button1 = Button.addInstance();
+const Button2 = Button.addInstance();
+const LED = scripting.addModule("/ti/drivers/apps/LED");
+const LED1 = LED.addInstance();
+const LED2 = LED.addInstance();
+const zstack = scripting.addModule("/ti/zstack/zstack");
+
+/**
+ * Write custom configuration values to the imported modules.
+ */
+CCFG.enableBootloader = true;
+CCFG.enableBootloaderBackdoor = true;
+CCFG.dioBootloaderBackdoor = 13;
+CCFG.levelBootloaderBackdoor = "Active low";
+CCFG.srcClkLF = "Derived from HF XOSC";
+CCFG.enableDCDC = false;
+CCFG.ccfgTemplate.$name = "ti_devices_CCFGTemplate0";
+
+AESCBC1.$name = "CONFIG_AESCBC_0";
+
+AESCCM1.$name = "CONFIG_AESCCM_0";
+AESCCM1.interruptPriority = "2";
+
+AESECB1.$name = "CONFIG_AESECB_0";
+AESECB1.interruptPriority = "1";
+
+ECDH1.$name = "CONFIG_ECDH_0";
+
+ECDSA1.$name = "CONFIG_ECDSA_0";
+
+ECJPAKE1.$name = "CONFIG_ECJPAKE_0";
+
+NVS1.$name = "CONFIG_NVSINTERNAL";
+NVS1.internalFlash.$name = "ti_drivers_nvs_NVSCC26XX0";
+NVS1.internalFlash.regionBase = 0x50000;
+NVS1.internalFlash.regionSize = 0x6000;
+
+NVS2.$name = "CONFIG_NVSEXTERNAL";
+NVS2.nvsType = "External";
+NVS2.$hardware = system.deviceData.board.components.MX25R8035F;
+NVS2.externalFlash.$name = "ti_drivers_nvs_NVSSPI25X0";
+NVS2.externalFlash.regionSize = 0x256000;
+NVS2.externalFlash.verifyBufferSize = 64;
+
+SHA21.$name = "CONFIG_SHA2_0";
+
+TRNG1.$name = "CONFIG_TRNG_0";
+
+UART1.$hardware = system.deviceData.board.components.XDS110UART;
+UART1.$name = "CONFIG_DISPLAY_UART";
+UART1.txPinInstance.$name = "CONFIG_PIN_UART_TX";
+UART1.rxPinInstance.$name = "CONFIG_PIN_UART_RX";
+
+Button1.$name = "CONFIG_BTN_LEFT";
+Button1.$hardware = system.deviceData.board.components["BTN-1"];
+Button1.gpioPin.$name = "CONFIG_GPIO_BTN1";
+Button1.gpioPin.pinInstance.$name = "CONFIG_PIN_BTN1";
+
+Button2.$name = "CONFIG_BTN_RIGHT";
+Button2.$hardware = system.deviceData.board.components["BTN-2"];
+Button2.gpioPin.$name = "CONFIG_GPIO_BTN2";
+Button2.gpioPin.pinInstance.$name = "CONFIG_PIN_BTN2";
+
+LED1.$name = "CONFIG_LED_RED";
+LED1.$hardware = system.deviceData.board.components.LED_RED;
+LED1.gpioPin.$name = "CONFIG_GPIO_RLED";
+LED1.gpioPin.pinInstance.$name = "CONFIG_PIN_RLED";
+
+LED2.$name = "CONFIG_LED_GREEN";
+LED2.$hardware = system.deviceData.board.components.LED_GREEN;
+LED2.gpioPin.$name = "CONFIG_GPIO_GLED";
+LED2.gpioPin.pinInstance.$name = "CONFIG_PIN_GLED";
+
+const NVSSPI25XDevice = scripting.addModule("/ti/drivers/nvs/NVSSPI25XDevice", {}, false);
+const NVSSPI25XDevice1 = NVSSPI25XDevice.addInstance({}, false);
+NVSSPI25XDevice1.$name = "CONFIG_NVS_SPI_0";
+NVS2.externalFlash.spiFlashDevice = NVSSPI25XDevice1;
+NVSSPI25XDevice1.slaveSelectGpioInstance.$name = "CONFIG_GPIO_0";
+NVSSPI25XDevice1.slaveSelectGpioInstance.pinInstance.$name = "CONFIG_PIN_0";
+
+const SPI = scripting.addModule("/ti/drivers/SPI", {}, false);
+const SPI1 = SPI.addInstance({}, false);
+SPI1.$name = "CONFIG_SPI_0";
+NVSSPI25XDevice1.sharedSpiInstance = SPI1;
+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.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";
+
+/**
+ * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
+ * version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to
+ * re-solve from scratch.
+ */
+UART1.uart.$suggestSolution = "UART1";
+UART1.uart.txPin.$suggestSolution = "boosterpack.4";
+UART1.uart.rxPin.$suggestSolution = "boosterpack.3";
+Button1.gpioPin.gpioPin.$suggestSolution = "boosterpack.13";
+Button2.gpioPin.gpioPin.$suggestSolution = "boosterpack.12";
+LED1.gpioPin.gpioPin.$suggestSolution = "boosterpack.39";
+LED2.gpioPin.gpioPin.$suggestSolution = "boosterpack.40";
+NVSSPI25XDevice1.slaveSelectGpioInstance.gpioPin.$suggestSolution = "boosterpack.38";
+SPI1.spi.$suggestSolution = "SSI0";
+SPI1.spi.sclkPin.$suggestSolution = "boosterpack.7";
+SPI1.spi.misoPin.$suggestSolution = "boosterpack.14";
+SPI1.spi.mosiPin.$suggestSolution = "boosterpack.15";
+SPI1.spi.dmaRxChannel.$suggestSolution = "DMA_CH3";
+SPI1.spi.dmaTxChannel.$suggestSolution = "DMA_CH4";
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt.h b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
index e4c8212..8efa00a 100644
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
@@ -443,6 +443,7 @@ extern "C"
#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_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_sys.c b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_sys.c
index f3d45f6..d709df7 100644
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_sys.c
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_sys.c
@@ -510,8 +510,8 @@ static void MT_SysVersion(void)
uint8_t *pBuf = &verStr[sizeof(MTVersionString)];
#if (defined MAKE_CRC_SHDW) || (defined FAKE_CRC_SHDW) //built for bootloader
uint32_t sblSig;
- uint32_t sblRev;
#endif
+ uint32_t sblRev;
OsalPort_memcpy(verStr, (uint8_t *)MTVersionString, sizeof(MTVersionString));
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 b7ed73b..661e027 100644
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
@@ -151,6 +151,7 @@ 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_UtilAssocFindDevice(uint8_t *pBuf);
static void MT_UtilAssocGetWithAddress(uint8_t *pBuf);
static void MT_UtilBindAddEntry(uint8_t *pBuf);
@@ -317,6 +318,10 @@ uint8_t MT_UtilCommandProcessing(uint8_t *pBuf)
MT_UtilBindAddEntry(pBuf);
break;
+ case MT_UTIL_ASSOC_REMOVE:
+ MT_UtilAssocRemove(pBuf);
+ break;
+
#if defined ZCL_KEY_ESTABLISH
case MT_UTIL_ZCL_KEY_EST_INIT_EST:
MT_UtilzclGeneral_KeyEstablish_InitiateKeyEstablishment(pBuf);
@@ -1584,6 +1589,33 @@ 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_UtilAssocFindDevice
*
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c
index dbe48fb..f8402cd 100644
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c
@@ -69,7 +69,7 @@
*****************************************************************************/
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 */
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/revision_info.h b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/revision_info.h
new file mode 100644
index 0000000..fac1a7e
--- /dev/null
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/revision_info.h
@@ -0,0 +1,4 @@
+#ifndef APPLICATION_MT_REVISION_INFO_H_
+#define APPLICATION_MT_REVISION_INFO_H_
+#define CODE_REVISION_NUMBER 20200925
+#endif
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
new file mode 100644
index 0000000..27496eb
--- /dev/null
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
@@ -0,0 +1,39 @@
+#define INCLUDE_REVISION_INFORMATION
+#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
+#define CONCENTRATOR_DISCOVERY_TIME 120
+#define CONCENTRATOR_ROUTE_CACHE TRUE
+#define MAX_RTG_SRC_ENTRIES 200
+#define SRC_RTG_EXPIRY_TIME 255
+
+/**
+ * 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
+#define NWK_INDIRECT_MSG_TIMEOUT 20
\ No newline at end of file
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 d809fb2..abb769e 100644
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts
@@ -93,3 +93,5 @@
/* BDB interface */
-DMT_APP_CNF_FUNC
+
+--preinclude=preinclude.h
\ No newline at end of file
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/af/af.c b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/af/af.c
index a96b3cc..088df18 100644
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/af/af.c
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/af/af.c
@@ -406,10 +406,18 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16_t S
#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 );
+ }
- epDesc = afFindEndPointDesc( grpEp );
if ( epDesc == NULL )
return; // Endpoint descriptor not found
@@ -456,7 +464,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_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
index 0c62cd3..6d55ba4 100644
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
@@ -110,7 +110,7 @@ uint8_t zgSecurePermitJoin = TRUE;
// 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;
+uint8_t zgAllowRejoinsWithWellKnownKey = TRUE; // https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/p/882650/3265311#3265311
//allowInstallCodes
uint8_t zgAllowInstallCodes = ZG_IC_SUPPORTED_NOT_REQUIRED;
@@ -204,7 +204,9 @@ uint8_t zgEndDeviceConfiguration = END_DEV_CONFIGURATION;
//
// NOTICE: Before enabling Child Aging make sure to review all the related
// definitions in this file, especially zgNwkParentInformation.
-uint8_t zgChildAgingEnable = TRUE;
+
+// Disable child aging, otherwise Xiaomi devices are being kicked off the network.
+uint8_t zgChildAgingEnable = FALSE;
//========== TouchLink NWK configuration ===============
// Values used by Router when starts a network as initiator
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 a893bc3..ca57a6a 100644
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
@@ -422,12 +422,11 @@ uint32_t ZDApp_event_loop( uint8_t task_id, uint32_t events )
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
{
@@ -905,12 +904,11 @@ void ZDApp_NetworkStartEvt( void )
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 464e39c..1329f45 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
index aec0296..dd5e562 100644
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/znp.syscfg
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/znp.syscfg
@@ -1,185 +1,155 @@
-/*
- * Copyright (c) 2018, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-// @cliArgs --board /ti/boards/CC26X2R1_LAUNCHXL
-
-/*
- * znp.syscfg
- */
-
-/* Modules */
-var AESCBC = scripting.addModule("/ti/drivers/AESCBC");
-var AESCCM = scripting.addModule("/ti/drivers/AESCCM");
-var AESECB = scripting.addModule("/ti/drivers/AESECB");
-var device = scripting.addModule("/ti/devices/CCFG");
-var DMA = scripting.addModule("/ti/drivers/DMA");
-var ECDH = scripting.addModule("/ti/drivers/ECDH");
-var ECDSA = scripting.addModule("/ti/drivers/ECDSA");
-var ECJPAKE = scripting.addModule("/ti/drivers/ECJPAKE");
-var Button = scripting.addModule("/ti/drivers/apps/Button");
-var LED = scripting.addModule("/ti/drivers/apps/LED");
-var NVS = scripting.addModule("/ti/drivers/NVS");
-var Power = scripting.addModule("/ti/drivers/Power");
-var RF = scripting.addModule("/ti/drivers/RF");
-var SHA2 = scripting.addModule("/ti/drivers/SHA2");
-var TRNG = scripting.addModule("/ti/drivers/TRNG");
-var UART = scripting.addModule("/ti/drivers/UART");
-var zstack = scripting.addModule("/ti/zstack/zstack");
-
-
-/* Instances */
-var AESCBC1 = AESCBC.addInstance();
-var AESCCM1 = AESCCM.addInstance();
-var AESECB1 = AESECB.addInstance();
-var ECDH1 = ECDH.addInstance();
-var ECDSA1 = ECDSA.addInstance();
-var ECJPAKE1 = ECJPAKE.addInstance();
-var Button1 = Button.addInstance();
-var Button2 = Button.addInstance();
-var LED1 = LED.addInstance();
-var LED2 = LED.addInstance();
-var NVS1 = NVS.addInstance();
-var NVS2 = NVS.addInstance();
-var SHA21 = SHA2.addInstance();
-var TRNG1 = TRNG.addInstance();
-var UART1 = UART.addInstance();
-
-
-/* AESCCM */
-AESCCM1.interruptPriority = "2";
-
-
-/* AESECB */
-AESECB1.interruptPriority = "1";
-
-/* ======== RF Design ======== */
-var rfDesign = scripting.addModule("ti/devices/radioconfig/rfdesign");
-const rfDesignSettings = system.getScript("/ti/common/lprf_rf_design_settings.js").rfDesignSettings;
-for(var setting in rfDesignSettings)
-{
- rfDesign[setting] = rfDesignSettings[setting];
-}
-
-
-/* CCFG */
-const ccfgSettings = system.getScript("/ti/common/lprf_ccfg_settings.js").ccfgSettings;
-for(var setting in ccfgSettings)
-{
- device[setting] = ccfgSettings[setting];
-}
-
-
-/* Red LED */
-LED1.$name = "CONFIG_LED_RED";
-LED1.$hardware = system.deviceData.board.components.LED_RED;
-LED1.gpioPin.$name = "CONFIG_GPIO_RLED";
-LED1.gpioPin.mode = "Output";
-LED1.gpioPin.callbackFunction = "";
-LED1.gpioPin.pinInstance.$name = "CONFIG_PIN_RLED";
-
-/* Green LED */
-LED2.$name = "CONFIG_LED_GREEN";
-LED2.$hardware = system.deviceData.board.components.LED_GREEN;
-LED2.gpioPin.$name = "CONFIG_GPIO_GLED";
-LED2.gpioPin.mode = "Output";
-LED2.gpioPin.callbackFunction = "";
-LED2.gpioPin.pinInstance.$name = "CONFIG_PIN_GLED";
-
-/* Left Button */
-Button1.$name = "CONFIG_BTN_LEFT";
-Button1.$hardware = system.deviceData.board.components["BTN-1"];
-Button1.gpioPin.$name = "CONFIG_GPIO_BTN1";
-Button1.gpioPin.pull = "Pull Up";
-Button1.gpioPin.interruptTrigger = "Falling Edge";
-Button1.gpioPin.pinInstance.$name = "CONFIG_PIN_BTN1";
-
-/* Left Button */
-Button2.$name = "CONFIG_BTN_RIGHT";
-Button2.$hardware = system.deviceData.board.components["BTN-2"];
-Button2.gpioPin.$name = "CONFIG_GPIO_BTN2";
-Button2.gpioPin.pull = "Pull Up";
-Button2.gpioPin.interruptTrigger = "Falling Edge";
-Button2.gpioPin.pinInstance.$name = "CONFIG_PIN_BTN2";
-
-
-/* Internal NVS */
-NVS1.$name = "CONFIG_NVSINTERNAL";
-NVS1.nvsType = "Internal";
-NVS1.internalFlash.regionBase = 0x52000;
-NVS1.internalFlash.regionSize = 0x4000;
-
-
-/* External NVS */
-NVS2.$name = "CONFIG_NVSEXTERNAL";
-NVS2.nvsType = "External";
-NVS2.$hardware = system.deviceData.board.components.MX25R8035F;
-NVS2.externalFlash.regionBase = 0;
-NVS2.externalFlash.regionSize = 0x256000;
-NVS2.externalFlash.sectorSize = 0x1000;
-NVS2.externalFlash.verifyBufferSize = 64;
-
-
-/* External NVS SPI instance */
-var NVSSPI25XDevice1 = NVS2.externalFlash.spiFlashDevice;
-var SPI1 = NVSSPI25XDevice1.sharedSpiInstance;
-SPI1.$name = "CONFIG_SPI_0";
-SPI1.sclkPinInstance.$name = "CONFIG_PIN_SPI_SCLK";
-SPI1.misoPinInstance.$name = "CONFIG_PIN_SPI_MISO";
-SPI1.mosiPinInstance.$name = "CONFIG_PIN_SPI_MOSI";
-
-
-/* RF */
-/* if an antenna component exists, assign it to the RF instance */
-if (system.deviceData.board && system.deviceData.board.components.RF) {
- RF.$hardware = system.deviceData.board.components.RF;
-}
-
-/* Display (UART) */
-UART1.$hardware = system.deviceData.board.components.XDS110UART;
-UART1.txPinInstance.$name = "CONFIG_PIN_UART_TX";
-UART1.rxPinInstance.$name = "CONFIG_PIN_UART_RX";
-UART1.$name = "CONFIG_DISPLAY_UART";
-
-
-/* Z-Stack */
-zstack.deviceType = "znp";
-zstack.deviceTypeReadOnly = true;
-zstack.rf.rfDesign = rfDesignSettings.rfDesign;
-
-/* ======== Do device specific settings ======== */
-const deviceName = system.getScript("/ti/ti154stack/ti154stack_common.js").getLaunchPadFromDevice();
-
-/* Update LF Clock Source for CC2652RB devices */
-if(deviceName.includes("RB"))
-{
- device.srcClkLF = "Derived from HF XOSC";
-}
-
+/**
+ * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
+ * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
+ * @cliArgs --board "/ti/boards/CC26X2R1_LAUNCHXL" --product "simplelink_cc13x2_26x2_sdk@4.20.01.04"
+ * @versions {"data":"2020052512","timestamp":"2020052512","tool":"1.5.0+1397","templates":"2020052512"}
+ */
+
+/**
+ * Import the modules used in this configuration.
+ */
+const CCFG = scripting.addModule("/ti/devices/CCFG");
+const rfdesign = scripting.addModule("/ti/devices/radioconfig/rfdesign");
+const AESCBC = scripting.addModule("/ti/drivers/AESCBC");
+const AESCBC1 = AESCBC.addInstance();
+const AESCCM = scripting.addModule("/ti/drivers/AESCCM");
+const AESCCM1 = AESCCM.addInstance();
+const AESECB = scripting.addModule("/ti/drivers/AESECB");
+const AESECB1 = AESECB.addInstance();
+const DMA = scripting.addModule("/ti/drivers/DMA");
+const ECDH = scripting.addModule("/ti/drivers/ECDH");
+const ECDH1 = ECDH.addInstance();
+const ECDSA = scripting.addModule("/ti/drivers/ECDSA");
+const ECDSA1 = ECDSA.addInstance();
+const ECJPAKE = scripting.addModule("/ti/drivers/ECJPAKE");
+const ECJPAKE1 = ECJPAKE.addInstance();
+const NVS = scripting.addModule("/ti/drivers/NVS");
+const NVS1 = NVS.addInstance();
+const NVS2 = NVS.addInstance();
+const Power = scripting.addModule("/ti/drivers/Power");
+const RF = scripting.addModule("/ti/drivers/RF");
+const SHA2 = scripting.addModule("/ti/drivers/SHA2");
+const SHA21 = SHA2.addInstance();
+const TRNG = scripting.addModule("/ti/drivers/TRNG");
+const TRNG1 = TRNG.addInstance();
+const UART = scripting.addModule("/ti/drivers/UART");
+const UART1 = UART.addInstance();
+const Button = scripting.addModule("/ti/drivers/apps/Button");
+const Button1 = Button.addInstance();
+const Button2 = Button.addInstance();
+const LED = scripting.addModule("/ti/drivers/apps/LED");
+const LED1 = LED.addInstance();
+const LED2 = LED.addInstance();
+const zstack = scripting.addModule("/ti/zstack/zstack");
+
+/**
+ * Write custom configuration values to the imported modules.
+ */
+CCFG.enableBootloader = true;
+CCFG.enableBootloaderBackdoor = true;
+CCFG.dioBootloaderBackdoor = 13;
+CCFG.levelBootloaderBackdoor = "Active low";
+CCFG.enableDCDC = false;
+CCFG.ccfgTemplate.$name = "ti_devices_CCFGTemplate0";
+
+AESCBC1.$name = "CONFIG_AESCBC_0";
+
+AESCCM1.$name = "CONFIG_AESCCM_0";
+AESCCM1.interruptPriority = "2";
+
+AESECB1.$name = "CONFIG_AESECB_0";
+AESECB1.interruptPriority = "1";
+
+ECDH1.$name = "CONFIG_ECDH_0";
+
+ECDSA1.$name = "CONFIG_ECDSA_0";
+
+ECJPAKE1.$name = "CONFIG_ECJPAKE_0";
+
+NVS1.$name = "CONFIG_NVSINTERNAL";
+NVS1.internalFlash.$name = "ti_drivers_nvs_NVSCC26XX0";
+NVS1.internalFlash.regionBase = 0x50000;
+NVS1.internalFlash.regionSize = 0x6000;
+
+NVS2.$name = "CONFIG_NVSEXTERNAL";
+NVS2.nvsType = "External";
+NVS2.$hardware = system.deviceData.board.components.MX25R8035F;
+NVS2.externalFlash.$name = "ti_drivers_nvs_NVSSPI25X0";
+NVS2.externalFlash.regionSize = 0x256000;
+NVS2.externalFlash.verifyBufferSize = 64;
+
+SHA21.$name = "CONFIG_SHA2_0";
+
+TRNG1.$name = "CONFIG_TRNG_0";
+
+UART1.$hardware = system.deviceData.board.components.XDS110UART;
+UART1.$name = "CONFIG_DISPLAY_UART";
+UART1.txPinInstance.$name = "CONFIG_PIN_UART_TX";
+UART1.rxPinInstance.$name = "CONFIG_PIN_UART_RX";
+
+Button1.$name = "CONFIG_BTN_LEFT";
+Button1.$hardware = system.deviceData.board.components["BTN-1"];
+Button1.gpioPin.$name = "CONFIG_GPIO_BTN1";
+Button1.gpioPin.pinInstance.$name = "CONFIG_PIN_BTN1";
+
+Button2.$name = "CONFIG_BTN_RIGHT";
+Button2.$hardware = system.deviceData.board.components["BTN-2"];
+Button2.gpioPin.$name = "CONFIG_GPIO_BTN2";
+Button2.gpioPin.pinInstance.$name = "CONFIG_PIN_BTN2";
+
+LED1.$name = "CONFIG_LED_RED";
+LED1.$hardware = system.deviceData.board.components.LED_RED;
+LED1.gpioPin.$name = "CONFIG_GPIO_RLED";
+LED1.gpioPin.pinInstance.$name = "CONFIG_PIN_RLED";
+
+LED2.$name = "CONFIG_LED_GREEN";
+LED2.$hardware = system.deviceData.board.components.LED_GREEN;
+LED2.gpioPin.$name = "CONFIG_GPIO_GLED";
+LED2.gpioPin.pinInstance.$name = "CONFIG_PIN_GLED";
+
+const NVSSPI25XDevice = scripting.addModule("/ti/drivers/nvs/NVSSPI25XDevice", {}, false);
+const NVSSPI25XDevice1 = NVSSPI25XDevice.addInstance({}, false);
+NVSSPI25XDevice1.$name = "CONFIG_NVS_SPI_0";
+NVS2.externalFlash.spiFlashDevice = NVSSPI25XDevice1;
+NVSSPI25XDevice1.slaveSelectGpioInstance.$name = "CONFIG_GPIO_0";
+NVSSPI25XDevice1.slaveSelectGpioInstance.pinInstance.$name = "CONFIG_PIN_0";
+
+const SPI = scripting.addModule("/ti/drivers/SPI", {}, false);
+const SPI1 = SPI.addInstance({}, false);
+SPI1.$name = "CONFIG_SPI_0";
+NVSSPI25XDevice1.sharedSpiInstance = SPI1;
+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.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";
+
+/**
+ * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
+ * version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to
+ * re-solve from scratch.
+ */
+UART1.uart.$suggestSolution = "UART1";
+UART1.uart.txPin.$suggestSolution = "boosterpack.4";
+UART1.uart.rxPin.$suggestSolution = "boosterpack.3";
+Button1.gpioPin.gpioPin.$suggestSolution = "boosterpack.13";
+Button2.gpioPin.gpioPin.$suggestSolution = "boosterpack.12";
+LED1.gpioPin.gpioPin.$suggestSolution = "boosterpack.39";
+LED2.gpioPin.gpioPin.$suggestSolution = "boosterpack.40";
+NVSSPI25XDevice1.slaveSelectGpioInstance.gpioPin.$suggestSolution = "boosterpack.38";
+SPI1.spi.$suggestSolution = "SSI0";
+SPI1.spi.sclkPin.$suggestSolution = "boosterpack.7";
+SPI1.spi.misoPin.$suggestSolution = "boosterpack.14";
+SPI1.spi.mosiPin.$suggestSolution = "boosterpack.15";
+SPI1.spi.dmaRxChannel.$suggestSolution = "DMA_CH3";
+SPI1.spi.dmaTxChannel.$suggestSolution = "DMA_CH4";
--
2.24.3 (Apple Git-128)