Инструкция по прошивке zigbee- модуля CC2652 в OpenWrt на примере прошивки платы CC2652 от u236 для МТС.
Предварительная остановка сервиса homed-zigbee
/etc/init.d/homed-zigbee stop
Установка необходимых пакетов для прошивки платы
opkg update; opkg install python3 python3-pip git-http ca-bundle unzip
Настройка окружения python и установка дополнительных пакетов
python -m venv .venv
source .venv/bin/activate
pip3 install pyserial intelhex python-magic
Скачивание утилиты прошивки
git clone https://github.com/JelmerT/cc2538-bsl.git
cd cc2538-bsl/cc2538_bsl
Скачивание версии прошивки для cc2652 рекомендуемой для использования в HOMEd
wget https://github.com/Koenkk/Z-Stack-firmware/raw/a7745634b539df3d0b1ad1ae84a137017af58fe2/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20221226.zip
unzip CC1352P2_CC2652P_launchpad_coordinator_20221226.zip
Перевод платы cc2652 в режим прошивки:
для OpenWRT от u236
echo 0 > /sys/class/gpio/zigbee-boot/value
sleep 1
echo 0 > /sys/class/gpio/zigbee-reset/value
sleep 1
echo 1 > /sys/class/gpio/zigbee-reset/value
sleep 1
для OpenWRT от OpenLumi
Единоразово выполнить экспорт пина
echo 132 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio132/direction
далее перед самой прошивкой
echo 0 > /sys/class/gpio/gpio132/value
sleep 1
echo 0 > /sys/class/gpio/zigbee-reset/value
sleep 1
echo 1 > /sys/class/gpio/zigbee-reset/value
sleep 1
Запуск обновления прошивки:
./cc2538_bsl.py -p /dev/ttymxc3 -V -e -w CC1352P2_CC2652P_launchpad_coordinator_20221226.hex
Запуск сервиса homed-zigbee после успешного завершения прошивки.
sleep 10
/etc/init.d/homed-zigbee start
Пример вывода команды прошивки:
(.venv) root@ow24-4g-znp:~/cc2538-bsl/cc2538_bsl# ./cc2538_bsl.py -p /dev/ttymxc3 -V -e -w CC1352P2_CC2652P_launchpad_coordinator_20221226.hex
Opening port /dev/ttymxc3, baud 500000
Reading data from CC1352P2_CC2652P_launchpad_coordinator_20221226.hex
Your firmware looks like an Intel Hex file
Connecting to target...
CC1350 PG2.1 (7x7mm): 352KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x00057FD8
Primary IEEE Address: 00:12:4B:00:31:DD:22:0A
Performing mass erase
Erasing all main bank flash sectors
Erase done
Writing 360448 bytes starting at address 0x00000000
Write 104 bytes at 0x00057F980
Write done
(.venv) root@ow24-4g-znp:~/cc2538-bsl/cc2538_bsl#
Полный листинг команд от установки пакетов до прошивки чипа в OpenWrt 24.10 от OpenLumi:
root@polar-station:~# opkg update; opkg install python3 python3-pip git-http ca-bundle unzip
Downloading http://downloads.openwrt.org/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/base/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_base
Downloading http://downloads.openwrt.org/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/base/Packages.sig
Signature check passed.
Downloading http://downloads.openwrt.org/releases/24.10.4/targets/imx/cortexa7/packages//Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_core_upstream
Downloading http://downloads.openwrt.org/releases/24.10.4/targets/imx/cortexa7/packages//Packages.sig
Signature check passed.
Downloading http://downloads.openwrt.org/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/luci/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_luci
Downloading http://downloads.openwrt.org/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/luci/Packages.sig
Signature check passed.
Downloading http://downloads.openwrt.org/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_packages
Downloading http://downloads.openwrt.org/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/packages/Packages.sig
Signature check passed.
Downloading https://openlumi.github.io/releases/24.10.4/targets/imx/cortexa7/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openlumi_core
Downloading https://openlumi.github.io/releases/24.10.4/targets/imx/cortexa7/packages/Packages.sig
Signature check passed.
Downloading https://openlumi.github.io/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/base/Packages.gz
Updated list of available packages in /var/opkg-lists/openlumi_base
Downloading https://openlumi.github.io/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/base/Packages.sig
Signature check passed.
Downloading https://openlumi.github.io/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/luci/Packages.gz
Updated list of available packages in /var/opkg-lists/openlumi_luci
Downloading https://openlumi.github.io/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/luci/Packages.sig
Signature check passed.
Downloading https://openlumi.github.io/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/node/Packages.gz
Updated list of available packages in /var/opkg-lists/openlumi_node
Downloading https://openlumi.github.io/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/node/Packages.sig
Signature check passed.
Downloading https://openlumi.github.io/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/openlumi/Packages.gz
Updated list of available packages in /var/opkg-lists/openlumi_openlumi
Downloading https://openlumi.github.io/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/openlumi/Packages.sig
Signature check passed.
Downloading https://openlumi.github.io/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openlumi_packages
Downloading https://openlumi.github.io/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/packages/Packages.sig
Signature check passed.
Downloading https://openlumi.github.io/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/routing/Packages.gz
Updated list of available packages in /var/opkg-lists/openlumi_routing
Downloading https://openlumi.github.io/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/routing/Packages.sig
Signature check passed.
Downloading https://openlumi.github.io/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/telephony/Packages.gz
Updated list of available packages in /var/opkg-lists/openlumi_telephony
Downloading https://openlumi.github.io/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/telephony/Packages.sig
Signature check passed.
Package python3 (3.11.14-r1) installed in root is up to date.
Installing python3-pip (23.3.1-r1) to root...
Downloading http://downloads.openwrt.org/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/packages/python3-pip_23.3.1-r1_arm_cortex-a7_neon-vfpv4.ipk
Package git-http (2.50.1-r1) installed in root is up to date.
Package ca-bundle (20250419-r1) installed in root is up to date.
Installing unzip (6.0-r8) to root...
Downloading http://downloads.openwrt.org/releases/24.10.4/packages/arm_cortex-a7_neon-vfpv4/packages/unzip_6.0-r8_arm_cortex-a7_neon-vfpv4.ipk
Configuring unzip.
Configuring python3-pip.
root@polar-station:~# python -m venv .venv
root@polar-station:~# source .venv/bin/activate
(.venv) root@polar-station:~#
(.venv) root@polar-station:~# pip3 install pyserial intelhex python-magic
Collecting pyserial
Downloading pyserial-3.5-py2.py3-none-any.whl.metadata (1.6 kB)
Collecting intelhex
Downloading intelhex-2.3.0-py2.py3-none-any.whl.metadata (2.7 kB)
Collecting python-magic
Downloading python_magic-0.4.27-py2.py3-none-any.whl.metadata (5.8 kB)
Downloading pyserial-3.5-py2.py3-none-any.whl (90 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 90.6/90.6 kB 590.2 kB/s eta 0:00:00
Downloading intelhex-2.3.0-py2.py3-none-any.whl (50 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 50.9/50.9 kB 441.6 kB/s eta 0:00:00
Downloading python_magic-0.4.27-py2.py3-none-any.whl (13 kB)
Installing collected packages: pyserial, intelhex, python-magic
Successfully installed intelhex-2.3.0 pyserial-3.5 python-magic-0.4.27
[notice] A new release of pip is available: 24.0 -> 25.3
[notice] To update, run: pip install --upgrade pip
(.venv) root@polar-station:~#
(.venv) root@polar-station:~# git clone https://github.com/JelmerT/cc2538-bsl.git
Cloning into 'cc2538-bsl'...
remote: Enumerating objects: 534, done.
remote: Counting objects: 100% (188/188), done.
remote: Compressing objects: 100% (57/57), done.
remote: Total 534 (delta 163), reused 131 (delta 131), pack-reused 346 (from 3)
Receiving objects: 100% (534/534), 180.88 KiB | 289.00 KiB/s, done.
Resolving deltas: 100% (247/247), done.
(.venv) root@polar-station:~# cd cc2538-bsl/cc2538_bsl
(.venv) root@polar-station:~/cc2538-bsl/cc2538_bsl#
(.venv) root@polar-station:~/cc2538-bsl/cc2538_bsl# wget https://github.com/Koenkk/Z-Stack-firmware/raw/a7745634b539df3d0b1ad1ae84a137017af58fe2/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20221226.zip
Downloading 'https://github.com/Koenkk/Z-Stack-firmware/raw/a7745634b539df3d0b1ad1ae84a137017af58fe2/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20221226.zip'
Connecting to 140.82.121.3:443
Redirected to /Koenkk/Z-Stack-firmware/a7745634b539df3d0b1ad1ae84a137017af58fe2/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20221226.zip on raw.githubusercontent.com
Writing to 'CC1352P2_CC2652P_launchpad_coordinator_20221226.zip'
CC1352P2_CC2652P_lau 100% |*******************************| 171k 0:00:00 ETA
Download completed (175365 bytes)
(.venv) root@polar-station:~/cc2538-bsl/cc2538_bsl# unzip CC1352P2_CC2652P_launchpad_coordinator_20221226.zip
Archive: CC1352P2_CC2652P_launchpad_coordinator_20221226.zip
inflating: CC1352P2_CC2652P_launchpad_coordinator_20221226.hex
(.venv) root@polar-station:~/cc2538-bsl/cc2538_bsl#
(.venv) root@polar-station:~/cc2538-bsl/cc2538_bsl# echo 132 > /sys/class/gpio/export
(.venv) root@polar-station:~/cc2538-bsl/cc2538_bsl# echo out > /sys/class/gpio/gpio132/direction
(.venv) root@polar-station:~/cc2538-bsl/cc2538_bsl# echo 0 > /sys/class/gpio/gpio132/value
(.venv) root@polar-station:~/cc2538-bsl/cc2538_bsl# sleep 1
(.venv) root@polar-station:~/cc2538-bsl/cc2538_bsl# echo 0 > /sys/class/gpio/zigbee-reset/value
(.venv) root@polar-station:~/cc2538-bsl/cc2538_bsl# sleep 1
(.venv) root@polar-station:~/cc2538-bsl/cc2538_bsl# echo 1 > /sys/class/gpio/zigbee-reset/value
(.venv) root@polar-station:~/cc2538-bsl/cc2538_bsl# sleep 1
(.venv) root@polar-station:~/cc2538-bsl/cc2538_bsl#
(.venv) root@polar-station:~/cc2538-bsl/cc2538_bsl# ./cc2538_bsl.py -p /dev/ttymxc3 -V -e -w CC1352P2_CC2652P_launchpad_coordinator_20221226.hex
Opening port /dev/ttymxc3, baud 500000
Reading data from CC1352P2_CC2652P_launchpad_coordinator_20221226.hex
Your firmware looks like an Intel Hex file
Connecting to target...
CC1350 PG2.1 (7x7mm): 352KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x00057FD8
Primary IEEE Address: 00:12:4B:00:31:DD:1F:28
Performing mass erase
Erasing all main bank flash sectors
Erase done
Writing 360448 bytes starting at address 0x00000000
Write 104 bytes at 0x00057F980
Write done
(.venv) root@polar-station:~/cc2538-bsl/cc2538_bsl#