mirror of
https://github.com/Koenkk/Z-Stack-firmware.git
synced 2024-11-29 21:33:22 +01:00
2791 lines
103 KiB
Diff
2791 lines
103 KiB
Diff
From 4020572e2d11875bab0ba410b0727e8d08078c16 Mon Sep 17 00:00:00 2001
|
|
From: Koen Kanters <koenkanters94@gmail.com>
|
|
Date: Tue, 7 Dec 2021 20:41:07 +0100
|
|
Subject: [PATCH 1/1] Own changes
|
|
|
|
---
|
|
.../Application/mt/mt.h | 4 +
|
|
.../Application/mt/mt_util.c | 108 +++++
|
|
.../Application/mt/mt_version.c | 8 +-
|
|
.../Application/mt/mt_zdo.c | 5 +
|
|
.../Stack/Config/preinclude.h | 78 ++++
|
|
.../Stack/Config/znp_cnf.opts | 2 +
|
|
.../Stack/af/af.c | 18 +-
|
|
.../Stack/nwk/nwk_globals.c | 8 +-
|
|
.../Stack/sys/zglobals.c | 6 +-
|
|
.../Stack/zdo/zd_app.c | 30 +-
|
|
.../Stack/zdo/zd_object.c | 14 +
|
|
.../Stack/zdo/zd_sec_mgr.c | 23 ++
|
|
.../Stack/zdo/zd_sec_mgr.h | 5 +
|
|
znp_CC1352P_2_LAUNCHXL_tirtos_ccs/app.cfg | 4 +-
|
|
.../cc13x2_cc26x2.cmd | 6 +-
|
|
.../ti_devices_config.c | 105 +++++
|
|
.../ti_drivers_config.h | 274 +++++++++++++
|
|
.../ti_radio_config.c | 387 ++++++++++++++++++
|
|
.../ti_radio_config.h | 83 ++++
|
|
znp_CC1352P_2_LAUNCHXL_tirtos_ccs/znp.syscfg | 10 +-
|
|
.../Application/mt/mt.h | 4 +
|
|
.../Application/mt/mt_util.c | 108 +++++
|
|
.../Application/mt/mt_version.c | 8 +-
|
|
.../Application/mt/mt_zdo.c | 5 +
|
|
.../Stack/Config/preinclude.h | 60 +++
|
|
.../Stack/Config/znp_cnf.opts | 2 +
|
|
.../Stack/af/af.c | 18 +-
|
|
.../Stack/nwk/nwk_globals.c | 8 +-
|
|
.../Stack/sys/zglobals.c | 6 +-
|
|
.../Stack/zdo/zd_app.c | 30 +-
|
|
.../Stack/zdo/zd_object.c | 14 +
|
|
.../Stack/zdo/zd_sec_mgr.c | 23 ++
|
|
.../Stack/zdo/zd_sec_mgr.h | 5 +
|
|
znp_CC26X2R1_LAUNCHXL_tirtos_ccs/app.cfg | 4 +-
|
|
.../cc13x2_cc26x2.cmd | 6 +-
|
|
znp_CC26X2R1_LAUNCHXL_tirtos_ccs/znp.syscfg | 6 +-
|
|
.../Application/mt/mt.h | 4 +
|
|
.../Application/mt/mt_util.c | 108 +++++
|
|
.../Application/mt/mt_version.c | 8 +-
|
|
.../Application/mt/mt_zdo.c | 5 +
|
|
.../Stack/Config/preinclude.h | 60 +++
|
|
.../Stack/Config/znp_cnf.opts | 2 +
|
|
znp_LP_CC2652RB_tirtos_ccs/Stack/af/af.c | 18 +-
|
|
.../Stack/nwk/nwk_globals.c | 8 +-
|
|
.../Stack/sys/zglobals.c | 6 +-
|
|
znp_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_app.c | 30 +-
|
|
.../Stack/zdo/zd_object.c | 14 +
|
|
.../Stack/zdo/zd_sec_mgr.c | 23 ++
|
|
.../Stack/zdo/zd_sec_mgr.h | 5 +
|
|
znp_LP_CC2652RB_tirtos_ccs/app.cfg | 4 +-
|
|
znp_LP_CC2652RB_tirtos_ccs/cc13x2_cc26x2.cmd | 6 +-
|
|
znp_LP_CC2652RB_tirtos_ccs/znp.syscfg | 6 +-
|
|
52 files changed, 1705 insertions(+), 87 deletions(-)
|
|
create mode 100644 znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
|
|
mode change 100644 => 100755 znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/af/af.c
|
|
mode change 100644 => 100755 znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/nwk/nwk_globals.c
|
|
create mode 100644 znp_CC1352P_2_LAUNCHXL_tirtos_ccs/ti_devices_config.c
|
|
create mode 100644 znp_CC1352P_2_LAUNCHXL_tirtos_ccs/ti_drivers_config.h
|
|
create mode 100644 znp_CC1352P_2_LAUNCHXL_tirtos_ccs/ti_radio_config.c
|
|
create mode 100644 znp_CC1352P_2_LAUNCHXL_tirtos_ccs/ti_radio_config.h
|
|
create mode 100644 znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
|
|
create mode 100644 znp_LP_CC2652RB_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 d4e9759..b7ff84c 100644
|
|
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
|
|
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
|
|
@@ -415,6 +415,8 @@ extern "C"
|
|
#define MT_UTIL_CALLBACK_SUB_CMD 0x06
|
|
#define MT_UTIL_TIME_ALIVE 0x09
|
|
|
|
+#define MT_UTIL_LED_CONTROL 0x0A
|
|
+
|
|
#define MT_UTIL_TEST_LOOPBACK 0x10
|
|
#define MT_UTIL_DATA_REQ 0x11
|
|
|
|
@@ -441,6 +443,8 @@ 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_ASSOC_ADD 0x64 // 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_util.c b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
|
|
index 90d6d4a..a687b10 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
|
|
@@ -53,6 +53,9 @@
|
|
#include "mt_zdo.h"
|
|
#include "ssp.h"
|
|
|
|
+#include <ti/drivers/apps/LED.h>
|
|
+#include "ti_drivers_config.h"
|
|
+
|
|
#if !defined NONWK
|
|
|
|
#include "mt_nwk.h"
|
|
@@ -95,6 +98,7 @@ static void MT_UtilSpi2Addr( zAddrType_t *pDst, uint8_t *pSrc );
|
|
#endif
|
|
|
|
#if defined (MT_UTIL_FUNC)
|
|
+
|
|
static void MT_UtilGetDeviceInfo(void);
|
|
static void MT_UtilGetNvInfo(void);
|
|
static void MT_UtilSetPanID(uint8_t *pBuf);
|
|
@@ -128,6 +132,9 @@ 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_UtilLedControl(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);
|
|
@@ -260,6 +267,10 @@ uint8_t MT_UtilCommandProcessing(uint8_t *pBuf)
|
|
MT_UtilAssocCount(pBuf);
|
|
break;
|
|
|
|
+ case MT_UTIL_LED_CONTROL:
|
|
+ MT_UtilLedControl(pBuf);
|
|
+ break;
|
|
+
|
|
case MT_UTIL_ASSOC_FIND_DEVICE:
|
|
MT_UtilAssocFindDevice(pBuf);
|
|
break;
|
|
@@ -272,6 +283,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 +1394,95 @@ 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_UtilLedControl
|
|
+ *
|
|
+ * @brief Proxy the LedControl() function.
|
|
+ *
|
|
+ * @param pBuf - pointer to the received buffer
|
|
+ *
|
|
+ * @return void
|
|
+ ***************************************************************************************************/
|
|
+static void MT_UtilLedControl(uint8_t *pBuf)
|
|
+{
|
|
+ uint8_t cmdId = pBuf[MT_RPC_POS_CMD1];
|
|
+ pBuf += MT_RPC_FRAME_HDR_SZ;
|
|
+
|
|
+ uint8_t mode = pBuf[1];
|
|
+
|
|
+ if (gLedHandle == NULL) {
|
|
+ LED_Params ledParams;
|
|
+ LED_Params_init(&ledParams);
|
|
+ gLedHandle = LED_open(CONFIG_LED_GREEN, &ledParams);
|
|
+ }
|
|
+
|
|
+ if (mode==0) {
|
|
+ LED_setOff(gLedHandle);
|
|
+ } else if (mode == 5) {
|
|
+ gLedsDisabled = TRUE;
|
|
+ LED_setOff(gLedHandle);
|
|
+ } else {
|
|
+ LED_setOn(gLedHandle, LED_BRIGHTNESS_MAX);
|
|
+ }
|
|
+
|
|
+ uint8_t retValue = 0;
|
|
+ MT_BuildAndSendZToolResponse(((uint8_t)MT_RPC_CMD_SRSP | (uint8_t)MT_RPC_SYS_UTIL), cmdId, 1, &retValue);
|
|
+}
|
|
+
|
|
+/***************************************************************************************************
|
|
+ * @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
|
|
index 63c143b..44ddc34 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"
|
|
|
|
+#define CODE_REVISION_NUMBER 20211217
|
|
+
|
|
/******************************************************************************
|
|
* 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/Application/mt/mt_zdo.c b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_zdo.c
|
|
index a4b15c6..d2c3b1f 100644
|
|
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_zdo.c
|
|
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Application/mt/mt_zdo.c
|
|
@@ -1658,6 +1658,11 @@ static void MT_ZdoMgmtPermitJoinRequest(uint8_t *pBuf)
|
|
ignoreIndication = TRUE;
|
|
retValue = (uint8_t)ZDP_MgmtPermitJoinReq( &destAddr, duration, tcSignificance, 0);
|
|
ignoreIndication = FALSE;
|
|
+
|
|
+ // If joining is enabled via a router, ZDO_ProcessMgmtPermitJoinReq is never triggered thus
|
|
+ // ZDSecMgrPermitJoining is never called. Joining via a router would always fail now since
|
|
+ // ZDSecMgrPermitJoiningEnabled in zd_sec_mgr.c stays FALSE
|
|
+ ZDSecMgrPermitJoining(duration);
|
|
|
|
MT_BuildAndSendZToolResponse(((uint8_t)MT_RPC_CMD_SRSP | (uint8_t)MT_RPC_SYS_ZDO), cmdId, 1, &retValue);
|
|
}
|
|
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..3b3e552
|
|
--- /dev/null
|
|
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
|
|
@@ -0,0 +1,78 @@
|
|
+#define MT_SYS_KEY_MANAGEMENT 1
|
|
+#define FEATURE_NVEXID 1
|
|
+
|
|
+// Increase MAC buffers
|
|
+#undef MAC_CFG_TX_DATA_MAX
|
|
+#define MAC_CFG_TX_DATA_MAX 20
|
|
+#undef MAC_CFG_TX_MAX
|
|
+#define MAC_CFG_TX_MAX 32
|
|
+#undef MAC_CFG_RX_MAX
|
|
+#define MAC_CFG_RX_MAX 20
|
|
+
|
|
+// 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 100
|
|
+#define CONCENTRATOR_ROUTE_CACHE TRUE
|
|
+#define MAX_RTG_SRC_ENTRIES 200
|
|
+#define SRC_RTG_EXPIRY_TIME 2
|
|
+
|
|
+/**
|
|
+ * Set default transmit power to 9
|
|
+ */
|
|
+#define TXPOWER 9
|
|
+
|
|
+/**
|
|
+ * 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
|
|
+
|
|
+/**
|
|
+ * Reduce the APS ack wait duration from 6000 ms to 1000 ms (value * 2 = value in ms).
|
|
+ * This will make requests timeout quicker, in pratice the default timeout of 6000ms is too long.
|
|
+ */
|
|
+#define APSC_ACK_WAIT_DURATION_POLLED 500
|
|
+
|
|
+// From https://www.ti.com/lit/an/swra650b/swra650b.pdf
|
|
+#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
|
|
+
|
|
+// Different configs, uncomment for for launchpad firmware
|
|
+#define LAUNCHPAD_CONFIG 1
|
|
+
|
|
+#ifdef LAUNCHPAD_CONFIG
|
|
+#define CONFIG_RF_24GHZ 0x0000001c
|
|
+#define CONFIG_RF_HIGH_PA 0x0000001d
|
|
+#define SET_CCFG_MODE_CONF_XOSC_CAPARRAY_DELTA 0xc1
|
|
+#else
|
|
+#define CONFIG_RF_24GHZ 0x0000006
|
|
+#define CONFIG_RF_HIGH_PA 0x0000005
|
|
+#define SET_CCFG_MODE_CONF_XOSC_CAPARRAY_DELTA 0xfa
|
|
+#endif
|
|
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..886d0b4 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
|
|
+
|
|
+--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
|
|
old mode 100644
|
|
new mode 100755
|
|
index 3a7afa3..2dcef5a
|
|
--- 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
|
|
#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
|
|
|
|
@@ -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 )) ||
|
|
+ // Forward messages to endpoint even with profileID mismatches
|
|
+ ((aff->ProfileID >= 0x100) && (aff->ProfileID <= 0xFC01)) )
|
|
{
|
|
// Save original endpoint
|
|
uint8_t endpoint = aff->DstEndPoint;
|
|
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/nwk/nwk_globals.c b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/nwk/nwk_globals.c
|
|
old mode 100644
|
|
new mode 100755
|
|
index b761da1..bc406ff
|
|
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/nwk/nwk_globals.c
|
|
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/nwk/nwk_globals.c
|
|
@@ -65,10 +65,10 @@
|
|
* CONSTANTS
|
|
*/
|
|
// Maximums for the data buffer queue
|
|
-#define NWK_MAX_DATABUFS_WAITING 8 // Waiting to be sent to MAC
|
|
-#define NWK_MAX_DATABUFS_SCHEDULED 5 // Timed messages to be sent
|
|
-#define NWK_MAX_DATABUFS_CONFIRMED 5 // Held after MAC confirms
|
|
-#define NWK_MAX_DATABUFS_TOTAL 12 // Total number of buffers
|
|
+#define NWK_MAX_DATABUFS_WAITING 32 // Waiting to be sent to MAC
|
|
+#define NWK_MAX_DATABUFS_SCHEDULED 20 // Timed messages to be sent
|
|
+#define NWK_MAX_DATABUFS_CONFIRMED 20 // Held after MAC confirms
|
|
+#define NWK_MAX_DATABUFS_TOTAL 48 // Total number of buffers
|
|
|
|
// 1-255 (0 -> 256) X RTG_TIMER_INTERVAL
|
|
// A known shortcoming is that when a message is enqueued as "hold" for a
|
|
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 aafb10d..8d56d78 100644
|
|
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
|
|
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
|
|
@@ -105,7 +105,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;
|
|
@@ -199,7 +199,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 63519d6..088ad02 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
|
|
@@ -415,12 +415,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
|
|
{
|
|
@@ -881,12 +880,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
|
|
{
|
|
@@ -3139,6 +3137,14 @@ void ZDO_NetworkStatusCB( uint16_t nwkDstAddr, uint8_t statusCode, uint16_t dstA
|
|
// Routing error for dstAddr, this is informational and a Route
|
|
// Request should happen automatically.
|
|
}
|
|
+
|
|
+ if ( (nwkDstAddr == NLME_GetShortAddr())
|
|
+ && (statusCode == NWKSTAT_SOURCE_ROUTE_FAILURE) )
|
|
+ {
|
|
+ // Received a source route failure, remove route and rediscover.
|
|
+ RTG_RemoveRtgEntry( dstAddr, 0 );
|
|
+ NLME_RouteDiscoveryRequest( dstAddr, 0, 30 );
|
|
+ }
|
|
}
|
|
|
|
/******************************************************************************
|
|
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_object.c b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_object.c
|
|
index 0440d04..4e08567 100644
|
|
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_object.c
|
|
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_object.c
|
|
@@ -650,6 +650,20 @@ void ZDO_ProcessNodeDescReq( zdoIncomingMsg_t *inMsg )
|
|
|
|
if ( desc != NULL )
|
|
{
|
|
+ uint8_t extAddr[Z_EXTADDR_LEN];
|
|
+ // Respond with Xiaomi manufacturer code when ieeAddr is withing Xiaomi address space
|
|
+ // Otherwise some devices don't work
|
|
+ // https://github.com/Koenkk/zigbee2mqtt/issues/9274
|
|
+ if (APSME_LookupExtAddr(inMsg->srcAddr.addr.shortAddr, extAddr) == TRUE &&
|
|
+ ((extAddr[7] == 0x04 && extAddr[6] == 0xcf && extAddr[5] == 0x8c) ||
|
|
+ (extAddr[7] == 0x54 && extAddr[6] == 0xef && extAddr[5] == 0x44))) {
|
|
+ desc->ManufacturerCode[0] = 0x5f;
|
|
+ desc->ManufacturerCode[1] = 0x11;
|
|
+ } else {
|
|
+ desc->ManufacturerCode[0] = 0x0;
|
|
+ desc->ManufacturerCode[1] = 0x0;
|
|
+ }
|
|
+
|
|
ZDP_NodeDescMsg( inMsg, aoi, desc );
|
|
}
|
|
else
|
|
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_sec_mgr.c b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_sec_mgr.c
|
|
index 4ce9188..f613b6a 100644
|
|
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_sec_mgr.c
|
|
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_sec_mgr.c
|
|
@@ -62,6 +62,7 @@ extern "C"
|
|
|
|
#include <ti/drivers/TRNG.h>
|
|
#include <ti/drivers/cryptoutils/cryptokey/CryptoKeyPlaintext.h>
|
|
+#include "ti_drivers_config.h"
|
|
|
|
/******************************************************************************
|
|
* CONSTANTS
|
|
@@ -119,6 +120,8 @@ typedef struct
|
|
*/
|
|
extern CONST uint8_t gMAX_NWK_SEC_MATERIAL_TABLE_ENTRIES;
|
|
extern pfnZdoCb zdoCBFunc[MAX_ZDO_CB_FUNC];
|
|
+bool gLedsDisabled = FALSE;
|
|
+LED_Handle gLedHandle;
|
|
|
|
/******************************************************************************
|
|
* EXTERNAL FUNCTIONS
|
|
@@ -1519,6 +1522,23 @@ void ZDSecMgrConfig( void )
|
|
}
|
|
}
|
|
|
|
+void updateLED( void )
|
|
+{
|
|
+ if (gLedHandle == NULL) {
|
|
+ LED_Params ledParams;
|
|
+ LED_Params_init(&ledParams);
|
|
+ gLedHandle = LED_open(CONFIG_LED_GREEN, &ledParams);
|
|
+ }
|
|
+
|
|
+ if (gLedsDisabled == FALSE && gLedHandle != NULL) {
|
|
+ if (ZDSecMgrPermitJoiningEnabled == TRUE) {
|
|
+ LED_setOn(gLedHandle, LED_BRIGHTNESS_MAX);
|
|
+ } else {
|
|
+ LED_setOff(gLedHandle);
|
|
+ }
|
|
+ }
|
|
+}
|
|
+
|
|
/******************************************************************************
|
|
* @fn ZDSecMgrPermitJoining
|
|
*
|
|
@@ -1547,6 +1567,7 @@ uint8_t ZDSecMgrPermitJoining( uint8_t duration )
|
|
ZDSecMgrPermitJoiningEnabled = FALSE;
|
|
}
|
|
|
|
+ updateLED();
|
|
accept = TRUE;
|
|
|
|
return accept;
|
|
@@ -1568,6 +1589,8 @@ void ZDSecMgrPermitJoiningTimeout( void )
|
|
ZDSecMgrPermitJoiningEnabled = FALSE;
|
|
ZDSecMgrPermitJoiningTimed = FALSE;
|
|
}
|
|
+
|
|
+ updateLED();
|
|
}
|
|
|
|
/******************************************************************************
|
|
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_sec_mgr.h b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_sec_mgr.h
|
|
index 6468e0d..e61c5e4 100644
|
|
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_sec_mgr.h
|
|
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_sec_mgr.h
|
|
@@ -51,6 +51,8 @@ extern "C"
|
|
#include "zcomdef.h"
|
|
#include "zd_app.h"
|
|
|
|
+#include <ti/drivers/apps/LED.h>
|
|
+
|
|
/******************************************************************************
|
|
* TYPEDEFS
|
|
*/
|
|
@@ -95,6 +97,9 @@ extern CONST uint16_t gZDSECMGR_TC_DEVICE_MAX;
|
|
extern CONST uint16_t gZDSECMGR_TC_DEVICE_IC_MAX;
|
|
extern uint8_t gZDSECMGR_TC_ATTEMPT_DEFAULT_KEY;
|
|
|
|
+extern bool gLedsDisabled;
|
|
+extern LED_Handle gLedHandle;
|
|
+
|
|
typedef struct
|
|
{
|
|
uint32_t FrameCounter;
|
|
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/app.cfg b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/app.cfg
|
|
index 5089a84..146ef06 100644
|
|
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/app.cfg
|
|
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/app.cfg
|
|
@@ -700,7 +700,9 @@ var GateMutexPri = xdc.useModule('ti.sysbios.gates.GateMutexPri');
|
|
*/
|
|
var Memory = xdc.useModule('xdc.runtime.Memory');
|
|
var HEAPMGR_CONFIG = 0;
|
|
-var HEAPMGR_SIZE = 0x1800;
|
|
+// Increase heap to 48kb
|
|
+// https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum/1052120/cc2652r-mac-no-resources-0x1a-errors-complete-crash-with-simplelink-cc13xx-cc26xx-sdk_5-30-00-56/3897554#3897554
|
|
+var HEAPMGR_SIZE = 0xc000;
|
|
|
|
// The following will create the #define HEAPMGR_CONFIG. It can then be used by include <xdc/cfg/global.h>
|
|
Program.global.HEAPMGR_CONFIG = HEAPMGR_CONFIG;
|
|
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/cc13x2_cc26x2.cmd b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/cc13x2_cc26x2.cmd
|
|
index 2856ad2..d9a66ac 100755
|
|
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/cc13x2_cc26x2.cmd
|
|
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/cc13x2_cc26x2.cmd
|
|
@@ -67,9 +67,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/ti_devices_config.c b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/ti_devices_config.c
|
|
new file mode 100644
|
|
index 0000000..577e5a0
|
|
--- /dev/null
|
|
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/ti_devices_config.c
|
|
@@ -0,0 +1,105 @@
|
|
+/*
|
|
+ * ======== ti_devices_config.c ========
|
|
+ * Customer Configuration for CC26XX and CC13XX devices.
|
|
+ *
|
|
+ * DO NOT EDIT - This file is generated by the SysConfig tool.
|
|
+ *
|
|
+ */
|
|
+
|
|
+//#####################################
|
|
+// Force VDDR high setting (Higher output power but also higher power consumption)
|
|
+// This is also called "boost mode"
|
|
+//#####################################
|
|
+
|
|
+// Force VDDR voltage to the factory HH setting (FCFG1..VDDR_TRIM_HH)
|
|
+#define CCFG_FORCE_VDDR_HH 0x1
|
|
+
|
|
+
|
|
+//#####################################
|
|
+// Power settings
|
|
+//#####################################
|
|
+
|
|
+// Do not use the DC/DC during recharge in powerdown
|
|
+#define SET_CCFG_MODE_CONF_DCDC_RECHARGE 0x1
|
|
+
|
|
+// Do not use the DC/DC during active mode
|
|
+#define SET_CCFG_MODE_CONF_DCDC_ACTIVE 0x1
|
|
+
|
|
+
|
|
+//#####################################
|
|
+// Clock settings
|
|
+//#####################################
|
|
+
|
|
+// LF XOSC
|
|
+#define SET_CCFG_MODE_CONF_SCLK_LF_OPTION 0x2
|
|
+
|
|
+// Apply cap-array delta
|
|
+#define SET_CCFG_MODE_CONF_XOSC_CAP_MOD 0x0
|
|
+// CUSTOM: set in preinclude.h
|
|
+// #define SET_CCFG_MODE_CONF_XOSC_CAPARRAY_DELTA 0xc1
|
|
+
|
|
+//#####################################
|
|
+// Special HF clock source setting
|
|
+//#####################################
|
|
+
|
|
+// HF source is a 48 MHz xtal
|
|
+#define SET_CCFG_MODE_CONF_XOSC_FREQ 0x2
|
|
+
|
|
+//#####################################
|
|
+// Bootloader settings
|
|
+//#####################################
|
|
+
|
|
+// Enable ROM boot loader
|
|
+#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5
|
|
+
|
|
+// Enabled boot loader backdoor
|
|
+#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5
|
|
+
|
|
+// DIO number for boot loader backdoor
|
|
+#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER 0xf
|
|
+
|
|
+// Active low to open boot loader backdoor
|
|
+#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x0
|
|
+
|
|
+
|
|
+// Default address in IMAGE_VALID_CONF register
|
|
+#define SET_CCFG_IMAGE_VALID_CONF_IMAGE_VALID 0x00000000
|
|
+
|
|
+//#####################################
|
|
+// Debug access settings
|
|
+//#####################################
|
|
+
|
|
+// Disable unlocking of TI FA option.
|
|
+#define SET_CCFG_CCFG_TI_OPTIONS_TI_FA_ENABLE 0x00
|
|
+
|
|
+// Access enabled if also enabled in FCFG
|
|
+#define SET_CCFG_CCFG_TAP_DAP_0_CPU_DAP_ENABLE 0xC5
|
|
+
|
|
+// Access enabled if also enabled in FCFG
|
|
+#define SET_CCFG_CCFG_TAP_DAP_0_PWRPROF_TAP_ENABLE 0xC5
|
|
+
|
|
+// Access disabled
|
|
+#define SET_CCFG_CCFG_TAP_DAP_0_TEST_TAP_ENABLE 0x00
|
|
+
|
|
+// Access disabled
|
|
+#define SET_CCFG_CCFG_TAP_DAP_1_PBIST2_TAP_ENABLE 0x00
|
|
+
|
|
+// Access disabled
|
|
+#define SET_CCFG_CCFG_TAP_DAP_1_PBIST1_TAP_ENABLE 0x00
|
|
+
|
|
+// Access disabled
|
|
+#define SET_CCFG_CCFG_TAP_DAP_1_AON_TAP_ENABLE 0x00
|
|
+
|
|
+//#####################################
|
|
+// Select between cache or GPRAM
|
|
+//#####################################
|
|
+
|
|
+// Cache is enabled and GPRAM is disabled (unavailable)
|
|
+#define SET_CCFG_SIZE_AND_DIS_FLAGS_DIS_GPRAM 0x1
|
|
+
|
|
+/*
|
|
+ * ======== Include Base Settings for device ========
|
|
+ */
|
|
+
|
|
+#include <ti/devices/DeviceFamily.h>
|
|
+#include DeviceFamily_constructPath(startup_files/ccfg.c)
|
|
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/ti_drivers_config.h b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/ti_drivers_config.h
|
|
new file mode 100644
|
|
index 0000000..00c102a
|
|
--- /dev/null
|
|
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/ti_drivers_config.h
|
|
@@ -0,0 +1,274 @@
|
|
+/*
|
|
+ * ======== ti_drivers_config.h ========
|
|
+ * Configured TI-Drivers module declarations
|
|
+ *
|
|
+ * The macros defines herein are intended for use by applications which
|
|
+ * directly include this header. These macros should NOT be hard coded or
|
|
+ * copied into library source code.
|
|
+ *
|
|
+ * Symbols declared as const are intended for use with libraries.
|
|
+ * Library source code must extern the correct symbol--which is resolved
|
|
+ * when the application is linked.
|
|
+ *
|
|
+ * DO NOT EDIT - This file is generated for the CC1352P_2_LAUNCHXL
|
|
+ * by the SysConfig tool.
|
|
+ */
|
|
+#ifndef ti_drivers_config_h
|
|
+#define ti_drivers_config_h
|
|
+
|
|
+#define CONFIG_SYSCONFIG_PREVIEW
|
|
+
|
|
+#define CONFIG_CC1352P_2_LAUNCHXL
|
|
+#ifndef DeviceFamily_CC13X2
|
|
+#define DeviceFamily_CC13X2
|
|
+#endif
|
|
+
|
|
+#include <ti/devices/DeviceFamily.h>
|
|
+
|
|
+#include <stdint.h>
|
|
+
|
|
+/* support C++ sources */
|
|
+#ifdef __cplusplus
|
|
+extern "C" {
|
|
+#endif
|
|
+
|
|
+
|
|
+/*
|
|
+ * ======== CCFG ========
|
|
+ */
|
|
+
|
|
+
|
|
+/*
|
|
+ * ======== AESCBC ========
|
|
+ */
|
|
+
|
|
+extern const uint_least8_t CONFIG_AESCBC_0_CONST;
|
|
+#define CONFIG_AESCBC_0 0
|
|
+#define CONFIG_TI_DRIVERS_AESCBC_COUNT 1
|
|
+
|
|
+
|
|
+/*
|
|
+ * ======== AESCCM ========
|
|
+ */
|
|
+
|
|
+extern const uint_least8_t CONFIG_AESCCM_0_CONST;
|
|
+#define CONFIG_AESCCM_0 0
|
|
+#define CONFIG_TI_DRIVERS_AESCCM_COUNT 1
|
|
+
|
|
+
|
|
+/*
|
|
+ * ======== AESECB ========
|
|
+ */
|
|
+
|
|
+extern const uint_least8_t CONFIG_AESECB_0_CONST;
|
|
+#define CONFIG_AESECB_0 0
|
|
+#define CONFIG_TI_DRIVERS_AESECB_COUNT 1
|
|
+
|
|
+
|
|
+/*
|
|
+ * ======== ECDH ========
|
|
+ */
|
|
+
|
|
+extern const uint_least8_t CONFIG_ECDH_0_CONST;
|
|
+#define CONFIG_ECDH_0 0
|
|
+#define CONFIG_TI_DRIVERS_ECDH_COUNT 1
|
|
+
|
|
+
|
|
+/*
|
|
+ * ======== ECDSA ========
|
|
+ */
|
|
+
|
|
+extern const uint_least8_t CONFIG_ECDSA_0_CONST;
|
|
+#define CONFIG_ECDSA_0 0
|
|
+#define CONFIG_TI_DRIVERS_ECDSA_COUNT 1
|
|
+
|
|
+
|
|
+/*
|
|
+ * ======== GPIO ========
|
|
+ */
|
|
+/* Owned by CONFIG_DISPLAY_UART as */
|
|
+extern const uint_least8_t CONFIG_GPIO_1_CONST;
|
|
+#define CONFIG_GPIO_1 13
|
|
+
|
|
+/* Owned by CONFIG_DISPLAY_UART as */
|
|
+extern const uint_least8_t CONFIG_GPIO_2_CONST;
|
|
+#define CONFIG_GPIO_2 12
|
|
+
|
|
+/* Owned by /ti/drivers/RF as */
|
|
+extern const uint_least8_t CONFIG_RF_24GHZ_CONST;
|
|
+// CUSTOM: set in preinclude.h
|
|
+// #define CONFIG_RF_24GHZ 28
|
|
+
|
|
+/* Owned by /ti/drivers/RF as */
|
|
+extern const uint_least8_t CONFIG_RF_HIGH_PA_CONST;
|
|
+// CUSTOM: set in preinclude.h
|
|
+// #define CONFIG_RF_HIGH_PA 29
|
|
+
|
|
+/* Owned by /ti/drivers/RF as */
|
|
+extern const uint_least8_t CONFIG_RF_SUB1GHZ_CONST;
|
|
+#define CONFIG_RF_SUB1GHZ 30
|
|
+
|
|
+/* Owned by CONFIG_BTN_LEFT as */
|
|
+extern const uint_least8_t CONFIG_GPIO_BTN1_CONST;
|
|
+#define CONFIG_GPIO_BTN1 15
|
|
+
|
|
+/* Owned by CONFIG_BTN_RIGHT as */
|
|
+extern const uint_least8_t CONFIG_GPIO_BTN2_CONST;
|
|
+#define CONFIG_GPIO_BTN2 14
|
|
+
|
|
+/* Owned by CONFIG_LED_RED as */
|
|
+extern const uint_least8_t CONFIG_GPIO_RLED_CONST;
|
|
+#define CONFIG_GPIO_RLED 6
|
|
+
|
|
+/* Owned by CONFIG_LED_GREEN as */
|
|
+extern const uint_least8_t CONFIG_GPIO_GLED_CONST;
|
|
+#define CONFIG_GPIO_GLED 7
|
|
+
|
|
+/* Owned by CONFIG_NVS_SPI_0 as */
|
|
+extern const uint_least8_t CONFIG_GPIO_0_CONST;
|
|
+#define CONFIG_GPIO_0 20
|
|
+
|
|
+/* Owned by CONFIG_SPI_0 as */
|
|
+extern const uint_least8_t CONFIG_PIN_SPI_SCLK_CONST;
|
|
+#define CONFIG_PIN_SPI_SCLK 10
|
|
+
|
|
+/* Owned by CONFIG_SPI_0 as */
|
|
+extern const uint_least8_t CONFIG_PIN_SPI_MISO_CONST;
|
|
+#define CONFIG_PIN_SPI_MISO 8
|
|
+
|
|
+/* Owned by CONFIG_SPI_0 as */
|
|
+extern const uint_least8_t CONFIG_PIN_SPI_MOSI_CONST;
|
|
+#define CONFIG_PIN_SPI_MOSI 9
|
|
+
|
|
+/* The range of pins available on this device */
|
|
+extern const uint_least8_t GPIO_pinLowerBound;
|
|
+extern const uint_least8_t GPIO_pinUpperBound;
|
|
+
|
|
+/* LEDs are active high */
|
|
+#define CONFIG_GPIO_LED_ON (1)
|
|
+#define CONFIG_GPIO_LED_OFF (0)
|
|
+
|
|
+#define CONFIG_LED_ON (CONFIG_GPIO_LED_ON)
|
|
+#define CONFIG_LED_OFF (CONFIG_GPIO_LED_OFF)
|
|
+
|
|
+
|
|
+/*
|
|
+ * ======== NVS ========
|
|
+ */
|
|
+
|
|
+extern const uint_least8_t CONFIG_NVSINTERNAL_CONST;
|
|
+#define CONFIG_NVSINTERNAL 0
|
|
+/*
|
|
+ * MOSI: DIO9
|
|
+ * MISO: DIO8
|
|
+ * SCLK: DIO10
|
|
+ * LaunchPad SPI Bus
|
|
+ * SS: undefined
|
|
+ */
|
|
+extern const uint_least8_t CONFIG_NVSEXTERNAL_CONST;
|
|
+#define CONFIG_NVSEXTERNAL 1
|
|
+#define CONFIG_TI_DRIVERS_NVS_COUNT 2
|
|
+
|
|
+
|
|
+/*
|
|
+ * ======== RF ========
|
|
+ */
|
|
+#define Board_DIO_30_RFSW 0x0000001e
|
|
+
|
|
+
|
|
+/*
|
|
+ * ======== SHA2 ========
|
|
+ */
|
|
+
|
|
+extern const uint_least8_t CONFIG_SHA2_0_CONST;
|
|
+#define CONFIG_SHA2_0 0
|
|
+#define CONFIG_TI_DRIVERS_SHA2_COUNT 1
|
|
+
|
|
+
|
|
+/*
|
|
+ * ======== SPI ========
|
|
+ */
|
|
+
|
|
+/*
|
|
+ * MOSI: DIO9
|
|
+ * MISO: DIO8
|
|
+ * SCLK: DIO10
|
|
+ * LaunchPad SPI Bus
|
|
+ */
|
|
+extern const uint_least8_t CONFIG_SPI_0_CONST;
|
|
+#define CONFIG_SPI_0 0
|
|
+#define CONFIG_TI_DRIVERS_SPI_COUNT 1
|
|
+
|
|
+
|
|
+/*
|
|
+ * ======== TRNG ========
|
|
+ */
|
|
+
|
|
+extern const uint_least8_t CONFIG_TRNG_0_CONST;
|
|
+#define CONFIG_TRNG_0 0
|
|
+#define CONFIG_TI_DRIVERS_TRNG_COUNT 1
|
|
+
|
|
+
|
|
+/*
|
|
+ * ======== UART ========
|
|
+ */
|
|
+
|
|
+/*
|
|
+ * TX: DIO13
|
|
+ * RX: DIO12
|
|
+ * XDS110 UART
|
|
+ */
|
|
+extern const uint_least8_t CONFIG_DISPLAY_UART_CONST;
|
|
+#define CONFIG_DISPLAY_UART 0
|
|
+#define CONFIG_TI_DRIVERS_UART_COUNT 1
|
|
+
|
|
+
|
|
+/*
|
|
+ * ======== Button ========
|
|
+ */
|
|
+
|
|
+extern const uint_least8_t CONFIG_BTN_LEFT_CONST;
|
|
+#define CONFIG_BTN_LEFT 0
|
|
+extern const uint_least8_t CONFIG_BTN_RIGHT_CONST;
|
|
+#define CONFIG_BTN_RIGHT 1
|
|
+#define CONFIG_TI_DRIVERS_BUTTON_COUNT 2
|
|
+
|
|
+
|
|
+/*
|
|
+ * ======== LED ========
|
|
+ */
|
|
+
|
|
+extern const uint_least8_t CONFIG_LED_RED_CONST;
|
|
+#define CONFIG_LED_RED 0
|
|
+extern const uint_least8_t CONFIG_LED_GREEN_CONST;
|
|
+#define CONFIG_LED_GREEN 1
|
|
+#define CONFIG_TI_DRIVERS_LED_COUNT 2
|
|
+
|
|
+
|
|
+/*
|
|
+ * ======== Board_init ========
|
|
+ * Perform all required TI-Drivers initialization
|
|
+ *
|
|
+ * This function should be called once at a point before any use of
|
|
+ * TI-Drivers.
|
|
+ */
|
|
+extern void Board_init(void);
|
|
+
|
|
+/*
|
|
+ * ======== Board_initGeneral ========
|
|
+ * (deprecated)
|
|
+ *
|
|
+ * Board_initGeneral() is defined purely for backward compatibility.
|
|
+ *
|
|
+ * All new code should use Board_init() to do any required TI-Drivers
|
|
+ * initialization _and_ use <Driver>_init() for only where specific drivers
|
|
+ * are explicitly referenced by the application. <Driver>_init() functions
|
|
+ * are idempotent.
|
|
+ */
|
|
+#define Board_initGeneral Board_init
|
|
+
|
|
+#ifdef __cplusplus
|
|
+}
|
|
+#endif
|
|
+
|
|
+#endif /* include guard */
|
|
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/ti_radio_config.c b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/ti_radio_config.c
|
|
new file mode 100644
|
|
index 0000000..c23e14a
|
|
--- /dev/null
|
|
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/ti_radio_config.c
|
|
@@ -0,0 +1,387 @@
|
|
+/*
|
|
+ * ======== ti_radio_config.c ========
|
|
+ * Configured RadioConfig module definitions
|
|
+ *
|
|
+ * DO NOT EDIT - This file is generated for the CC1352P1F3RGZ
|
|
+ * by the SysConfig tool.
|
|
+ *
|
|
+ * Radio Config module version : 1.11
|
|
+ * SmartRF Studio data version : 2.23.0
|
|
+ */
|
|
+
|
|
+#include "ti_radio_config.h"
|
|
+#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_ieee_802_15_4.h)
|
|
+
|
|
+
|
|
+// *********************************************************************************
|
|
+// RF Frontend configuration
|
|
+// *********************************************************************************
|
|
+// RF design based on: LAUNCHXL-CC1352P-2 (CC1352PEM-XD4251-XD24-PA24_10dBm)
|
|
+
|
|
+// TX Power tables
|
|
+// The RF_TxPowerTable_DEFAULT_PA_ENTRY and RF_TxPowerTable_HIGH_PA_ENTRY macros are defined in RF.h.
|
|
+// The following arguments are required:
|
|
+// RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost, coefficient)
|
|
+// RF_TxPowerTable_HIGH_PA_ENTRY(bias, ibboost, boost, coefficient, ldoTrim)
|
|
+// See the Technical Reference Manual for further details about the "txPower" Command field.
|
|
+// The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise.
|
|
+
|
|
+// 868 MHz, 13 dBm
|
|
+RF_TxPowerTable_Entry txPowerTable_868_pa13[TXPOWERTABLE_868_PA13_SIZE] =
|
|
+{
|
|
+ {-20, RF_TxPowerTable_DEFAULT_PA_ENTRY(0, 3, 0, 2) },
|
|
+ {-15, RF_TxPowerTable_DEFAULT_PA_ENTRY(1, 3, 0, 3) },
|
|
+ {-10, RF_TxPowerTable_DEFAULT_PA_ENTRY(2, 3, 0, 5) },
|
|
+ {-5, RF_TxPowerTable_DEFAULT_PA_ENTRY(4, 3, 0, 5) },
|
|
+ {0, RF_TxPowerTable_DEFAULT_PA_ENTRY(8, 3, 0, 8) },
|
|
+ {1, RF_TxPowerTable_DEFAULT_PA_ENTRY(9, 3, 0, 9) },
|
|
+ {2, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 3, 0, 9) },
|
|
+ {3, RF_TxPowerTable_DEFAULT_PA_ENTRY(11, 3, 0, 10) },
|
|
+ {4, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 3, 0, 11) },
|
|
+ {5, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 3, 0, 14) },
|
|
+ {6, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 3, 0, 16) },
|
|
+ {7, RF_TxPowerTable_DEFAULT_PA_ENTRY(20, 3, 0, 19) },
|
|
+ {8, RF_TxPowerTable_DEFAULT_PA_ENTRY(24, 3, 0, 22) },
|
|
+ {9, RF_TxPowerTable_DEFAULT_PA_ENTRY(28, 3, 0, 31) },
|
|
+ {10, RF_TxPowerTable_DEFAULT_PA_ENTRY(18, 2, 0, 31) },
|
|
+ {11, RF_TxPowerTable_DEFAULT_PA_ENTRY(26, 2, 0, 51) },
|
|
+ {12, RF_TxPowerTable_DEFAULT_PA_ENTRY(16, 0, 0, 82) },
|
|
+ // The original PA value (12.5 dBm) has been rounded to an integer value.
|
|
+ {13, RF_TxPowerTable_DEFAULT_PA_ENTRY(36, 0, 0, 89) },
|
|
+ // This setting requires CCFG_FORCE_VDDR_HH = 1.
|
|
+ {14, RF_TxPowerTable_DEFAULT_PA_ENTRY(63, 0, 1, 0) },
|
|
+ RF_TxPowerTable_TERMINATION_ENTRY
|
|
+};
|
|
+
|
|
+
|
|
+// 2400 MHz, 5 dBm
|
|
+RF_TxPowerTable_Entry txPowerTable_2400_pa5[TXPOWERTABLE_2400_PA5_SIZE] =
|
|
+{
|
|
+ {-20, RF_TxPowerTable_DEFAULT_PA_ENTRY(6, 3, 0, 2) },
|
|
+ {-18, RF_TxPowerTable_DEFAULT_PA_ENTRY(8, 3, 0, 3) },
|
|
+ {-15, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 3, 0, 3) },
|
|
+ {-12, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 3, 0, 5) },
|
|
+ {-10, RF_TxPowerTable_DEFAULT_PA_ENTRY(15, 3, 0, 5) },
|
|
+ {-9, RF_TxPowerTable_DEFAULT_PA_ENTRY(16, 3, 0, 5) },
|
|
+ {-6, RF_TxPowerTable_DEFAULT_PA_ENTRY(20, 3, 0, 8) },
|
|
+ {-5, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 3, 0, 9) },
|
|
+ {-3, RF_TxPowerTable_DEFAULT_PA_ENTRY(19, 2, 0, 12) },
|
|
+ {0, RF_TxPowerTable_DEFAULT_PA_ENTRY(19, 1, 0, 20) },
|
|
+ {1, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 1, 0, 20) },
|
|
+ {2, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 1, 0, 25) },
|
|
+ {3, RF_TxPowerTable_DEFAULT_PA_ENTRY(29, 1, 0, 28) },
|
|
+ {4, RF_TxPowerTable_DEFAULT_PA_ENTRY(35, 1, 0, 39) },
|
|
+ {5, RF_TxPowerTable_DEFAULT_PA_ENTRY(23, 0, 0, 57) },
|
|
+ RF_TxPowerTable_TERMINATION_ENTRY
|
|
+};
|
|
+
|
|
+// 2400 MHz, 5 + 20 dBm
|
|
+RF_TxPowerTable_Entry txPowerTable_2400_pa5_20[TXPOWERTABLE_2400_PA5_20_SIZE] =
|
|
+{
|
|
+ {-20, RF_TxPowerTable_DEFAULT_PA_ENTRY(6, 3, 0, 2) },
|
|
+ {-18, RF_TxPowerTable_DEFAULT_PA_ENTRY(8, 3, 0, 3) },
|
|
+ {-15, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 3, 0, 3) },
|
|
+ {-12, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 3, 0, 5) },
|
|
+ {-10, RF_TxPowerTable_DEFAULT_PA_ENTRY(15, 3, 0, 5) },
|
|
+ {-9, RF_TxPowerTable_DEFAULT_PA_ENTRY(16, 3, 0, 5) },
|
|
+ {-6, RF_TxPowerTable_DEFAULT_PA_ENTRY(20, 3, 0, 8) },
|
|
+ {-5, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 3, 0, 9) },
|
|
+ {-3, RF_TxPowerTable_DEFAULT_PA_ENTRY(19, 2, 0, 12) },
|
|
+ {0, RF_TxPowerTable_DEFAULT_PA_ENTRY(19, 1, 0, 20) },
|
|
+ {1, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 1, 0, 20) },
|
|
+ {2, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 1, 0, 25) },
|
|
+ {3, RF_TxPowerTable_DEFAULT_PA_ENTRY(29, 1, 0, 28) },
|
|
+ {4, RF_TxPowerTable_DEFAULT_PA_ENTRY(35, 1, 0, 39) },
|
|
+ {5, RF_TxPowerTable_DEFAULT_PA_ENTRY(23, 0, 0, 57) },
|
|
+
|
|
+ // CUSTOM: allow transmit power 6 - 13 dbm
|
|
+ {6, .value.rawValue = (0x144f2a), .value.paType = RF_TxPowerTable_HighPA },
|
|
+ {7, .value.rawValue = (0x14285f), .value.paType = RF_TxPowerTable_HighPA },
|
|
+ {8, .value.rawValue = (0x10335a), .value.paType = RF_TxPowerTable_HighPA },
|
|
+ {9, .value.rawValue = (0x103f5f), .value.paType = RF_TxPowerTable_HighPA },
|
|
+ {10, .value.rawValue = (0x104f66), .value.paType = RF_TxPowerTable_HighPA },
|
|
+ {11, .value.rawValue = (0x3021cb), .value.paType = RF_TxPowerTable_HighPA },
|
|
+ {12, .value.rawValue = (0x3f27cc), .value.paType = RF_TxPowerTable_HighPA },
|
|
+ {13, .value.rawValue = (0x3fc3cd), .value.paType = RF_TxPowerTable_HighPA },
|
|
+
|
|
+ {14, RF_TxPowerTable_HIGH_PA_ENTRY(22, 3, 1, 19, 27) },
|
|
+ {15, RF_TxPowerTable_HIGH_PA_ENTRY(26, 3, 1, 23, 27) },
|
|
+ {16, RF_TxPowerTable_HIGH_PA_ENTRY(30, 3, 1, 28, 27) },
|
|
+ {17, RF_TxPowerTable_HIGH_PA_ENTRY(37, 3, 1, 39, 27) },
|
|
+ {18, RF_TxPowerTable_HIGH_PA_ENTRY(32, 3, 1, 35, 48) },
|
|
+ {19, RF_TxPowerTable_HIGH_PA_ENTRY(34, 3, 1, 48, 63) },
|
|
+ {20, RF_TxPowerTable_HIGH_PA_ENTRY(53, 3, 1, 58, 63) },
|
|
+ RF_TxPowerTable_TERMINATION_ENTRY
|
|
+};
|
|
+
|
|
+
|
|
+
|
|
+//*********************************************************************************
|
|
+// RF Setting: IEEE 802.15.4-2006, 250 kbps, OQPSK, DSSS = 1:8
|
|
+//
|
|
+// PHY: ieee154
|
|
+// Setting file: setting_ieee_802_15_4.json
|
|
+//*********************************************************************************
|
|
+
|
|
+// PARAMETER SUMMARY
|
|
+// Channel - Frequency (MHz): 2405
|
|
+// TX Power (dBm): 20
|
|
+
|
|
+// TI-RTOS RF Mode Object
|
|
+RF_Mode RF_prop_ieee154 =
|
|
+{
|
|
+ .rfMode = RF_MODE_AUTO,
|
|
+ .cpePatchFxn = &rf_patch_cpe_ieee_802_15_4,
|
|
+ .mcePatchFxn = 0,
|
|
+ .rfePatchFxn = 0
|
|
+};
|
|
+
|
|
+// Overrides for CMD_RADIO_SETUP_PA
|
|
+uint32_t pOverrides_ieee154[] =
|
|
+{
|
|
+ // override_ieee_802_15_4.json
|
|
+ // Rx: Set LNA bias current offset to +15 to saturate trim to max (default: 0)
|
|
+ (uint32_t)0x000F8883,
|
|
+ // Tx: Set DCDC settings IPEAK=3, dither = off
|
|
+ (uint32_t)0x00F388D3,
|
|
+ (uint32_t)0xFFFFFFFF
|
|
+};
|
|
+
|
|
+// Overrides for CMD_RADIO_SETUP_PA
|
|
+uint32_t pOverrides_ieee154TxStd[] =
|
|
+{
|
|
+ // override_txstd_placeholder.json
|
|
+ // TX Standard power override
|
|
+ TX_STD_POWER_OVERRIDE(0x7217),
|
|
+ // The ANADIV radio parameter based on LO divider and front end settings
|
|
+ (uint32_t)0x05320703,
|
|
+ // override_txstd_settings.json
|
|
+ // Set RTIM offset to default for standard PA
|
|
+ (uint32_t)0x00008783,
|
|
+ // Set synth mux to default value for standard PA
|
|
+ (uint32_t)0x050206C3,
|
|
+ // Set TXRX pin to 0 in RX and high impedance in idle/TX.
|
|
+ HW_REG_OVERRIDE(0x60A8,0x0401),
|
|
+ // Tx: Set DCDC settings IPEAK=3, dither = off
|
|
+ (uint32_t)0x00F388D3,
|
|
+ (uint32_t)0xFFFFFFFF
|
|
+};
|
|
+
|
|
+// Overrides for CMD_RADIO_SETUP_PA
|
|
+uint32_t pOverrides_ieee154Tx20[] =
|
|
+{
|
|
+ // override_tx20_placeholder.json
|
|
+ // TX HighPA power override
|
|
+ TX20_POWER_OVERRIDE(0x003F75F5),
|
|
+ // The ANADIV radio parameter based on LO divider and front end settings
|
|
+ (uint32_t)0x01C20703,
|
|
+ // override_tx20_settings.json
|
|
+ // Set RTIM offset to 3 for high power PA
|
|
+ (uint32_t)0x00038783,
|
|
+ // Set synth mux for high power PA
|
|
+ (uint32_t)0x010206C3,
|
|
+ // Set TXRX pin to 0 in RX/TX and high impedance in idle.
|
|
+ HW_REG_OVERRIDE(0x60A8,0x0001),
|
|
+ // Tx: Set DCDC settings IPEAK=7, dither = off
|
|
+ (uint32_t)0x00F788D3,
|
|
+ (uint32_t)0xFFFFFFFF
|
|
+};
|
|
+
|
|
+
|
|
+
|
|
+// CMD_RADIO_SETUP_PA
|
|
+// Radio Setup Command for Pre-Defined Schemes
|
|
+const rfc_CMD_RADIO_SETUP_PA_t RF_cmdRadioSetup_ieee154 =
|
|
+{
|
|
+ .commandNo = 0x0802,
|
|
+ .status = 0x0000,
|
|
+ .pNextOp = 0,
|
|
+ .startTime = 0x00000000,
|
|
+ .startTrigger.triggerType = 0x0,
|
|
+ .startTrigger.bEnaCmd = 0x0,
|
|
+ .startTrigger.triggerNo = 0x0,
|
|
+ .startTrigger.pastTrig = 0x0,
|
|
+ .condition.rule = 0x1,
|
|
+ .condition.nSkip = 0x0,
|
|
+ .mode = 0x01,
|
|
+ .loDivider = 0x00,
|
|
+ .config.frontEndMode = 0x0,
|
|
+ .config.biasMode = 0x1,
|
|
+ .config.analogCfgMode = 0x0,
|
|
+ .config.bNoFsPowerUp = 0x0,
|
|
+ .config.bSynthNarrowBand = 0x0,
|
|
+ .txPower = 0xFFFF,
|
|
+ .pRegOverride = pOverrides_ieee154,
|
|
+ .pRegOverrideTxStd = pOverrides_ieee154TxStd,
|
|
+ .pRegOverrideTx20 = pOverrides_ieee154Tx20
|
|
+};
|
|
+
|
|
+// CMD_FS
|
|
+// Frequency Synthesizer Programming Command
|
|
+const rfc_CMD_FS_t RF_cmdFs_ieee154 =
|
|
+{
|
|
+ .commandNo = 0x0803,
|
|
+ .status = 0x0000,
|
|
+ .pNextOp = 0,
|
|
+ .startTime = 0x00000000,
|
|
+ .startTrigger.triggerType = 0x0,
|
|
+ .startTrigger.bEnaCmd = 0x0,
|
|
+ .startTrigger.triggerNo = 0x0,
|
|
+ .startTrigger.pastTrig = 0x0,
|
|
+ .condition.rule = 0x1,
|
|
+ .condition.nSkip = 0x0,
|
|
+ .frequency = 0x0965,
|
|
+ .fractFreq = 0x0000,
|
|
+ .synthConf.bTxMode = 0x0,
|
|
+ .synthConf.refFreq = 0x0,
|
|
+ .__dummy0 = 0x00,
|
|
+ .__dummy1 = 0x00,
|
|
+ .__dummy2 = 0x00,
|
|
+ .__dummy3 = 0x0000
|
|
+};
|
|
+
|
|
+// CMD_IEEE_TX
|
|
+// IEEE 802.15.4 Transmit Command
|
|
+const rfc_CMD_IEEE_TX_t RF_cmdIeeeTx_ieee154 =
|
|
+{
|
|
+ .commandNo = 0x2C01,
|
|
+ .status = 0x0000,
|
|
+ .pNextOp = 0,
|
|
+ .startTime = 0x00000000,
|
|
+ .startTrigger.triggerType = 0x0,
|
|
+ .startTrigger.bEnaCmd = 0x0,
|
|
+ .startTrigger.triggerNo = 0x0,
|
|
+ .startTrigger.pastTrig = 0x0,
|
|
+ .condition.rule = 0x1,
|
|
+ .condition.nSkip = 0x0,
|
|
+ .txOpt.bIncludePhyHdr = 0x0,
|
|
+ .txOpt.bIncludeCrc = 0x0,
|
|
+ .txOpt.payloadLenMsb = 0x0,
|
|
+ .payloadLen = 0x1E,
|
|
+ .pPayload = 0,
|
|
+ .timeStamp = 0x00000000
|
|
+};
|
|
+
|
|
+// CMD_IEEE_RX
|
|
+// IEEE 802.15.4 Receive Command
|
|
+const rfc_CMD_IEEE_RX_t RF_cmdIeeeRx_ieee154 =
|
|
+{
|
|
+ .commandNo = 0x2801,
|
|
+ .status = 0x0000,
|
|
+ .pNextOp = 0,
|
|
+ .startTime = 0x00000000,
|
|
+ .startTrigger.triggerType = 0x0,
|
|
+ .startTrigger.bEnaCmd = 0x0,
|
|
+ .startTrigger.triggerNo = 0x0,
|
|
+ .startTrigger.pastTrig = 0x0,
|
|
+ .condition.rule = 0x1,
|
|
+ .condition.nSkip = 0x0,
|
|
+ .channel = 0x00,
|
|
+ .rxConfig.bAutoFlushCrc = 0x0,
|
|
+ .rxConfig.bAutoFlushIgn = 0x0,
|
|
+ .rxConfig.bIncludePhyHdr = 0x0,
|
|
+ .rxConfig.bIncludeCrc = 0x0,
|
|
+ .rxConfig.bAppendRssi = 0x1,
|
|
+ .rxConfig.bAppendCorrCrc = 0x1,
|
|
+ .rxConfig.bAppendSrcInd = 0x0,
|
|
+ .rxConfig.bAppendTimestamp = 0x0,
|
|
+ .pRxQ = 0,
|
|
+ .pOutput = 0,
|
|
+ .frameFiltOpt.frameFiltEn = 0x0,
|
|
+ .frameFiltOpt.frameFiltStop = 0x0,
|
|
+ .frameFiltOpt.autoAckEn = 0x0,
|
|
+ .frameFiltOpt.slottedAckEn = 0x0,
|
|
+ .frameFiltOpt.autoPendEn = 0x0,
|
|
+ .frameFiltOpt.defaultPend = 0x0,
|
|
+ .frameFiltOpt.bPendDataReqOnly = 0x0,
|
|
+ .frameFiltOpt.bPanCoord = 0x0,
|
|
+ .frameFiltOpt.maxFrameVersion = 0x3,
|
|
+ .frameFiltOpt.fcfReservedMask = 0x0,
|
|
+ .frameFiltOpt.modifyFtFilter = 0x0,
|
|
+ .frameFiltOpt.bStrictLenFilter = 0x0,
|
|
+ .frameTypes.bAcceptFt0Beacon = 0x1,
|
|
+ .frameTypes.bAcceptFt1Data = 0x1,
|
|
+ .frameTypes.bAcceptFt2Ack = 0x1,
|
|
+ .frameTypes.bAcceptFt3MacCmd = 0x1,
|
|
+ .frameTypes.bAcceptFt4Reserved = 0x1,
|
|
+ .frameTypes.bAcceptFt5Reserved = 0x1,
|
|
+ .frameTypes.bAcceptFt6Reserved = 0x1,
|
|
+ .frameTypes.bAcceptFt7Reserved = 0x1,
|
|
+ .ccaOpt.ccaEnEnergy = 0x0,
|
|
+ .ccaOpt.ccaEnCorr = 0x0,
|
|
+ .ccaOpt.ccaEnSync = 0x0,
|
|
+ .ccaOpt.ccaCorrOp = 0x1,
|
|
+ .ccaOpt.ccaSyncOp = 0x1,
|
|
+ .ccaOpt.ccaCorrThr = 0x0,
|
|
+ .ccaRssiThr = 0x64,
|
|
+ .__dummy0 = 0x00,
|
|
+ .numExtEntries = 0x00,
|
|
+ .numShortEntries = 0x00,
|
|
+ .pExtEntryList = 0,
|
|
+ .pShortEntryList = 0,
|
|
+ .localExtAddr = 0x12345678,
|
|
+ .localShortAddr = 0xABBA,
|
|
+ .localPanID = 0x0000,
|
|
+ .__dummy1 = 0x000000,
|
|
+ .endTrigger.triggerType = 0x1,
|
|
+ .endTrigger.bEnaCmd = 0x0,
|
|
+ .endTrigger.triggerNo = 0x0,
|
|
+ .endTrigger.pastTrig = 0x0,
|
|
+ .endTime = 0x00000000
|
|
+};
|
|
+
|
|
+// CMD_IEEE_CSMA
|
|
+// IEEE 802.15.4 CSMA-CA Command
|
|
+const rfc_CMD_IEEE_CSMA_t RF_cmdIeeeCsma_ieee154 =
|
|
+{
|
|
+ .commandNo = 0x2C02,
|
|
+ .status = 0x0000,
|
|
+ .pNextOp = 0,
|
|
+ .startTime = 0x00000000,
|
|
+ .startTrigger.triggerType = 0x0,
|
|
+ .startTrigger.bEnaCmd = 0x0,
|
|
+ .startTrigger.triggerNo = 0x0,
|
|
+ .startTrigger.pastTrig = 0x0,
|
|
+ .condition.rule = 0x0,
|
|
+ .condition.nSkip = 0x0,
|
|
+ .randomState = 0x0000,
|
|
+ .macMaxBE = 0x00,
|
|
+ .macMaxCSMABackoffs = 0x00,
|
|
+ .csmaConfig.initCW = 0x0,
|
|
+ .csmaConfig.bSlotted = 0x0,
|
|
+ .csmaConfig.rxOffMode = 0x0,
|
|
+ .NB = 0x00,
|
|
+ .BE = 0x00,
|
|
+ .remainingPeriods = 0x00,
|
|
+ .lastRssi = 0x00,
|
|
+ .endTrigger.triggerType = 0x0,
|
|
+ .endTrigger.bEnaCmd = 0x0,
|
|
+ .endTrigger.triggerNo = 0x0,
|
|
+ .endTrigger.pastTrig = 0x0,
|
|
+ .lastTimeStamp = 0x00000000,
|
|
+ .endTime = 0x00000000
|
|
+};
|
|
+
|
|
+// CMD_IEEE_RX_ACK
|
|
+// IEEE 802.15.4 Receive Acknowledgement Command
|
|
+const rfc_CMD_IEEE_RX_ACK_t RF_cmdIeeeRxAck_ieee154 =
|
|
+{
|
|
+ .commandNo = 0x2C03,
|
|
+ .status = 0x0000,
|
|
+ .pNextOp = 0,
|
|
+ .startTime = 0x00000000,
|
|
+ .startTrigger.triggerType = 0x0,
|
|
+ .startTrigger.bEnaCmd = 0x0,
|
|
+ .startTrigger.triggerNo = 0x0,
|
|
+ .startTrigger.pastTrig = 0x0,
|
|
+ .condition.rule = 0x0,
|
|
+ .condition.nSkip = 0x0,
|
|
+ .seqNo = 0x00,
|
|
+ .endTrigger.triggerType = 0x0,
|
|
+ .endTrigger.bEnaCmd = 0x0,
|
|
+ .endTrigger.triggerNo = 0x0,
|
|
+ .endTrigger.pastTrig = 0x0,
|
|
+ .endTime = 0x00000000
|
|
+};
|
|
+
|
|
+
|
|
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/ti_radio_config.h b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/ti_radio_config.h
|
|
new file mode 100644
|
|
index 0000000..9d58da3
|
|
--- /dev/null
|
|
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/ti_radio_config.h
|
|
@@ -0,0 +1,83 @@
|
|
+/*
|
|
+ * ======== ti_radio_config.h ========
|
|
+ * Configured RadioConfig module definitions
|
|
+ *
|
|
+ * DO NOT EDIT - This file is generated for the CC1352P1F3RGZ
|
|
+ * by the SysConfig tool.
|
|
+ *
|
|
+ * Radio Config module version : 1.11
|
|
+ * SmartRF Studio data version : 2.23.0
|
|
+ */
|
|
+#ifndef _TI_RADIO_CONFIG_H_
|
|
+#define _TI_RADIO_CONFIG_H_
|
|
+
|
|
+#include <ti/devices/DeviceFamily.h>
|
|
+#include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
|
|
+#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
|
|
+#include DeviceFamily_constructPath(driverlib/rf_ieee_cmd.h)
|
|
+#include <ti/drivers/rf/RF.h>
|
|
+
|
|
+/* SmartRF Studio version that the RF data is fetched from */
|
|
+#define SMARTRF_STUDIO_VERSION "2.23.0"
|
|
+
|
|
+// *********************************************************************************
|
|
+// RF Frontend configuration
|
|
+// *********************************************************************************
|
|
+// RF design based on: LAUNCHXL-CC1352P-2 (CC1352PEM-XD4251-XD24-PA24_10dBm)
|
|
+#define LAUNCHXL_CC1352P_2
|
|
+
|
|
+// High-Power Amplifier supported
|
|
+#define SUPPORT_HIGH_PA
|
|
+
|
|
+// RF frontend configuration
|
|
+#define FRONTEND_SUB1G_DIFF_RF
|
|
+#define FRONTEND_SUB1G_EXT_BIAS
|
|
+#define FRONTEND_24G_DIFF_RF
|
|
+#define FRONTEND_24G_EXT_BIAS
|
|
+
|
|
+// Supported frequency bands
|
|
+#define SUPPORT_FREQBAND_868
|
|
+#define SUPPORT_FREQBAND_2400
|
|
+
|
|
+// TX power table size definitions
|
|
+#define TXPOWERTABLE_868_PA13_SIZE 20 // 868 MHz, 13 dBm
|
|
+#define TXPOWERTABLE_2400_PA5_SIZE 16 // 2400 MHz, 5 dBm
|
|
+// CUSTOM: account for extra entities in ti_radio_config.c txPowerTable_2400_pa5_20
|
|
+#define TXPOWERTABLE_2400_PA5_20_SIZE 31 // 2400 MHz, 5 + 20 dBm
|
|
+
|
|
+// TX power tables
|
|
+extern RF_TxPowerTable_Entry txPowerTable_868_pa13[]; // 868 MHz, 13 dBm
|
|
+extern RF_TxPowerTable_Entry txPowerTable_2400_pa5[]; // 2400 MHz, 5 dBm
|
|
+extern RF_TxPowerTable_Entry txPowerTable_2400_pa5_20[]; // 2400 MHz, 5 + 20 dBm
|
|
+
|
|
+
|
|
+
|
|
+//*********************************************************************************
|
|
+// RF Setting: IEEE 802.15.4-2006, 250 kbps, OQPSK, DSSS = 1:8
|
|
+//
|
|
+// PHY: ieee154
|
|
+// Setting file: setting_ieee_802_15_4.json
|
|
+//*********************************************************************************
|
|
+
|
|
+// PA table usage
|
|
+#define TX_POWER_TABLE_SIZE_ieee154 TXPOWERTABLE_2400_PA5_20_SIZE
|
|
+
|
|
+#define txPowerTable_ieee154 txPowerTable_2400_pa5_20
|
|
+
|
|
+// TI-RTOS RF Mode object
|
|
+extern RF_Mode RF_prop_ieee154;
|
|
+
|
|
+// RF Core API commands
|
|
+extern const rfc_CMD_RADIO_SETUP_PA_t RF_cmdRadioSetup_ieee154;
|
|
+extern const rfc_CMD_FS_t RF_cmdFs_ieee154;
|
|
+extern const rfc_CMD_IEEE_TX_t RF_cmdIeeeTx_ieee154;
|
|
+extern const rfc_CMD_IEEE_RX_t RF_cmdIeeeRx_ieee154;
|
|
+extern const rfc_CMD_IEEE_CSMA_t RF_cmdIeeeCsma_ieee154;
|
|
+extern const rfc_CMD_IEEE_RX_ACK_t RF_cmdIeeeRxAck_ieee154;
|
|
+
|
|
+// RF Core API overrides
|
|
+extern uint32_t pOverrides_ieee154[];
|
|
+extern uint32_t pOverrides_ieee154TxStd[];
|
|
+extern uint32_t pOverrides_ieee154Tx20[];
|
|
+
|
|
+#endif // _TI_RADIO_CONFIG_H_
|
|
diff --git a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/znp.syscfg b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/znp.syscfg
|
|
index b24581d..b9a3cf3 100644
|
|
--- a/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/znp.syscfg
|
|
+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/znp.syscfg
|
|
@@ -4,6 +4,10 @@
|
|
* @cliArgs --board "/ti/boards/CC1352P_2_LAUNCHXL" --rtos "tirtos" --product "simplelink_cc13xx_cc26xx_sdk@5.30.01.01"
|
|
* @versions {"tool":"1.10.0+2163"}
|
|
*/
|
|
+scripting.excludeFromBuild("ti_devices_config.c");
|
|
+scripting.excludeFromBuild("ti_radio_config.c");
|
|
+scripting.excludeFromBuild("ti_radio_config.h");
|
|
+scripting.excludeFromBuild("ti_drivers_config.h");
|
|
|
|
/**
|
|
* Import the modules used in this configuration.
|
|
@@ -50,6 +54,7 @@ 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";
|
|
@@ -75,8 +80,8 @@ ECDSA1.$name = "CONFIG_ECDSA_0";
|
|
|
|
NVS1.$name = "CONFIG_NVSINTERNAL";
|
|
NVS1.internalFlash.$name = "ti_drivers_nvs_NVSCC26XX0";
|
|
-NVS1.internalFlash.regionSize = 0x4000;
|
|
-NVS1.internalFlash.regionBase = 0x52000;
|
|
+NVS1.internalFlash.regionBase = 0x50000;
|
|
+NVS1.internalFlash.regionSize = 0x6000;
|
|
|
|
NVS2.$name = "CONFIG_NVSEXTERNAL";
|
|
NVS2.nvsType = "External";
|
|
@@ -128,6 +133,7 @@ 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.txPower = "20";
|
|
zstack.rf.radioConfig.$name = "ti_devices_radioconfig_settings_ieee_15_40";
|
|
zstack.rf.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param0";
|
|
zstack.rf.coexSettings.$name = "ti_zstack_rf_zstack_coex_mod0";
|
|
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt.h b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
|
|
index d4e9759..b7ff84c 100644
|
|
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
|
|
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt.h
|
|
@@ -415,6 +415,8 @@ extern "C"
|
|
#define MT_UTIL_CALLBACK_SUB_CMD 0x06
|
|
#define MT_UTIL_TIME_ALIVE 0x09
|
|
|
|
+#define MT_UTIL_LED_CONTROL 0x0A
|
|
+
|
|
#define MT_UTIL_TEST_LOOPBACK 0x10
|
|
#define MT_UTIL_DATA_REQ 0x11
|
|
|
|
@@ -441,6 +443,8 @@ 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_ASSOC_ADD 0x64 // 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_util.c b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
|
|
index 90d6d4a..a687b10 100644
|
|
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
|
|
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_util.c
|
|
@@ -53,6 +53,9 @@
|
|
#include "mt_zdo.h"
|
|
#include "ssp.h"
|
|
|
|
+#include <ti/drivers/apps/LED.h>
|
|
+#include "ti_drivers_config.h"
|
|
+
|
|
#if !defined NONWK
|
|
|
|
#include "mt_nwk.h"
|
|
@@ -95,6 +98,7 @@ static void MT_UtilSpi2Addr( zAddrType_t *pDst, uint8_t *pSrc );
|
|
#endif
|
|
|
|
#if defined (MT_UTIL_FUNC)
|
|
+
|
|
static void MT_UtilGetDeviceInfo(void);
|
|
static void MT_UtilGetNvInfo(void);
|
|
static void MT_UtilSetPanID(uint8_t *pBuf);
|
|
@@ -128,6 +132,9 @@ 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_UtilLedControl(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);
|
|
@@ -260,6 +267,10 @@ uint8_t MT_UtilCommandProcessing(uint8_t *pBuf)
|
|
MT_UtilAssocCount(pBuf);
|
|
break;
|
|
|
|
+ case MT_UTIL_LED_CONTROL:
|
|
+ MT_UtilLedControl(pBuf);
|
|
+ break;
|
|
+
|
|
case MT_UTIL_ASSOC_FIND_DEVICE:
|
|
MT_UtilAssocFindDevice(pBuf);
|
|
break;
|
|
@@ -272,6 +283,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 +1394,95 @@ 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_UtilLedControl
|
|
+ *
|
|
+ * @brief Proxy the LedControl() function.
|
|
+ *
|
|
+ * @param pBuf - pointer to the received buffer
|
|
+ *
|
|
+ * @return void
|
|
+ ***************************************************************************************************/
|
|
+static void MT_UtilLedControl(uint8_t *pBuf)
|
|
+{
|
|
+ uint8_t cmdId = pBuf[MT_RPC_POS_CMD1];
|
|
+ pBuf += MT_RPC_FRAME_HDR_SZ;
|
|
+
|
|
+ uint8_t mode = pBuf[1];
|
|
+
|
|
+ if (gLedHandle == NULL) {
|
|
+ LED_Params ledParams;
|
|
+ LED_Params_init(&ledParams);
|
|
+ gLedHandle = LED_open(CONFIG_LED_GREEN, &ledParams);
|
|
+ }
|
|
+
|
|
+ if (mode==0) {
|
|
+ LED_setOff(gLedHandle);
|
|
+ } else if (mode == 5) {
|
|
+ gLedsDisabled = TRUE;
|
|
+ LED_setOff(gLedHandle);
|
|
+ } else {
|
|
+ LED_setOn(gLedHandle, LED_BRIGHTNESS_MAX);
|
|
+ }
|
|
+
|
|
+ uint8_t retValue = 0;
|
|
+ MT_BuildAndSendZToolResponse(((uint8_t)MT_RPC_CMD_SRSP | (uint8_t)MT_RPC_SYS_UTIL), cmdId, 1, &retValue);
|
|
+}
|
|
+
|
|
+/***************************************************************************************************
|
|
+ * @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_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_version.c
|
|
index 63c143b..44ddc34 100644
|
|
--- 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"
|
|
|
|
+#define CODE_REVISION_NUMBER 20211217
|
|
+
|
|
/******************************************************************************
|
|
* 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_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_zdo.c b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_zdo.c
|
|
index a4b15c6..1383e55 100644
|
|
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_zdo.c
|
|
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Application/mt/mt_zdo.c
|
|
@@ -1659,6 +1659,11 @@ static void MT_ZdoMgmtPermitJoinRequest(uint8_t *pBuf)
|
|
retValue = (uint8_t)ZDP_MgmtPermitJoinReq( &destAddr, duration, tcSignificance, 0);
|
|
ignoreIndication = FALSE;
|
|
|
|
+ // If joining is enabled via a router, ZDO_ProcessMgmtPermitJoinReq is never triggered thus
|
|
+ // ZDSecMgrPermitJoining is never called. Joining via a router would always fail now since
|
|
+ // ZDSecMgrPermitJoiningEnabled in zd_sec_mgr.c stays FALSE
|
|
+ ZDSecMgrPermitJoining(duration);
|
|
+
|
|
MT_BuildAndSendZToolResponse(((uint8_t)MT_RPC_CMD_SRSP | (uint8_t)MT_RPC_SYS_ZDO), cmdId, 1, &retValue);
|
|
}
|
|
|
|
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..a19e37a
|
|
--- /dev/null
|
|
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/preinclude.h
|
|
@@ -0,0 +1,60 @@
|
|
+#define MT_SYS_KEY_MANAGEMENT 1
|
|
+#define FEATURE_NVEXID 1
|
|
+
|
|
+// Increase MAC buffers
|
|
+#undef MAC_CFG_TX_DATA_MAX
|
|
+#define MAC_CFG_TX_DATA_MAX 20
|
|
+#undef MAC_CFG_TX_MAX
|
|
+#define MAC_CFG_TX_MAX 32
|
|
+#undef MAC_CFG_RX_MAX
|
|
+#define MAC_CFG_RX_MAX 20
|
|
+
|
|
+// 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 100
|
|
+#define CONCENTRATOR_ROUTE_CACHE TRUE
|
|
+#define MAX_RTG_SRC_ENTRIES 200
|
|
+#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
|
|
+
|
|
+/**
|
|
+ * Reduce the APS ack wait duration from 6000 ms to 1000 ms (value * 2 = value in ms).
|
|
+ * This will make requests timeout quicker, in pratice the default timeout of 6000ms is too long.
|
|
+ */
|
|
+#define APSC_ACK_WAIT_DURATION_POLLED 500
|
|
+
|
|
+// From https://www.ti.com/lit/an/swra650b/swra650b.pdf
|
|
+#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_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts
|
|
index 6e3cb6a..886d0b4 100644
|
|
--- 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
|
|
+
|
|
+--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 3a7afa3..2dcef5a 100644
|
|
--- 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
|
|
#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
|
|
|
|
@@ -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 )) ||
|
|
+ // Forward messages to endpoint even with profileID mismatches
|
|
+ ((aff->ProfileID >= 0x100) && (aff->ProfileID <= 0xFC01)) )
|
|
{
|
|
// Save original endpoint
|
|
uint8_t endpoint = aff->DstEndPoint;
|
|
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/nwk/nwk_globals.c b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/nwk/nwk_globals.c
|
|
index b761da1..bc406ff 100644
|
|
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/nwk/nwk_globals.c
|
|
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/nwk/nwk_globals.c
|
|
@@ -65,10 +65,10 @@
|
|
* CONSTANTS
|
|
*/
|
|
// Maximums for the data buffer queue
|
|
-#define NWK_MAX_DATABUFS_WAITING 8 // Waiting to be sent to MAC
|
|
-#define NWK_MAX_DATABUFS_SCHEDULED 5 // Timed messages to be sent
|
|
-#define NWK_MAX_DATABUFS_CONFIRMED 5 // Held after MAC confirms
|
|
-#define NWK_MAX_DATABUFS_TOTAL 12 // Total number of buffers
|
|
+#define NWK_MAX_DATABUFS_WAITING 32 // Waiting to be sent to MAC
|
|
+#define NWK_MAX_DATABUFS_SCHEDULED 20 // Timed messages to be sent
|
|
+#define NWK_MAX_DATABUFS_CONFIRMED 20 // Held after MAC confirms
|
|
+#define NWK_MAX_DATABUFS_TOTAL 48 // Total number of buffers
|
|
|
|
// 1-255 (0 -> 256) X RTG_TIMER_INTERVAL
|
|
// A known shortcoming is that when a message is enqueued as "hold" for a
|
|
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
|
|
index aafb10d..8d56d78 100644
|
|
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
|
|
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/sys/zglobals.c
|
|
@@ -105,7 +105,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;
|
|
@@ -199,7 +199,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 63519d6..088ad02 100644
|
|
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
|
|
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_app.c
|
|
@@ -415,12 +415,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
|
|
{
|
|
@@ -881,12 +880,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
|
|
{
|
|
@@ -3139,6 +3137,14 @@ void ZDO_NetworkStatusCB( uint16_t nwkDstAddr, uint8_t statusCode, uint16_t dstA
|
|
// Routing error for dstAddr, this is informational and a Route
|
|
// Request should happen automatically.
|
|
}
|
|
+
|
|
+ if ( (nwkDstAddr == NLME_GetShortAddr())
|
|
+ && (statusCode == NWKSTAT_SOURCE_ROUTE_FAILURE) )
|
|
+ {
|
|
+ // Received a source route failure, remove route and rediscover.
|
|
+ RTG_RemoveRtgEntry( dstAddr, 0 );
|
|
+ NLME_RouteDiscoveryRequest( dstAddr, 0, 30 );
|
|
+ }
|
|
}
|
|
|
|
/******************************************************************************
|
|
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_object.c b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_object.c
|
|
index 0440d04..4e08567 100644
|
|
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_object.c
|
|
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_object.c
|
|
@@ -650,6 +650,20 @@ void ZDO_ProcessNodeDescReq( zdoIncomingMsg_t *inMsg )
|
|
|
|
if ( desc != NULL )
|
|
{
|
|
+ uint8_t extAddr[Z_EXTADDR_LEN];
|
|
+ // Respond with Xiaomi manufacturer code when ieeAddr is withing Xiaomi address space
|
|
+ // Otherwise some devices don't work
|
|
+ // https://github.com/Koenkk/zigbee2mqtt/issues/9274
|
|
+ if (APSME_LookupExtAddr(inMsg->srcAddr.addr.shortAddr, extAddr) == TRUE &&
|
|
+ ((extAddr[7] == 0x04 && extAddr[6] == 0xcf && extAddr[5] == 0x8c) ||
|
|
+ (extAddr[7] == 0x54 && extAddr[6] == 0xef && extAddr[5] == 0x44))) {
|
|
+ desc->ManufacturerCode[0] = 0x5f;
|
|
+ desc->ManufacturerCode[1] = 0x11;
|
|
+ } else {
|
|
+ desc->ManufacturerCode[0] = 0x0;
|
|
+ desc->ManufacturerCode[1] = 0x0;
|
|
+ }
|
|
+
|
|
ZDP_NodeDescMsg( inMsg, aoi, desc );
|
|
}
|
|
else
|
|
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_sec_mgr.c b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_sec_mgr.c
|
|
index 4ce9188..f613b6a 100644
|
|
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_sec_mgr.c
|
|
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_sec_mgr.c
|
|
@@ -62,6 +62,7 @@ extern "C"
|
|
|
|
#include <ti/drivers/TRNG.h>
|
|
#include <ti/drivers/cryptoutils/cryptokey/CryptoKeyPlaintext.h>
|
|
+#include "ti_drivers_config.h"
|
|
|
|
/******************************************************************************
|
|
* CONSTANTS
|
|
@@ -119,6 +120,8 @@ typedef struct
|
|
*/
|
|
extern CONST uint8_t gMAX_NWK_SEC_MATERIAL_TABLE_ENTRIES;
|
|
extern pfnZdoCb zdoCBFunc[MAX_ZDO_CB_FUNC];
|
|
+bool gLedsDisabled = FALSE;
|
|
+LED_Handle gLedHandle;
|
|
|
|
/******************************************************************************
|
|
* EXTERNAL FUNCTIONS
|
|
@@ -1519,6 +1522,23 @@ void ZDSecMgrConfig( void )
|
|
}
|
|
}
|
|
|
|
+void updateLED( void )
|
|
+{
|
|
+ if (gLedHandle == NULL) {
|
|
+ LED_Params ledParams;
|
|
+ LED_Params_init(&ledParams);
|
|
+ gLedHandle = LED_open(CONFIG_LED_GREEN, &ledParams);
|
|
+ }
|
|
+
|
|
+ if (gLedsDisabled == FALSE && gLedHandle != NULL) {
|
|
+ if (ZDSecMgrPermitJoiningEnabled == TRUE) {
|
|
+ LED_setOn(gLedHandle, LED_BRIGHTNESS_MAX);
|
|
+ } else {
|
|
+ LED_setOff(gLedHandle);
|
|
+ }
|
|
+ }
|
|
+}
|
|
+
|
|
/******************************************************************************
|
|
* @fn ZDSecMgrPermitJoining
|
|
*
|
|
@@ -1547,6 +1567,7 @@ uint8_t ZDSecMgrPermitJoining( uint8_t duration )
|
|
ZDSecMgrPermitJoiningEnabled = FALSE;
|
|
}
|
|
|
|
+ updateLED();
|
|
accept = TRUE;
|
|
|
|
return accept;
|
|
@@ -1568,6 +1589,8 @@ void ZDSecMgrPermitJoiningTimeout( void )
|
|
ZDSecMgrPermitJoiningEnabled = FALSE;
|
|
ZDSecMgrPermitJoiningTimed = FALSE;
|
|
}
|
|
+
|
|
+ updateLED();
|
|
}
|
|
|
|
/******************************************************************************
|
|
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_sec_mgr.h b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_sec_mgr.h
|
|
index 6468e0d..e61c5e4 100644
|
|
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_sec_mgr.h
|
|
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/Stack/zdo/zd_sec_mgr.h
|
|
@@ -51,6 +51,8 @@ extern "C"
|
|
#include "zcomdef.h"
|
|
#include "zd_app.h"
|
|
|
|
+#include <ti/drivers/apps/LED.h>
|
|
+
|
|
/******************************************************************************
|
|
* TYPEDEFS
|
|
*/
|
|
@@ -95,6 +97,9 @@ extern CONST uint16_t gZDSECMGR_TC_DEVICE_MAX;
|
|
extern CONST uint16_t gZDSECMGR_TC_DEVICE_IC_MAX;
|
|
extern uint8_t gZDSECMGR_TC_ATTEMPT_DEFAULT_KEY;
|
|
|
|
+extern bool gLedsDisabled;
|
|
+extern LED_Handle gLedHandle;
|
|
+
|
|
typedef struct
|
|
{
|
|
uint32_t FrameCounter;
|
|
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/app.cfg b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/app.cfg
|
|
index 5089a84..146ef06 100644
|
|
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/app.cfg
|
|
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/app.cfg
|
|
@@ -700,7 +700,9 @@ var GateMutexPri = xdc.useModule('ti.sysbios.gates.GateMutexPri');
|
|
*/
|
|
var Memory = xdc.useModule('xdc.runtime.Memory');
|
|
var HEAPMGR_CONFIG = 0;
|
|
-var HEAPMGR_SIZE = 0x1800;
|
|
+// Increase heap to 48kb
|
|
+// https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum/1052120/cc2652r-mac-no-resources-0x1a-errors-complete-crash-with-simplelink-cc13xx-cc26xx-sdk_5-30-00-56/3897554#3897554
|
|
+var HEAPMGR_SIZE = 0xc000;
|
|
|
|
// The following will create the #define HEAPMGR_CONFIG. It can then be used by include <xdc/cfg/global.h>
|
|
Program.global.HEAPMGR_CONFIG = HEAPMGR_CONFIG;
|
|
diff --git a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/cc13x2_cc26x2.cmd b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/cc13x2_cc26x2.cmd
|
|
index 2856ad2..d9a66ac 100755
|
|
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/cc13x2_cc26x2.cmd
|
|
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/cc13x2_cc26x2.cmd
|
|
@@ -67,9 +67,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 f0650d7..6abe720 100644
|
|
--- a/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/znp.syscfg
|
|
+++ b/znp_CC26X2R1_LAUNCHXL_tirtos_ccs/znp.syscfg
|
|
@@ -47,6 +47,7 @@ CCFG.enableBootloader = true;
|
|
CCFG.enableBootloaderBackdoor = true;
|
|
CCFG.dioBootloaderBackdoor = 13;
|
|
CCFG.levelBootloaderBackdoor = "Active low";
|
|
+CCFG.enableDCDC = false;
|
|
CCFG.ccfgTemplate.$name = "ti_devices_CCFGTemplate0";
|
|
|
|
Display1.$hardware = system.deviceData.board.components.XDS110UART;
|
|
@@ -70,8 +71,8 @@ ECDSA1.$name = "CONFIG_ECDSA_0";
|
|
|
|
NVS1.$name = "CONFIG_NVSINTERNAL";
|
|
NVS1.internalFlash.$name = "ti_drivers_nvs_NVSCC26XX0";
|
|
-NVS1.internalFlash.regionSize = 0x4000;
|
|
-NVS1.internalFlash.regionBase = 0x52000;
|
|
+NVS1.internalFlash.regionBase = 0x50000;
|
|
+NVS1.internalFlash.regionSize = 0x6000;
|
|
|
|
NVS2.$name = "CONFIG_NVSEXTERNAL";
|
|
NVS2.nvsType = "External";
|
|
@@ -121,6 +122,7 @@ 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.txPower = "5";
|
|
zstack.rf.radioConfig.$name = "ti_devices_radioconfig_settings_ieee_15_40";
|
|
zstack.rf.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param0";
|
|
zstack.rf.coexSettings.$name = "ti_zstack_rf_zstack_coex_mod0";
|
|
diff --git a/znp_LP_CC2652RB_tirtos_ccs/Application/mt/mt.h b/znp_LP_CC2652RB_tirtos_ccs/Application/mt/mt.h
|
|
index d4e9759..b7ff84c 100644
|
|
--- a/znp_LP_CC2652RB_tirtos_ccs/Application/mt/mt.h
|
|
+++ b/znp_LP_CC2652RB_tirtos_ccs/Application/mt/mt.h
|
|
@@ -415,6 +415,8 @@ extern "C"
|
|
#define MT_UTIL_CALLBACK_SUB_CMD 0x06
|
|
#define MT_UTIL_TIME_ALIVE 0x09
|
|
|
|
+#define MT_UTIL_LED_CONTROL 0x0A
|
|
+
|
|
#define MT_UTIL_TEST_LOOPBACK 0x10
|
|
#define MT_UTIL_DATA_REQ 0x11
|
|
|
|
@@ -441,6 +443,8 @@ 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_ASSOC_ADD 0x64 // Custom command
|
|
|
|
#define MT_UTIL_ZCL_KEY_EST_INIT_EST 0x80
|
|
#define MT_UTIL_ZCL_KEY_EST_SIGN 0x81
|
|
diff --git a/znp_LP_CC2652RB_tirtos_ccs/Application/mt/mt_util.c b/znp_LP_CC2652RB_tirtos_ccs/Application/mt/mt_util.c
|
|
index 90d6d4a..a687b10 100644
|
|
--- a/znp_LP_CC2652RB_tirtos_ccs/Application/mt/mt_util.c
|
|
+++ b/znp_LP_CC2652RB_tirtos_ccs/Application/mt/mt_util.c
|
|
@@ -53,6 +53,9 @@
|
|
#include "mt_zdo.h"
|
|
#include "ssp.h"
|
|
|
|
+#include <ti/drivers/apps/LED.h>
|
|
+#include "ti_drivers_config.h"
|
|
+
|
|
#if !defined NONWK
|
|
|
|
#include "mt_nwk.h"
|
|
@@ -95,6 +98,7 @@ static void MT_UtilSpi2Addr( zAddrType_t *pDst, uint8_t *pSrc );
|
|
#endif
|
|
|
|
#if defined (MT_UTIL_FUNC)
|
|
+
|
|
static void MT_UtilGetDeviceInfo(void);
|
|
static void MT_UtilGetNvInfo(void);
|
|
static void MT_UtilSetPanID(uint8_t *pBuf);
|
|
@@ -128,6 +132,9 @@ 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_UtilLedControl(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);
|
|
@@ -260,6 +267,10 @@ uint8_t MT_UtilCommandProcessing(uint8_t *pBuf)
|
|
MT_UtilAssocCount(pBuf);
|
|
break;
|
|
|
|
+ case MT_UTIL_LED_CONTROL:
|
|
+ MT_UtilLedControl(pBuf);
|
|
+ break;
|
|
+
|
|
case MT_UTIL_ASSOC_FIND_DEVICE:
|
|
MT_UtilAssocFindDevice(pBuf);
|
|
break;
|
|
@@ -272,6 +283,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 +1394,95 @@ 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_UtilLedControl
|
|
+ *
|
|
+ * @brief Proxy the LedControl() function.
|
|
+ *
|
|
+ * @param pBuf - pointer to the received buffer
|
|
+ *
|
|
+ * @return void
|
|
+ ***************************************************************************************************/
|
|
+static void MT_UtilLedControl(uint8_t *pBuf)
|
|
+{
|
|
+ uint8_t cmdId = pBuf[MT_RPC_POS_CMD1];
|
|
+ pBuf += MT_RPC_FRAME_HDR_SZ;
|
|
+
|
|
+ uint8_t mode = pBuf[1];
|
|
+
|
|
+ if (gLedHandle == NULL) {
|
|
+ LED_Params ledParams;
|
|
+ LED_Params_init(&ledParams);
|
|
+ gLedHandle = LED_open(CONFIG_LED_GREEN, &ledParams);
|
|
+ }
|
|
+
|
|
+ if (mode==0) {
|
|
+ LED_setOff(gLedHandle);
|
|
+ } else if (mode == 5) {
|
|
+ gLedsDisabled = TRUE;
|
|
+ LED_setOff(gLedHandle);
|
|
+ } else {
|
|
+ LED_setOn(gLedHandle, LED_BRIGHTNESS_MAX);
|
|
+ }
|
|
+
|
|
+ uint8_t retValue = 0;
|
|
+ MT_BuildAndSendZToolResponse(((uint8_t)MT_RPC_CMD_SRSP | (uint8_t)MT_RPC_SYS_UTIL), cmdId, 1, &retValue);
|
|
+}
|
|
+
|
|
+/***************************************************************************************************
|
|
+ * @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_LP_CC2652RB_tirtos_ccs/Application/mt/mt_version.c b/znp_LP_CC2652RB_tirtos_ccs/Application/mt/mt_version.c
|
|
index 63c143b..44ddc34 100644
|
|
--- a/znp_LP_CC2652RB_tirtos_ccs/Application/mt/mt_version.c
|
|
+++ b/znp_LP_CC2652RB_tirtos_ccs/Application/mt/mt_version.c
|
|
@@ -43,15 +43,21 @@
|
|
#include "zcomdef.h"
|
|
#include "mt_version.h"
|
|
|
|
+#define CODE_REVISION_NUMBER 20211217
|
|
+
|
|
/******************************************************************************
|
|
* 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_LP_CC2652RB_tirtos_ccs/Application/mt/mt_zdo.c b/znp_LP_CC2652RB_tirtos_ccs/Application/mt/mt_zdo.c
|
|
index a4b15c6..1383e55 100644
|
|
--- a/znp_LP_CC2652RB_tirtos_ccs/Application/mt/mt_zdo.c
|
|
+++ b/znp_LP_CC2652RB_tirtos_ccs/Application/mt/mt_zdo.c
|
|
@@ -1659,6 +1659,11 @@ static void MT_ZdoMgmtPermitJoinRequest(uint8_t *pBuf)
|
|
retValue = (uint8_t)ZDP_MgmtPermitJoinReq( &destAddr, duration, tcSignificance, 0);
|
|
ignoreIndication = FALSE;
|
|
|
|
+ // If joining is enabled via a router, ZDO_ProcessMgmtPermitJoinReq is never triggered thus
|
|
+ // ZDSecMgrPermitJoining is never called. Joining via a router would always fail now since
|
|
+ // ZDSecMgrPermitJoiningEnabled in zd_sec_mgr.c stays FALSE
|
|
+ ZDSecMgrPermitJoining(duration);
|
|
+
|
|
MT_BuildAndSendZToolResponse(((uint8_t)MT_RPC_CMD_SRSP | (uint8_t)MT_RPC_SYS_ZDO), cmdId, 1, &retValue);
|
|
}
|
|
|
|
diff --git a/znp_LP_CC2652RB_tirtos_ccs/Stack/Config/preinclude.h b/znp_LP_CC2652RB_tirtos_ccs/Stack/Config/preinclude.h
|
|
new file mode 100644
|
|
index 0000000..a19e37a
|
|
--- /dev/null
|
|
+++ b/znp_LP_CC2652RB_tirtos_ccs/Stack/Config/preinclude.h
|
|
@@ -0,0 +1,60 @@
|
|
+#define MT_SYS_KEY_MANAGEMENT 1
|
|
+#define FEATURE_NVEXID 1
|
|
+
|
|
+// Increase MAC buffers
|
|
+#undef MAC_CFG_TX_DATA_MAX
|
|
+#define MAC_CFG_TX_DATA_MAX 20
|
|
+#undef MAC_CFG_TX_MAX
|
|
+#define MAC_CFG_TX_MAX 32
|
|
+#undef MAC_CFG_RX_MAX
|
|
+#define MAC_CFG_RX_MAX 20
|
|
+
|
|
+// 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 100
|
|
+#define CONCENTRATOR_ROUTE_CACHE TRUE
|
|
+#define MAX_RTG_SRC_ENTRIES 200
|
|
+#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
|
|
+
|
|
+/**
|
|
+ * Reduce the APS ack wait duration from 6000 ms to 1000 ms (value * 2 = value in ms).
|
|
+ * This will make requests timeout quicker, in pratice the default timeout of 6000ms is too long.
|
|
+ */
|
|
+#define APSC_ACK_WAIT_DURATION_POLLED 500
|
|
+
|
|
+// From https://www.ti.com/lit/an/swra650b/swra650b.pdf
|
|
+#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_LP_CC2652RB_tirtos_ccs/Stack/Config/znp_cnf.opts b/znp_LP_CC2652RB_tirtos_ccs/Stack/Config/znp_cnf.opts
|
|
index 6e3cb6a..886d0b4 100644
|
|
--- a/znp_LP_CC2652RB_tirtos_ccs/Stack/Config/znp_cnf.opts
|
|
+++ b/znp_LP_CC2652RB_tirtos_ccs/Stack/Config/znp_cnf.opts
|
|
@@ -32,3 +32,5 @@
|
|
-DMT_GP_CB_FUNC
|
|
|
|
-DMT_APP_CNF_FUNC
|
|
+
|
|
+--preinclude=preinclude.h
|
|
\ No newline at end of file
|
|
diff --git a/znp_LP_CC2652RB_tirtos_ccs/Stack/af/af.c b/znp_LP_CC2652RB_tirtos_ccs/Stack/af/af.c
|
|
index 3a7afa3..2dcef5a 100644
|
|
--- a/znp_LP_CC2652RB_tirtos_ccs/Stack/af/af.c
|
|
+++ b/znp_LP_CC2652RB_tirtos_ccs/Stack/af/af.c
|
|
@@ -407,10 +407,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
|
|
|
|
@@ -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 )) ||
|
|
+ // Forward messages to endpoint even with profileID mismatches
|
|
+ ((aff->ProfileID >= 0x100) && (aff->ProfileID <= 0xFC01)) )
|
|
{
|
|
// Save original endpoint
|
|
uint8_t endpoint = aff->DstEndPoint;
|
|
diff --git a/znp_LP_CC2652RB_tirtos_ccs/Stack/nwk/nwk_globals.c b/znp_LP_CC2652RB_tirtos_ccs/Stack/nwk/nwk_globals.c
|
|
index b761da1..bc406ff 100644
|
|
--- a/znp_LP_CC2652RB_tirtos_ccs/Stack/nwk/nwk_globals.c
|
|
+++ b/znp_LP_CC2652RB_tirtos_ccs/Stack/nwk/nwk_globals.c
|
|
@@ -65,10 +65,10 @@
|
|
* CONSTANTS
|
|
*/
|
|
// Maximums for the data buffer queue
|
|
-#define NWK_MAX_DATABUFS_WAITING 8 // Waiting to be sent to MAC
|
|
-#define NWK_MAX_DATABUFS_SCHEDULED 5 // Timed messages to be sent
|
|
-#define NWK_MAX_DATABUFS_CONFIRMED 5 // Held after MAC confirms
|
|
-#define NWK_MAX_DATABUFS_TOTAL 12 // Total number of buffers
|
|
+#define NWK_MAX_DATABUFS_WAITING 32 // Waiting to be sent to MAC
|
|
+#define NWK_MAX_DATABUFS_SCHEDULED 20 // Timed messages to be sent
|
|
+#define NWK_MAX_DATABUFS_CONFIRMED 20 // Held after MAC confirms
|
|
+#define NWK_MAX_DATABUFS_TOTAL 48 // Total number of buffers
|
|
|
|
// 1-255 (0 -> 256) X RTG_TIMER_INTERVAL
|
|
// A known shortcoming is that when a message is enqueued as "hold" for a
|
|
diff --git a/znp_LP_CC2652RB_tirtos_ccs/Stack/sys/zglobals.c b/znp_LP_CC2652RB_tirtos_ccs/Stack/sys/zglobals.c
|
|
index aafb10d..8d56d78 100644
|
|
--- a/znp_LP_CC2652RB_tirtos_ccs/Stack/sys/zglobals.c
|
|
+++ b/znp_LP_CC2652RB_tirtos_ccs/Stack/sys/zglobals.c
|
|
@@ -105,7 +105,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;
|
|
@@ -199,7 +199,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_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_app.c b/znp_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_app.c
|
|
index 63519d6..088ad02 100644
|
|
--- a/znp_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_app.c
|
|
+++ b/znp_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_app.c
|
|
@@ -415,12 +415,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
|
|
{
|
|
@@ -881,12 +880,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
|
|
{
|
|
@@ -3139,6 +3137,14 @@ void ZDO_NetworkStatusCB( uint16_t nwkDstAddr, uint8_t statusCode, uint16_t dstA
|
|
// Routing error for dstAddr, this is informational and a Route
|
|
// Request should happen automatically.
|
|
}
|
|
+
|
|
+ if ( (nwkDstAddr == NLME_GetShortAddr())
|
|
+ && (statusCode == NWKSTAT_SOURCE_ROUTE_FAILURE) )
|
|
+ {
|
|
+ // Received a source route failure, remove route and rediscover.
|
|
+ RTG_RemoveRtgEntry( dstAddr, 0 );
|
|
+ NLME_RouteDiscoveryRequest( dstAddr, 0, 30 );
|
|
+ }
|
|
}
|
|
|
|
/******************************************************************************
|
|
diff --git a/znp_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_object.c b/znp_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_object.c
|
|
index 0440d04..4e08567 100644
|
|
--- a/znp_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_object.c
|
|
+++ b/znp_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_object.c
|
|
@@ -650,6 +650,20 @@ void ZDO_ProcessNodeDescReq( zdoIncomingMsg_t *inMsg )
|
|
|
|
if ( desc != NULL )
|
|
{
|
|
+ uint8_t extAddr[Z_EXTADDR_LEN];
|
|
+ // Respond with Xiaomi manufacturer code when ieeAddr is withing Xiaomi address space
|
|
+ // Otherwise some devices don't work
|
|
+ // https://github.com/Koenkk/zigbee2mqtt/issues/9274
|
|
+ if (APSME_LookupExtAddr(inMsg->srcAddr.addr.shortAddr, extAddr) == TRUE &&
|
|
+ ((extAddr[7] == 0x04 && extAddr[6] == 0xcf && extAddr[5] == 0x8c) ||
|
|
+ (extAddr[7] == 0x54 && extAddr[6] == 0xef && extAddr[5] == 0x44))) {
|
|
+ desc->ManufacturerCode[0] = 0x5f;
|
|
+ desc->ManufacturerCode[1] = 0x11;
|
|
+ } else {
|
|
+ desc->ManufacturerCode[0] = 0x0;
|
|
+ desc->ManufacturerCode[1] = 0x0;
|
|
+ }
|
|
+
|
|
ZDP_NodeDescMsg( inMsg, aoi, desc );
|
|
}
|
|
else
|
|
diff --git a/znp_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_sec_mgr.c b/znp_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_sec_mgr.c
|
|
index 4ce9188..f613b6a 100644
|
|
--- a/znp_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_sec_mgr.c
|
|
+++ b/znp_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_sec_mgr.c
|
|
@@ -62,6 +62,7 @@ extern "C"
|
|
|
|
#include <ti/drivers/TRNG.h>
|
|
#include <ti/drivers/cryptoutils/cryptokey/CryptoKeyPlaintext.h>
|
|
+#include "ti_drivers_config.h"
|
|
|
|
/******************************************************************************
|
|
* CONSTANTS
|
|
@@ -119,6 +120,8 @@ typedef struct
|
|
*/
|
|
extern CONST uint8_t gMAX_NWK_SEC_MATERIAL_TABLE_ENTRIES;
|
|
extern pfnZdoCb zdoCBFunc[MAX_ZDO_CB_FUNC];
|
|
+bool gLedsDisabled = FALSE;
|
|
+LED_Handle gLedHandle;
|
|
|
|
/******************************************************************************
|
|
* EXTERNAL FUNCTIONS
|
|
@@ -1519,6 +1522,23 @@ void ZDSecMgrConfig( void )
|
|
}
|
|
}
|
|
|
|
+void updateLED( void )
|
|
+{
|
|
+ if (gLedHandle == NULL) {
|
|
+ LED_Params ledParams;
|
|
+ LED_Params_init(&ledParams);
|
|
+ gLedHandle = LED_open(CONFIG_LED_GREEN, &ledParams);
|
|
+ }
|
|
+
|
|
+ if (gLedsDisabled == FALSE && gLedHandle != NULL) {
|
|
+ if (ZDSecMgrPermitJoiningEnabled == TRUE) {
|
|
+ LED_setOn(gLedHandle, LED_BRIGHTNESS_MAX);
|
|
+ } else {
|
|
+ LED_setOff(gLedHandle);
|
|
+ }
|
|
+ }
|
|
+}
|
|
+
|
|
/******************************************************************************
|
|
* @fn ZDSecMgrPermitJoining
|
|
*
|
|
@@ -1547,6 +1567,7 @@ uint8_t ZDSecMgrPermitJoining( uint8_t duration )
|
|
ZDSecMgrPermitJoiningEnabled = FALSE;
|
|
}
|
|
|
|
+ updateLED();
|
|
accept = TRUE;
|
|
|
|
return accept;
|
|
@@ -1568,6 +1589,8 @@ void ZDSecMgrPermitJoiningTimeout( void )
|
|
ZDSecMgrPermitJoiningEnabled = FALSE;
|
|
ZDSecMgrPermitJoiningTimed = FALSE;
|
|
}
|
|
+
|
|
+ updateLED();
|
|
}
|
|
|
|
/******************************************************************************
|
|
diff --git a/znp_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_sec_mgr.h b/znp_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_sec_mgr.h
|
|
index 6468e0d..e61c5e4 100644
|
|
--- a/znp_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_sec_mgr.h
|
|
+++ b/znp_LP_CC2652RB_tirtos_ccs/Stack/zdo/zd_sec_mgr.h
|
|
@@ -51,6 +51,8 @@ extern "C"
|
|
#include "zcomdef.h"
|
|
#include "zd_app.h"
|
|
|
|
+#include <ti/drivers/apps/LED.h>
|
|
+
|
|
/******************************************************************************
|
|
* TYPEDEFS
|
|
*/
|
|
@@ -95,6 +97,9 @@ extern CONST uint16_t gZDSECMGR_TC_DEVICE_MAX;
|
|
extern CONST uint16_t gZDSECMGR_TC_DEVICE_IC_MAX;
|
|
extern uint8_t gZDSECMGR_TC_ATTEMPT_DEFAULT_KEY;
|
|
|
|
+extern bool gLedsDisabled;
|
|
+extern LED_Handle gLedHandle;
|
|
+
|
|
typedef struct
|
|
{
|
|
uint32_t FrameCounter;
|
|
diff --git a/znp_LP_CC2652RB_tirtos_ccs/app.cfg b/znp_LP_CC2652RB_tirtos_ccs/app.cfg
|
|
index 5089a84..146ef06 100644
|
|
--- a/znp_LP_CC2652RB_tirtos_ccs/app.cfg
|
|
+++ b/znp_LP_CC2652RB_tirtos_ccs/app.cfg
|
|
@@ -700,7 +700,9 @@ var GateMutexPri = xdc.useModule('ti.sysbios.gates.GateMutexPri');
|
|
*/
|
|
var Memory = xdc.useModule('xdc.runtime.Memory');
|
|
var HEAPMGR_CONFIG = 0;
|
|
-var HEAPMGR_SIZE = 0x1800;
|
|
+// Increase heap to 48kb
|
|
+// https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum/1052120/cc2652r-mac-no-resources-0x1a-errors-complete-crash-with-simplelink-cc13xx-cc26xx-sdk_5-30-00-56/3897554#3897554
|
|
+var HEAPMGR_SIZE = 0xc000;
|
|
|
|
// The following will create the #define HEAPMGR_CONFIG. It can then be used by include <xdc/cfg/global.h>
|
|
Program.global.HEAPMGR_CONFIG = HEAPMGR_CONFIG;
|
|
diff --git a/znp_LP_CC2652RB_tirtos_ccs/cc13x2_cc26x2.cmd b/znp_LP_CC2652RB_tirtos_ccs/cc13x2_cc26x2.cmd
|
|
index 2856ad2..d9a66ac 100755
|
|
--- a/znp_LP_CC2652RB_tirtos_ccs/cc13x2_cc26x2.cmd
|
|
+++ b/znp_LP_CC2652RB_tirtos_ccs/cc13x2_cc26x2.cmd
|
|
@@ -67,9 +67,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_LP_CC2652RB_tirtos_ccs/znp.syscfg b/znp_LP_CC2652RB_tirtos_ccs/znp.syscfg
|
|
index 68c1c52..420d5e2 100644
|
|
--- a/znp_LP_CC2652RB_tirtos_ccs/znp.syscfg
|
|
+++ b/znp_LP_CC2652RB_tirtos_ccs/znp.syscfg
|
|
@@ -48,6 +48,7 @@ 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";
|
|
|
|
Display1.$hardware = system.deviceData.board.components.XDS110UART;
|
|
@@ -71,8 +72,8 @@ ECDSA1.$name = "CONFIG_ECDSA_0";
|
|
|
|
NVS1.$name = "CONFIG_NVSINTERNAL";
|
|
NVS1.internalFlash.$name = "ti_drivers_nvs_NVSCC26XX0";
|
|
-NVS1.internalFlash.regionSize = 0x4000;
|
|
-NVS1.internalFlash.regionBase = 0x52000;
|
|
+NVS1.internalFlash.regionBase = 0x50000;
|
|
+NVS1.internalFlash.regionSize = 0x6000;
|
|
|
|
NVS2.$name = "CONFIG_NVSEXTERNAL";
|
|
NVS2.nvsType = "External";
|
|
@@ -122,6 +123,7 @@ 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.txPower = "5";
|
|
zstack.rf.radioConfig.$name = "ti_devices_radioconfig_settings_ieee_15_40";
|
|
zstack.rf.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param0";
|
|
zstack.rf.coexSettings.$name = "ti_zstack_rf_zstack_coex_mod0";
|
|
--
|
|
2.34.0
|
|
|