Skip to content

Commit f1b9ac7

Browse files
diescalodaescalona
authored andcommitted
hardware: add new versions to the supported hardware list
- Added support to the following new hardware: - 0x4E: XBee 3 Cellular LTE-M/NB-IoT (Telit) - 0x50: XB3-DMLR - 0x51: XB3-DMLR868 - 0x52: XBee 3 Reduced RAM - 0x53: S2C P5 - Adapted firmware update and file system features to the new hardware. https://onedigi.atlassian.net/browse/XBJAPI-535 Signed-off-by: Diego Escalona <diego.escalona@digi.com> Signed-off-by: Tatiana Leon <Tatiana.Leon@digi.com>
1 parent 11138bc commit f1b9ac7

File tree

6 files changed

+59
-18
lines changed

6 files changed

+59
-18
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ Changelog
44
v1.4.1 - XX/XX/2021
55
-------------------
66

7+
* Support for new hardware variants:
8+
9+
* XBee 3 Cellular LTE-M/NB-IoT (Telit)
10+
* XBee 3 Reduced RAM
11+
* S2C P5
12+
* XB3-DMLR
13+
* XB3-DMLR868
714
* OTA firmware update:
815

916
* Implementation of considerations for versions 1009, 300A, 200A or prior

digi/xbee/filesystem.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@
8282

8383
_SECURE_ELEMENT_SUFFIX = "#"
8484

85-
SUPPORTED_HW_VERSIONS = (HardwareVersion.XBEE3.code,
86-
HardwareVersion.XBEE3_SMT.code,
87-
HardwareVersion.XBEE3_TH.code)
85+
REMOTE_SUPPORTED_HW_VERSIONS = (HardwareVersion.XBEE3.code,
86+
HardwareVersion.XBEE3_SMT.code,
87+
HardwareVersion.XBEE3_TH.code)
88+
LOCAL_SUPPORTED_HW_VERSIONS = REMOTE_SUPPORTED_HW_VERSIONS \
89+
+ (HardwareVersion.XBEE3_RR.code,)
8890

8991
# Update this value when File System API frames are supported
9092
XB3_MIN_FW_VERSION_FS_API_SUPPORT = {
@@ -3355,7 +3357,10 @@ def check_fs_support(xbee, min_fw_vers=None, max_fw_vers=None):
33553357
"filesystem support: %s", str(exc))
33563358

33573359
# Check compatibility
3358-
if hw_version and hw_version.code not in SUPPORTED_HW_VERSIONS:
3360+
supported_hw_versions = LOCAL_SUPPORTED_HW_VERSIONS
3361+
if xbee.is_remote():
3362+
supported_hw_versions = REMOTE_SUPPORTED_HW_VERSIONS
3363+
if hw_version and hw_version.code not in supported_hw_versions:
33593364
return False
33603365

33613366
if not fw_version:

digi/xbee/firmware.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,15 @@
7777
_PATTERN_GECKO_BOOTLOADER_COMPATIBILITY_FULL = \
7878
"^.*Gecko Bootloader.*\\(([0-9a-fA-F]{4})-([0-9a-fA-F]{2})(.*)\\).*$"
7979
_PATTERN_GECKO_BOOTLOADER_VERSION = \
80-
"^.*Gecko Bootloader v([0-9a-fA-F]{1}\\.[0-9a-fA-F]{1}\\.[0-9a-fA-F]{1}).*$"
80+
"^.*Gecko Bootloader v([0-9a-fA-F]{1,}\\.[0-9a-fA-F]{1,}\\.[0-9a-fA-F]{1,}).*$"
8181

82-
_XBEE3_BOOTLOADER_FILE_PREFIX = "xb3-boot-rf_"
82+
_XBEE3_BL_DEF_PREFIX = "xb3-boot-rf_"
83+
_XBEE3_BOOTLOADER_FILE_PREFIX = {
84+
HardwareVersion.XBEE3.code: _XBEE3_BL_DEF_PREFIX,
85+
HardwareVersion.XBEE3_SMT.code: _XBEE3_BL_DEF_PREFIX,
86+
HardwareVersion.XBEE3_TH.code: _XBEE3_BL_DEF_PREFIX,
87+
HardwareVersion.XBEE3_RR.code: "xb3-boot-rr_"
88+
}
8389

8490
_GEN3_BOOTLOADER_ERROR_CHECKSUM = 0x12
8591
_GEN3_BOOTLOADER_ERROR_VERIFY = 0x13
@@ -280,15 +286,17 @@
280286
HardwareVersion.XB24C.code,
281287
HardwareVersion.XBP24C_S2C_SMT.code,
282288
HardwareVersion.XBP24C_TH_DIP.code,
283-
HardwareVersion.XB24C_TH_DIP.code)
289+
HardwareVersion.XB24C_TH_DIP.code,
290+
HardwareVersion.S2C_P5.code)
284291

285292
SX_HW_VERSIONS = (HardwareVersion.SX.code,
286293
HardwareVersion.SX_PRO.code,
287294
HardwareVersion.XB8X.code)
288295

289296
XBEE3_HW_VERSIONS = (HardwareVersion.XBEE3.code,
290297
HardwareVersion.XBEE3_SMT.code,
291-
HardwareVersion.XBEE3_TH.code)
298+
HardwareVersion.XBEE3_TH.code,
299+
HardwareVersion.XBEE3_RR.code)
292300

293301
LOCAL_SUPPORTED_HW_VERSIONS = SX_HW_VERSIONS + XBEE3_HW_VERSIONS
294302
REMOTE_SUPPORTED_HW_VERSIONS = SX_HW_VERSIONS + XBEE3_HW_VERSIONS + S2C_HW_VERSIONS
@@ -521,7 +529,7 @@ def parse_file(self):
521529
self._image_type = utils.bytes_to_int(
522530
_reverse_bytearray(file.read(_BUFFER_SIZE_SHORT)))
523531
_log.debug(" - Image type: %s (%d)",
524-
"Firmware" if not self._image_type else "File system", self._image_type)
532+
"Firmware" if self._image_type in (0, 1) else "File system", self._image_type)
525533
f_version = _reverse_bytearray(file.read(_BUFFER_SIZE_INT))
526534
self._file_version = utils.bytes_to_int(f_version)
527535
_log.debug(" - File version: %s (%d)",
@@ -652,8 +660,8 @@ def manufacturer_code(self):
652660
@property
653661
def image_type(self):
654662
"""
655-
Returns the OTA file image type: 0x0000 for firmware,
656-
0x0100 for file system.
663+
Returns the OTA file image type: 0x0000 for XBee 3 firmware,
664+
0x0001 for XBee 3 RR firmware, 0x0100 for file system.
657665
658666
Returns:
659667
Integer: OTA file image type.
@@ -3720,7 +3728,8 @@ def _check_bootloader_binary_file(self):
37203728
if self._bootloader_fw_file is None:
37213729
path = Path(self._xml_fw_file)
37223730
self._bootloader_fw_file = str(Path(path.parent).joinpath(
3723-
_XBEE3_BOOTLOADER_FILE_PREFIX + str(self._xml_bootloader_version[0])
3731+
_XBEE3_BOOTLOADER_FILE_PREFIX[self._target_hw_version]
3732+
+ str(self._xml_bootloader_version[0])
37243733
+ _BOOTLOADER_VERSION_SEPARATOR + str(self._xml_bootloader_version[1])
37253734
+ _BOOTLOADER_VERSION_SEPARATOR + str(self._xml_bootloader_version[2])
37263735
+ EXTENSION_GBL))
@@ -4932,8 +4941,9 @@ def _check_img_data(self, payload):
49324941
if man_code != self._ota_file.manufacturer_code:
49334942
server_status = _XBee3OTAStatus.NO_IMAGE_AVAILABLE
49344943
# Check image type:
4935-
# 0x0000: firmware upgrade
4936-
# 0x0100: file system upgrade
4944+
# 0x0000: XBee 3 firmware upgrade
4945+
# 0x0001: XBee 3 RR firmware upgrade
4946+
# 0x0100: XBee 3 file system upgrade
49374947
elif img_type != self._ota_file.image_type:
49384948
server_status = _XBee3OTAStatus.NO_IMAGE_AVAILABLE
49394949
# Check compatibility number

digi/xbee/models/hw.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ class HardwareVersion(Enum):
9393
CELLULAR_3_LTE_M_VERIZON = (0x4A, "XBee Cellular 3 LTE-M Verizon")
9494
CELLULAR_3_LTE_M_ATT = (0x4B, "XBee Cellular 3 LTE-M AT&T")
9595
CELLULAR_3_CAT1_LTE_VERIZON = (0x4D, "XBee Cellular 3 Cat 1 LTE Verizon")
96+
CELLULAR_3_LTE_M_TELIT = (0x4E, "XBee 3 Cellular LTE-M/NB-IoT (Telit)")
97+
XBEE3_DM_LR = (0x50, "XB3-DMLR")
98+
XBEE3_DM_LR_868 = (0x51, "XB3-DMLR868")
99+
XBEE3_RR = (0x52, "XBee 3 Reduced RAM")
100+
S2C_P5 = (0x53, "S2C P5")
96101

97102
def __init__(self, code, description):
98103
self.__code = code

digi/xbee/models/protocol.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,17 @@ def determine_protocol(hw_version, fw_version, br_value=None):
256256
HardwareVersion.CELLULAR_3_CAT1_LTE_ATT.code,
257257
HardwareVersion.CELLULAR_3_LTE_M_VERIZON.code,
258258
HardwareVersion.CELLULAR_3_LTE_M_ATT.code,
259-
HardwareVersion.CELLULAR_3_CAT1_LTE_VERIZON.code):
259+
HardwareVersion.CELLULAR_3_CAT1_LTE_VERIZON.code,
260+
HardwareVersion.CELLULAR_3_LTE_M_TELIT.code):
260261
return XBeeProtocol.CELLULAR
261262

262263
if hw_version == HardwareVersion.CELLULAR_NBIOT_EUROPE.code:
263264
return XBeeProtocol.CELLULAR_NBIOT
264265

265266
if hw_version in (HardwareVersion.XBEE3.code,
266267
HardwareVersion.XBEE3_SMT.code,
267-
HardwareVersion.XBEE3_TH.code):
268+
HardwareVersion.XBEE3_TH.code,
269+
HardwareVersion.XBEE3_RR.code):
268270
if fw_version.startswith("2"):
269271
return XBeeProtocol.RAW_802_15_4
270272
if fw_version.startswith("3"):
@@ -275,6 +277,17 @@ def determine_protocol(hw_version, fw_version, br_value=None):
275277
return (XBeeProtocol.DIGI_MESH
276278
if br_value != 0 else XBeeProtocol.DIGI_POINT)
277279

280+
if hw_version in (HardwareVersion.XBEE3_DM_LR.code,
281+
HardwareVersion.XBEE3_DM_LR_868.code):
282+
return XBeeProtocol.DIGI_MESH
283+
284+
if hw_version == HardwareVersion.S2C_P5.code:
285+
if fw_version.startswith("C"):
286+
return XBeeProtocol.RAW_802_15_4
287+
if fw_version.startswith("B"):
288+
return XBeeProtocol.DIGI_MESH
289+
return XBeeProtocol.ZIGBEE
290+
278291
return XBeeProtocol.ZIGBEE
279292

280293

digi/xbee/recovery.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019, 2020, Digi International Inc.
1+
# Copyright 2019-2021, Digi International Inc.
22
#
33
# This Source Code Form is subject to the terms of the Mozilla Public
44
# License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -30,7 +30,8 @@
3030

3131
SUPPORTED_HARDWARE_VERSIONS = (HardwareVersion.XBEE3.code,
3232
HardwareVersion.XBEE3_SMT.code,
33-
HardwareVersion.XBEE3_TH.code)
33+
HardwareVersion.XBEE3_TH.code,
34+
HardwareVersion.XBEE3_RR.code)
3435

3536
_BAUDRATE_KEY = "baudrate"
3637
_PARITY_KEY = "parity"

0 commit comments

Comments
 (0)