Author: Daniel Heifetz <daniel.heifetz@gmail.com>  2017-01-03 13:40:35
Committer: Daniel Heifetz <daniel.heifetz@gmail.com>  2017-01-03 13:40:35
Parent: dc2d646f1331235fd71a6fb7644c06b0e555bf29 (Original code)
Branch: master
Follows: 
Precedes: 

    - Updated hal_board_cfg.g for cc2530-PI
    - Updated UART BAUD and port
    - Disabled BDB_DEFAULT_TC_REQUIRE_KEY_EXCHANGE
    - Enabled usage of DEFAULT_CHANLIST
    - Allowed indefinite join permission
    - Set maximum TX_POWER

--------------- Components/hal/target/CC2530ZNP/hal_board_cfg.h ---------------
index 5bd7cde..4654c71 100644
@@ -1,7 +1,7 @@
 /**************************************************************************************************
   Filename:       hal_board_cfg.h
-  Revised:        $Date: 2014-11-19 13:29:24 -0800 (Wed, 19 Nov 2014) $
-  Revision:       $Revision: 41175 $
+  Revised:        $Date: 2014-07-10 18:43:27 -0700 (Thu, 10 Jul 2014) $
+  Revision:       $Revision: 39394 $
 
   Description:    Declarations for the CC2530EM used as a ZNP replacement for
                   the CC2520 on MSP platforms (and possibly others.)
@@ -59,20 +59,7 @@
  *                        Note that only one of them can be defined
  * ------------------------------------------------------------------------------------------------
  */
-#define xHAL_PA_LNA
-#define xHAL_PA_LNA_CC2590
-
-
-/* ------------------------------------------------------------------------------------------------
- *                                       Board Indentifier
- *
- *      Define the Board Identifier to HAL_BOARD_CC2530EB_REV13 for SmartRF05 EB 1.3 board
- * ------------------------------------------------------------------------------------------------
- */
-
-#if !defined (HAL_BOARD_CC2530EB_REV17) && !defined (HAL_BOARD_CC2530EB_REV13)
-#define HAL_BOARD_CC2530EB_REV17
-#endif
+//#define HAL_PA_LNA
 
 /* ------------------------------------------------------------------------------------------------
  *                                          Clock Speed
@@ -91,9 +78,8 @@
 #define ZNP_CFG0_32K_OSC         0         /* 32kHz crystal not installed; internal osc. used */
 #define ZNP_CFG1_SPI             1         /* use SPI transport */
 #define ZNP_CFG1_UART            0         /* use UART transport */
-#define ZNP_CFG1_UART_USB        2         /* definition required for CC2531 compatibility */
+#define ZNP_CFG1_UART_USB	 2         /* definition required for CC2531 compatibility. will never be set for CC2530 */
 extern unsigned char znpCfg1;
-extern unsigned char znpCfg0;
 
 
 /* ------------------------------------------------------------------------------------------------
@@ -101,13 +87,10 @@ extern unsigned char znpCfg0;
  * ------------------------------------------------------------------------------------------------
  */
 
-#if defined (HAL_BOARD_CC2530EB_REV17) && !defined (HAL_PA_LNA) && !defined (HAL_PA_LNA_CC2590)
-  #define HAL_NUM_LEDS            3
-#elif defined (HAL_BOARD_CC2530EB_REV13) || defined (HAL_PA_LNA) || defined (HAL_PA_LNA_CC2590)
-  #define HAL_NUM_LEDS            1
-#else
-  #error Unknown Board Indentifier
-#endif
+#define HAL_NUM_LEDS            3
+
+#define ACTIVE_LOW        !
+#define ACTIVE_HIGH       !!    /* double negation forces result to be '1' */
 
 #define HAL_LED_BLINK_DELAY()   st( { volatile uint32 i; for (i=0; i<0x5800; i++) { }; } )
 
@@ -115,21 +98,19 @@ extern unsigned char znpCfg0;
 #define LED1_BV           BV(0)
 #define LED1_SBIT         P1_0
 #define LED1_DDR          P1DIR
-#define LED1_POLARITY     ACTIVE_HIGH
-
-#if defined (HAL_BOARD_CC2530EB_REV17)
-  /* 2 - Red */
-  #define LED2_BV           BV(1)
-  #define LED2_SBIT         P1_1
-  #define LED2_DDR          P1DIR
-  #define LED2_POLARITY     ACTIVE_HIGH
-
-  /* 3 - Yellow */
-  #define LED3_BV           BV(4)
-  #define LED3_SBIT         P1_4
-  #define LED3_DDR          P1DIR
-  #define LED3_POLARITY     ACTIVE_HIGH
-#endif
+#define LED1_POLARITY     ACTIVE_LOW
+
+/* 2 - Blue */
+#define LED2_BV           BV(2)
+#define LED2_SBIT         P1_2
+#define LED2_DDR          P1DIR
+#define LED2_POLARITY     ACTIVE_LOW
+
+/* 3 - Yellow */
+#define LED3_BV           BV(3)
+#define LED3_SBIT         P1_3
+#define LED3_DDR          P1DIR
+#define LED3_POLARITY     ACTIVE_LOW
 
 /* ------------------------------------------------------------------------------------------------
  *                                       GPIO Configuration
@@ -227,31 +208,6 @@ extern unsigned char znpCfg0;
 #define MCU_IO_DIR_OUTPUT_PREP(port, pin)   st( P##port##DIR |= BV(pin); )
 
 /* ------------------------------------------------------------------------------------------------
- *                                    Push Button Configuration
- * ------------------------------------------------------------------------------------------------
- */
-
-#define ACTIVE_LOW        !
-#define ACTIVE_HIGH       !!    /* double negation forces result to be '1' */
-
-/* S1 */
-#define PUSH1_BV          BV(1)
-#define PUSH1_SBIT        P0_1
-
-#if defined (HAL_BOARD_CC2530EB_REV17)
-  #define PUSH1_POLARITY    ACTIVE_HIGH
-#elif defined (HAL_BOARD_CC2530EB_REV13)
-  #define PUSH1_POLARITY    ACTIVE_LOW
-#else
-  #error Unknown Board Indentifier
-#endif
-
-/* Joystick Center Press */
-#define PUSH2_BV          BV(0)
-#define PUSH2_SBIT        P2_0
-#define PUSH2_POLARITY    ACTIVE_HIGH
-
-/* ------------------------------------------------------------------------------------------------
  *                         OSAL NV implemented by internal flash pages.
  * ------------------------------------------------------------------------------------------------
  */
@@ -314,7 +270,7 @@ extern unsigned char znpCfg0;
  */
 
 /* ----------- RF-frontend Connection Initialization ---------- */
-#if defined HAL_PA_LNA || defined HAL_PA_LNA_CC2590
+#if defined HAL_PA_LNA
 extern void MAC_RfFrontendSetup(void);
 #define HAL_BOARD_RF_FRONTEND_SETUP() MAC_RfFrontendSetup()
 #else
@@ -325,67 +281,12 @@ extern void MAC_RfFrontendSetup(void);
 #define PREFETCH_ENABLE()     st( FCTL = 0x08; )
 #define PREFETCH_DISABLE()    st( FCTL = 0x04; )
 
-/* Default powerup with P1_2 as input with pullup. P1_2 is read into znpCfg0 is in "init_board()".
- * 1->0x00 external 32 kHz xosc & 0->0x80 for internal. 
- */
-#define HAL_CLOCK_STABLE()    st( uint8 vOSC_32KHZ = ((znpCfg0 == ZNP_CFG0_32K_XTAL) ? 0x00 : 0x80); \
-                                  while (CLKCONSTA != (CLKCONCMD_32MHZ | vOSC_32KHZ)); )
-
-#if defined CC2530_MK
-#define OSC_32KHZ  0x80
-#else
-/* Default powerup with P1_2 as input with pullup, so 1->0x00 external 32 kHz xosc & 0->0x80 for internal */
-#if (P1_2 == ZNP_CFG0_32K_XTAL)
 #define OSC_32KHZ  0x00 /* external 32 KHz xosc */
-#else
-#define OSC_32KHZ  0x80 /* internal 32 KHz rcosc */
-#endif
-#endif
-
-/* ----------- Board Initialization ---------- */
-#if defined (HAL_BOARD_CC2530EB_REV17) && !defined (HAL_PA_LNA) && !defined (HAL_PA_LNA_CC2590)
-
-#define HAL_BOARD_INIT() st                                      \
-(                                                                \
-  uint8 vOSC_32KHZ = OSC_32KHZ;                                  \
-  uint16 i;                                                      \
-                                                                 \
-  SLEEPCMD &= ~OSC_PD;                        /* turn on 16MHz RC and 32MHz XOSC */                \
-  while (!(SLEEPSTA & XOSC_STB));             /* wait for 32MHz XOSC stable */                     \
-  asm("NOP");                                 /* chip bug workaround */                            \
-  for (i=0; i<504; i++) asm("NOP");           /* Require 63us delay for all revs */                \
-  CLKCONCMD = (CLKCONCMD_32MHZ | vOSC_32KHZ); /* Select 32MHz XOSC and the source for 32K clock */ \
-  while (CLKCONSTA != (CLKCONCMD_32MHZ | vOSC_32KHZ)); /* Wait for the change to be effective */   \
-  SLEEPCMD |= OSC_PD;                         /* turn off 16MHz RC */                              \
-                                                                 \
-  /* Turn on cache prefetch mode */                              \
-  PREFETCH_ENABLE();                                             \
-)
 
-#elif defined (HAL_BOARD_CC2530EB_REV13) || defined (HAL_PA_LNA) || defined (HAL_PA_LNA_CC2590)
+#define HAL_CLOCK_STABLE()    st( while (CLKCONSTA != (CLKCONCMD_32MHZ | OSC_32KHZ)); )
 
-#ifdef HAL_ENABLE_WIFI_COEX_PINS
-#define HAL_BOARD_ENABLE_WIFI_COEX_PINS() st                                      \
-( 															   \
-  /* Set WIFI_TX_DISABLE control P1_6 */							\
-  P1DIR |= BV(6); 								               \
-)
-#else
-#define HAL_BOARD_ENABLE_WIFI_COEX_PINS()
-#endif
-
-#ifdef HAL_ENABLE_SPARE_PINS_AS_OUTPUTS
-#define HAL_BOARD_ENABLE_SPARE_PINS_AS_OUTPUTS() st                                      \
-( 															   \
-  /* Set SPARE_1 control P0_6 */							\
-  P0DIR |= BV(6); 								               \
-  /* Set SPARE_2 control P1_5 */							  \
-  P1DIR |= BV(5); 											 \
-)
-#else
-#define HAL_BOARD_ENABLE_SPARE_PINS_AS_OUTPUTS()
-#endif
 
+/* ----------- Board Initialization ---------- */
 
 #define HAL_BOARD_INIT() st                                      \
 (                                                                \
@@ -402,92 +303,23 @@ extern void MAC_RfFrontendSetup(void);
                                                                  \
   /* Turn on cache prefetch mode */                              \
   PREFETCH_ENABLE();                                             \
-                                                                 \
-  /* set direction for GPIO outputs  */                          \
-  LED1_DDR |= LED1_BV;                                           \
-                                                                 \
-  /* Set PA/LNA HGM control P0_7 */                              \
-  P0DIR |= BV(7);                                                \
-                                                                 \
-  HAL_BOARD_ENABLE_WIFI_COEX_PINS();                             \
-                                                                 \
-  HAL_BOARD_ENABLE_SPARE_PINS_AS_OUTPUTS();                      \
-                                                                 \
-  /* configure tristates */                                      \
-  P0INP |= PUSH2_BV;                                             \
-                                                                 \
   /* setup RF frontend if necessary */                           \
   HAL_BOARD_RF_FRONTEND_SETUP();                                 \
+  HAL_TURN_OFF_LED1();                                           \
+  HAL_TURN_OFF_LED2();                                           \
+  HAL_TURN_OFF_LED3();                                           \
+  LED1_DDR |= LED1_BV;                                           \
+  LED2_DDR |= LED2_BV;                                           \
+  LED3_DDR |= LED3_BV;                                           \
 )
-
-#endif
-
-/* ----------- Debounce ---------- */
-#define HAL_DEBOUNCE(expr)    { int i; for (i=0; i<500; i++) { if (!(expr)) i = 0; } }
-
-/* ----------- Push Buttons ---------- */
-#define HAL_PUSH_BUTTON1()        (PUSH1_POLARITY (PUSH1_SBIT))
-#define HAL_PUSH_BUTTON2()        (PUSH2_POLARITY (PUSH2_SBIT))
-#define HAL_PUSH_BUTTON3()        (0)
-#define HAL_PUSH_BUTTON4()        (0)
-#define HAL_PUSH_BUTTON5()        (0)
-#define HAL_PUSH_BUTTON6()        (0)
-
-/* ----------- LED's ---------- */
-#if defined (HAL_BOARD_CC2530EB_REV17) && !defined (HAL_PA_LNA) && !defined (HAL_PA_LNA_CC2590)
-
-  #define HAL_TURN_OFF_LED1()       st( LED1_SBIT = LED1_POLARITY (0); )
-  #define HAL_TURN_OFF_LED2()       st( LED2_SBIT = LED2_POLARITY (0); )
-  #define HAL_TURN_OFF_LED3()       st( LED3_SBIT = LED3_POLARITY (0); )
-  #define HAL_TURN_OFF_LED4()       HAL_TURN_OFF_LED1()
-
-  #define HAL_TURN_ON_LED1()        st( LED1_SBIT = LED1_POLARITY (1); )
-  #define HAL_TURN_ON_LED2()        st( LED2_SBIT = LED2_POLARITY (1); )
-  #define HAL_TURN_ON_LED3()        st( LED3_SBIT = LED3_POLARITY (1); )
-  #define HAL_TURN_ON_LED4()        HAL_TURN_ON_LED1()
-
-  #define HAL_TOGGLE_LED1()         st( if (LED1_SBIT) { LED1_SBIT = 0; } else { LED1_SBIT = 1;} )
-  #define HAL_TOGGLE_LED2()         st( if (LED2_SBIT) { LED2_SBIT = 0; } else { LED2_SBIT = 1;} )
-  #define HAL_TOGGLE_LED3()         st( if (LED3_SBIT) { LED3_SBIT = 0; } else { LED3_SBIT = 1;} )
-  #define HAL_TOGGLE_LED4()         HAL_TOGGLE_LED1()
-
-  #define HAL_STATE_LED1()          (LED1_POLARITY (LED1_SBIT))
-  #define HAL_STATE_LED2()          (LED2_POLARITY (LED2_SBIT))
-  #define HAL_STATE_LED3()          (LED3_POLARITY (LED3_SBIT))
-  #define HAL_STATE_LED4()          HAL_STATE_LED1()
-
-#elif defined (HAL_BOARD_CC2530EB_REV13) || defined (HAL_PA_LNA) || defined (HAL_PA_LNA_CC2590)
-
-  #define HAL_TURN_OFF_LED1()       st( LED1_SBIT = LED1_POLARITY (0); )
-  #define HAL_TURN_OFF_LED2()       HAL_TURN_OFF_LED1()
-  #define HAL_TURN_OFF_LED3()       HAL_TURN_OFF_LED1()
-  #define HAL_TURN_OFF_LED4()       HAL_TURN_OFF_LED1()
-
-  #define HAL_TURN_ON_LED1()        st( LED1_SBIT = LED1_POLARITY (1); )
-  #define HAL_TURN_ON_LED2()        HAL_TURN_ON_LED1()
-  #define HAL_TURN_ON_LED3()        HAL_TURN_ON_LED1()
-  #define HAL_TURN_ON_LED4()        HAL_TURN_ON_LED1()
-
-  #define HAL_TOGGLE_LED1()         st( if (LED1_SBIT) { LED1_SBIT = 0; } else { LED1_SBIT = 1;} )
-  #define HAL_TOGGLE_LED2()         HAL_TOGGLE_LED1()
-  #define HAL_TOGGLE_LED3()         HAL_TOGGLE_LED1()
-  #define HAL_TOGGLE_LED4()         HAL_TOGGLE_LED1()
-
-  #define HAL_STATE_LED1()          (LED1_POLARITY (LED1_SBIT))
-  #define HAL_STATE_LED2()          HAL_STATE_LED1()
-  #define HAL_STATE_LED3()          HAL_STATE_LED1()
-  #define HAL_STATE_LED4()          HAL_STATE_LED1()
-
-#endif
-
+                        
 /* ----------- XNV ---------- */
-#define XNV_SPI_BEGIN()             st(P1_3 = 0;)
+#define XNV_SPI_BEGIN()             st(P0_6 = 0;)
 #define XNV_SPI_TX(x)               st(U1CSR &= ~0x02; U1DBUF = (x);)
 #define XNV_SPI_RX()                U1DBUF
 #define XNV_SPI_WAIT_RXRDY()        st(while (!(U1CSR & 0x02));)
-#define XNV_SPI_END()               st(P1_3 = 1;)
+#define XNV_SPI_END()               st(P0_6 = 1;)
 
-// The TI reference design uses UART1 Alt. 2 in SPI mode.
 #define XNV_SPI_INIT() \
 st( \
   /* Mode select UART1 SPI Mode as master. */\
@@ -500,25 +332,44 @@ st( \
   /* Set bit order to MSB */\
   U1GCR |= BV(5); \
   \
-  /* Set UART1 I/O to alternate 2 location on P1 pins. */\
-  PERCFG |= 0x02;  /* U1CFG */\
+  /* Set UART1 I/O to alternate 1 location on P0 pins. */\
+  PERCFG = 0xfd;  /* U1CFG */\
   \
   /* Select peripheral function on I/O pins but SS is left as GPIO for separate control. */\
-  P1SEL |= 0xE0;  /* SELP1_[7:4] */\
-  /* P1.1,2,3: reset, LCD CS, XNV CS. */\
-  P1SEL &= ~0x0E; \
-  P1 |= 0x0E; \
-  P1_1 = 0; \
-  P1DIR |= 0x0E; \
+  P0SEL |= 0x38;  /* SELP0_[6:3] */\
+  P0 |= 0x40; \
+  P0DIR |= 0x58; \
   \
-  /* Give UART1 priority over Timer3. */\
-  P2SEL &= ~0x20;  /* PRI2P1 */\
+  /* Give UART1 priority on P0. */\
+  P2DIR &= 0x7f;  /* PRI2P1 */\
+  P2DIR |= 0x40;  /* PRI2P1 */\
   \
   /* When SPI config is complete, enable it. */\
   U1CSR |= 0x40; \
-  /* Release XNV reset. */\
-  P1_1 = 1; \
-)
+)                                                                 
+                                                                 
+                                                                 
+/* ----------- LED's ---------- */
+
+#define HAL_TURN_OFF_LED1()       st( LED1_SBIT = LED1_POLARITY (0); )
+#define HAL_TURN_OFF_LED2()       st( LED2_SBIT = LED2_POLARITY (0); )
+#define HAL_TURN_OFF_LED3()       st( LED3_SBIT = LED3_POLARITY (0); )
+#define HAL_TURN_OFF_LED4()       HAL_TURN_OFF_LED1()
+
+#define HAL_TURN_ON_LED1()        st( LED1_SBIT = LED1_POLARITY (1); )
+#define HAL_TURN_ON_LED2()        st( LED2_SBIT = LED2_POLARITY (1); )
+#define HAL_TURN_ON_LED3()        st( LED3_SBIT = LED3_POLARITY (1); )
+#define HAL_TURN_ON_LED4()        HAL_TURN_ON_LED1()
+
+#define HAL_TOGGLE_LED1()         st( if (LED1_SBIT) { LED1_SBIT = 0; } else { LED1_SBIT = 1;} )
+#define HAL_TOGGLE_LED2()         st( if (LED2_SBIT) { LED2_SBIT = 0; } else { LED2_SBIT = 1;} )
+#define HAL_TOGGLE_LED3()         st( if (LED3_SBIT) { LED3_SBIT = 0; } else { LED3_SBIT = 1;} )
+#define HAL_TOGGLE_LED4()         HAL_TOGGLE_LED1()
+
+#define HAL_STATE_LED1()          (LED1_POLARITY (LED1_SBIT))
+#define HAL_STATE_LED2()          (LED2_POLARITY (LED2_SBIT))
+#define HAL_STATE_LED3()          (LED3_POLARITY (LED3_SBIT))
+#define HAL_STATE_LED4()          HAL_STATE_LED1()
 
 /* ----------- Minimum safe bus voltage ---------- */
 
@@ -571,19 +422,18 @@ st( \
 
 /* Set to TRUE enable LED usage, FALSE disable it */
 #ifndef HAL_LED
-#define HAL_LED FALSE
+#define HAL_LED TRUE
 #endif
 #if (!defined BLINK_LEDS) && (HAL_LED == TRUE)
 #define BLINK_LEDS
 #endif
-
 /* Set to TRUE enable KEY usage, FALSE disable it */
 #ifndef HAL_KEY
 #define HAL_KEY FALSE
 #endif
 
 #ifndef HAL_SPI
-#define HAL_SPI       TRUE
+#define HAL_SPI       FALSE
 #endif
 #define HAL_UART      TRUE
 

---------------------------- Components/mt/MT_SYS.c ----------------------------
index aa57766..b3c9ecc 100644
@@ -1501,6 +1501,7 @@ static void MT_SysGpio(uint8 *pBuf)
   op = (GPIO_Op_t)(*pBuf++);
   val = *pBuf;
 
+#if !CONCENTRATOR_ENABLE   
   switch (op)
   {
     case GPIO_DIR:
@@ -1553,7 +1554,8 @@ static void MT_SysGpio(uint8 *pBuf)
   val |= (GPIO_GET(1)) ? BV(1) : 0;
   val |= (GPIO_GET(2)) ? BV(2) : 0;
   val |= (GPIO_GET(3)) ? BV(3) : 0;
-
+#endif
+  
   /* Build and send back the response */
   MT_BuildAndSendZToolResponse( MT_SRSP_SYS, MT_SYS_GPIO,
                                 sizeof(val), &val);

--------------------------- Components/mt/MT_UART.h ---------------------------
index 5ba3870..a0b8285 100644
@@ -68,11 +68,11 @@ extern "C"
 #endif
 
 #if !defined( MT_UART_DEFAULT_OVERFLOW )
-  #define MT_UART_DEFAULT_OVERFLOW       TRUE
+  #define MT_UART_DEFAULT_OVERFLOW       FALSE
 #endif
 
 #if !defined MT_UART_DEFAULT_BAUDRATE
-#define MT_UART_DEFAULT_BAUDRATE         HAL_UART_BR_38400
+#define MT_UART_DEFAULT_BAUDRATE         HAL_UART_BR_115200
 #endif
 #define MT_UART_DEFAULT_THRESHOLD        MT_UART_THRESHOLD
 #define MT_UART_DEFAULT_MAX_RX_BUFF      MT_UART_RX_BUFF_MAX

-------------------------- Components/mt/MT_VERSION.c --------------------------
index cd8ac81..d13e087 100644
@@ -72,7 +72,7 @@ const uint8 MTVersionString[] = {
                                    0,  /* Product ID */
                                    2,  /* Software major release number */
                                    7,  /* Software minor release number */
-                                   0,  /* Software maintenance release number */
+                                   1,  /* Software maintenance release number */
 #if defined( INCLUDE_REVISION_INFORMATION )
                                    ((CODE_REVISION_NUMBER >> 0)  & 0xFF),
                                    ((CODE_REVISION_NUMBER >> 8)  & 0xFF),

---------------------------- Components/mt/MT_ZDO.c ----------------------------
index 59f700d..d4d57c2 100644
@@ -206,7 +206,7 @@ void MT_ZdoInit(void)
 {
 #ifdef MT_ZDO_CB_FUNC
   /* Register with ZDO for indication callbacks */
-  ZDO_RegisterForZdoCB(ZDO_SRC_RTG_IND_CBID, &MT_ZdoSrcRtgCB);
+  //ZDO_RegisterForZdoCB(ZDO_SRC_RTG_IND_CBID, &MT_ZdoSrcRtgCB);
   ZDO_RegisterForZdoCB(ZDO_CONCENTRATOR_IND_CBID, &MT_ZdoConcentratorIndCB);
   ZDO_RegisterForZdoCB(ZDO_LEAVE_IND_CBID, &MT_ZdoLeaveInd);
   ZDO_RegisterForZdoCB(ZDO_PERMIT_JOIN_CBID, &MT_ZdoPermitJoinInd);

--------------------- Components/stack/bdb/bdb_interface.h ---------------------
index 25f6041..0ade32a 100644
@@ -108,7 +108,7 @@ extern "C"
 #define BDB_DEFAULT_SECONDARY_CHANNEL_SET                  (DEFAULT_CHANLIST ^ 0x07FFF800)      //BDB specification default is: (0x07FFF800 ^ 0x02108800)
 #define BDB_DEFAULT_TC_LINK_KEY_EXCHANGE_METHOD            BDB_TC_LINK_KEY_EXCHANGE_APS_KEY
 #define BDB_DEFAULT_TC_NODE_JOIN_TIMEOUT                   0x0F
-#define BDB_DEFAULT_TC_REQUIRE_KEY_EXCHANGE                TRUE 
+#define BDB_DEFAULT_TC_REQUIRE_KEY_EXCHANGE                FALSE 
 
 #define BDB_DEFAULT_DEVICE_UNAUTH_TIMEOUT                  3000  //Time joining device waits for nwk before attempt association again. In BDB is known as apsSecurityTimeOutPeriod
 

----------------------- Components/stack/sys/ZGlobals.c -----------------------
index e8b58ff..35e40b9 100644
@@ -91,7 +91,7 @@ uint8 zgMaxDataRetries = NWK_MAX_DATA_RETRIES;
 uint8 zgMaxPollFailureRetries = MAX_POLL_FAILURE_RETRIES;
 
 // Default channel list
-uint32 zgDefaultChannelList = 0;
+uint32 zgDefaultChannelList = DEFAULT_CHANLIST;
 
 // Stack profile Id
 uint8 zgStackProfile = STACK_PROFILE_ID;
@@ -254,7 +254,7 @@ uint16 zgApsMinDupRejTableSize = APS_DUP_REJ_ENTRIES;
 // If TRUE, preConfigKey should be configured on all devices on the network
 // If false, it is configured only on the coordinator and sent to other
 // devices upon joining.
-uint8 zgPreConfigKeys = FALSE;
+uint8 zgPreConfigKeys = TRUE;
 
 // The type of link key in use.  This will determine the security
 // policies associated with sending and receiving APS messages.

----------------------- Components/stack/zdo/ZDObject.c -----------------------
index 9409e27..7504956 100644
@@ -1970,10 +1970,10 @@ void ZDO_ProcessMgmtPermitJoinReq( zdoIncomingMsg_t *inMsg )
   //tcsig    = inMsg->asdu[ZDP_MGMT_PERMIT_JOIN_REQ_TC_SIG];
 
   // Per R21 Spec this duration cannot last forever 2.4.3.3.7.2 (Mgmt_Permit_Joining_req Effect on Receipt)
-  if(duration == 0xFF)
+  /*if(duration == 0xFF)
   {
     duration = 0xFE;
-  }
+  }*/
   
   // Set the network layer permit join duration
   stat = (byte) NLME_PermitJoiningRequest( duration );

----------------- Projects/zstack/Tools/CC2530DB/f8wConfig.cfg -----------------
index 3eef12c..47fbee9 100644
@@ -17,46 +17,26 @@
 /* Enable ZigBee-Pro */
 -DZIGBEEPRO
 
+-DHAL_ASSERT_RESET
+-DASSERT_WHILE
+
+-DISR_KEYINTERRUPT
+
 /* Set to 1 to enable security. To disable set to 0 */
 -DSECURE=1
 -DZG_SECURE_DYNAMIC=0
 
 /* Enable the Reflector */
 -DREFLECTOR
-
-/* Default channel is Channel 11 - 0x0B */
-// Channels are defined in the following:
-//         0      : 868 MHz     0x00000001
-//         1 - 10 : 915 MHz     0x000007FE
-//        11 - 26 : 2.4 GHz     0x07FFF800
-//
-//-DMAX_CHANNELS_868MHZ     0x00000001
-//-DMAX_CHANNELS_915MHZ     0x000007FE
-//-DMAX_CHANNELS_24GHZ      0x07FFF800
-//-DDEFAULT_CHANLIST=0x04000000  // 26 - 0x1A
-//-DDEFAULT_CHANLIST=0x02000000  // 25 - 0x19
-//-DDEFAULT_CHANLIST=0x01000000  // 24 - 0x18
-//-DDEFAULT_CHANLIST=0x00800000  // 23 - 0x17
-//-DDEFAULT_CHANLIST=0x00400000  // 22 - 0x16
-//-DDEFAULT_CHANLIST=0x00200000  // 21 - 0x15
-//-DDEFAULT_CHANLIST=0x00100000  // 20 - 0x14
-//-DDEFAULT_CHANLIST=0x00080000  // 19 - 0x13
-//-DDEFAULT_CHANLIST=0x00040000  // 18 - 0x12
-//-DDEFAULT_CHANLIST=0x00020000  // 17 - 0x11
-//-DDEFAULT_CHANLIST=0x00010000  // 16 - 0x10
-//-DDEFAULT_CHANLIST=0x00008000  // 15 - 0x0F
-//-DDEFAULT_CHANLIST=0x00004000  // 14 - 0x0E
-//-DDEFAULT_CHANLIST=0x00002000  // 13 - 0x0D
-//-DDEFAULT_CHANLIST=0x00001000  // 12 - 0x0C
--DDEFAULT_CHANLIST=0x00000800  // 11 - 0x0B
-
 /* Define the default PAN ID.
  *
  * Setting this to a value other than 0xFFFF causes
  * ZDO_COORD to use this value as its PAN ID and
  * Routers and end devices to join PAN with this ID
  */
--DZDAPP_CONFIG_PAN_ID=0xFFFF
+//-DZDAPP_CONFIG_PAN_ID=0x2f4a
+//-DZDAPP_CONFIG_PAN_ID=0xda11
+-DZDAPP_CONFIG_PAN_ID=0xac11
 
 /* Minimum number of milliseconds to hold off the start of the device
  * in the network and the minimum delay between joining cycles.
@@ -71,10 +51,6 @@
  */
 -DEXTENDED_JOINING_RANDOM_MASK=0x007F
 
-/* Minimum number of milliseconds to delay between each beacon request
- * in a joining cycle.
- */
--DBEACON_REQUEST_DELAY=100
 
 /* Mask for the random beacon request delay. This value is masked with the
  * return from osal_rand() to get a random delay time for each joining cycle.
@@ -139,8 +115,8 @@
 -DMAX_BINDING_CLUSTER_IDS=4
 
 /* Default security key. */
--DDEFAULT_KEY="{0}"
-
+-DDEFAULT_KEY="{0xa3, 0xb7, 0x92, 0x31, 0x94, 0xe5, 0x76, 0x98, 0x28, 0x96, 0xab, 0xcb, 0xef, 0x11, 0x25, 0x4f}"
+  
 /* Reset when ASSERT occurs, otherwise flash LEDs */
 //-DASSERT_RESET
 
@@ -163,29 +139,26 @@
 -DRFD_RCVC_ALWAYS_ON=FALSE
 
 /* The number of milliseconds to wait between data request polls to the coordinator. */
--DPOLL_RATE=1000
+-DPOLL_RATE=3000
 
 /* This is used after receiving a data indication to poll immediately
  * for queued messages...in milliseconds.
  */
--DQUEUED_POLL_RATE=100
+-DQUEUED_POLL_RATE=0
 
 /* This is used after receiving a data confirmation to poll immediately
  * for response messages...in milliseconds
  */
--DRESPONSE_POLL_RATE=100
+-DRESPONSE_POLL_RATE=0
 
 /* This is used as an alternate response poll rate only for rejoin request.
  * This rate is determined by the response time of the parent that the device
  * is trying to join.
  */
--DREJOIN_POLL_RATE=440
+-DREJOIN_POLL_RATE=1000
 
 /* Rejoin retry backoff silent period timer duration in milliseconds - default 15 minutes according to HA test spec */
 -DREJOIN_BACKOFF=900000
 
 /* Rejoin retry backoff scan timer duration in milliseconds - default 15 minutes according to HA test spec */
--DREJOIN_SCAN=900000
-
-/* Latest sample apps use LED4 and do not use S1 switch */
--DENABLE_LED4_DISABLE_S1
+-DREJOIN_SCAN=900000
\ No newline at end of file

----------------- Projects/zstack/Tools/CC2530DB/f8wEndev.cfg -----------------
index 7f36d6e..b0c6e51 100644
@@ -19,3 +19,34 @@
 -DMAC_CFG_TX_MAX=6
 -DMAC_CFG_RX_MAX=3
 
+/* Default channel is Channel 11 - 0x0B */
+// Channels are defined in the following:
+//         0      : 868 MHz     0x00000001
+//         1 - 10 : 915 MHz     0x000007FE
+//        11 - 26 : 2.4 GHz     0x07FFF800
+//
+//-DMAX_CHANNELS_868MHZ     0x00000001
+//-DMAX_CHANNELS_915MHZ     0x000007FE
+//-DMAX_CHANNELS_24GHZ      0x07FFF800
+//-DDEFAULT_CHANLIST=0x04000000  // 26 - 0x1A
+//-DDEFAULT_CHANLIST=0x02000000  // 25 - 0x19
+//-DDEFAULT_CHANLIST=0x01000000  // 24 - 0x18
+//-DDEFAULT_CHANLIST=0x00800000  // 23 - 0x17
+//-DDEFAULT_CHANLIST=0x00400000  // 22 - 0x16
+//-DDEFAULT_CHANLIST=0x00200000  // 21 - 0x15
+//-DDEFAULT_CHANLIST=0x00100000  // 20 - 0x14
+//-DDEFAULT_CHANLIST=0x00080000  // 19 - 0x13
+//-DDEFAULT_CHANLIST=0x00040000  // 18 - 0x12
+//-DDEFAULT_CHANLIST=0x00020000  // 17 - 0x11
+//-DDEFAULT_CHANLIST=0x00010000  // 16 - 0x10
+//-DDEFAULT_CHANLIST=0x00008000  // 15 - 0x0F
+//-DDEFAULT_CHANLIST=0x00004000  // 14 - 0x0E
+//-DDEFAULT_CHANLIST=0x00002000  // 13 - 0x0D
+//-DDEFAULT_CHANLIST=0x00001000  // 12 - 0x0C
+//-DDEFAULT_CHANLIST=0x00000800  // 11 - 0x0B
+-DDEFAULT_CHANLIST=0x07FFF800
+
+/* Minimum number of milliseconds to delay between each beacon request
+ * in a joining cycle.
+ */
+-DBEACON_REQUEST_DELAY=500

----------------- Projects/zstack/Tools/CC2530DB/f8wRouter.cfg -----------------
index 24731d8..aa33242 100644
@@ -20,5 +20,52 @@
 -DMAC_CFG_TX_MAX=8
 -DMAC_CFG_RX_MAX=5
 
+/* Default channel is Channel 11 - 0x0B */
+// Channels are defined in the following:
+//         0      : 868 MHz     0x00000001
+//         1 - 10 : 915 MHz     0x000007FE
+//        11 - 26 : 2.4 GHz     0x07FFF800
+//
+//-DMAX_CHANNELS_868MHZ     0x00000001
+//-DMAX_CHANNELS_915MHZ     0x000007FE
+//-DMAX_CHANNELS_24GHZ      0x07FFF800
+//-DDEFAULT_CHANLIST=0x04000000  // 26 - 0x1A
+//-DDEFAULT_CHANLIST=0x02000000  // 25 - 0x19
+//-DDEFAULT_CHANLIST=0x01000000  // 24 - 0x18
+//-DDEFAULT_CHANLIST=0x00800000  // 23 - 0x17
+//-DDEFAULT_CHANLIST=0x00400000  // 22 - 0x16
+//-DDEFAULT_CHANLIST=0x00200000  // 21 - 0x15
+//-DDEFAULT_CHANLIST=0x00100000  // 20 - 0x14
+//-DDEFAULT_CHANLIST=0x00080000  // 19 - 0x13
+//-DDEFAULT_CHANLIST=0x00040000  // 18 - 0x12
+//-DDEFAULT_CHANLIST=0x00020000  // 17 - 0x11
+
+// Default deployment channel
+//-DDEFAULT_CHANLIST=0x00010000  // 16 - 0x10
+
+//-DDEFAULT_CHANLIST=0x00008000  // 15 - 0x0F
+//-DDEFAULT_CHANLIST=0x00004000  // 14 - 0x0E
+
+// Default test channel
+//-DDEFAULT_CHANLIST=0x00002000  // 13 - 0x0D
+
+//-DDEFAULT_CHANLIST=0x00001000  // 12 - 0x0C
+//-DDEFAULT_CHANLIST=0x00000800  // 11 - 0x0B
+-DDEFAULT_CHANLIST=0x07FFF800
+
 /* Router Settings */
 -DRTR_NWK                          // Router Functions
+/* Minimum number of milliseconds to delay between each beacon request
+ * in a joining cycle.
+ */
+-DBEACON_REQUEST_DELAY=100
+
+-DLINK_DOWN_TRIGGER=12
+-DNWK_ROUTE_AGE_LIMIT=30
+-DBCAST_DELIVERY_TIME=100
+-DDEF_NWK_RADIUS=15
+-DDEFAULT_ROUTE_REQUEST_RADIUS=8
+-DROUTE_DISCOVERY_TIME=13
+-DZDNWKMGR_MIN_TRANSMISSIONS=0
+-DNWK_LINK_STATUS_PERIOD=30
+-DMAX_NEIGHBOR_ENTRIES=48 
\ No newline at end of file

-------- Projects/zstack/Utilities/BootLoad/CC2530ZNP/source/sb_main.c --------
index 79ebb82..e253694 100644
@@ -261,11 +261,8 @@ static void sblInit(void)
    */
   HAL_DMA_SET_ADDR_DESC0(&dmaCh0);
 
-#if defined CC2530_MK
-  znpCfg1 = ZNP_CFG1_SPI;
-#else
-  znpCfg1 = P2_0;
-#endif
+  znpCfg1 = ZNP_CFG1_UART;
+
   if (znpCfg1 == ZNP_CFG1_SPI)
   {
     SRDY_CLR();

------------------ Projects/zstack/ZMain/TI2530ZNP/OnBoard.c ------------------
index 310944f..4b8298b 100644
@@ -142,18 +142,8 @@ void InitBoard( uint8 level )
     // Check for Brown-Out reset
     ChkReset();
 
-#if defined CC2531ZNP
     znpCfg1 = ZNP_CFG1_UART;
-#elif defined CC2530_MK
-    znpCfg1 = ZNP_CFG1_SPI;
-    znpCfg0 = ZNP_CFG0_32K_OSC;
-#else
-    znpCfg1 = P2_0;
-    znpCfg0 = P1_2;
-    // Tri-state the 2 CFG inputs after being read (see hal_board_cfg_xxx.h for CFG0.)
-    P1INP |= BV(2);
-    P2INP |= BV(0);
-#endif
+
   }
   else  // !OB_COLD
   {
@@ -264,12 +254,12 @@ uint8 OnBoard_SendKeys( uint8 keys, uint8 state )
  *********************************************************************/
 void OnBoard_KeyCallback ( uint8 keys, uint8 state )
 {
-  uint8 shift;
-  (void)state;
+  //uint8 shift;
+  //(void)state;
 
-  shift = (keys & HAL_KEY_SW_6) ? true : false;
+  // shift = (keys & HAL_KEY_SW_6) ? true : false;
 
-  if ( OnBoard_SendKeys( keys, shift ) != ZSuccess )
+  if ( OnBoard_SendKeys( keys, state ) != ZSuccess )
   {
     // Process SW1 here
     if ( keys & HAL_KEY_SW_1 )  // Switch 1

-------------------- Projects/zstack/ZNP/CC253x/CC2530.ewp --------------------
index 0d19190..65c408b 100644
@@ -303,13 +303,11 @@
         <option>
           <name>CCDefines</name>
           <state>BDB_FINDING_BINDING_CAPABILITY_ENABLED=0</state>
-          <state>TC_LINKKEY_JOIN</state>
           <state>NWK_MAX_DEVICE_LIST=10</state>
-          <state>ZDSECMGR_TC_DEVICE_MAX=30</state>
           <state>ZNP_ENABLED</state>
-          <state>POWER_SAVING</state>
+          <state>ZDSECMGR_TC_DEVICE_MAX=5</state>
           <state>FEATURE_SYSTEM_STATS</state>
-          <state>MT_GP_CB_FUNC</state>
+          <state>ASSERT_RESET</state>
         </option>
         <option>
           <name>CCPreprocFile</name>
@@ -480,6 +478,7 @@
           <state>$PROJ_DIR$\Source</state>
           <state>$PROJ_DIR$\..\Source</state>
           <state>$PROJ_DIR$\..\..\SE\Source</state>
+          <state>$PROJ_DIR$\..\..\Utilities\BootLoad\Source</state>
           <state>$PROJ_DIR$\..\..\ZMain\TI2530ZNP</state>
           <state>$PROJ_DIR$\..\..\..\..\Components\hal\include</state>
           <state>$PROJ_DIR$\..\..\..\..\Components\hal\target\CC2530ZNP</state>
@@ -1448,15 +1447,13 @@
         <option>
           <name>CCDefines</name>
           <state>BDB_FINDING_BINDING_CAPABILITY_ENABLED=0</state>
-          <state>TC_LINKKEY_JOIN</state>
           <state>NWK_MAX_DEVICE_LIST=10</state>
-          <state>ZDSECMGR_TC_DEVICE_MAX=30</state>
           <state>ZNP_ENABLED</state>
-          <state>POWER_SAVING</state>
+          <state>ZDSECMGR_TC_DEVICE_MAX=5</state>
           <state>FEATURE_SYSTEM_STATS</state>
-          <state>MT_GP_CB_FUNC</state>
           <state>ASSERT_RESET</state>
           <state>MAKE_CRC_SHDW</state>
+          <state>HAL_PA_LNA</state>
         </option>
         <option>
           <name>CCPreprocFile</name>
@@ -2113,20 +2110,20 @@
         </option>
         <option>
           <name>GenerateExtraOutput</name>
-          <state>0</state>
+          <state>1</state>
         </option>
         <option>
           <name>XExtraOutOverride</name>
-          <state>0</state>
+          <state>1</state>
         </option>
         <option>
           <name>ExtraOutputFile</name>
-          <state>CC2530.sim</state>
+          <state>ZNP-ProdSbl.hex</state>
         </option>
         <option>
           <name>ExtraOutputFormat</name>
           <version>11</version>
-          <state>60</state>
+          <state>23</state>
         </option>
         <option>
           <name>ExtraFormatVariant</name>

------------------- Projects/zstack/ZNP/CC253x/tools/znp.bat -------------------
index bb0566c..a86992d 100644
@@ -41,6 +41,7 @@ rem ****************************************************************************
 if "%2"=="" goto Usage
 
 :Launch
+e:
 chdir %1
 start znp.js %2
 exit /b

---------------------- Projects/zstack/ZNP/Source/znp.cfg ----------------------
index 2b8d56d..93b0059 100644
@@ -43,6 +43,32 @@
 /* MAC Settings */
 -DMAC_CFG_APP_PENDING_QUEUE=TRUE
 
+/* Default channel is Channel 11 - 0x0B */
+// Channels are defined in the following:
+//         0      : 868 MHz     0x00000001
+//         1 - 10 : 915 MHz     0x000007FE
+//        11 - 26 : 2.4 GHz     0x07FFF800
+//
+//-DMAX_CHANNELS_868MHZ     0x00000001
+//-DMAX_CHANNELS_915MHZ     0x000007FE
+//-DMAX_CHANNELS_24GHZ      0x07FFF800
+//-DDEFAULT_CHANLIST=0x04000000  // 26 - 0x1A
+//-DDEFAULT_CHANLIST=0x02000000  // 25 - 0x19
+//-DDEFAULT_CHANLIST=0x01000000  // 24 - 0x18
+//-DDEFAULT_CHANLIST=0x00800000  // 23 - 0x17
+//-DDEFAULT_CHANLIST=0x00400000  // 22 - 0x16
+//-DDEFAULT_CHANLIST=0x00200000  // 21 - 0x15
+//-DDEFAULT_CHANLIST=0x00100000  // 20 - 0x14
+//-DDEFAULT_CHANLIST=0x00080000  // 19 - 0x13
+//-DDEFAULT_CHANLIST=0x00040000  // 18 - 0x12
+//-DDEFAULT_CHANLIST=0x00020000  // 17 - 0x11
+-DDEFAULT_CHANLIST=0x00010000  // 16 - 0x10
+//-DDEFAULT_CHANLIST=0x00008000  // 15 - 0x0F
+//-DDEFAULT_CHANLIST=0x00004000  // 14 - 0x0E
+//-DDEFAULT_CHANLIST=0x00002000  // 13 - 0x0D
+//-DDEFAULT_CHANLIST=0x00001000  // 12 - 0x0C
+//-DDEFAULT_CHANLIST=0x00000800  // 11 - 0x0B
+//-DDEFAULT_CHANLIST=0x02222800
 /* Generic All-in-One Settings */
 -DZSTACK_DEVICE_BUILD="(DEVICE_BUILD_COORDINATOR | DEVICE_BUILD_ROUTER | DEVICE_BUILD_ENDDEVICE)"
 
@@ -56,20 +82,35 @@
 
 -DZIGBEEPRO
 -DZIGBEE_FRAGMENTATION
--DINTER_PAN
+//-DINTER_PAN
 -DOSAL_CLOCK
 -DOSAL_SAPI=FALSE
 -DSAPI_CB_FUNC=FALSE
 
--DHOLD_AUTO_START
 -DNV_RESTORE
 -DNV_INIT
 -DNUM_DISC_ATTEMPTS=0
 
-//-DSRC_RTG_EXPIRY_TIME=255
-//-DCONCENTRATOR_ENABLE=TRUE
-//-DCONCENTRATOR_DISCOVERY_TIME=60
-//-DMAX_RTG_SRC_ENTRIES=100
+-DBEACON_REQUEST_DELAY=100
+
+
+-DMAXMEMHEAP=1900
+-DNWK_MAX_DEVICE_LIST=10
+-DCONCENTRATOR_ENABLE=TRUE
+-DCONCENTRATOR_DISCOVERY_TIME=120
+-DMAX_RTG_SRC_ENTRIES=100
+-DSRC_RTG_EXPIRY_TIME=2
+//-DCONCENTRATOR_ROUTE_CACHE
+-DMTO_RREQ_LIMIT_TIME=5000
+-DLINK_DOWN_TRIGGER=12
+-DNWK_ROUTE_AGE_LIMIT=30
+-DBCAST_DELIVERY_TIME=100
+-DDEF_NWK_RADIUS=15
+-DDEFAULT_ROUTE_REQUEST_RADIUS=12
+-DROUTE_DISCOVERY_TIME=13
+-DZDNWKMGR_MIN_TRANSMISSIONS=0
+-DNWK_LINK_STATUS_PERIOD=30
+-DLQI_ADJUST
 
 // Define this flag to enable ZNP implementation of the ZCL_KEY_ESTABLISHMENT_ENDPOINT and task.
 //-DTC_LINKKEY_JOIN
@@ -100,10 +141,7 @@
 -DMT_ZDO_MGMT
 -DMT_ZDO_EXTENSIONS
 
-/* MT_GP GreenPower interface */
--DMT_GP_CB_FUNC
-
 /* MT_APP interface - useful when ZAP defines ZAP_ZNP_MT for MT_SYS_APP_MSG pass-through. */
 -DMT_APP_FUNC
--DMT_APP_CNF_FUNC
 
+-DZNP_ALT
\ No newline at end of file

--------------------- Projects/zstack/ZNP/Source/znp_app.c ---------------------
index e461086..9744b34 100644
@@ -134,6 +134,7 @@ void znpInit(uint8 taskId)
   znpBasicRspRate = ZNP_BASIC_RSP_RATE;
   (void)osal_start_reload_timer(taskId, ZNP_BASIC_RSP_EVENT, ZNP_BASIC_RSP_RATE);
 #endif
+  TXPOWER=0xf5;
 }
 
 /**************************************************************************************************
