mirror of
https://github.com/Koenkk/Z-Stack-firmware.git
synced 2025-03-02 07:31:06 +01:00
Add firmware for CC2538-CC2592 based USB stick by MODKAM.RU (#144)
* Add firmware for CC2538-CC2592 based USB stick by MODKAM.RU * Add COMPILE_modkamruv3.md * Fix dev tools version * Fix IAR link * Update Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
This commit is contained in:
parent
c82d2865bc
commit
d0e58b6132
@ -1,4 +1,4 @@
|
||||
# Compiling the firmware
|
||||
# CC2530, CC2530_CC2591, CC2530_CC2592, CC2531
|
||||
|
||||
## Setup development environment
|
||||
1. Download and install [Z-STACK-3.0.2](http://www.ti.com/tool/Z-STACK).
|
||||
@ -7,8 +7,8 @@
|
||||
*NOTE: For IAR Embedded Workbench for 8051 you need either the full (paid) version or the 30-days evaluation version.*
|
||||
|
||||
## Compiling
|
||||
1. Copy `firmware.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 firmware.patch --ignore-space-change`.
|
||||
1. Copy `firmware_CC2531_CC2530.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 firmware_CC2531_CC2530.patch --ignore-space-change`.
|
||||
3. Open `Z-Stack 3.0.2\Projects\zstack\ZNP\CC253x\znp.eww` with IAR Embedded workbench for 8051.
|
||||
4. Select the correct target:
|
||||
- For CC2531 select *CC2531 - ZNP-with-SBL*
|
||||
@ -21,3 +21,27 @@
|
||||
7. Press OK.
|
||||
8. Right-click on your target and click *Rebuild all*.
|
||||
9. Once finished, you can find the `CC253(0|1)ZNP-Prod.(hex|bin)` file in `Z-Stack 3.0.2\Projects\zstack\ZNP\CC253x\dev`.
|
||||
|
||||
# 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\`.
|
||||
|
||||
|
BIN
coordinator/Z-Stack_3.0.x/bin/CC2538_CC2592_MODKAMRU_V3.zip
Normal file
BIN
coordinator/Z-Stack_3.0.x/bin/CC2538_CC2592_MODKAMRU_V3.zip
Normal file
Binary file not shown.
@ -0,0 +1,644 @@
|
||||
From 39b182bf308683304840b23b31923ca75849d811 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Gavr <reverieline@gmail.com>
|
||||
Date: Wed, 29 Jan 2020 10:01:25 +0200
|
||||
Subject: [PATCH] Basic MODKAMRU_V3 patch
|
||||
|
||||
|
||||
diff --git a/.gitignore b/.gitignore
|
||||
new file mode 100644
|
||||
index 0000000..8a8c68b
|
||||
--- /dev/null
|
||||
+++ b/.gitignore
|
||||
@@ -0,0 +1,27 @@
|
||||
+*.html
|
||||
+*.txt
|
||||
+!note.txt
|
||||
+*.eww
|
||||
+*.ewd
|
||||
+*.ewp
|
||||
+*.pdf
|
||||
+*.s51
|
||||
+*.xcl
|
||||
+*.exe
|
||||
+*.lib
|
||||
+*.dep
|
||||
+
|
||||
+Accessories/
|
||||
+Components/hal/target/CC2530USB/usb/driver/
|
||||
+_iss/
|
||||
+Tools/
|
||||
+Projects/zstack/Libraries/
|
||||
+Projects/zstack/OTA/Boot/CC2538/Image Boot Manager/
|
||||
+Projects/zstack/Utilities/BootLoad/CC2538_SPI/bin/
|
||||
+Projects/zstack/Utilities/BootLoad/CC2538_UART/bin/
|
||||
+Projects/zstack/ZNP/CC2538/bin/
|
||||
+Projects/zstack/ZNP/CC2538/dev/
|
||||
+Projects/zstack/ZNP/CC253x/bin/
|
||||
+Projects/zstack/ZNP/CC253x/dev/
|
||||
+Projects/zstack/ZNP/CC2538/CC2538ZNP-Debug/
|
||||
+Projects/zstack/ZNP/CC2538/settings/
|
||||
\ No newline at end of file
|
||||
diff --git a/Components/bsp/srf06eb_cc2538/drivers/source/bsp.h b/Components/bsp/srf06eb_cc2538/drivers/source/bsp.h
|
||||
index 38ac3d9..44c0d5b 100644
|
||||
--- a/Components/bsp/srf06eb_cc2538/drivers/source/bsp.h
|
||||
+++ b/Components/bsp/srf06eb_cc2538/drivers/source/bsp.h
|
||||
@@ -81,15 +81,21 @@ 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
|
||||
diff --git a/Components/hal/include/hal_led.h b/Components/hal/include/hal_led.h
|
||||
index bb327f1..846dea2 100644
|
||||
--- a/Components/hal/include/hal_led.h
|
||||
+++ b/Components/hal/include/hal_led.h
|
||||
@@ -87,6 +87,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..3de1993 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))
|
||||
|
||||
@@ -300,6 +300,7 @@ 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(); \
|
||||
@@ -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..d9e461d 100644
|
||||
--- a/Components/mt/MT_UTIL.c
|
||||
+++ b/Components/mt/MT_UTIL.c
|
||||
@@ -922,6 +922,12 @@ static void MT_UtilLedControl(uint8 *pBuf)
|
||||
iLed = *pBuf++;
|
||||
iMode = *pBuf;
|
||||
|
||||
+#ifdef MODKAMRU_V3
|
||||
+ if(iMode==0)
|
||||
+ modkamUseLeds(false);
|
||||
+ else modkamUseLeds(true);
|
||||
+#endif
|
||||
+
|
||||
if ( iLed == 1 )
|
||||
Led = HAL_LED_1;
|
||||
else if ( iLed == 2 )
|
||||
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 20200128
|
||||
\ 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..4bbb646 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/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/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..b2d54d3 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
|
||||
@@ -161,6 +165,13 @@ int main( void )
|
||||
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 */
|
||||
|
||||
return 0; /* Shouldn't get here. */
|
||||
diff --git a/Projects/zstack/ZNP/Source/znp.cfg b/Projects/zstack/ZNP/Source/znp.cfg
|
||||
index 2b8d56d..3de9bd9 100644
|
||||
--- a/Projects/zstack/ZNP/Source/znp.cfg
|
||||
+++ b/Projects/zstack/ZNP/Source/znp.cfg
|
||||
@@ -107,3 +107,14 @@
|
||||
-DMT_APP_FUNC
|
||||
-DMT_APP_CNF_FUNC
|
||||
|
||||
+//Additional flags
|
||||
+-DINCLUDE_REVISION_INFORMATION
|
||||
+-DMT_SYS_KEY_MANAGEMENT=1
|
||||
+-DTP2_LEGACY_ZC
|
||||
+-DHAL_PA_LNA
|
||||
+-DHAL_PA_LNA_CC2592
|
||||
+
|
||||
+-DHAL_LED=TRUE
|
||||
+-DBLINK_LEDS
|
||||
+
|
||||
+-DMODKAMRU_V3
|
||||
\ No newline at end of file
|
||||
diff --git a/Projects/zstack/ZNP/Source/znp_app.c b/Projects/zstack/ZNP/Source/znp_app.c
|
||||
index 31b115e..9575690 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;
|
||||
@@ -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..c6c23c4
|
||||
--- /dev/null
|
||||
+++ b/note.txt
|
||||
@@ -0,0 +1,13 @@
|
||||
+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
|
||||
--
|
||||
2.24.1.windows.2
|
||||
|
Loading…
Reference in New Issue
Block a user