├── .gitignore ├── README.md ├── images └── codm-zigbee-cc2652p-rpi-module.jpg ├── rpi-cc2652p-uart.bom.csv ├── rpi-cc2652p-uart.bom.xlsx ├── rpi-cc2652p-uart.brd ├── rpi-cc2652p-uart.sch └── rpi-cc2652p-uart.sch.pdf /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore list for Eagle, a PCB layout tool 2 | 3 | # Backup files 4 | *.s#? 5 | *.b#? 6 | *.l#? 7 | *.b$? 8 | *.s$? 9 | *.l$? 10 | 11 | # Eagle project file 12 | # It contains a serial number and references to the file structure 13 | # on your computer. 14 | # comment the following line if you want to have your project file included. 15 | eagle.epf 16 | 17 | # Autorouter files 18 | *.pro 19 | *.job 20 | 21 | # CAM files 22 | *.$$$ 23 | *.cmp 24 | *.ly2 25 | *.l15 26 | *.sol 27 | *.plc 28 | *.stc 29 | *.sts 30 | *.crc 31 | *.crs 32 | 33 | *.dri 34 | *.drl 35 | *.gpi 36 | *.pls 37 | *.ger 38 | *.gpi 39 | *.xln 40 | 41 | *.drd 42 | *.drd.* 43 | 44 | *.s#* 45 | *.b#* 46 | 47 | 48 | # file locks introduced since 7.x 49 | *.lck 50 | 51 | .DS_Store 52 | eagle.epf 53 | 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cod.m ZigBee CC2652P Raspberry Pi module 2 | [ZigBee CC2652 Raspberry Pi Coordinator](https://shop.codm.de/automation/zigbee/33/zigbee-cc2652p2-raspberry-pi-module) - a ZigBee Coordinator designed for the GPIO of the Raspberry Pi running Z-Stack Firmware 3.x - thanks to [Koenkk](https://github.com/Koenkk/). 3 | The used CC2652P is the current generation of microcontrollers for ZigBee 3.x Coordinators and has an integrated power amplifier (+20dBm) for better coverage. 4 | 5 | According to [koenkk](https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator) the CC2652 allows for up to 50 direct children and 100/200 routes directly on the coordinator. 6 | The size of a ZigBee mesh is not defined by the count of possible direct children at the coordinator, see https://www.zigbee2mqtt.io/information/FAQ.html#i-read-that-zigbee2mqtt-has-a-limit-of-20-devices-is-this-true 7 | 8 | This module is the successor of our [CC2538 module](https://github.com/codm/cc2538-raspberry-pi-module). This time it is powered via the 5V rail of the Raspberry Pi with an LDO (Low Drop Out) voltage regulator. The CC2538 worked well on 3.3V directly but for the CC2652 we've decided to be not dependent on the internal voltage regulators of the Pi itself. 9 | 10 | You can buy a ready built coordinator, including external antenna at our webshop https://shop.codm.de/automation/zigbee/33/zigbee-cc2652p2-raspberry-pi-module or built on for non commercial use by yourself based on the files in this repository. Use the `bom.ulp` from Eagle to generate a parts list (BOM). 11 | If you can't get hold of the AP2112K you can also use an TLV75533P. 12 | 13 | The 3D model of the RF-Star CC2652P could be found at GrabCad: https://grabcad.com/library/rf-star-cc2652p-module-1 14 | 15 | ![cod.m CC2652 ZigBee Raspberry Pi Module](images/codm-zigbee-cc2652p-rpi-module.jpg) 16 | 17 | 18 | # Running 19 | To us the module directly on the serial interface on the GPIO of the Raspberry Pi, you have to free it up first. Either completely or by moving the Bluetooth UART to the mini-uart. 20 | See https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-uarts for a detailed explanation. 21 | 22 | This is also explained in the manual (german): [Anleitung cod.m ZigBee CC2652 Raspberry Pi Modul](https://shop.codm.de/media/pdf/31/38/dd/20210427_ZigBee_CC2652_Raspberry_Pi_Modul_V02_Datenblatt_Anleitung-webnc4XN2YCGznNh.pdf) 23 | 24 | 25 | If you want to use it with Home Assistant refer to this guide: https://github.com/MarijnPessers/cod.m-CC2538-CC2592-for-Home-Assistant 26 | 27 | ## zigbee2mqtt 28 | Edit `data/configuration.yaml` accordingly: 29 | 30 | ``` 31 | serial: 32 | port: /dev/ttyAMA0 33 | advanced: 34 | baudrate: 115200 35 | rtscts: false 36 | ``` 37 | For Zigbee2Mqtt version 2.x and up edit `data/configuration.yaml` accordingly: 38 | ``` 39 | serial: 40 | adapter: zstack 41 | port: /dev/ttyAMA0 42 | baudrate: 115200 43 | rtscts: false 44 | ``` 45 | 46 | 47 | ## Homegear 48 | Install `homegear-zigbee` and edit `/etc/homegear/families/zigbee.conf`: 49 | 50 | ``` 51 | [Serial] 52 | id = CC2652 53 | deviceType = serial 54 | 55 | #use your own 16 bytes hexadecimal key! 56 | password = AABBCCDDEEFF11223344556677889900 57 | 58 | device = /dev/ttyAMA0 59 | ``` 60 | Don't forget to comment in the `[]` block. 61 | 62 | 63 | # Antenna 64 | We recommend to use only external antennas as the module is close to the WiFi and Bluetooth module/antenna on the Raspberry Pi. But if you want to use the attached PCB antenna, rotate the resistor pointing to the u.FL socket by 90° so it connects the PCB trace. 65 | 66 | # Firmware 67 | We use Koenkk's Z-Stack 3.x Coordinator Firmware from https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/Z-Stack_3.x.0/bin, ZigStar Variant as it uses the same RF-BM-2652P2. 68 | 69 | You can flash the firmware either by JTAG or directly from the Raspberry Pi using [cc2538-prog](https://github.com/1248/cc2538-prog/) - despite the name it also works with the CC2652. 70 | The firmware has the needed serial bootloader enabled. 71 | 72 | ## JTAG 73 | The 2x05 header is following the common [JTAG-Cortex-M0](https://www.segger.com/products/debug-probes/j-link/accessories/adapters/9-pin-cortex-m-adapter/) Layout. 74 | 75 | Use `CC2652R1F` and `JTAG`@4000kHz. 76 | 77 | 78 | ## Serial via GPIO 79 | 80 | ### cc2538-bsl (preferred) 81 | Install python3 if not alreay present with `sudo apt update && sudo apt-get install python3-pip` and install the needed python libraries `sudo pip3 install pyserial intelhex`. 82 | 83 | Download or checkout [cc2538-bsl](https://github.com/JelmerT/cc2538-bsl) into a directory. After that download and extract the wanted coordinator firmware from [https://github.com/Koenkk/Z-Stack-firmware/tree/develop/coordinator/Z-Stack_3.x.0/bin](https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/Z-Stack_3.x.0/bin) - for the cod.m CC2652 Raspberry Pi module you'll need `CC1352P2_CC2652P_launchpad_*.zip` as listed on Koenkk's GitHub. 84 | 85 | Please check that you zigbee software is not running anymore an nothing is accessing the serial device where the zigbee module is plugged in (`/dev/ttyAMA0`). 86 | 87 | While connected and powered through the Pi, hold down the flash button on the module and press reset shortly while still holding flash. The CC2652 should now be in the bootloder. 88 | 89 | To flash type `python3 cc2538-bsl.py -p /dev/ttyAMA0 -evw CC1352P2_CC2652P_launchpad_coordinator_20211217.hex` in the appropriate directory. Change the filename of the .hex-file accordingly. 90 | 91 | The output looks something like this: 92 | ``` 93 | pi@zigbee:~/cc2538-bsl $ python3 cc2538-bsl.py -evw -p /dev/ttyAMA0 ../CC1352P2_CC2652P_launchpad_coordinator_20211217.hex 94 | Opening port /dev/ttyAMA0, baud 500000 95 | Reading data from ../CC1352P2_CC2652P_launchpad_coordinator_20211217.hex 96 | Your firmware looks like an Intel Hex file 97 | Connecting to target... 98 | CC1350 PG2.0 (7x7mm): 352KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x00057FD8 99 | Primary IEEE Address: 00:12:4B:00:25:8F:18:32 100 | Performing mass erase 101 | Erasing all main bank flash sectors 102 | Erase done 103 | Writing 360448 bytes starting at address 0x00000000 104 | Write 104 bytes at 0x00057F980 105 | Write done 106 | Verifying by comparing CRC32 calculations. 107 | Verified (match: 0xba5c19c5) 108 | ``` 109 | 110 | After that hit the reset button on the module and start your zigbee software again. Maybe you have to replug the module or powercycle the pi. 111 | 112 | Thanks to Alex for the documentation of that way. 113 | Alternatively you can use https://github.com/electrolama/llama-bsl but I did not test this yet. 114 | 115 | ### cc2538-prog 116 | Install and compile [cc2538-prog](https://github.com/1248/cc2538-prog/). 117 | 118 | While connected and powered through the Pi, hold down the `flash` button on the module and press `reset` shortly while still holding `flash`. The CC2652 should now be in the bootloder. 119 | 120 | Then execute `./cc2538-prog -d /dev/ttyAMA0 -f CC1352P2_CC2652P_launchpad_coordinator_20210120.hex ` 121 | 122 | The output should look like this: 123 | ``` 124 | ping ok 125 | Bootloader detected 126 | Erasing page 0 127 | Erasing page 1 128 | [...] 129 | Erasing page 254 130 | Erasing page 255 131 | Writing 16 bytes to 0x00200000 132 | Writing 16 bytes to 0x00200010 133 | [...] 134 | Writing 16 bytes to 0x0023C7F0 135 | Writing 12 bytes to 0x0027FFD4 136 | ``` 137 | 138 | After that reset the module using the corresponding button. 139 | It happened sometimes that I had to replug the module to get it to work again. 140 | 141 | 142 | 143 | 144 | 145 | # Thanks 146 | * @koenkk Z-Stack Firmware - https://github.com/Koenkk/Z-Stack-firmware 147 | * @1248 cc2538-prog - https://github.com/1248/cc2538-prog/ 148 | 149 | # License 150 | [CC-BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/) 151 | 152 | cod.m GmbH, Patrik Mayer, 2021 153 | -------------------------------------------------------------------------------- /images/codm-zigbee-cc2652p-rpi-module.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codm/cc2652-raspberry-pi-module/a5f5d29f90cc102ef94be35d1df8ee4f10243c8a/images/codm-zigbee-cc2652p-rpi-module.jpg -------------------------------------------------------------------------------- /rpi-cc2652p-uart.bom.csv: -------------------------------------------------------------------------------- 1 | "Qty";"Value";"Device";"Package";"Parts";"Description";"CHIP-TECHNOLOGY";"DATASHEET-URL";"DESCRIPTION";"DOMINANT-WAVELENGTH";"EMITTING-COLOR";"FORWARD-VOLTAGE";"H";"HEIGHT";"LUMINOUS-INTENSITY";"MANUFACTURER_NAME";"MANUFACTURER_PART_NUMBER";"MOUSER_PART_NUMBER";"MOUSER_PRICE-STOCK";"OPERATION-FORCE";"PART-NUMBER";"PEAK-WAVELENGTH";"POPULARITY";"PROD_ID";"QTY";"SPICEPREFIX";"VALUE"; 2 | "2";"";"434153017835";"434153017835";"FLASH, RESET";"WS-TASV J-Bend SMT Tact Switch 3.5x2.9 mm";"";"https://www.we-online.com/catalog/datasheet/434153017835.pdf";"";"";"";"";"1.7mm";"";"";"";"";"";"";"350g";"434153017835";"";"";"";" 4000 ";"";""; 3 | "1";"";"PINHD-2X5";"2X05";"JP1";"PIN HEADER";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";""; 4 | "1";"100n";"C-EUC0603K";"C0603K";"C1";"CAPACITOR, European symbol";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"30";"";"";"C";""; 5 | "1";"150080YS75000";"WL-SMCW_0805_150080YS75000";"WL-SMCW_0805";"CC";"WL-SMCW SMT Mono-color Chip LED Waterclea";"AlInGaP";"https://www.we-online.com/redexpert/spec/150080YS75000?ae";"";"590nm";"Yellow";"140°";"";"";"120mcd";"";"";"";"";"";"150080YS75000";"595nm";"";"";"";"";"150080YS75000"; 6 | "2";"1k";"R-EU_R0603RF";"R0603RF";"R1, R2";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";""; 7 | "2";"1u";"C-EUC0805";"C0805";"C2, C3";"CAPACITOR, European symbol";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"88";"";"";"C";""; 8 | "1";"20021121-00010C4LF";"20021121-00010C4LF";"2002112100010C4LF";"JTAG";"Headers & Wire Housings 1.27x1.27mm BTB, Hdr Unshrd, SMT, 10 Pos";"";"";"Headers & Wire Housings 1.27x1.27mm BTB, Hdr Unshrd, SMT, 10 Pos";"";"";"";"";"4.55mm";"";"Amphenol";"20021121-00010C4LF";"649-202112100010C4LF";"https://www.mouser.com/Search/Refine.aspx?Keyword=649-202112100010C4LF";"";"";"";"";"";"";"";""; 9 | "1";"AP2112K";"V_REG_AP2112K-3.3V";"SOT23-5";"U2";"AP2112 - 600mA CMOS LDO Regulator w/ Enable";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"VREG-12457";"";"";"3.3V"; 10 | "1";"CC2652P2-DUOWEISI";"CC2652P2-DUOWEISI";"CC2652P2-DUOWEISI";"U1";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";""; 11 | "3";"FIDUCIAL1X2";"FIDUCIAL1X2";"FIDUCIAL-1X2";"FD1, FD2, FD3";"Fiducial Alignment Points";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";""; 12 | -------------------------------------------------------------------------------- /rpi-cc2652p-uart.bom.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codm/cc2652-raspberry-pi-module/a5f5d29f90cc102ef94be35d1df8ee4f10243c8a/rpi-cc2652p-uart.bom.xlsx -------------------------------------------------------------------------------- /rpi-cc2652p-uart.sch.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codm/cc2652-raspberry-pi-module/a5f5d29f90cc102ef94be35d1df8ee4f10243c8a/rpi-cc2652p-uart.sch.pdf --------------------------------------------------------------------------------