Merge branch 'master' into develop

This commit is contained in:
Koen Kanters 2021-01-26 15:32:46 +01:00
commit 9f296cdeee
6 changed files with 18 additions and 714 deletions

View File

@ -1,5 +1,11 @@
# 20190523
# CC2530, CC2530_CC2591, CC2530_CC2592, CC2531
## 20190523
- Add CC2530 and CC2530_CC2591 firmware
# 20190425
- Initial version.
## 20190425
- Initial version.
# CC2538_CC2592_MODKAMRU_V3
Available [here](https://github.com/jethome-ru/zigbee-firmware/tree/master/ti/coordinator/cc2538_cc2592#changelog).

View File

@ -24,24 +24,4 @@
# CC2538_CC2592_MODKAMRU_V3
## Setup development environment
1. Download and install [Z-STACK-3.0.2](http://www.ti.com/tool/Z-STACK).
2. Download and install [IAR Embedded Workbench for ARM](https://www.iar.com/iar-embedded-workbench/#!?architecture=Arm).
*NOTE: For IAR Embedded Workbench for ARM you need either the full (paid) version or the 30-days evaluation version.*
## Compiling
1. Copy `firmware_CC2538_CC2592_MODKAMRU_V3.patch` to `Z-Stack 3.0.2`
2. Open Git Bash, go to `Z-Stack 3.0.2` and apply the patch using:
`git apply --reject --whitespace=fix firmware_CC2538_CC2592_MODKAMRU_V3.patch`
3. Open `Z-Stack 3.0.2\Projects\zstack\ZNP\CC2538\ZNP.eww` with IAR Embedded workbench for ARM.
4. Select `CC2538ZNP-Debug` target.
5. Right-click on your target and press options. Go to C/C++ compiler -> preprocessor. Depending on what you want to compile, correct the following symbols in *Defined symbols*:
- to use USB interface: `HAL_UART_USB`, `xHAL_UART=TRUE`, `xZNP_ALT`;
- to use UART interface without flow control: `xHAL_UART_USB`, `HAL_UART=TRUE`, `ZNP_ALT`;
- to use UART interface with flow control enabled: `xHAL_UART_USB`, `HAL_UART=TRUE`, `xZNP_ALT`.
6. Go to Output Converter, check `Generate additional output` checkbox, select `Intel Extended hex` output format and uncheck `Override default` checkbox.
7. Press OK.
8. Right-click on your target and click *Rebuild all*.
9. Once finished, you can find the `ZNP.hex` file in `Z-Stack 3.0.2\Projects\zstack\ZNP\CC2538\CC2538ZNP-Debug\Exe\`.
Available [here](https://github.com/jethome-ru/zigbee-firmware/tree/master/ti/coordinator/cc2538_cc2592#modkam-v3-differences-form-the-original-ti-znp-z-stack-302).

View File

@ -0,0 +1 @@
Firmwares are hosted [here](https://github.com/jethome-ru/zigbee-firmware/tree/master/ti/coordinator/cc2538_cc2592).

View File

@ -1,683 +0,0 @@
diff --git a/Components/bsp/srf06eb_cc2538/drivers/source/bsp.h b/Components/bsp/srf06eb_cc2538/drivers/source/bsp.h
index 38ac3d9..367699d 100644
--- a/Components/bsp/srf06eb_cc2538/drivers/source/bsp.h
+++ b/Components/bsp/srf06eb_cc2538/drivers/source/bsp.h
@@ -81,16 +81,22 @@ extern "C"
#define BSP_3V3_EN GPIO_PIN_4 //!< PB4
// Board LED defines
-#define BSP_LED_BASE GPIO_C_BASE
-#define BSP_LED_1 GPIO_PIN_0 //!< PC0
-#define BSP_LED_2 GPIO_PIN_1 //!< PC1
-#define BSP_LED_3 GPIO_PIN_2 //!< PC2
-#define BSP_LED_4 GPIO_PIN_3 //!< PC3
-#define BSP_LED_ALL (BSP_LED_1 | \
- BSP_LED_2 | \
- BSP_LED_3 | \
- BSP_LED_4) //!< Bitmask of all LEDs
-
+#ifdef MODKAMRU_V3 // Redefine board LEDs
+ #define BSP_LED_BASE GPIO_B_BASE
+ #define BSP_LED_1 GPIO_PIN_1
+ #define BSP_LED_2 GPIO_PIN_2
+ #define BSP_LED_3 GPIO_PIN_3
+ #define BSP_LED_4 GPIO_PIN_4
+ #define BSP_LED_ALL (BSP_LED_1 | BSP_LED_2 | BSP_LED_3 | BSP_LED_4)
+#else //Not a MODKAMRU board
+ #define BSP_LED_BASE GPIO_C_BASE
+ #define BSP_LED_1 GPIO_PIN_0 //!< PC0
+ #define BSP_LED_2 GPIO_PIN_1 //!< PC1
+ #define BSP_LED_3 GPIO_PIN_2 //!< PC2
+ #define BSP_LED_4 GPIO_PIN_3 //!< PC3
+ #define BSP_LED_ALL (BSP_LED_1 | BSP_LED_2 | BSP_LED_3 | BSP_LED_4) //!< Bitmask of all LEDs
+#endif
+
// Board key defines
#define BSP_KEY_DIR_BASE GPIO_C_BASE //!< Base for left/right/up/down
#define BSP_KEY_SEL_BASE GPIO_A_BASE //!< Base for Select
diff --git a/Components/hal/include/hal_led.h b/Components/hal/include/hal_led.h
index bb327f1..f8a88b2 100644
--- a/Components/hal/include/hal_led.h
+++ b/Components/hal/include/hal_led.h
@@ -86,6 +86,19 @@ extern "C"
/*********************************************************************
* GLOBAL VARIABLES
*/
+
+#ifdef MODKAMRU_V3 //LED control helpers
+ /* Dynamically enable/disable LEDs */
+ extern bool gbModkamUseLeds;
+ extern void modkamUseLeds(bool);
+
+ /* LED control macros */
+#define MODKAM_LED_ON(leds) {if(gbModkamUseLeds)HalLedSet(leds,HAL_LED_MODE_ON);}
+#define MODKAM_LED_OFF(leds) {if(gbModkamUseLeds)HalLedSet(leds,HAL_LED_MODE_OFF);}
+#define MODKAM_LED_BLINK(leds,count,duty,duration) {if(gbModkamUseLeds)HalLedBlink(leds,count,duty,duration);}
+#define MODKAM_LED_BLINK_LONG(leds) MODKAM_LED_BLINK(leds,1,90,1000)
+#define MODKAM_LED_BLINK_SHORT(leds) MODKAM_LED_BLINK(leds,1,50,100)
+#endif
/*
* Initialize LED Service.
diff --git a/Components/hal/target/CC2538ZNP/hal_board_cfg.h b/Components/hal/target/CC2538ZNP/hal_board_cfg.h
index 0bc45b5..9f28629 100644
--- a/Components/hal/target/CC2538ZNP/hal_board_cfg.h
+++ b/Components/hal/target/CC2538ZNP/hal_board_cfg.h
@@ -231,7 +231,7 @@ extern unsigned char znpCfg0;
#define HAL_FLASH_WORD_SIZE 4
// Z-Stack uses flash pages for NV
-#define HAL_NV_PAGE_CNT 6
+#define HAL_NV_PAGE_CNT 12
#define HAL_NV_PAGE_BEG (HAL_NV_PAGE_END-HAL_NV_PAGE_CNT+1)
#define HAL_NV_START_ADDR ((FLASH_BASE) + (HAL_NV_PAGE_BEG * HAL_FLASH_PAGE_SIZE))
@@ -280,7 +280,7 @@ extern unsigned char znpCfg0;
*/
/* ----------- RF-frontend Connection Initialization ---------- */
-#if defined HAL_PA_LNA || defined HAL_PA_LNA_CC2590
+#if defined HAL_PA_LNA || defined HAL_PA_LNA_CC2590 || defined HAL_PA_LNA_CC2592
extern void MAC_RfFrontendSetup(void);
#define HAL_BOARD_RF_FRONTEND_SETUP() MAC_RfFrontendSetup()
#else
@@ -300,13 +300,14 @@ extern void MAC_RfFrontendSetup(void);
/* ----------- Board Initialization ---------- */
#define HAL_BOARD_INIT() \
{ \
+ HAL_BOARD_LED_INIT(); \
HAL_BOARD_COMMON_INIT() \
HAL_BOARD_PA_LNA_INIT(); \
HAL_BOARD_RF_FRONTEND_SETUP(); \
}
-#ifdef HAL_PA_LNA
+#if defined HAL_PA_LNA || defined HAL_PA_LNA_CC2592
#define HAL_BOARD_PA_LNA_INIT() st(GPIOPinTypeGPIOOutput(HGM_BASE, HGM_PIN); )
#else
#define HAL_BOARD_PA_LNA_INIT()
@@ -340,15 +341,34 @@ extern void MAC_RfFrontendSetup(void);
}
/* ----------- LED's ---------- */
-#define HAL_TURN_OFF_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, 0)
-#define HAL_TURN_OFF_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, 0)
-#define HAL_TURN_OFF_LED3() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, 0)
-#define HAL_TURN_OFF_LED4() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, 0)
+#ifdef MODKAMRU_V3 //Set LED pins to output mode
+ #define HAL_BOARD_LED_INIT() GPIOPinTypeGPIOOutput(BSP_LED_BASE,BSP_LED_ALL)
+#else
+ #define HAL_BOARD_LED_INIT()
+#endif
+
+#ifdef MODKAMRU_V3 //Redefine LED contorl macros
+ #define HAL_TURN_OFF_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, BSP_LED_1)
+ #define HAL_TURN_OFF_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, BSP_LED_2)
+ #define HAL_TURN_OFF_LED3() GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, BSP_LED_3)
+ #define HAL_TURN_OFF_LED4() GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, BSP_LED_4)
+
+ #define HAL_TURN_ON_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, 0)
+ #define HAL_TURN_ON_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, 0)
+ #define HAL_TURN_ON_LED3() GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, 0)
+ #define HAL_TURN_ON_LED4() GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, 0)
+#else /* Not a MODKAMRU board */
+ #define HAL_TURN_OFF_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, 0)
+ #define HAL_TURN_OFF_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, 0)
+ #define HAL_TURN_OFF_LED3() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, 0)
+ #define HAL_TURN_OFF_LED4() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, 0)
+
+ #define HAL_TURN_ON_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, BSP_LED_1)
+ #define HAL_TURN_ON_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, BSP_LED_2)
+ #define HAL_TURN_ON_LED3() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, BSP_LED_3)
+ #define HAL_TURN_ON_LED4() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, BSP_LED_4)
+#endif
-#define HAL_TURN_ON_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, BSP_LED_1)
-#define HAL_TURN_ON_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, BSP_LED_2)
-#define HAL_TURN_ON_LED3() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, BSP_LED_3)
-#define HAL_TURN_ON_LED4() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, BSP_LED_4)
#define HAL_CLR_GPIO_00() GPIOPinWrite(BSP_LED_BASE, GPIO_PIN_2, 0) // LED3
#define HAL_CLR_GPIO_02() GPIOPinWrite(BSP_LED_BASE, GPIO_PIN_3, 0) // LED4
@@ -357,16 +377,30 @@ extern void MAC_RfFrontendSetup(void);
#define HAL_SET_GPIO_02() GPIOPinWrite(BSP_LED_BASE, GPIO_PIN_3, GPIO_PIN_3) // LED4
/* ----------- Toggle the LEDs ---------- */
-#define HAL_TOGGLE_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_1)))
-#define HAL_TOGGLE_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_2)))
-#define HAL_TOGGLE_LED3() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_3)))
-#define HAL_TOGGLE_LED4() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_4)))
+#ifdef MODKAMRU_V3 //Redefine LED contorl macros
+ #define HAL_TOGGLE_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_1)))
+ #define HAL_TOGGLE_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_2)))
+ #define HAL_TOGGLE_LED3() GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_3)))
+ #define HAL_TOGGLE_LED4() GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_4)))
+#else //Not a MODKAMRU board
+ #define HAL_TOGGLE_LED1() GPIOPinWrite(BSP_LED_BASE, BSP_LED_1, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_1)))
+ #define HAL_TOGGLE_LED2() GPIOPinWrite(BSP_LED_BASE, BSP_LED_2, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_2)))
+ #define HAL_TOGGLE_LED3() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_3, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_3)))
+ #define HAL_TOGGLE_LED4() //GPIOPinWrite(BSP_LED_BASE, BSP_LED_4, ~(GPIOPinRead(BSP_LED_BASE, BSP_LED_4)))
+#endif
/* ----------- Read the LEDs ---------- */
-#define HAL_STATE_LED1() GPIOPinRead(BSP_LED_BASE, BSP_LED_1)
-#define HAL_STATE_LED2() GPIOPinRead(BSP_LED_BASE, BSP_LED_2)
-#define HAL_STATE_LED3() GPIOPinRead(BSP_LED_BASE, BSP_LED_3)
-#define HAL_STATE_LED4() GPIOPinRead(BSP_LED_BASE, BSP_LED_4)
+#ifdef MODKAMRU_V3 //Redefine LED state reading macros
+ #define HAL_STATE_LED1() (!GPIOPinRead(BSP_LED_BASE, BSP_LED_1))
+ #define HAL_STATE_LED2() (!GPIOPinRead(BSP_LED_BASE, BSP_LED_2))
+ #define HAL_STATE_LED3() (!GPIOPinRead(BSP_LED_BASE, BSP_LED_3))
+ #define HAL_STATE_LED4() (!GPIOPinRead(BSP_LED_BASE, BSP_LED_4))
+#else //Not a MODKAMRU board
+ #define HAL_STATE_LED1() GPIOPinRead(BSP_LED_BASE, BSP_LED_1)
+ #define HAL_STATE_LED2() GPIOPinRead(BSP_LED_BASE, BSP_LED_2)
+ #define HAL_STATE_LED3() GPIOPinRead(BSP_LED_BASE, BSP_LED_3)
+ #define HAL_STATE_LED4() GPIOPinRead(BSP_LED_BASE, BSP_LED_4)
+#endif
#define HAL_PUSH_BUTTON1()(PUSH_BTN_POLARITY (GPIOPinRead(BSP_KEY_SEL_BASE, BSP_KEY_SELECT)))
diff --git a/Components/hal/target/CC2538ZNP/hal_led.c b/Components/hal/target/CC2538ZNP/hal_led.c
index 1a6e636..cf560e9 100644
--- a/Components/hal/target/CC2538ZNP/hal_led.c
+++ b/Components/hal/target/CC2538ZNP/hal_led.c
@@ -103,6 +103,18 @@ void HalLedOnOff (uint8 leds, uint8 mode);
* FUNCTIONS - API
***************************************************************************************************/
+#ifdef MODKAMRU_V3 // LED control helpers
+ // Dynamically enable/disable LEDs
+bool gbModkamUseLeds = true;
+void modkamUseLeds(bool enable){
+ gbModkamUseLeds=enable;
+ if(!enable)
+ HalLedSet(HAL_LED_ALL,HAL_LED_MODE_OFF);
+ else
+ HalLedSet(HAL_LED_1,HAL_LED_MODE_ON);// Light on power LED
+}
+#endif
+
/***************************************************************************************************
* @fn HalLedInit
*
diff --git a/Components/hal/target/CC2538ZNP/hal_uart_isr.c b/Components/hal/target/CC2538ZNP/hal_uart_isr.c
index a6ce62b..0e34aec 100644
--- a/Components/hal/target/CC2538ZNP/hal_uart_isr.c
+++ b/Components/hal/target/CC2538ZNP/hal_uart_isr.c
@@ -160,10 +160,17 @@ uint8 HalUARTOpenIsr(uint8 port, halUARTCfg_t *config)
if(config->flowControl)
{
+#ifdef MODKAMRU_V3
+ IOCPinConfigPeriphOutput(GPIO_D_BASE, GPIO_PIN_1, IOC_MUX_OUT_SEL_UART1_RTS);
+ GPIOPinTypeUARTOutput(GPIO_D_BASE, GPIO_PIN_1);
+ IOCPinConfigPeriphInput(GPIO_B_BASE, GPIO_PIN_0, IOC_UARTCTS_UART1);
+ GPIOPinTypeUARTInput(GPIO_B_BASE, GPIO_PIN_0);
+#else
IOCPinConfigPeriphOutput(GPIO_D_BASE, GPIO_PIN_3, IOC_MUX_OUT_SEL_UART1_RTS);
GPIOPinTypeUARTOutput(GPIO_D_BASE, GPIO_PIN_3);
IOCPinConfigPeriphInput(GPIO_B_BASE, GPIO_PIN_0, IOC_UARTCTS_UART1);
GPIOPinTypeUARTInput(GPIO_B_BASE, GPIO_PIN_0);
+#endif
}
IntEnable(HAL_UART_INT_CTRL);
@@ -364,11 +371,14 @@ uint16 HalUARTWriteIsr(uint8 port, uint8 *pBuffer, uint16 length)
cnt = idx - cnt;
}
+#ifdef MODKAMRU_V3
+#else
/* Accept "all-or-none" on write request. */
if (cnt < length)
{
return 0;
}
+#endif
txMT = false;
idx = uartRecord.tx.bufferTail;
diff --git a/Components/mt/MT_SYS.c b/Components/mt/MT_SYS.c
index aa57766..9b3cb3d 100644
--- a/Components/mt/MT_SYS.c
+++ b/Components/mt/MT_SYS.c
@@ -73,7 +73,7 @@
#endif
#if (defined INCLUDE_REVISION_INFORMATION) && ((defined MAKE_CRC_SHDW) || (defined FAKE_CRC_SHDW)) //built for bootloader
#include "hal_flash.h"
- #include "sb_shared.h"
+ //#include "sb_shared.h"
#endif
/******************************************************************************
@@ -515,7 +515,7 @@ static void MT_SysVersion(void)
#endif
osal_memcpy(verStr, (uint8 *)MTVersionString, sizeof(MTVersionString));
-
+/*
#if (defined MAKE_CRC_SHDW) || (defined FAKE_CRC_SHDW) //built for bootloader
HalFlashRead(SBL_SIG_ADDR / HAL_FLASH_PAGE_SIZE,
SBL_SIG_ADDR % HAL_FLASH_PAGE_SIZE,
@@ -537,6 +537,8 @@ static void MT_SysVersion(void)
// SBL is NOT supported
sblRev = 0xFFFFFFFF;
#endif
+*/
+ sblRev = 0xFFFFFFFF;
// Plug the SBL revision indication
UINT32_TO_BUF_LITTLE_ENDIAN(pBuf,sblRev);
diff --git a/Components/mt/MT_UTIL.c b/Components/mt/MT_UTIL.c
index b4a24d8..68d7ceb 100644
--- a/Components/mt/MT_UTIL.c
+++ b/Components/mt/MT_UTIL.c
@@ -921,6 +921,12 @@ static void MT_UtilLedControl(uint8 *pBuf)
/* LED and Mode */
iLed = *pBuf++;
iMode = *pBuf;
+
+#ifdef MODKAMRU_V3
+ if(iMode==0)
+ modkamUseLeds(false);
+ else modkamUseLeds(true);
+#endif
if ( iLed == 1 )
Led = HAL_LED_1;
diff --git a/Components/mt/MT_VERSION.c b/Components/mt/MT_VERSION.c
index f374554..f2e3de9 100644
--- a/Components/mt/MT_VERSION.c
+++ b/Components/mt/MT_VERSION.c
@@ -69,7 +69,7 @@
*****************************************************************************/
const uint8 MTVersionString[] = {
2, /* Transport protocol revision */
- 0, /* Product ID */
+ 2, /* Product ID */
2, /* Software major release number */
7, /* Software minor release number */
2, /* Software maintenance release number */
diff --git a/Components/mt/revision_info.h b/Components/mt/revision_info.h
new file mode 100644
index 0000000..636ccc8
--- /dev/null
+++ b/Components/mt/revision_info.h
@@ -0,0 +1 @@
+#define CODE_REVISION_NUMBER 20200211
\ No newline at end of file
diff --git a/Components/osal/mcu/cc2538/osal_nv.c b/Components/osal/mcu/cc2538/osal_nv.c
index 9275e64..7e2fee5 100644
--- a/Components/osal/mcu/cc2538/osal_nv.c
+++ b/Components/osal/mcu/cc2538/osal_nv.c
@@ -62,7 +62,7 @@
* $PROJ_DIR$\..\..\..\Tools\"Processor Specific Name"\"Specific Name".xcl
*/
#ifndef OSAL_NV_PHY_PER_PG
- #define OSAL_NV_PHY_PER_PG 1
+ #define OSAL_NV_PHY_PER_PG 2
#endif
#define OSAL_NV_PAGES_USED (HAL_NV_PAGE_CNT / OSAL_NV_PHY_PER_PG)
diff --git a/Components/stack/af/AF.c b/Components/stack/af/AF.c
index 5e54237..c88b195 100644
--- a/Components/stack/af/AF.c
+++ b/Components/stack/af/AF.c
@@ -405,10 +405,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
+ 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
@@ -425,6 +433,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/bdb/bdb_FindingAndBinding.c b/Components/stack/bdb/bdb_FindingAndBinding.c
index 1b4f72c..7695d9f 100644
--- a/Components/stack/bdb/bdb_FindingAndBinding.c
+++ b/Components/stack/bdb/bdb_FindingAndBinding.c
@@ -624,6 +624,9 @@ void bdb_ProcessSimpleDesc( zdoIncomingMsg_t *msgPtr )
else
{
//Save the simple desc to don't ask for it again
+#ifdef MODKAMRU_V3
+ bdb_zclSimpleDescClusterListClean( &bdb_FindingBindingTargetSimpleDesc );
+#endif
pCurr->SimpleDescriptor = &bdb_FindingBindingTargetSimpleDesc;
}
(void)extAddr; //dummy
diff --git a/Components/stack/nwk/nwk_globals.c b/Components/stack/nwk/nwk_globals.c
index eb436ae..8b43ae5 100644
--- a/Components/stack/nwk/nwk_globals.c
+++ b/Components/stack/nwk/nwk_globals.c
@@ -71,10 +71,17 @@
* CONSTANTS
*/
// Maximums for the data buffer queue
+#ifdef MODKAMRU_V3
+#define NWK_MAX_DATABUFS_WAITING 80 // Waiting to be sent to MAC
+#define NWK_MAX_DATABUFS_SCHEDULED 50 // Timed messages to be sent
+#define NWK_MAX_DATABUFS_CONFIRMED 50 // Held after MAC confirms
+#define NWK_MAX_DATABUFS_TOTAL 255 // Total number of buffers
+#else
#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
+#endif
// 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/sys/ZGlobals.c b/Components/stack/sys/ZGlobals.c
index d170283..e251f15 100644
--- a/Components/stack/sys/ZGlobals.c
+++ b/Components/stack/sys/ZGlobals.c
@@ -212,7 +212,10 @@ uint8 zgEndDeviceConfiguration = END_DEV_CONFIGURATION;
//
// NOTICE: Before enabling Child Aging make sure to review all the related
// definitions in this file, especially zgNwkParentInformation.
-uint8 zgChildAgingEnable = TRUE;
+/**
+ * Disable child aging, otherwise Xiaomi devices are being kicked off the network.
+ */
+uint8 zgChildAgingEnable = FALSE;
//========== TouchLink NWK configuration ===============
// Values used by Router when starts a network as initiator
diff --git a/Components/stack/zdo/ZDObject.c b/Components/stack/zdo/ZDObject.c
index dcb6efa..29c8adc 100644
--- a/Components/stack/zdo/ZDObject.c
+++ b/Components/stack/zdo/ZDObject.c
@@ -76,6 +76,10 @@
/* HAL */
#include "hal_lcd.h"
+#ifdef MODKAMRU_V3
+#include "hal_led.h"
+#endif
+
/*********************************************************************
* MACROS
*/
@@ -1957,6 +1961,12 @@ void ZDO_ProcessMgmtPermitJoinReq( zdoIncomingMsg_t *inMsg )
#endif
duration = inMsg->asdu[ZDP_MGMT_PERMIT_JOIN_REQ_DURATION];
+
+#ifdef MODKAMRU_V3
+ if(duration==0)
+ MODKAM_LED_OFF(HAL_LED_3)
+ else MODKAM_LED_BLINK(HAL_LED_3,duration/2,50,2000)
+#endif
// Per R21 Spec this field is not longer relevant 2.4.3.3.7.2 (Mgmt_Permit_Joining_req Effect on Receipt)
//tcsig = inMsg->asdu[ZDP_MGMT_PERMIT_JOIN_REQ_TC_SIG];
diff --git a/Components/zmac/ZMAC.h b/Components/zmac/ZMAC.h
index d658113..f4e7142 100644
--- a/Components/zmac/ZMAC.h
+++ b/Components/zmac/ZMAC.h
@@ -458,7 +458,10 @@ typedef enum
TX_PWR_PLUS_16,
TX_PWR_PLUS_17,
TX_PWR_PLUS_18,
- TX_PWR_PLUS_19
+ TX_PWR_PLUS_19,
+ TX_PWR_PLUS_20,
+ TX_PWR_PLUS_21,
+ TX_PWR_PLUS_22
} ZMacTransmitPower_t; // The transmit power in units of -1 dBm.
typedef struct
diff --git a/Projects/zstack/Tools/CC2538DB/CC2538.icf b/Projects/zstack/Tools/CC2538DB/CC2538.icf
index d4c95cc..cb8abf6 100644
--- a/Projects/zstack/Tools/CC2538DB/CC2538.icf
+++ b/Projects/zstack/Tools/CC2538DB/CC2538.icf
@@ -15,7 +15,7 @@ define memory mem with size = 4G;
//
// Define a region for the on-chip program code space.
//
-define region FLASH = mem:[from 0x00200000 to 0x0027C7FF];
+define region FLASH = mem:[from 0x00200000 to 0x002797FF];
//
// Define a region for the OTA CRC structure.
@@ -39,7 +39,7 @@ define region FLASH = mem:[from 0x00200000 to 0x0027C7FF];
// The size of this region MUST MATCH the size defined by "HAL_NV_PAGE_CNT"
// in the file: hal_board_cfg.h
//
-define region NV_MEM = mem:[from 0x0027C800 to 0x0027F7FF];
+define region NV_MEM = mem:[from 0x00279800 to 0x0027F7FF];
//
// Define regions for on-chip factory Commissioning Parameters.
@@ -87,7 +87,7 @@ define region FLASH_LCK = mem:[from 0x0027FFE0 to 0x0027FFFF];
//
// Define a region for the on-chip SRAM.
//
-define region SRAM = mem:[from 0x20004000 to 0x20007FFF];
+define region SRAM = mem:[from 0x20000000 to 0x20007FFF];
//
// Define a block for the heap. The size should be set to something other
diff --git a/Projects/zstack/Tools/CC2538DB/f8wConfig.cfg b/Projects/zstack/Tools/CC2538DB/f8wConfig.cfg
index 9d2c1bf..328cbbb 100644
--- a/Projects/zstack/Tools/CC2538DB/f8wConfig.cfg
+++ b/Projects/zstack/Tools/CC2538DB/f8wConfig.cfg
@@ -119,7 +119,7 @@
-DMAX_POLL_FAILURE_RETRIES=2
/* The number of items in the broadcast table */
--DMAX_BCAST=9
+//-DMAX_BCAST=9
/* The maximum number of groups in the groups table */
-DAPS_MAX_GROUPS=16
diff --git a/Projects/zstack/ZMain/TI2538ZNP/OnBoard.h b/Projects/zstack/ZMain/TI2538ZNP/OnBoard.h
index 02bce67..3271563 100644
--- a/Projects/zstack/ZMain/TI2538ZNP/OnBoard.h
+++ b/Projects/zstack/ZMain/TI2538ZNP/OnBoard.h
@@ -120,10 +120,17 @@ extern uint8 aExtendedAddress[8];
/* SOC defines the ideal sizes in the
* individual _hal_uart_dma/isr.c modules.
*/
-#define HAL_UART_FLOW_THRESHOLD 5
-#define HAL_UART_RX_BUF_SIZE 170
-#define HAL_UART_TX_BUF_SIZE 120
-#define HAL_UART_IDLE_TIMEOUT 5
+#ifdef MODKAMRU_V3
+ #define HAL_UART_FLOW_THRESHOLD 10
+ #define HAL_UART_RX_BUF_SIZE 340
+ #define HAL_UART_TX_BUF_SIZE 240
+ #define HAL_UART_IDLE_TIMEOUT 10
+#else
+ #define HAL_UART_FLOW_THRESHOLD 5
+ #define HAL_UART_RX_BUF_SIZE 170
+ #define HAL_UART_TX_BUF_SIZE 120
+ #define HAL_UART_IDLE_TIMEOUT 5
+#endif
/* Restart system from absolute beginning
* Disables interrupts, forces WatchDog reset
diff --git a/Projects/zstack/ZMain/TI2538ZNP/ZMain.c b/Projects/zstack/ZMain/TI2538ZNP/ZMain.c
index 5febd92..0d3a44f 100644
--- a/Projects/zstack/ZMain/TI2538ZNP/ZMain.c
+++ b/Projects/zstack/ZMain/TI2538ZNP/ZMain.c
@@ -48,6 +48,10 @@
#include "OnBoard.h"
#include "ZMAC.h"
+#ifdef MODKAMRU_V3
+ #include "hal_led.h"
+#endif
+
#ifndef NONWK
#include "AF.h"
#endif
@@ -160,6 +164,13 @@ int main( void )
/* If WDT is used, this is a good place to enable it. */
WatchDogEnable( WDTIMX );
#endif
+
+#ifdef MODKAMRU_V3
+ // Test all LEDs
+ MODKAM_LED_BLINK_LONG(HAL_LED_ALL);
+ // Power LED on
+ MODKAM_LED_ON(HAL_LED_1);
+#endif
osal_start_system(); /* No Return from here */
diff --git a/Projects/zstack/ZNP/Source/znp.cfg b/Projects/zstack/ZNP/Source/znp.cfg
index 2b8d56d..b7fc48a 100644
--- a/Projects/zstack/ZNP/Source/znp.cfg
+++ b/Projects/zstack/ZNP/Source/znp.cfg
@@ -107,3 +107,38 @@
-DMT_APP_FUNC
-DMT_APP_CNF_FUNC
+//Additional flags
+-DMODKAMRU_V3
+
+-DINCLUDE_REVISION_INFORMATION
+-DMT_SYS_KEY_MANAGEMENT=1
+-DTP2_LEGACY_ZC
+-DMULTICAST_ENABLED=FALSE
+
+//-DHAL_PA_LNA
+-DHAL_PA_LNA_CC2592
+-DHAL_LED=TRUE
+-DBLINK_LEDS
+-DHAL_LCD=FALSE
+
+
+/* Large netrowk optimizations (MTO, Source Routing) */
+-DINT_HEAP_LEN=12288
+-DNWK_MAX_DEVICE_LIST=80
+-DCONCENTRATOR_ENABLE=TRUE
+-DCONCENTRATOR_DISCOVERY_TIME=120
+-DMAX_RTG_SRC_ENTRIES=400
+-DMAX_NEIGHBOR_ENTRIES=100
+-DSRC_RTG_EXPIRY_TIME=10
+-DCONCENTRATOR_ROUTE_CACHE=TRUE
+-DMTO_RREQ_LIMIT_TIME=5000
+
+-DLINK_DOWN_TRIGGER=6
+-DNWK_ROUTE_AGE_LIMIT=12
+-DBCAST_DELIVERY_TIME=100
+-DMAX_BCAST=12
+//-DDEF_NWK_RADIUS=15
+//-DDEFAULT_ROUTE_REQUEST_RADIUS=8
+-DROUTE_DISCOVERY_TIME=13
+//-DZDNWKMGR_MIN_TRANSMISSIONS=0
+-DNWK_LINK_STATUS_PERIOD=60
diff --git a/Projects/zstack/ZNP/Source/znp_app.c b/Projects/zstack/ZNP/Source/znp_app.c
index 31b115e..f7ada93 100644
--- a/Projects/zstack/ZNP/Source/znp_app.c
+++ b/Projects/zstack/ZNP/Source/znp_app.c
@@ -67,6 +67,10 @@
#include "zcl.h"
#endif
+#ifdef MODKAMRU_V3
+ #include "hal_led.h"
+#endif
+
/* ------------------------------------------------------------------------------------------------
* Local Functions
* ------------------------------------------------------------------------------------------------
@@ -156,6 +160,10 @@ void znpInit(uint8 taskId)
*/
uint16 znpEventLoop(uint8 taskId, uint16 events)
{
+#ifdef MODKAMRU_V3
+ MODKAM_LED_BLINK_SHORT(HAL_LED_4);
+#endif
+
osal_event_hdr_t *pMsg;
#if !defined CC2531ZNP
uint8 *pBuf;
@@ -406,7 +414,7 @@ static void npInit(void)
MT_UartRegisterTaskID(znpTaskId);
#ifdef HAL_PA_LNA_CC2592
- ZMacSetTransmitPower(TX_PWR_PLUS_19);
+ ZMacSetTransmitPower(TX_PWR_PLUS_22);
#else
ZMacSetTransmitPower(TX_PWR_PLUS_4);
#endif
@@ -508,6 +516,18 @@ static void npBasicRsp(void)
*/
static void npUartCback(uint8 port, uint8 event)
{
+#ifdef MODKAMRU_V3
+ // There can be multiple event bits in event argument
+ if(
+ (event & HAL_UART_RX_FULL) ||
+ (event & HAL_UART_RX_ABOUT_FULL) ||
+ (event & HAL_UART_RX_TIMEOUT)
+ ){
+ MT_UartProcessZToolData(port, znpTaskId);
+ }else if(event & HAL_UART_TX_EMPTY){
+ osal_set_event(znpTaskId, ZNP_UART_TX_READY_EVENT);
+ }
+#else
switch (event) {
case HAL_UART_RX_FULL:
case HAL_UART_RX_ABOUT_FULL:
@@ -522,6 +542,7 @@ static void npUartCback(uint8 port, uint8 event)
default:
break;
}
+#endif
}
/**************************************************************************************************
diff --git a/note.txt b/note.txt
new file mode 100644
index 0000000..91122c7
--- /dev/null
+++ b/note.txt
@@ -0,0 +1,15 @@
+Preprocessor:
+ USB:
+ - HAL_UART_USB
+ - xHAL_UART=TRUE
+ - xZNP_ALT
+ UART FC:
+ - xHAL_UART_USB
+ - HAL_UART=TRUE
+ - xZNP_ALT
+ UART no FC:
+ - xHAL_UART_USB
+ - HAL_UART=TRUE
+ - ZNP_ALT
+
+

View File

@ -1,13 +1,13 @@
# Buttons
The S1 button only changes the state of the green LED.
The S2 button repairs CC2531 (see below)
* S1 button: only changes the state of the green LED.
* S2 button: repairs CC2531 (see below)
# Lights
Short fast blinks (one per second) the router is connecting to a network.
Short long blinks (one per 4 seconds) normal operations.
Three short blinks the router cannot send a report to a coordinator.
* Short fast blinks (one per second) the router is connecting to a network.
* Short long blinks (one per 4 seconds) normal operations.
* Three short blinks the router cannot send a report to a coordinator.
# Pairing
@ -15,5 +15,5 @@ Flash firmware and permit joining to a network on your coordinator.
# Re-pairing
CC2530, CC2531: Power on, wait 2 seconds, power off, repeat this cycle three times.
CC2531: Power on, press and hold down the S2 button for 5 seconds.
* CC2530, CC2531: Power on, wait 2 seconds, power off, repeat this cycle three times.
* CC2531: Power on, press and hold down the S2 button for 5 seconds.