Merge pull request #253 from Koenkk/develop

Develop
This commit is contained in:
Koen Kanters 2021-02-01 18:03:21 +01:00 committed by GitHub
commit 06f9acda3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 5420 additions and 147 deletions

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2018 Koen Kanters
Copyright (c) 2018-2021 Koen Kanters
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,2 @@
# Z-Stack-firmware
This reposistory contains:
- Compiled Z-Stack firmwares (`.hex` files)
- If you want to use these to flash to your CC253X (using the [Flash Programmer (not v2)](http://www.ti.com/tool/FLASH-PROGRAMMER) for example).
- If you want to use these to flash to your CC2652R (using the [Flash Programmer v2](http://www.ti.com/tool/FLASH-PROGRAMMER) for example).
- Instructions on how to compile them
This repository contains compilation instructions and compiled Z-Stack firmwares for the Texas Instruments CC2530, CC2531, CC2538, CC1352P, CC2652R and CC2652RB.

View File

@ -1,5 +1,5 @@
# Z-Stack coordinator firmwares
This repository contains various Z-Stack coordinator firmwares.
This directory contains various Z-Stack coordinator firmwares.
## Overiew
<table>
@ -70,7 +70,7 @@ This repository contains various Z-Stack coordinator firmwares.
</tr>
<tr>
<td rowspan="2">Z-Stack_3.x.0</td>
<td>CC26X2R1, CC1352P_2</td>
<td>CC2652R, CC2652RB, CC1352P-2</td>
<td>3.0</td>
<td>50</td>
<td>100/200</td>
@ -82,11 +82,11 @@ This repository contains various Z-Stack coordinator firmwares.
</tr>
</table>
### I'm a Zigbee2MQTT user, which one should I use?
### I'm using a CC2530 or CC2531, which firmware should I use?
This depends:
- Zigbee 3.0 coordinators are only recommended for CC26X2R1 and CC1352P_2 (other devices might not be powerful enough)
- If you have a network of 1 - 30 devices, the Z-Stack_Home_1.2 **default** firmware is recommended.
- If you have a network of 30+ devices, the Z-Stack_Home_1.2 **source routing** firmware is recommended.
- Zigbee 3.0 firmwares are **not** recommended for the CC2530 and CC2531 (since those are not powerful enough)
- If you have a network of 1 - 15 devices, the Z-Stack_Home_1.2 **default** firmware is recommended.
- If you have a network of 15+ devices, the Z-Stack_Home_1.2 **source routing** firmware is recommended.
- Note that the **source routing** firmware only supports 5 direct children, therefore you need to have routers in range of the coordinator.
### Legend

View File

@ -1,3 +1,9 @@
# 20210120
- Optimize network parameters (according to https://www.ti.com/lit/an/swra650b/swra650b.pdf)
- Change default CC2652R/CC2652RB/CC1352P-2/CC2652P transmit power from 0dBm to 5dBm
- Potential fix for Hue end devices disconnecting
- SimpleLink SDK 4.40.00.44 ([changelog](http://software-dl.ti.com/simplelink/esd/simplelink_cc13x2_26x2_sdk/4.40.00.44/exports/changelog.html))
# 20201026
- SimpleLink SDK 4.30.00.54 ([changelog](http://software-dl.ti.com/simplelink/esd/simplelink_cc13x2_26x2_sdk/4.30.00.54/exports/changelog.html))
- Expose `AssocAdd` function

View File

@ -1,14 +1,24 @@
# Compiling the firmware
## Setup development environment
1. Download and install [SIMPLELINK-CC13X2-26X2-SDK_4.30.00.54](http://www.ti.com/tool/download/SIMPLELINK-CC13X2-26X2-SDK).
1. Download and install [Code Composer Studio 10.1.1.00004](http://www.ti.com/tool/CCSTUDIO).
1. Download and install [SIMPLELINK-CC13X2-26X2-SDK_4.40.00.44](http://www.ti.com/tool/download/SIMPLELINK-CC13X2-26X2-SDK).
1. Download and install [Code Composer Studio 10.2.0.00009](http://www.ti.com/tool/CCSTUDIO).
## Compiling
1. Start Code Composer Studio
1. Go to *File -> Import -> Code Composer Studio -> CCS Projects -> Select* search-directory: `simplelink_cc13x2_26x2_sdk_4_20_00_35/examples/rtos`. Select `znp_CC26X2R1_LAUNCHXL_tirtos_css`, `znp_CC1352P_2_LAUNCHXL_tirtos_css` and `znp_CC2652RB_LAUNCHXL_tirtos_css`. Press *Finish*.
1. Go to *File -> Import -> Code Composer Studio -> CCS Projects -> Select* search-directory: `simplelink_cc13x2_26x2_sdk_4_40_00_44/examples/rtos`. Select `znp_CC26X2R1_LAUNCHXL_tirtos_css`, `znp_CC1352P_2_LAUNCHXL_tirtos_css` and `znp_CC2652RB_LAUNCHXL_tirtos_css`. Press *Finish*.
1. In Code Composer Studio, expand the 3 projects and for each open `znp.syscfg`, change `Minimal Poll Period (ms)` to `1000`, change it back to `100` immediately and save the file.
1. Go to your CCS workspace and copy `firmware.patch` to the root.
1. Open Git Bash, go to your CCS root and apply the patch using `git apply firmware.patch --ignore-space-change`.
1. Build both projects; right click -> *Build project*.
1. Once finished, the firmware can be found under `znp_[CC26X2R1/CC1352P_2/CC2652RB]_LAUNCHXL_tirtos_ccs/default/znp_[CC26X2R1/CC1352P_2]_LAUNCHXL_tirtos_ccs.hex`
1. **Only** for `znp_CC1352P_2_LAUNCHXL_tirtos_css`:
- Right click on `znp.syscfg` -> *Delete*
- Right click on `znp_CC1352P_2_LAUNCHXL_tirtos_css` -> *Properties*.
- Go to *(CCS) Build* - *ARM Compiler* - *Include Options* -> Under *Add dir to #include search path (--include_path, -l)* add `${PROJECT_ROOT}/syscfg` as the **last** entry.
- Go to *(CCS) Build* - *ARM Linker* - *File Search Path* -> Under *Include library file or command file as input (--library, -l)* change `${PROJECT_BUILD_DIR}/syscfg/ti_utils_build_linker.cmd.genlibs` to `${PROJECT_ROOT}/syscfg/ti_utils_build_linker.cmd.genlibs`
1. Build the 3 projects; right click -> *Build project*.
- **Important:** by default the **launchpad** variant of the CC1352P2_CC2652P (= `znp_CC1352P_2_LAUNCHXL_tirtos_ccs`) is build. To build the **other** variant comment `#define LAUNCHPAD_CONFIG 1` in `preinclude.h` (located under `Stack/Config/`), don't forget to save.
1. Once finished, the firmware can be found under `znp_[CC26X2R1/CC1352P_2/CC2652RB]_LAUNCHXL_tirtos_ccs/default/znp_[CC26X2R1/CC2652RB/CC1352P_2]_LAUNCHXL_tirtos_ccs.hex`
- `znp_CC26X2R1_LAUNCHXL_tirtos_ccs.hex` -> CC2652R
- `znp_CC2652RB_LAUNCHXL_tirtos_ccs.hex` -> CC2652RB
- `znp_CC1352P_2_LAUNCHXL_tirtos_ccs.hex` -> CC1352P-2 and CC2652P

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,101 @@
# Tested adapters
**WARNING:** Make sure you flash the correct firmware! Flashing the **wrong** firmware might lock your bootloader preventing future flashing. If you are a Zigbee2MQTT user and don't know what to pick click the **Coordinator firmware** link of your adapter on: https://www.zigbee2mqtt.io/information/supported_adapters.html.
<table>
<thead>
<tr>
<th>Adapter</th>
<th>TI Chip/Module Used</th>
<th>Firmware to Flash</th>
<th>BSL Trigger Pin (1)</th>
<th>Auto-BSL (2)</th>
<th>RF Switch Control Pins (3)</th>
<th>LED(s)</th>
</tr>
</thead>
<tbody>
<tr>
<td>TI LAUNCHXL-CC26xR1</td>
<td>CC2652R</td>
<td>CC2652R_*.zip<br></td>
<td>DIO_13</td>
<td>No</td>
<td>N/A</td>
<td>DIO_6 (Red)<br>DIO_7 (Green)<br></td>
</tr>
<tr>
<td>TI LAUNCHXL-CC1352P-2</td>
<td>CC1352P</td>
<td>CC1352P2_CC2652P_launchpad_*.zip</td>
<td>DIO_15</td>
<td>No</td>
<td>DIO_28: 2.4Ghz<br>DIO_29: 20dBm PA<br>DIO_30: Sub-1GHz</td>
<td>DIO_6 (Red)<br>DIO_7 (Green)<br></td>
</tr>
<tr>
<td>Electrolama zzh</td>
<td>CC2652R</td>
<td>CC2652R_*.zip</td>
<td>DIO_13</td>
<td>No</td>
<td>N/A</td>
<td>DIO_7 (Pink)</td>
</tr>
<tr>
<td>Electrolama zzhp-lite</td>
<td>CC2652P<br>(Ebyte E72)<br></td>
<td>CC1352P2_CC2652P_other_*.zip</td>
<td>DIO_15</td>
<td>Yes</td>
<td>DIO_5: 20dBm PA ??<br>DIO_6: 2.4GHz ??<br></td>
<td>DIO_7 (Pink)</td>
</tr>
<tr>
<td>Electrolama zzhp</td>
<td>CC2652P</td>
<td>CC1352P2_CC2652P_other_*.zip</td>
<td>DIO_15</td>
<td>Yes</td>
<td>DIO_5: 20dBm PA ??<br>DIO_6: 2.4GHz ??</td>
<td>DIO_7 (Pink)</td>
</tr>
<tr>
<td>Electrolama zoe2</td>
<td>CC1352P<br>(Ebyte E79)<br></td>
<td>CC1352P2_CC2652P_other_*.zip</td>
<td>DIO_15</td>
<td>No</td>
<td>DIO_5: 20dBm PA ??<br>DIO_6: 2.4GHz ??</td>
<td>DIO_7 (Pink)</td>
</tr>
<tr>
<td>slaesh's CC2652RB stick</td>
<td>CC2652RB</td>
<td>CC2652RB_*.zip</td>
<td>DIO_13</td>
<td>Yes</td>
<td>N/A</td>
<td>DIO_7</td>
</tr>
<tr>
<td>ZigStar<br></td>
<td>CC2652P<br>(RFSTAR RF-BM-2652P2)<br></td>
<td>CC1352P2_CC2652P_launchpad_*.zip</td>
<td>DIO_15</td>
<td>Only for CH340C ver.</td>
<td>DIO_28: 2.4Ghz<br>DIO_29: 20dBm PA</td>
<td>DIO_6 (Green)<br>DIO_7 (Red)<br></td>
</tr>
<tr>
<td>Zigbeer E72 by Egony</td>
<td>CC2652P<br>(Ebyte E72)</td>
<td>CC1352P2_CC2652P_other_*.zip</td>
<td>DIO_15</td>
<td>No</td>
<td>DIO_5: 20dBm PA<br>DIO_6: 2.4GHz</td>
<td>DIO_8 (Green)<br>DIO_7 (Red)<br></td>
</tr>
</tbody>
</table>

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,8 @@
# 20201127/20201128
- Fix join failing after some uptime
- Support PGC410EU
- Fix incorrect route usage with source routing firmware
# 20190619
- Make source routing firmware identical to 20190315 MAX_STABILITY

View File

@ -1,3 +1,23 @@
From 79b43ef6bb5d3ab40e60c26f1419ba6143559d48 Mon Sep 17 00:00:00 2001
From: Koen Kanters <koenkanters94@gmail.com>
Date: Tue, 28 Jul 2020 19:39:55 +0200
Subject: [PATCH 1/1] Own changes
---
.../hal/target/CC2530ZNP/hal_board_cfg.h | 6 +-
Components/mt/MT_SYS.c | 16 +++
Components/mt/revision_info.h | 1 +
Components/stack/af/AF.c | 26 +++-
Components/stack/zdo/ZDApp.c | 10 +-
Components/stack/zdo/ZDSecMgr.c | 17 +++
Projects/zstack/ZMain/TI2530ZNP/OnBoard.c | 9 ++
.../zstack/ZNP/CC253x/Source/preinclude.h | 123 ++++++++++++++++++
Projects/zstack/ZNP/Source/znp.cfg | 4 +-
Projects/zstack/ZNP/Source/znp_app.c | 22 +++-
10 files changed, 223 insertions(+), 11 deletions(-)
create mode 100644 Components/mt/revision_info.h
create mode 100644 Projects/zstack/ZNP/CC253x/Source/preinclude.h
diff --git a/Components/hal/target/CC2530ZNP/hal_board_cfg.h b/Components/hal/target/CC2530ZNP/hal_board_cfg.h
index 0459c86..1e40362 100644
--- a/Components/hal/target/CC2530ZNP/hal_board_cfg.h
@ -65,13 +85,13 @@ index 35aae57..1f8ee82 100644
diff --git a/Components/mt/revision_info.h b/Components/mt/revision_info.h
new file mode 100644
index 0000000..abe513b
index 0000000..f9343d6
--- /dev/null
+++ b/Components/mt/revision_info.h
@@ -0,0 +1 @@
+#define CODE_REVISION_NUMBER 20190619
+#define CODE_REVISION_NUMBER 20201128
diff --git a/Components/stack/af/AF.c b/Components/stack/af/AF.c
index c6183b6..2b885b6 100644
index c6183b6..128b194 100644
--- a/Components/stack/af/AF.c
+++ b/Components/stack/af/AF.c
@@ -372,10 +372,18 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16 Src
@ -110,11 +130,37 @@ index c6183b6..2b885b6 100644
else if ( (epDesc = afFindEndPointDesc( aff->DstEndPoint )) )
{
pList = afFindEndPointDescList( epDesc->endPoint );
@@ -422,7 +436,9 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16 Src
// if the Wildcard ProfileID is received the message should not be sent to ZDO endpoint
if ( (aff->ProfileID == epProfileID) ||
((epDesc->endPoint == ZDO_EP) && (aff->ProfileID == ZDO_PROFILE_ID)) ||
- ((epDesc->endPoint != ZDO_EP) && ( aff->ProfileID == ZDO_WILDCARD_PROFILE_ID )) )
+ ((epDesc->endPoint != ZDO_EP) && ( aff->ProfileID == ZDO_WILDCARD_PROFILE_ID )) ||
+ // Fix below is to support PGC410EU: https://github.com/Koenkk/zigbee2mqtt/issues/4055
+ ((epDesc->endPoint == 2) && ( aff->ProfileID == 0xFC01 )) )
{
// Save original endpoint
uint8 endpoint = aff->DstEndPoint;
diff --git a/Components/stack/zdo/ZDApp.c b/Components/stack/zdo/ZDApp.c
index 242be04..cca4781 100644
index 242be04..cfad5e9 100644
--- a/Components/stack/zdo/ZDApp.c
+++ b/Components/stack/zdo/ZDApp.c
@@ -3463,7 +3463,7 @@ void ZDApp_NVUpdate( void )
@@ -3148,6 +3148,14 @@ void ZDO_NetworkStatusCB( uint16 nwkDstAddr, uint8 statusCode, uint16 dstAddr )
// Routing error for dstAddr, this is informational and a Route
// Request should happen automatically.
}
+
+ if ( (nwkDstAddr == NLME_GetShortAddr())
+ && (statusCode == NWKSTAT_SOURCE_ROUTE_FAILURE) )
+ {
+ // Received a source route failure, remove route and rediscover.
+ RTG_RemoveRtgEntry( dstAddr, 0 );
+ NLME_RouteDiscoveryRequest( dstAddr, 0, 30 );
+ }
}
/******************************************************************************
@@ -3463,7 +3471,7 @@ void ZDApp_NVUpdate( void )
*/
uint16 ZDApp_CoordStartPANIDConflictCB( uint16 panid )
{
@ -123,6 +169,68 @@ index 242be04..cca4781 100644
}
/*********************************************************************
diff --git a/Components/stack/zdo/ZDSecMgr.c b/Components/stack/zdo/ZDSecMgr.c
index 2eacc11..a910a06 100644
--- a/Components/stack/zdo/ZDSecMgr.c
+++ b/Components/stack/zdo/ZDSecMgr.c
@@ -42,6 +42,8 @@ extern "C"
{
#endif
+#define SLEEP(_count) do {volatile uint32 count = (_count); while (count--);} while (0)
+
/******************************************************************************
* INCLUDES
*/
@@ -1114,14 +1116,22 @@ ZStatus_t ZDSecMgrDeviceJoin( ZDSecMgrDevice_t* device )
ZStatus_t status = ZSuccess;
uint16 ami;
+ // Add sleeps, see https://github.com/Koenkk/zigbee2mqtt/issues/3177
+ SLEEP(0x3E8);
+
// attempt to validate device that joined/rejoined without security
if ( device->secure == FALSE )
{
+ SLEEP(0x3E8);
status = ZDSecMgrDeviceValidate( device );
}
+
+ SLEEP(0x3E8);
if ( status == ZSuccess )
{
+ SLEEP(0x3E8);
+
// Add the device to the address manager
ZDSecMgrAddrStore( device->nwkAddr, device->extAddr, &ami );
@@ -1129,18 +1139,25 @@ ZStatus_t ZDSecMgrDeviceJoin( ZDSecMgrDevice_t* device )
if ( ( device->devStatus & DEV_SEC_INIT_STATUS ) &&
( device->secure == FALSE ) )
{
+ SLEEP(0x3E8);
//send the nwk key data to the joining device
status = ZDSecMgrSendNwkKey( device );
}
+
+ SLEEP(0x3E8);
if ( status != ZSuccess )
{
+ SLEEP(0x3E8);
ZDSecMgrAddrClear( device->extAddr );
}
}
+
+ SLEEP(0x3E8);
if ( status != ZSuccess )
{
+ SLEEP(0x3E8);
// not allowed or transport key failed, remove the device
ZDSecMgrDeviceRemove( device );
}
diff --git a/Projects/zstack/ZMain/TI2530ZNP/OnBoard.c b/Projects/zstack/ZMain/TI2530ZNP/OnBoard.c
index 7c6c77e..8265ff1 100644
--- a/Projects/zstack/ZMain/TI2530ZNP/OnBoard.c
@ -333,3 +441,6 @@ index 470ff12..e42ac65 100644
}
else
{
--
2.18.0.windows.1

View File

@ -1,4 +0,0 @@
# CC2530 router firmware
Currently no compilation instructions are available for this firmware.
Credits for this firmware go to [ptvoinfo](https://github.com/ptvoinfo)

View File

@ -1,4 +0,0 @@
# CC2530_CC2591 router firmware
Currently no compilation instructions are available for this firmware.
Credits for this firmware go to [ptvoinfo](https://github.com/ptvoinfo)

View File

@ -1,4 +0,0 @@
# CC2530_CC2592 router firmware
Currently no compilation instructions are available for this firmware.
Credits for this firmware go to [ptvoinfo](https://github.com/ptvoinfo)

View File

@ -1,4 +0,0 @@
# CC2531 router firmware
Currently no compilation instructions are available for this firmware.
Credits for this firmware go to [ptvoinfo](https://github.com/ptvoinfo)

View File

@ -0,0 +1,2 @@
# 20210128
- Initial router firmwares

View File

@ -0,0 +1,24 @@
# Compiling the firmware
## Setup development environment
1. Download and install [SIMPLELINK-CC13X2-26X2-SDK_4.40.00.44](http://www.ti.com/tool/download/SIMPLELINK-CC13X2-26X2-SDK).
1. Download and install [Code Composer Studio 10.2.0.00009](http://www.ti.com/tool/CCSTUDIO).
## Compiling
1. Start Code Composer Studio
1. Go to *File -> Import -> Code Composer Studio -> CCS Projects -> Select* search-directory: `simplelink_cc13x2_26x2_sdk_4_40_00_44/examples/rtos`. Select `zr_genericapp_CC26X2R1_LAUNCHXL_tirtos_css`, `zr_genericapp_CC1352P_2_LAUNCHXL_tirtos_css` and `zr_genericapp_CC2652RB_LAUNCHXL_tirtos_css`. Press *Finish*.
1. In Code Composer Studio, expand the 3 projects and for each open `znp.syscfg`, change `Minimal Poll Period (ms)` to `1000`, change it back to `100` immediately and save the file.
1. Go to your CCS workspace and copy `firmware.patch` to the root.
1. Open Git Bash, go to your CCS root and apply the patch using `git apply firmware.patch --ignore-space-change`.
1. **Only** for `zr_genericapp_CC1352P_2_LAUNCHXL_tirtos_css`:
- Right click on `znp.syscfg` -> *Delete*
- Right click on `zr_genericapp_CC1352P_2_LAUNCHXL_tirtos_css` -> *Properties*.
- Go to *(CCS) Build* - *ARM Compiler* - *Include Options* -> Under *Add dir to #include search path (--include_path, -l)* add `${PROJECT_ROOT}/syscfg` as the **last** entry.
- Go to *(CCS) Build* - *ARM Linker* - *File Search Path* -> Under *Include library file or command file as input (--library, -l)* change `${PROJECT_BUILD_DIR}/syscfg/ti_utils_build_linker.cmd.genlibs` to `${PROJECT_ROOT}/syscfg/ti_utils_build_linker.cmd.genlibs`
1. Build the 3 projects; right click -> *Build project*.
- **Important:** by default the **launchpad** variant of the CC1352P2_CC2652P (= `zr_genericapp_CC1352P_2_LAUNCHXL_tirtos_ccs`) is build. To build the **other** variant comment `#define LAUNCHPAD_CONFIG 1` in `preinclude.h` (located under `Stack/Config/`), don't forget to save.
1. Once finished, the firmware can be found under `zr_genericapp_[CC26X2R1/CC1352P_2/CC2652RB]_LAUNCHXL_tirtos_ccs/default/zr_genericapp_[CC26X2R1/CC2652RB/CC1352P_2]_LAUNCHXL_tirtos_ccs.hex`
- `zr_genericapp_CC26X2R1_LAUNCHXL_tirtos_ccs.hex` -> CC2652R
- `zr_genericapp_CC2652RB_LAUNCHXL_tirtos_ccs.hex` -> CC2652RB
- `zr_genericapp_CC1352P_2_LAUNCHXL_tirtos_ccs.hex` -> CC1352P-2 and CC2652P

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,14 @@
# Z-Stack 3.x.0 router firmwares
## What firmware to pick for my device?
Same logic as the coordinator firmware applies. See [README.md of the coordinator firmware](../../../coordinator/Z-Stack_3.x.0/bin/README.md).
## Pairing
After reflashing the router will automatically pair.
## Factory reset
To factory reset single press the button on your device.
Notes:
- Launchpads have 2 buttons, it doesn't matter which one you press
- Slaesh's CC2652RB stick has 2 buttons, press the one furthest away from the USB connector.

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,22 @@
# Buttons
# Z-Stack_Home 1.2 router firmware
Firmwares have been taken from: https://ptvo.info/ , no sources and compilation instructions are available. Credits go to [ptvoinfo](https://github.com/ptvoinfo).
* S1 button: only changes the state of the green LED.
## Buttons
* S1 button: only changes the state of the green LED.
* S2 button: repairs CC2531 (see below)
# Lights
## 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.
# Pairing
## Pairing
Flash firmware and permit joining to a network on your coordinator.
# Re-pairing
## 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.