mirror of
https://github.com/Koenkk/Z-Stack-firmware.git
synced 2024-09-06 01:48:00 +02:00
287 lines
9.4 KiB
Diff
287 lines
9.4 KiB
Diff
diff --git a/Components/mt/MT_SYS.c b/Components/mt/MT_SYS.c
|
|
index 35aae57..176a2ae 100644
|
|
--- a/Components/mt/MT_SYS.c
|
|
+++ b/Components/mt/MT_SYS.c
|
|
@@ -2141,6 +2141,21 @@ static void MT_SysSnifferParameters( uint8 *pBuf )
|
|
*****************************************************************************/
|
|
static void powerOffSoc(void)
|
|
{
|
|
+#if defined(FIRMWARE_CC2530_DEFAULT) || defined(FIRMWARE_CC2530_CC2591_DEFAULT)
|
|
+ HAL_DISABLE_INTERRUPTS();
|
|
+ STIF = 0; //HAL_SLEEP_TIMER_CLEAR_INT;
|
|
+ if (ZNP_CFG1_UART == znpCfg1)
|
|
+ {
|
|
+ HalUARTSuspend();
|
|
+ }
|
|
+
|
|
+ /* Prep CC2530 power mode */
|
|
+ //HAL_SLEEP_PREP_POWER_MODE(3);
|
|
+ SLEEPCMD &= ~PMODE; /* clear mode bits */
|
|
+ SLEEPCMD |= 3; /* set mode bits to PM3 */
|
|
+ while (!(STLOAD & LDRDY));
|
|
+ SystemReset();
|
|
+#else
|
|
HAL_DISABLE_INTERRUPTS();
|
|
|
|
/* turn off the RF front end device */
|
|
@@ -2181,6 +2196,7 @@ static void powerOffSoc(void)
|
|
PCON = halSleepPconValue;
|
|
asm("NOP");
|
|
}
|
|
+#endif
|
|
}
|
|
#endif
|
|
|
|
diff --git a/Components/mt/revision_info.h b/Components/mt/revision_info.h
|
|
new file mode 100644
|
|
index 0000000..004588d
|
|
--- /dev/null
|
|
+++ b/Components/mt/revision_info.h
|
|
@@ -0,0 +1 @@
|
|
+#define CODE_REVISION_NUMBER 20190217
|
|
\ No newline at end of file
|
|
diff --git a/Components/stack/af/AF.c b/Components/stack/af/AF.c
|
|
index c6183b6..2b885b6 100644
|
|
--- a/Components/stack/af/AF.c
|
|
+++ b/Components/stack/af/AF.c
|
|
@@ -372,10 +372,18 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16 Src
|
|
#if !defined ( APS_NO_GROUPS )
|
|
// Find the first endpoint for this group
|
|
grpEp = aps_FindGroupForEndpoint( aff->GroupID, APS_GROUPS_FIND_FIRST );
|
|
- if ( grpEp == APS_GROUPS_EP_NOT_FOUND )
|
|
- return; // No endpoint found
|
|
-
|
|
- epDesc = afFindEndPointDesc( grpEp );
|
|
+ if ( grpEp == APS_GROUPS_EP_NOT_FOUND ) {
|
|
+ // No endpoint found, default to endpoint 1.
|
|
+ // In the original source code there is a return here.
|
|
+ // This prevent the messags from being forwarded.
|
|
+ // For our use-case we want to capture all messages.
|
|
+ // Even if the coordinator is not in the group.
|
|
+ epDesc = afFindEndPointDesc( 1 );
|
|
+ }
|
|
+ else {
|
|
+ epDesc = afFindEndPointDesc( grpEp );
|
|
+ }
|
|
+
|
|
if ( epDesc == NULL )
|
|
return; // Endpoint descriptor not found
|
|
|
|
@@ -392,6 +400,12 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16 Src
|
|
epDesc = pList->epDesc;
|
|
}
|
|
}
|
|
+ else if ( aff->DstEndPoint == 10 || aff->DstEndPoint == 11 ) {
|
|
+ if ( (epDesc = afFindEndPointDesc( 1 )) )
|
|
+ {
|
|
+ pList = afFindEndPointDescList( epDesc->endPoint );
|
|
+ }
|
|
+ }
|
|
else if ( (epDesc = afFindEndPointDesc( aff->DstEndPoint )) )
|
|
{
|
|
pList = afFindEndPointDescList( epDesc->endPoint );
|
|
diff --git a/Components/stack/nwk/nwk_globals.c b/Components/stack/nwk/nwk_globals.c
|
|
index 20df18e..15c9cbb 100644
|
|
--- a/Components/stack/nwk/nwk_globals.c
|
|
+++ b/Components/stack/nwk/nwk_globals.c
|
|
@@ -70,10 +70,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 16 // Waiting to be sent to MAC
|
|
+#define NWK_MAX_DATABUFS_SCHEDULED 10 // Timed messages to be sent
|
|
+#define NWK_MAX_DATABUFS_CONFIRMED 10 // Held after MAC confirms
|
|
+#define NWK_MAX_DATABUFS_TOTAL 24 // 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/Components/stack/zdo/ZDApp.c b/Components/stack/zdo/ZDApp.c
|
|
index 242be04..cca4781 100644
|
|
--- a/Components/stack/zdo/ZDApp.c
|
|
+++ b/Components/stack/zdo/ZDApp.c
|
|
@@ -3463,7 +3463,7 @@ void ZDApp_NVUpdate( void )
|
|
*/
|
|
uint16 ZDApp_CoordStartPANIDConflictCB( uint16 panid )
|
|
{
|
|
- return ( panid + 1 );
|
|
+ return ( panid );
|
|
}
|
|
|
|
/*********************************************************************
|
|
diff --git a/Projects/zstack/ZMain/TI2530ZNP/OnBoard.c b/Projects/zstack/ZMain/TI2530ZNP/OnBoard.c
|
|
index 7c6c77e..b49a5ca 100644
|
|
--- a/Projects/zstack/ZMain/TI2530ZNP/OnBoard.c
|
|
+++ b/Projects/zstack/ZMain/TI2530ZNP/OnBoard.c
|
|
@@ -144,8 +144,17 @@ void InitBoard( uint8 level )
|
|
|
|
#if defined CC2531ZNP
|
|
znpCfg1 = ZNP_CFG1_UART;
|
|
+#elif defined FIRMWARE_CC2530_CC2591_DEFAULT
|
|
+ znpCfg1 = ZNP_CFG1_UART;
|
|
+ znpCfg0 = ZNP_CFG0_32K_OSC;
|
|
#elif defined CC2530_MK
|
|
+
|
|
+ #if defined FIRMWARE_CC2530_DEFAULT
|
|
+ znpCfg1 = ZNP_CFG1_UART;
|
|
+ #else
|
|
znpCfg1 = ZNP_CFG1_SPI;
|
|
+ #endif
|
|
+
|
|
znpCfg0 = ZNP_CFG0_32K_OSC;
|
|
#else
|
|
znpCfg1 = P2_0;
|
|
diff --git a/Projects/zstack/ZNP/CC253x/Source/preinclude.h b/Projects/zstack/ZNP/CC253x/Source/preinclude.h
|
|
new file mode 100644
|
|
index 0000000..393f8fd
|
|
--- /dev/null
|
|
+++ b/Projects/zstack/ZNP/CC253x/Source/preinclude.h
|
|
@@ -0,0 +1,84 @@
|
|
+// Shared accross all firmwares
|
|
+#define ASSERT_RESET
|
|
+
|
|
+#if defined FIRMWARE_SBL
|
|
+ #define MAKE_CRC_SHDW
|
|
+#else
|
|
+ #define FAKE_CRC_SHDW
|
|
+#endif
|
|
+
|
|
+#define TC_LINKKEY_JOIN
|
|
+#define SECURE 1
|
|
+#define INCLUDE_REVISION_INFORMATION
|
|
+
|
|
+// 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
|
|
+
|
|
+
|
|
+/**
|
|
+ * Reduce BCAST_DELIVERY_TIME and increase MAX_BCAST time.
|
|
+ * BCAST_DELIVERY_TIME is the length of time a broadcast message is kept in the broadcast table
|
|
+ * MAX_BCAST is the max number of messages that are in the broadcast table
|
|
+ * If e.g. BCAST_DELIVERY_TIME = 1 second and MAX_BCAST = 10; 10 broadcast messages per second can be send.
|
|
+ *
|
|
+ * Zigbee2mqtt has a fixed delay of 170ms between each command.
|
|
+ * Therefore a BCAST_DELIVERY_TIME = 20 (= 2 seconds) and MAX_BCAST = 12 allows us to send
|
|
+ * 2 / 12 = 1 group command per 166ms, which is just below the zigbee2mqtt delay.
|
|
+ * Therefore the broadcast table will never get full.
|
|
+ */
|
|
+#define BCAST_DELIVERY_TIME 20
|
|
+#undef MAX_BCAST // avoids incompatible redefinition of macro warning
|
|
+#define MAX_BCAST 12
|
|
+
|
|
+#if defined FIRMWARE_CC2531_DEFAULT
|
|
+ #define CC2531ZNP
|
|
+ #define NWK_MAX_DEVICE_LIST 15
|
|
+ #define MAXMEMHEAP 3075
|
|
+ #define OPTIMIZE_LARGE_NETWORK
|
|
+
|
|
+#elif defined FIRMWARE_CC2531_MAX_DEVICES
|
|
+ #define CC2531ZNP
|
|
+ #define NWK_MAX_DEVICE_LIST 43
|
|
+ #define MAXMEMHEAP 3199
|
|
+ #define MAX_NEIGHBOR_ENTRIES 1
|
|
+
|
|
+#elif defined FIRMWARE_CC2530_DEFAULT
|
|
+ #define HAL_LCD FALSE
|
|
+ #define HAL_ADC FALSE
|
|
+ #define HAL_UART_DMA_RX_MAX 128
|
|
+ #define NWK_MAX_DEVICE_LIST 15
|
|
+ #define MAXMEMHEAP 2997
|
|
+ #define ENABLE_MT_SYS_RESET_SHUTDOWN
|
|
+ #define ZTOOL_P1
|
|
+ #define CC2530_MK
|
|
+ #define OPTIMIZE_LARGE_NETWORK
|
|
+
|
|
+#elif defined FIRMWARE_CC2530_CC2591_DEFAULT
|
|
+ #define NWK_MAX_DEVICE_LIST 15
|
|
+ #define MAXMEMHEAP 2995
|
|
+ #define ENABLE_MT_SYS_RESET_SHUTDOWN
|
|
+ #define ZTOOL_P1
|
|
+ #define HAL_LCD FALSE
|
|
+ #define HAL_ADC FALSE
|
|
+ #define HAL_UART_DMA_RX_MAX 128
|
|
+ #define HAL_PA_LNA
|
|
+ #define OPTIMIZE_LARGE_NETWORK
|
|
+
|
|
+#endif
|
|
+
|
|
+#if defined OPTIMIZE_LARGE_NETWORK
|
|
+ #define CONCENTRATOR_ENABLE 1
|
|
+ #define CONCENTRATOR_DISCOVERY_TIME 120
|
|
+ #define MAX_RTG_SRC_ENTRIES 25
|
|
+ #define SRC_RTG_EXPIRY_TIME 5
|
|
+ #define CONCENTRATOR_ROUTE_CACHE 1
|
|
+ #define MTO_RREQ_LIMIT_TIME 5000
|
|
+ #define LINK_DOWN_TRIGGER 6
|
|
+ #define DEF_NWK_RADIUS 10
|
|
+ #define NWK_ROUTE_AGE_LIMIT 10
|
|
+ #define DEFAULT_ROUTE_REQUEST_RADIUS 20
|
|
+ #define ROUTE_DISCOVERY_TIME 8
|
|
+ #define NWK_LINK_STATUS_PERIOD 20
|
|
+ #define MAX_NEIGHBOR_ENTRIES 16
|
|
+#endif
|
|
\ No newline at end of file
|
|
diff --git a/Projects/zstack/ZNP/Source/znp.cfg b/Projects/zstack/ZNP/Source/znp.cfg
|
|
index 7e524a9..6326400 100644
|
|
--- a/Projects/zstack/ZNP/Source/znp.cfg
|
|
+++ b/Projects/zstack/ZNP/Source/znp.cfg
|
|
@@ -101,4 +101,6 @@
|
|
-DMT_ZDO_EXTENSIONS
|
|
|
|
/* MT_APP interface - useful when ZAP defines ZAP_ZNP_MT for MT_SYS_APP_MSG pass-through. */
|
|
--DMT_APP_FUNC
|
|
\ No newline at end of file
|
|
+-DMT_APP_FUNC
|
|
+
|
|
+--preinclude=preinclude.h
|
|
\ No newline at end of file
|
|
diff --git a/Projects/zstack/ZNP/Source/znp_app.c b/Projects/zstack/ZNP/Source/znp_app.c
|
|
index 470ff12..d8ff88e 100644
|
|
--- a/Projects/zstack/ZNP/Source/znp_app.c
|
|
+++ b/Projects/zstack/ZNP/Source/znp_app.c
|
|
@@ -390,12 +390,23 @@ static void npInit(void)
|
|
halUARTCfg_t uartConfig;
|
|
|
|
uartConfig.configured = TRUE;
|
|
+
|
|
+#if defined(FIRMWARE_CC2530_DEFAULT) || defined(FIRMWARE_CC2530_CC2591_DEFAULT)
|
|
+ uartConfig.baudRate = HAL_UART_BR_115200;
|
|
+#else
|
|
uartConfig.baudRate = ZNP_UART_BAUD;
|
|
-#ifdef ZNP_ALT
|
|
+#endif
|
|
+
|
|
+#if defined(FIRMWARE_CC2530_DEFAULT) || defined(FIRMWARE_CC2530_CC2591_DEFAULT)
|
|
uartConfig.flowControl = FALSE;
|
|
#else
|
|
+ #ifdef ZNP_ALT
|
|
+ uartConfig.flowControl = FALSE;
|
|
+ #else
|
|
uartConfig.flowControl = TRUE;
|
|
+ #endif
|
|
#endif
|
|
+
|
|
uartConfig.flowControlThreshold = HAL_UART_FLOW_THRESHOLD;
|
|
uartConfig.rx.maxBufSize = HAL_UART_RX_BUF_SIZE;
|
|
uartConfig.tx.maxBufSize = HAL_UART_TX_BUF_SIZE;
|
|
@@ -404,6 +415,15 @@ static void npInit(void)
|
|
uartConfig.callBackFunc = npUartCback;
|
|
HalUARTOpen(HAL_UART_PORT, &uartConfig);
|
|
MT_UartRegisterTaskID(znpTaskId);
|
|
+
|
|
+#if defined FIRMWARE_CC2530_CC2591_DEFAULT
|
|
+ //Add TX Setting
|
|
+ #ifdef HAL_PA_LNA
|
|
+ ZMacSetTransmitPower(TX_PWR_PLUS_19);
|
|
+ #else
|
|
+ ZMacSetTransmitPower(TX_PWR_PLUS_4);
|
|
+ #endif
|
|
+#endif
|
|
}
|
|
else
|
|
{
|