├── README.md ├── LICENSE ├── firmware.patch └── MODKAMRU_V3 └── modkamruv3.patch /README.md: -------------------------------------------------------------------------------- 1 | # CC2538-CC2592-ZNP 2 | Z-Stack 3.0.2 coordinator firmware patch for CC2538-CC2592 module. 3 | 4 | 1. Install Z-Stack 3.0.2 and apply patch. 5 | 2. Open IAR Embedded Workbanch file ...\Z-Stack 3.0.2\Projects\zstack\ZNP\CC2538\ZNP.eww 6 | 3. Select CC2538ZNP-Debug configuration. 7 | 4. Add additional hex output converter to project settings. 8 | 5. Rebuild project and flash .hex file. 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 reverieline 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /firmware.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Components/hal/target/CC2538ZNP/hal_board_cfg.h b/Components/hal/target/CC2538ZNP/hal_board_cfg.h 2 | index 0bc45b5..890c5fe 100644 3 | --- a/Components/hal/target/CC2538ZNP/hal_board_cfg.h 4 | +++ b/Components/hal/target/CC2538ZNP/hal_board_cfg.h 5 | @@ -231,7 +231,7 @@ extern unsigned char znpCfg0; 6 | #define HAL_FLASH_WORD_SIZE 4 7 | 8 | // Z-Stack uses flash pages for NV 9 | -#define HAL_NV_PAGE_CNT 6 10 | +#define HAL_NV_PAGE_CNT 12 11 | #define HAL_NV_PAGE_BEG (HAL_NV_PAGE_END-HAL_NV_PAGE_CNT+1) 12 | #define HAL_NV_START_ADDR ((FLASH_BASE) + (HAL_NV_PAGE_BEG * HAL_FLASH_PAGE_SIZE)) 13 | 14 | @@ -280,7 +280,7 @@ extern unsigned char znpCfg0; 15 | */ 16 | 17 | /* ----------- RF-frontend Connection Initialization ---------- */ 18 | -#if defined HAL_PA_LNA || defined HAL_PA_LNA_CC2590 19 | +#if defined HAL_PA_LNA || defined HAL_PA_LNA_CC2590 || defined HAL_PA_LNA_CC2592 20 | extern void MAC_RfFrontendSetup(void); 21 | #define HAL_BOARD_RF_FRONTEND_SETUP() MAC_RfFrontendSetup() 22 | #else 23 | @@ -306,7 +306,7 @@ extern void MAC_RfFrontendSetup(void); 24 | } 25 | 26 | 27 | -#ifdef HAL_PA_LNA 28 | +#if defined HAL_PA_LNA || defined HAL_PA_LNA_CC2592 29 | #define HAL_BOARD_PA_LNA_INIT() st(GPIOPinTypeGPIOOutput(HGM_BASE, HGM_PIN); ) 30 | #else 31 | #define HAL_BOARD_PA_LNA_INIT() 32 | diff --git a/Components/mt/MT_SYS.c b/Components/mt/MT_SYS.c 33 | index aa57766..8cc3939 100644 34 | --- a/Components/mt/MT_SYS.c 35 | +++ b/Components/mt/MT_SYS.c 36 | @@ -73,7 +73,7 @@ 37 | #endif 38 | #if (defined INCLUDE_REVISION_INFORMATION) && ((defined MAKE_CRC_SHDW) || (defined FAKE_CRC_SHDW)) //built for bootloader 39 | #include "hal_flash.h" 40 | - #include "sb_shared.h" 41 | + //#include "sb_shared.h" 42 | #endif 43 | 44 | /****************************************************************************** 45 | @@ -516,7 +516,7 @@ static void MT_SysVersion(void) 46 | 47 | osal_memcpy(verStr, (uint8 *)MTVersionString, sizeof(MTVersionString)); 48 | 49 | -#if (defined MAKE_CRC_SHDW) || (defined FAKE_CRC_SHDW) //built for bootloader 50 | +/*#if (defined MAKE_CRC_SHDW) || (defined FAKE_CRC_SHDW) //built for bootloader 51 | HalFlashRead(SBL_SIG_ADDR / HAL_FLASH_PAGE_SIZE, 52 | SBL_SIG_ADDR % HAL_FLASH_PAGE_SIZE, 53 | (uint8 *)&sblSig, sizeof(sblSig)); 54 | @@ -536,7 +536,8 @@ static void MT_SysVersion(void) 55 | #else 56 | // SBL is NOT supported 57 | sblRev = 0xFFFFFFFF; 58 | -#endif 59 | +#endif*/ 60 | + sblRev = 0xFFFFFFFF; 61 | 62 | // Plug the SBL revision indication 63 | UINT32_TO_BUF_LITTLE_ENDIAN(pBuf,sblRev); 64 | diff --git a/Components/mt/MT_VERSION.c b/Components/mt/MT_VERSION.c 65 | index f374554..f2e3de9 100644 66 | --- a/Components/mt/MT_VERSION.c 67 | +++ b/Components/mt/MT_VERSION.c 68 | @@ -69,7 +69,7 @@ 69 | *****************************************************************************/ 70 | const uint8 MTVersionString[] = { 71 | 2, /* Transport protocol revision */ 72 | - 0, /* Product ID */ 73 | + 2, /* Product ID */ 74 | 2, /* Software major release number */ 75 | 7, /* Software minor release number */ 76 | 2, /* Software maintenance release number */ 77 | diff --git a/Components/mt/revision_info.h b/Components/mt/revision_info.h 78 | new file mode 100644 79 | index 0000000..424fc66 80 | --- /dev/null 81 | +++ b/Components/mt/revision_info.h 82 | @@ -0,0 +1 @@ 83 | +#define CODE_REVISION_NUMBER 20200211 84 | \ No newline at end of file 85 | diff --git a/Components/osal/mcu/cc2538/osal_nv.c b/Components/osal/mcu/cc2538/osal_nv.c 86 | index 9275e64..7e2fee5 100644 87 | --- a/Components/osal/mcu/cc2538/osal_nv.c 88 | +++ b/Components/osal/mcu/cc2538/osal_nv.c 89 | @@ -62,7 +62,7 @@ 90 | * $PROJ_DIR$\..\..\..\Tools\"Processor Specific Name"\"Specific Name".xcl 91 | */ 92 | #ifndef OSAL_NV_PHY_PER_PG 93 | - #define OSAL_NV_PHY_PER_PG 1 94 | + #define OSAL_NV_PHY_PER_PG 2 95 | #endif 96 | 97 | #define OSAL_NV_PAGES_USED (HAL_NV_PAGE_CNT / OSAL_NV_PHY_PER_PG) 98 | diff --git a/Components/stack/af/AF.c b/Components/stack/af/AF.c 99 | index 5e54237..40f4bfc 100644 100 | --- a/Components/stack/af/AF.c 101 | +++ b/Components/stack/af/AF.c 102 | @@ -405,10 +405,19 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16 Src 103 | #if !defined ( APS_NO_GROUPS ) 104 | // Find the first endpoint for this group 105 | grpEp = aps_FindGroupForEndpoint( aff->GroupID, APS_GROUPS_FIND_FIRST ); 106 | - if ( grpEp == APS_GROUPS_EP_NOT_FOUND ) 107 | - return; // No endpoint found 108 | 109 | - epDesc = afFindEndPointDesc( grpEp ); 110 | + if ( grpEp == APS_GROUPS_EP_NOT_FOUND ) { 111 | + // No endpoint found, default to endpoint 1. 112 | + // In the original source code there is a return here. 113 | + // This prevent the messags from being forwarded. 114 | + // For our use-case we want to capture all messages. 115 | + // Even if the coordinator is not in the group. 116 | + epDesc = afFindEndPointDesc( 1 ); 117 | + } 118 | + else { 119 | + epDesc = afFindEndPointDesc( grpEp ); 120 | + } 121 | + 122 | if ( epDesc == NULL ) 123 | return; // Endpoint descriptor not found 124 | 125 | @@ -425,6 +434,13 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16 Src 126 | epDesc = pList->epDesc; 127 | } 128 | } 129 | + else if ( aff->DstEndPoint == 10 || aff->DstEndPoint == 11 ) 130 | + { 131 | + if ( (epDesc = afFindEndPointDesc( 1 )) ) 132 | + { 133 | + pList = afFindEndPointDescList( epDesc->endPoint ); 134 | + } 135 | + } 136 | else if ( (epDesc = afFindEndPointDesc( aff->DstEndPoint )) ) 137 | { 138 | pList = afFindEndPointDescList( epDesc->endPoint ); 139 | diff --git a/Components/stack/sys/ZGlobals.c b/Components/stack/sys/ZGlobals.c 140 | index d170283..e251f15 100644 141 | --- a/Components/stack/sys/ZGlobals.c 142 | +++ b/Components/stack/sys/ZGlobals.c 143 | @@ -212,7 +212,10 @@ uint8 zgEndDeviceConfiguration = END_DEV_CONFIGURATION; 144 | // 145 | // NOTICE: Before enabling Child Aging make sure to review all the related 146 | // definitions in this file, especially zgNwkParentInformation. 147 | -uint8 zgChildAgingEnable = TRUE; 148 | +/** 149 | + * Disable child aging, otherwise Xiaomi devices are being kicked off the network. 150 | + */ 151 | +uint8 zgChildAgingEnable = FALSE; 152 | 153 | //========== TouchLink NWK configuration =============== 154 | // Values used by Router when starts a network as initiator 155 | diff --git a/Projects/zstack/ZNP/Source/znp.cfg b/Projects/zstack/ZNP/Source/znp.cfg 156 | index 2b8d56d..6954a6a 100644 157 | --- a/Projects/zstack/ZNP/Source/znp.cfg 158 | +++ b/Projects/zstack/ZNP/Source/znp.cfg 159 | @@ -107,3 +107,8 @@ 160 | -DMT_APP_FUNC 161 | -DMT_APP_CNF_FUNC 162 | 163 | +/* Additional flags */ 164 | +-DINCLUDE_REVISION_INFORMATION 165 | +-DMT_SYS_KEY_MANAGEMENT=1 166 | +-DTP2_LEGACY_ZC 167 | +-DHAL_PA_LNA_CC2592 168 | -------------------------------------------------------------------------------- /MODKAMRU_V3/modkamruv3.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Components/bsp/srf06eb_cc2538/drivers/source/bsp.h b/Components/bsp/srf06eb_cc2538/drivers/source/bsp.h 2 | index 38ac3d9..44c0d5b 100644 3 | --- a/Components/bsp/srf06eb_cc2538/drivers/source/bsp.h 4 | +++ b/Components/bsp/srf06eb_cc2538/drivers/source/bsp.h 5 | @@ -81,15 +81,21 @@ extern "C" 6 | #define BSP_3V3_EN GPIO_PIN_4 //!< PB4 7 | 8 | // Board LED defines 9 | -#define BSP_LED_BASE GPIO_C_BASE 10 | -#define BSP_LED_1 GPIO_PIN_0 //!< PC0 11 | -#define BSP_LED_2 GPIO_PIN_1 //!< PC1 12 | -#define BSP_LED_3 GPIO_PIN_2 //!< PC2 13 | -#define BSP_LED_4 GPIO_PIN_3 //!< PC3 14 | -#define BSP_LED_ALL (BSP_LED_1 | \ 15 | - BSP_LED_2 | \ 16 | - BSP_LED_3 | \ 17 | - BSP_LED_4) //!< Bitmask of all LEDs 18 | +#ifdef MODKAMRU_V3 // Redefine board LEDs 19 | + #define BSP_LED_BASE GPIO_B_BASE 20 | + #define BSP_LED_1 GPIO_PIN_1 21 | + #define BSP_LED_2 GPIO_PIN_2 22 | + #define BSP_LED_3 GPIO_PIN_3 23 | + #define BSP_LED_4 GPIO_PIN_4 24 | + #define BSP_LED_ALL (BSP_LED_1 | BSP_LED_2 | BSP_LED_3 | BSP_LED_4) 25 | +#else //Not a MODKAMRU board 26 | + #define BSP_LED_BASE GPIO_C_BASE 27 | + #define BSP_LED_1 GPIO_PIN_0 //!< PC0 28 | + #define BSP_LED_2 GPIO_PIN_1 //!< PC1 29 | + #define BSP_LED_3 GPIO_PIN_2 //!< PC2 30 | + #define BSP_LED_4 GPIO_PIN_3 //!< PC3 31 | + #define BSP_LED_ALL (BSP_LED_1 | BSP_LED_2 | BSP_LED_3 | BSP_LED_4) //!< Bitmask of all LEDs 32 | +#endif 33 | 34 | // Board key defines 35 | #define BSP_KEY_DIR_BASE GPIO_C_BASE //!< Base for left/right/up/down 36 | diff --git a/Components/hal/include/hal_led.h b/Components/hal/include/hal_led.h 37 | index bb327f1..846dea2 100644 38 | --- a/Components/hal/include/hal_led.h 39 | +++ b/Components/hal/include/hal_led.h 40 | @@ -87,6 +87,19 @@ extern "C" 41 | * GLOBAL VARIABLES 42 | */ 43 | 44 | +#ifdef MODKAMRU_V3 //LED control helpers 45 | + /* Dynamically enable/disable LEDs */ 46 | + extern bool gbModkamUseLeds; 47 | + extern void modkamUseLeds(bool); 48 | + 49 | + /* LED control macros */ 50 | +#define MODKAM_LED_ON(leds) {if(gbModkamUseLeds)HalLedSet(leds,HAL_LED_MODE_ON);} 51 | +#define MODKAM_LED_OFF(leds) {if(gbModkamUseLeds)HalLedSet(leds,HAL_LED_MODE_OFF);} 52 | +#define MODKAM_LED_BLINK(leds,count,duty,duration) {if(gbModkamUseLeds)HalLedBlink(leds,count,duty,duration);} 53 | +#define MODKAM_LED_BLINK_LONG(leds) MODKAM_LED_BLINK(leds,1,90,1000) 54 | +#define MODKAM_LED_BLINK_SHORT(leds) MODKAM_LED_BLINK(leds,1,50,100) 55 | +#endif 56 | + 57 | /* 58 | * Initialize LED Service. 59 | */ 60 | diff --git a/Components/hal/target/CC2538ZNP/hal_board_cfg.h b/Components/hal/target/CC2538ZNP/hal_board_cfg.h 61 | index 0bc45b5..9f28629 100644 62 | --- a/Components/hal/target/CC2538ZNP/hal_board_cfg.h 63 | +++ b/Components/hal/target/CC2538ZNP/hal_board_cfg.h 64 | @@ -231,7 +231,7 @@ extern unsigned char znpCfg0; 65 | #define HAL_FLASH_WORD_SIZE 4 66 | 67 | // Z-Stack uses flash pages for NV 68 | -#define HAL_NV_PAGE_CNT 6 69 | +#define HAL_NV_PAGE_CNT 12 70 | #define HAL_NV_PAGE_BEG (HAL_NV_PAGE_END-HAL_NV_PAGE_CNT+1) 71 | #define HAL_NV_START_ADDR ((FLASH_BASE) + (HAL_NV_PAGE_BEG * HAL_FLASH_PAGE_SIZE)) 72 | 73 | @@ -280,7 +280,7 @@ extern unsigned char znpCfg0; 74 | */ 75 | 76 | /* ----------- RF-frontend Connection Initialization ---------- */ 77 | -#if defined HAL_PA_LNA || defined HAL_PA_LNA_CC2590 78 | +#if defined HAL_PA_LNA || defined HAL_PA_LNA_CC2590 || defined HAL_PA_LNA_CC2592 79 | extern void MAC_RfFrontendSetup(void); 80 | #define HAL_BOARD_RF_FRONTEND_SETUP() MAC_RfFrontendSetup() 81 | #else 82 | @@ -300,13 +300,14 @@ extern void MAC_RfFrontendSetup(void); 83 | /* ----------- Board Initialization ---------- */ 84 | #define HAL_BOARD_INIT() \ 85 | { \ 86 | + HAL_BOARD_LED_INIT(); \ 87 | HAL_BOARD_COMMON_INIT() \ 88 | HAL_BOARD_PA_LNA_INIT(); \ 89 | HAL_BOARD_RF_FRONTEND_SETUP(); \ 90 | } 91 | 92 | 93 | -#ifdef HAL_PA_LNA 94 | +#if defined HAL_PA_LNA || defined HAL_PA_LNA_CC2592 95 | #define HAL_BOARD_PA_LNA_INIT() st(GPIOPinTypeGPIOOutput(HGM_BASE, HGM_PIN); ) 96 | #else 97 | #define HAL_BOARD_PA_LNA_INIT() 98 | @@ -340,15 +341,34 @@ extern void MAC_RfFrontendSetup(void); 99 | } 100 | 101 | /* ----------- LED's ---------- */ 102 | -#define HAL_TURN_OFF_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, 0) 103 | -#define HAL_TURN_OFF_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, 0) 104 | -#define HAL_TURN_OFF_LED3() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, 0) 105 | -#define HAL_TURN_OFF_LED4() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, 0) 106 | +#ifdef MODKAMRU_V3 //Set LED pins to output mode 107 | + #define HAL_BOARD_LED_INIT() GPIOPinTypeGPIOOutput(BSP_LED_BASE,BSP_LED_ALL) 108 | +#else 109 | + #define HAL_BOARD_LED_INIT() 110 | +#endif 111 | + 112 | +#ifdef MODKAMRU_V3 //Redefine LED contorl macros 113 | + #define HAL_TURN_OFF_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, BSP_LED_1) 114 | + #define HAL_TURN_OFF_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, BSP_LED_2) 115 | + #define HAL_TURN_OFF_LED3() GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, BSP_LED_3) 116 | + #define HAL_TURN_OFF_LED4() GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, BSP_LED_4) 117 | + 118 | + #define HAL_TURN_ON_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, 0) 119 | + #define HAL_TURN_ON_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, 0) 120 | + #define HAL_TURN_ON_LED3() GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, 0) 121 | + #define HAL_TURN_ON_LED4() GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, 0) 122 | +#else /* Not a MODKAMRU board */ 123 | + #define HAL_TURN_OFF_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, 0) 124 | + #define HAL_TURN_OFF_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, 0) 125 | + #define HAL_TURN_OFF_LED3() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, 0) 126 | + #define HAL_TURN_OFF_LED4() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, 0) 127 | + 128 | + #define HAL_TURN_ON_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, BSP_LED_1) 129 | + #define HAL_TURN_ON_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, BSP_LED_2) 130 | + #define HAL_TURN_ON_LED3() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, BSP_LED_3) 131 | + #define HAL_TURN_ON_LED4() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, BSP_LED_4) 132 | +#endif 133 | 134 | -#define HAL_TURN_ON_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, BSP_LED_1) 135 | -#define HAL_TURN_ON_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, BSP_LED_2) 136 | -#define HAL_TURN_ON_LED3() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, BSP_LED_3) 137 | -#define HAL_TURN_ON_LED4() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, BSP_LED_4) 138 | 139 | #define HAL_CLR_GPIO_00() GPIOPinWrite(BSP_LED_BASE, GPIO_PIN_2, 0) // LED3 140 | #define HAL_CLR_GPIO_02() GPIOPinWrite(BSP_LED_BASE, GPIO_PIN_3, 0) // LED4 141 | @@ -357,16 +377,30 @@ extern void MAC_RfFrontendSetup(void); 142 | #define HAL_SET_GPIO_02() GPIOPinWrite(BSP_LED_BASE, GPIO_PIN_3, GPIO_PIN_3) // LED4 143 | 144 | /* ----------- Toggle the LEDs ---------- */ 145 | -#define HAL_TOGGLE_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_1))) 146 | -#define HAL_TOGGLE_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_2))) 147 | -#define HAL_TOGGLE_LED3() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_3))) 148 | -#define HAL_TOGGLE_LED4() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_4))) 149 | +#ifdef MODKAMRU_V3 //Redefine LED contorl macros 150 | + #define HAL_TOGGLE_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_1))) 151 | + #define HAL_TOGGLE_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_2))) 152 | + #define HAL_TOGGLE_LED3() GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_3))) 153 | + #define HAL_TOGGLE_LED4() GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_4))) 154 | +#else //Not a MODKAMRU board 155 | + #define HAL_TOGGLE_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_1))) 156 | + #define HAL_TOGGLE_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_2))) 157 | + #define HAL_TOGGLE_LED3() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_3))) 158 | + #define HAL_TOGGLE_LED4() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_4))) 159 | +#endif 160 | 161 | /* ----------- Read the LEDs ---------- */ 162 | -#define HAL_STATE_LED1() GPIOPinRead(BSP_LED_BASE, BSP_LED_1) 163 | -#define HAL_STATE_LED2() GPIOPinRead(BSP_LED_BASE, BSP_LED_2) 164 | -#define HAL_STATE_LED3() GPIOPinRead(BSP_LED_BASE, BSP_LED_3) 165 | -#define HAL_STATE_LED4() GPIOPinRead(BSP_LED_BASE, BSP_LED_4) 166 | +#ifdef MODKAMRU_V3 //Redefine LED state reading macros 167 | + #define HAL_STATE_LED1() (!GPIOPinRead(BSP_LED_BASE, BSP_LED_1)) 168 | + #define HAL_STATE_LED2() (!GPIOPinRead(BSP_LED_BASE, BSP_LED_2)) 169 | + #define HAL_STATE_LED3() (!GPIOPinRead(BSP_LED_BASE, BSP_LED_3)) 170 | + #define HAL_STATE_LED4() (!GPIOPinRead(BSP_LED_BASE, BSP_LED_4)) 171 | +#else //Not a MODKAMRU board 172 | + #define HAL_STATE_LED1() GPIOPinRead(BSP_LED_BASE, BSP_LED_1) 173 | + #define HAL_STATE_LED2() GPIOPinRead(BSP_LED_BASE, BSP_LED_2) 174 | + #define HAL_STATE_LED3() GPIOPinRead(BSP_LED_BASE, BSP_LED_3) 175 | + #define HAL_STATE_LED4() GPIOPinRead(BSP_LED_BASE, BSP_LED_4) 176 | +#endif 177 | 178 | #define HAL_PUSH_BUTTON1()(PUSH_BTN_POLARITY (GPIOPinRead(BSP_KEY_SEL_BASE, BSP_KEY_SELECT))) 179 | 180 | diff --git a/Components/hal/target/CC2538ZNP/hal_led.c b/Components/hal/target/CC2538ZNP/hal_led.c 181 | index 1a6e636..cf560e9 100644 182 | --- a/Components/hal/target/CC2538ZNP/hal_led.c 183 | +++ b/Components/hal/target/CC2538ZNP/hal_led.c 184 | @@ -103,6 +103,18 @@ void HalLedOnOff (uint8 leds, uint8 mode); 185 | * FUNCTIONS - API 186 | ***************************************************************************************************/ 187 | 188 | +#ifdef MODKAMRU_V3 // LED control helpers 189 | + // Dynamically enable/disable LEDs 190 | +bool gbModkamUseLeds = true; 191 | +void modkamUseLeds(bool enable){ 192 | + gbModkamUseLeds=enable; 193 | + if(!enable) 194 | + HalLedSet(HAL_LED_ALL,HAL_LED_MODE_OFF); 195 | + else 196 | + HalLedSet(HAL_LED_1,HAL_LED_MODE_ON);// Light on power LED 197 | +} 198 | +#endif 199 | + 200 | /*************************************************************************************************** 201 | * @fn HalLedInit 202 | * 203 | diff --git a/Components/hal/target/CC2538ZNP/hal_uart_isr.c b/Components/hal/target/CC2538ZNP/hal_uart_isr.c 204 | index a6ce62b..8d500af 100644 205 | --- a/Components/hal/target/CC2538ZNP/hal_uart_isr.c 206 | +++ b/Components/hal/target/CC2538ZNP/hal_uart_isr.c 207 | @@ -160,10 +160,17 @@ uint8 HalUARTOpenIsr(uint8 port, halUARTCfg_t *config) 208 | 209 | if(config->flowControl) 210 | { 211 | +#ifdef MODKAMRU_V3 212 | + IOCPinConfigPeriphOutput(GPIO_D_BASE, GPIO_PIN_1, IOC_MUX_OUT_SEL_UART1_RTS); 213 | + GPIOPinTypeUARTOutput(GPIO_D_BASE, GPIO_PIN_1); 214 | + IOCPinConfigPeriphInput(GPIO_B_BASE, GPIO_PIN_0, IOC_UARTCTS_UART1); 215 | + GPIOPinTypeUARTInput(GPIO_B_BASE, GPIO_PIN_0); 216 | +#else 217 | IOCPinConfigPeriphOutput(GPIO_D_BASE, GPIO_PIN_3, IOC_MUX_OUT_SEL_UART1_RTS); 218 | GPIOPinTypeUARTOutput(GPIO_D_BASE, GPIO_PIN_3); 219 | IOCPinConfigPeriphInput(GPIO_B_BASE, GPIO_PIN_0, IOC_UARTCTS_UART1); 220 | GPIOPinTypeUARTInput(GPIO_B_BASE, GPIO_PIN_0); 221 | +#endif 222 | } 223 | 224 | IntEnable(HAL_UART_INT_CTRL); 225 | diff --git a/Components/mt/MT_SYS.c b/Components/mt/MT_SYS.c 226 | index aa57766..9b3cb3d 100644 227 | --- a/Components/mt/MT_SYS.c 228 | +++ b/Components/mt/MT_SYS.c 229 | @@ -73,7 +73,7 @@ 230 | #endif 231 | #if (defined INCLUDE_REVISION_INFORMATION) && ((defined MAKE_CRC_SHDW) || (defined FAKE_CRC_SHDW)) //built for bootloader 232 | #include "hal_flash.h" 233 | - #include "sb_shared.h" 234 | + //#include "sb_shared.h" 235 | #endif 236 | 237 | /****************************************************************************** 238 | @@ -515,7 +515,7 @@ static void MT_SysVersion(void) 239 | #endif 240 | 241 | osal_memcpy(verStr, (uint8 *)MTVersionString, sizeof(MTVersionString)); 242 | - 243 | +/* 244 | #if (defined MAKE_CRC_SHDW) || (defined FAKE_CRC_SHDW) //built for bootloader 245 | HalFlashRead(SBL_SIG_ADDR / HAL_FLASH_PAGE_SIZE, 246 | SBL_SIG_ADDR % HAL_FLASH_PAGE_SIZE, 247 | @@ -537,6 +537,8 @@ static void MT_SysVersion(void) 248 | // SBL is NOT supported 249 | sblRev = 0xFFFFFFFF; 250 | #endif 251 | +*/ 252 | + sblRev = 0xFFFFFFFF; 253 | 254 | // Plug the SBL revision indication 255 | UINT32_TO_BUF_LITTLE_ENDIAN(pBuf,sblRev); 256 | diff --git a/Components/mt/MT_UTIL.c b/Components/mt/MT_UTIL.c 257 | index b4a24d8..d9e461d 100644 258 | --- a/Components/mt/MT_UTIL.c 259 | +++ b/Components/mt/MT_UTIL.c 260 | @@ -922,6 +922,12 @@ static void MT_UtilLedControl(uint8 *pBuf) 261 | iLed = *pBuf++; 262 | iMode = *pBuf; 263 | 264 | +#ifdef MODKAMRU_V3 265 | + if(iMode==0) 266 | + modkamUseLeds(false); 267 | + else modkamUseLeds(true); 268 | +#endif 269 | + 270 | if ( iLed == 1 ) 271 | Led = HAL_LED_1; 272 | else if ( iLed == 2 ) 273 | diff --git a/Components/mt/MT_VERSION.c b/Components/mt/MT_VERSION.c 274 | index f374554..f2e3de9 100644 275 | --- a/Components/mt/MT_VERSION.c 276 | +++ b/Components/mt/MT_VERSION.c 277 | @@ -69,7 +69,7 @@ 278 | *****************************************************************************/ 279 | const uint8 MTVersionString[] = { 280 | 2, /* Transport protocol revision */ 281 | - 0, /* Product ID */ 282 | + 2, /* Product ID */ 283 | 2, /* Software major release number */ 284 | 7, /* Software minor release number */ 285 | 2, /* Software maintenance release number */ 286 | diff --git a/Components/mt/revision_info.h b/Components/mt/revision_info.h 287 | new file mode 100644 288 | index 0000000..4e4e676 289 | --- /dev/null 290 | +++ b/Components/mt/revision_info.h 291 | @@ -0,0 +1 @@ 292 | +#define CODE_REVISION_NUMBER 20200327 293 | \ No newline at end of file 294 | diff --git a/Components/osal/mcu/cc2538/osal_nv.c b/Components/osal/mcu/cc2538/osal_nv.c 295 | index 9275e64..7e2fee5 100644 296 | --- a/Components/osal/mcu/cc2538/osal_nv.c 297 | +++ b/Components/osal/mcu/cc2538/osal_nv.c 298 | @@ -62,7 +62,7 @@ 299 | * $PROJ_DIR$\..\..\..\Tools\"Processor Specific Name"\"Specific Name".xcl 300 | */ 301 | #ifndef OSAL_NV_PHY_PER_PG 302 | - #define OSAL_NV_PHY_PER_PG 1 303 | + #define OSAL_NV_PHY_PER_PG 2 304 | #endif 305 | 306 | #define OSAL_NV_PAGES_USED (HAL_NV_PAGE_CNT / OSAL_NV_PHY_PER_PG) 307 | diff --git a/Components/stack/af/AF.c b/Components/stack/af/AF.c 308 | index 5e54237..c88b195 100644 309 | --- a/Components/stack/af/AF.c 310 | +++ b/Components/stack/af/AF.c 311 | @@ -405,10 +405,18 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16 Src 312 | #if !defined ( APS_NO_GROUPS ) 313 | // Find the first endpoint for this group 314 | grpEp = aps_FindGroupForEndpoint( aff->GroupID, APS_GROUPS_FIND_FIRST ); 315 | - if ( grpEp == APS_GROUPS_EP_NOT_FOUND ) 316 | - return; // No endpoint found 317 | + if ( grpEp == APS_GROUPS_EP_NOT_FOUND ) { 318 | + // No endpoint found, default to endpoint 1. 319 | + // In the original source code there is a return here. 320 | + // This prevent the messags from being forwarded. 321 | + // For our use-case we want to capture all messages. 322 | + // Even if the coordinator is not in the group. 323 | + epDesc = afFindEndPointDesc( 1 ); 324 | + } 325 | + else { 326 | + epDesc = afFindEndPointDesc( grpEp ); 327 | + } 328 | 329 | - epDesc = afFindEndPointDesc( grpEp ); 330 | if ( epDesc == NULL ) 331 | return; // Endpoint descriptor not found 332 | 333 | @@ -425,6 +433,12 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16 Src 334 | epDesc = pList->epDesc; 335 | } 336 | } 337 | + else if ( aff->DstEndPoint == 10 || aff->DstEndPoint == 11 ) { 338 | + if ( (epDesc = afFindEndPointDesc( 1 )) ) 339 | + { 340 | + pList = afFindEndPointDescList( epDesc->endPoint ); 341 | + } 342 | + } 343 | else if ( (epDesc = afFindEndPointDesc( aff->DstEndPoint )) ) 344 | { 345 | pList = afFindEndPointDescList( epDesc->endPoint ); 346 | diff --git a/Components/stack/bdb/bdb_FindingAndBinding.c b/Components/stack/bdb/bdb_FindingAndBinding.c 347 | index 1b4f72c..7695d9f 100644 348 | --- a/Components/stack/bdb/bdb_FindingAndBinding.c 349 | +++ b/Components/stack/bdb/bdb_FindingAndBinding.c 350 | @@ -624,6 +624,9 @@ void bdb_ProcessSimpleDesc( zdoIncomingMsg_t *msgPtr ) 351 | else 352 | { 353 | //Save the simple desc to don't ask for it again 354 | +#ifdef MODKAMRU_V3 355 | + bdb_zclSimpleDescClusterListClean( &bdb_FindingBindingTargetSimpleDesc ); 356 | +#endif 357 | pCurr->SimpleDescriptor = &bdb_FindingBindingTargetSimpleDesc; 358 | } 359 | (void)extAddr; //dummy 360 | diff --git a/Components/stack/nwk/nwk_globals.c b/Components/stack/nwk/nwk_globals.c 361 | index eb436ae..7d2281c 100644 362 | --- a/Components/stack/nwk/nwk_globals.c 363 | +++ b/Components/stack/nwk/nwk_globals.c 364 | @@ -71,10 +71,17 @@ 365 | * CONSTANTS 366 | */ 367 | // Maximums for the data buffer queue 368 | +#ifdef MODKAMRU_V3 369 | +#define NWK_MAX_DATABUFS_WAITING 180 // Waiting to be sent to MAC 370 | +#define NWK_MAX_DATABUFS_SCHEDULED 150 // Timed messages to be sent 371 | +#define NWK_MAX_DATABUFS_CONFIRMED 150 // Held after MAC confirms 372 | +#define NWK_MAX_DATABUFS_TOTAL 255 // Total number of buffers 373 | +#else 374 | #define NWK_MAX_DATABUFS_WAITING 8 // Waiting to be sent to MAC 375 | #define NWK_MAX_DATABUFS_SCHEDULED 5 // Timed messages to be sent 376 | #define NWK_MAX_DATABUFS_CONFIRMED 5 // Held after MAC confirms 377 | #define NWK_MAX_DATABUFS_TOTAL 12 // Total number of buffers 378 | +#endif 379 | 380 | // 1-255 (0 -> 256) X RTG_TIMER_INTERVAL 381 | // A known shortcoming is that when a message is enqueued as "hold" for a 382 | diff --git a/Components/stack/sys/ZGlobals.c b/Components/stack/sys/ZGlobals.c 383 | index d170283..e251f15 100644 384 | --- a/Components/stack/sys/ZGlobals.c 385 | +++ b/Components/stack/sys/ZGlobals.c 386 | @@ -212,7 +212,10 @@ uint8 zgEndDeviceConfiguration = END_DEV_CONFIGURATION; 387 | // 388 | // NOTICE: Before enabling Child Aging make sure to review all the related 389 | // definitions in this file, especially zgNwkParentInformation. 390 | -uint8 zgChildAgingEnable = TRUE; 391 | +/** 392 | + * Disable child aging, otherwise Xiaomi devices are being kicked off the network. 393 | + */ 394 | +uint8 zgChildAgingEnable = FALSE; 395 | 396 | //========== TouchLink NWK configuration =============== 397 | // Values used by Router when starts a network as initiator 398 | diff --git a/Components/stack/zdo/ZDObject.c b/Components/stack/zdo/ZDObject.c 399 | index dcb6efa..4bbb646 100644 400 | --- a/Components/stack/zdo/ZDObject.c 401 | +++ b/Components/stack/zdo/ZDObject.c 402 | @@ -76,6 +76,10 @@ 403 | /* HAL */ 404 | #include "hal_lcd.h" 405 | 406 | +#ifdef MODKAMRU_V3 407 | +#include "hal_led.h" 408 | +#endif 409 | + 410 | /********************************************************************* 411 | * MACROS 412 | */ 413 | @@ -1957,6 +1961,12 @@ void ZDO_ProcessMgmtPermitJoinReq( zdoIncomingMsg_t *inMsg ) 414 | #endif 415 | 416 | duration = inMsg->asdu[ZDP_MGMT_PERMIT_JOIN_REQ_DURATION]; 417 | + 418 | +#ifdef MODKAMRU_V3 419 | + if(duration==0) 420 | + MODKAM_LED_OFF(HAL_LED_3) 421 | + else MODKAM_LED_BLINK(HAL_LED_3,duration/2,50,2000) 422 | +#endif 423 | // Per R21 Spec this field is not longer relevant 2.4.3.3.7.2 (Mgmt_Permit_Joining_req Effect on Receipt) 424 | //tcsig = inMsg->asdu[ZDP_MGMT_PERMIT_JOIN_REQ_TC_SIG]; 425 | 426 | diff --git a/Components/zmac/ZMAC.h b/Components/zmac/ZMAC.h 427 | index d658113..f4e7142 100644 428 | --- a/Components/zmac/ZMAC.h 429 | +++ b/Components/zmac/ZMAC.h 430 | @@ -458,7 +458,10 @@ typedef enum 431 | TX_PWR_PLUS_16, 432 | TX_PWR_PLUS_17, 433 | TX_PWR_PLUS_18, 434 | - TX_PWR_PLUS_19 435 | + TX_PWR_PLUS_19, 436 | + TX_PWR_PLUS_20, 437 | + TX_PWR_PLUS_21, 438 | + TX_PWR_PLUS_22 439 | } ZMacTransmitPower_t; // The transmit power in units of -1 dBm. 440 | 441 | typedef struct 442 | diff --git a/Projects/zstack/Tools/CC2538DB/CC2538.icf b/Projects/zstack/Tools/CC2538DB/CC2538.icf 443 | index d4c95cc..cb8abf6 100644 444 | --- a/Projects/zstack/Tools/CC2538DB/CC2538.icf 445 | +++ b/Projects/zstack/Tools/CC2538DB/CC2538.icf 446 | @@ -15,7 +15,7 @@ define memory mem with size = 4G; 447 | // 448 | // Define a region for the on-chip program code space. 449 | // 450 | -define region FLASH = mem:[from 0x00200000 to 0x0027C7FF]; 451 | +define region FLASH = mem:[from 0x00200000 to 0x002797FF]; 452 | 453 | // 454 | // Define a region for the OTA CRC structure. 455 | @@ -39,7 +39,7 @@ define region FLASH = mem:[from 0x00200000 to 0x0027C7FF]; 456 | // The size of this region MUST MATCH the size defined by "HAL_NV_PAGE_CNT" 457 | // in the file: hal_board_cfg.h 458 | // 459 | -define region NV_MEM = mem:[from 0x0027C800 to 0x0027F7FF]; 460 | +define region NV_MEM = mem:[from 0x00279800 to 0x0027F7FF]; 461 | 462 | // 463 | // Define regions for on-chip factory Commissioning Parameters. 464 | @@ -87,7 +87,7 @@ define region FLASH_LCK = mem:[from 0x0027FFE0 to 0x0027FFFF]; 465 | // 466 | // Define a region for the on-chip SRAM. 467 | // 468 | -define region SRAM = mem:[from 0x20004000 to 0x20007FFF]; 469 | +define region SRAM = mem:[from 0x20000000 to 0x20007FFF]; 470 | 471 | // 472 | // Define a block for the heap. The size should be set to something other 473 | diff --git a/Projects/zstack/Tools/CC2538DB/f8wConfig.cfg b/Projects/zstack/Tools/CC2538DB/f8wConfig.cfg 474 | index 9d2c1bf..328cbbb 100644 475 | --- a/Projects/zstack/Tools/CC2538DB/f8wConfig.cfg 476 | +++ b/Projects/zstack/Tools/CC2538DB/f8wConfig.cfg 477 | @@ -119,7 +119,7 @@ 478 | -DMAX_POLL_FAILURE_RETRIES=2 479 | 480 | /* The number of items in the broadcast table */ 481 | --DMAX_BCAST=9 482 | +//-DMAX_BCAST=9 483 | 484 | /* The maximum number of groups in the groups table */ 485 | -DAPS_MAX_GROUPS=16 486 | diff --git a/Projects/zstack/ZMain/TI2538ZNP/OnBoard.h b/Projects/zstack/ZMain/TI2538ZNP/OnBoard.h 487 | index 02bce67..11ebfb6 100644 488 | --- a/Projects/zstack/ZMain/TI2538ZNP/OnBoard.h 489 | +++ b/Projects/zstack/ZMain/TI2538ZNP/OnBoard.h 490 | @@ -120,10 +120,17 @@ extern uint8 aExtendedAddress[8]; 491 | /* SOC defines the ideal sizes in the 492 | * individual _hal_uart_dma/isr.c modules. 493 | */ 494 | -#define HAL_UART_FLOW_THRESHOLD 5 495 | -#define HAL_UART_RX_BUF_SIZE 170 496 | -#define HAL_UART_TX_BUF_SIZE 120 497 | -#define HAL_UART_IDLE_TIMEOUT 5 498 | +#ifdef MODKAMRU_V3 499 | + #define HAL_UART_FLOW_THRESHOLD 5 500 | + #define HAL_UART_RX_BUF_SIZE 1024 501 | + #define HAL_UART_TX_BUF_SIZE 1024 502 | + #define HAL_UART_IDLE_TIMEOUT 5 503 | +#else 504 | + #define HAL_UART_FLOW_THRESHOLD 5 505 | + #define HAL_UART_RX_BUF_SIZE 170 506 | + #define HAL_UART_TX_BUF_SIZE 120 507 | + #define HAL_UART_IDLE_TIMEOUT 5 508 | +#endif 509 | 510 | /* Restart system from absolute beginning 511 | * Disables interrupts, forces WatchDog reset 512 | diff --git a/Projects/zstack/ZMain/TI2538ZNP/ZMain.c b/Projects/zstack/ZMain/TI2538ZNP/ZMain.c 513 | index 5febd92..b2d54d3 100644 514 | --- a/Projects/zstack/ZMain/TI2538ZNP/ZMain.c 515 | +++ b/Projects/zstack/ZMain/TI2538ZNP/ZMain.c 516 | @@ -48,6 +48,10 @@ 517 | #include "OnBoard.h" 518 | #include "ZMAC.h" 519 | 520 | +#ifdef MODKAMRU_V3 521 | + #include "hal_led.h" 522 | +#endif 523 | + 524 | #ifndef NONWK 525 | #include "AF.h" 526 | #endif 527 | @@ -161,6 +165,13 @@ int main( void ) 528 | WatchDogEnable( WDTIMX ); 529 | #endif 530 | 531 | +#ifdef MODKAMRU_V3 532 | + // Test all LEDs 533 | + MODKAM_LED_BLINK_LONG(HAL_LED_ALL); 534 | + // Power LED on 535 | + MODKAM_LED_ON(HAL_LED_1); 536 | +#endif 537 | + 538 | osal_start_system(); /* No Return from here */ 539 | 540 | return 0; /* Shouldn't get here. */ 541 | diff --git a/Projects/zstack/ZNP/Source/znp.cfg b/Projects/zstack/ZNP/Source/znp.cfg 542 | index 2b8d56d..36b3a2c 100644 543 | --- a/Projects/zstack/ZNP/Source/znp.cfg 544 | +++ b/Projects/zstack/ZNP/Source/znp.cfg 545 | @@ -107,3 +107,39 @@ 546 | -DMT_APP_FUNC 547 | -DMT_APP_CNF_FUNC 548 | 549 | +//Additional flags 550 | +-DMODKAMRU_V3 551 | + 552 | +-DINCLUDE_REVISION_INFORMATION 553 | +-DMT_SYS_KEY_MANAGEMENT=1 554 | +-DTP2_LEGACY_ZC 555 | +-DMULTICAST_ENABLED=FALSE 556 | + 557 | +//-DHAL_PA_LNA 558 | +-DHAL_PA_LNA_CC2592 559 | +-DHAL_LED=TRUE 560 | +-DBLINK_LEDS 561 | +-DHAL_LCD=FALSE 562 | + 563 | + 564 | +/* Large netrowk optimizations (MTO, Source Routing) */ 565 | +-DINT_HEAP_LEN=12288 566 | +-DZDSECMGR_TC_DEVICE_MAX=200 567 | +-DNWK_MAX_DEVICE_LIST=100 568 | +-DCONCENTRATOR_ENABLE=TRUE 569 | +-DCONCENTRATOR_DISCOVERY_TIME=120 570 | +-DMAX_RTG_SRC_ENTRIES=400 571 | +-DMAX_NEIGHBOR_ENTRIES=100 572 | +-DSRC_RTG_EXPIRY_TIME=10 573 | +-DCONCENTRATOR_ROUTE_CACHE=TRUE 574 | +-DMTO_RREQ_LIMIT_TIME=5000 575 | + 576 | +-DLINK_DOWN_TRIGGER=6 577 | +-DNWK_ROUTE_AGE_LIMIT=12 578 | +-DBCAST_DELIVERY_TIME=100 579 | +-DMAX_BCAST=12 580 | +//-DDEF_NWK_RADIUS=15 581 | +//-DDEFAULT_ROUTE_REQUEST_RADIUS=8 582 | +-DROUTE_DISCOVERY_TIME=13 583 | +//-DZDNWKMGR_MIN_TRANSMISSIONS=0 584 | +-DNWK_LINK_STATUS_PERIOD=60 585 | diff --git a/Projects/zstack/ZNP/Source/znp_app.c b/Projects/zstack/ZNP/Source/znp_app.c 586 | index 31b115e..ad68b55 100644 587 | --- a/Projects/zstack/ZNP/Source/znp_app.c 588 | +++ b/Projects/zstack/ZNP/Source/znp_app.c 589 | @@ -67,6 +67,10 @@ 590 | #include "zcl.h" 591 | #endif 592 | 593 | +#ifdef MODKAMRU_V3 594 | + #include "hal_led.h" 595 | +#endif 596 | + 597 | /* ------------------------------------------------------------------------------------------------ 598 | * Local Functions 599 | * ------------------------------------------------------------------------------------------------ 600 | @@ -156,6 +160,10 @@ void znpInit(uint8 taskId) 601 | */ 602 | uint16 znpEventLoop(uint8 taskId, uint16 events) 603 | { 604 | +#ifdef MODKAMRU_V3 605 | + MODKAM_LED_BLINK_SHORT(HAL_LED_4); 606 | +#endif 607 | + 608 | osal_event_hdr_t *pMsg; 609 | #if !defined CC2531ZNP 610 | uint8 *pBuf; 611 | @@ -406,7 +414,7 @@ static void npInit(void) 612 | MT_UartRegisterTaskID(znpTaskId); 613 | 614 | #ifdef HAL_PA_LNA_CC2592 615 | - ZMacSetTransmitPower(TX_PWR_PLUS_19); 616 | + ZMacSetTransmitPower(TX_PWR_PLUS_22); 617 | #else 618 | ZMacSetTransmitPower(TX_PWR_PLUS_4); 619 | #endif 620 | @@ -508,6 +516,18 @@ static void npBasicRsp(void) 621 | */ 622 | static void npUartCback(uint8 port, uint8 event) 623 | { 624 | +#ifdef MODKAMRU_V3 625 | + // There can be multiple event bits in event argument 626 | + if( 627 | + (event & HAL_UART_RX_FULL) || 628 | + (event & HAL_UART_RX_ABOUT_FULL) || 629 | + (event & HAL_UART_RX_TIMEOUT) 630 | + ){ 631 | + MT_UartProcessZToolData(port, znpTaskId); 632 | + }else if(event & HAL_UART_TX_EMPTY){ 633 | + osal_set_event(znpTaskId, ZNP_UART_TX_READY_EVENT); 634 | + } 635 | +#else 636 | switch (event) { 637 | case HAL_UART_RX_FULL: 638 | case HAL_UART_RX_ABOUT_FULL: 639 | @@ -522,6 +542,7 @@ static void npUartCback(uint8 port, uint8 event) 640 | default: 641 | break; 642 | } 643 | +#endif 644 | } 645 | 646 | /************************************************************************************************** 647 | diff --git a/note.txt b/note.txt 648 | new file mode 100644 649 | index 0000000..c6c23c4 650 | --- /dev/null 651 | +++ b/note.txt 652 | @@ -0,0 +1,13 @@ 653 | +Preprocessor: 654 | + USB: 655 | + - HAL_UART_USB 656 | + - xHAL_UART=TRUE 657 | + - xZNP_ALT 658 | + UART FC: 659 | + - xHAL_UART_USB 660 | + - HAL_UART=TRUE 661 | + - xZNP_ALT 662 | + UART no FC: 663 | + - xHAL_UART_USB 664 | + - HAL_UART=TRUE 665 | + - ZNP_ALT 666 | --------------------------------------------------------------------------------