CC2531 based router (firmware)

I’ve replaced my old coordinator hardware with CC2530 with an external antenna and therefore one of CC2531 was not used.

The guys on GitHub asked me to make a router firmware for ะกะก2531 too. I’ve spent some time and prepared 3 variants:

  1. CC2531-router.hex – just a router, without diagnostics and a USB serial port.
  2. CC2531-router-diag.hex – a router with diagnostic reports and without a USB serial port.
  3. CC2531-router-diag-usb.hex – a router with diagnostic reports and a USB serial port. The firmware dumps diagnostic reports to the serial port too.

Note: this firmware is for simple CC2531 boards without additional RD front-ends.

Buttons:

SW1 – Changes a virtual state of the router (the router sends it in a diagnostic report) and a state of the green light.
SW2:

  1. Short single press – to re-send a binding request to a coordinator (it allows you to test a connection).
  2. Long single press (about 5 seconds) – to reset the router and initiate a joining process.

Lights:

Green light – a short blink when the router connected to a network.

Red light:

  • short fast blinks (one per second) – the router is connecting to a network.
  • long blinks (one short flash per 4 seconds) – normal operations.
  • three short blinks – the router cannot send a report to a coordinator.

How to use

1. Download and flash the firmware.

2. Power off/on (restart) the router.

3. Permit joining to a network on your coordinator.

===========================

UPDATE 2018-09-26

1. Allows a router to use all possible channels (the old firmware was used the channel #11). But now, the router will take more time to connect to a coordinator.
2. A router may report link quality for all connected neighbors.


Comments
Harvey Specter
Posted at 19:23 May 29, 2018
John
Reply
Author

I have a xiaomi sensor which is sometimes out of range of the xiaomi gateway.
Is it possible to add this router between an existing Xiaomi sensor and the Xiaomi gateway?
If yes, what will be the procedure to make this work ?
How do I connect the router to the gateway and how connect the sensor to the router?

    Harvey Specter
    Posted at 04:20 May 30, 2018
    Owner
    Reply
    Author

    Sorry, this router was designed for networks based on alternative gateways (not the Xiaomi gateway). I didn’t test it with the Xiaomi gateway.

Harvey Specter
Posted at 16:52 June 15, 2018
Tiago
Reply
Author

Hello,

I’m having the following error when connecting the CC2531 as a router (connecting to another CC2531)
It was working before, until I add some IKEA devices. Then this error start. I’ve deleted all config from zigbee2mqtt a number of times, trying to find the device that was causing the problem. I then arrive to the CC2531 with router firmware as it is the only one connected. The error is:

2018-6-15 17:48:57 INFO Currently 1 devices are joined:
2018-6-15 17:48:57 INFO 0x00124b0012013a42 (0x00124b0012013a42): CC2530.ROUTER – Texas Instruments [CC2530 router](http://ptvo.info/cc2530-based-zigbee-coordinator-and-router-112/) (Router)
2018-6-15 17:48:57 INFO Connecting to MQTT server at mqtt://192.168.1.201:1883
/app/lib/zigbee.js:79
this.shepherd.find(device.ieeeAddr, 1).getDevice().update({
^
TypeError: Cannot read property ‘getDevice’ of undefined
at devices.forEach (/app/lib/zigbee.js:79:55)
at Array.forEach ()
at Zigbee.handleReady (/app/lib/zigbee.js:77:17)
at emitNone (events.js:106:13)
at ZShepherd.emit (events.js:208:7)
at Immediate._onImmediate (/app/node_modules/zigbee-shepherd/lib/shepherd.js:89:18)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
npm
ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zigbee2mqtt@0.1.0 start: `node index.js`
npm ERR! Exit status 1
npm
ERR!
npm ERR! Failed at the zigbee2mqtt@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-06-15T16:48:57.983Z pm2:client Calling daemon method pm2:getMonitorData on rpc socket:/root/.pm2/rpc.sock

Any ideas on how to proceed?
thanks,
Tiago

    Harvey Specter
    Posted at 05:00 June 16, 2018
    Owner
    Reply
    Author

    Hi,

    This problem is not related with the firmware directly. I’m using the same routers in my home without any problems. Unfortunately, I don’t have IKEA devices to examine this problem more deeply.

Harvey Specter
Posted at 12:19 July 5, 2018
Adrian
Reply
Author

Quick question regarding the CC2531 router, is the channel hardcoded?
i am using zigbee2mqtt and in the config you can set the channel, i tried changing to a zigbee channel far away from my wifi 2.4g channels to help remove any interference. i can successfully pair any device except the router when i have a channel specified in the config file, removing channel in config file, the router does pair with the coordinator. any ideas?

    Harvey Specter
    Posted at 18:24 July 5, 2018
    Owner
    Reply
    Author

    Yes, the channel number (11) is hardcoded in the current version.

      Harvey Specter
      Posted at 14:36 July 6, 2018
      Adrian Bishop
      Reply
      Author

      Thanks for confirming it, thought i was going mad trying to get it to pair. Will it be possible to change in a future update?

        Harvey Specter
        Posted at 18:18 July 6, 2018
        Owner
        Reply
        Author

        I will try to solve this problem after summer holidays.

          Harvey Specter
          Posted at 07:52 September 16, 2018
          John
          Author

          Did you already have time to change this?

          Harvey Specter
          Posted at 12:39 September 16, 2018
          Owner
          Author

          Yes, I’m working on it right now :). But I cannot estimate the release date of this update.

      Harvey Specter
      Posted at 13:41 July 10, 2018
      John
      Reply
      Author

      Does this mean it will only connect with a coordinator on channel 11?
      Or is this only used for a device connecting to the router?

        Harvey Specter
        Posted at 18:01 July 10, 2018
        Owner
        Reply
        Author

        All devices in one Zigbee network use the same channel number. If the channel number is different then this is another (different) network with another coordinator.

Harvey Specter
Posted at 12:27 July 8, 2018
kaelsaes
Reply
Author

Hi,

I paired successfully the CC2531 router with the CC2531 coordinator.

Do I have to delete manually the Xiaomi devices from the coordinator and re-pair them with the router?

Thanks.

    Harvey Specter
    Posted at 15:13 July 8, 2018
    Owner
    Reply
    Author

    This is not necessary. In any case all devices must be paired with a coordinator.

Harvey Specter
Posted at 19:18 July 8, 2018
kaelsaes
Reply
Author

Okay, thanks.

But how does the router work?

Some of my Xiaomi devices are loosing the connection to the coordinator no matter if the router is installed or not.

    Harvey Specter
    Posted at 04:31 July 9, 2018
    Owner
    Reply
    Author

    The router works like repeater. You must place it in the middle between the coordinator and your device.

Harvey Specter
Posted at 19:31 July 8, 2018
John
Reply
Author

Is the source also available?

    Harvey Specter
    Posted at 04:28 July 9, 2018
    Owner
    Reply
    Author

    Sources (ZStack) you can freely download from the TI website.

      Harvey Specter
      Posted at 16:52 July 9, 2018
      John
      Reply
      Author

      I mean the sources with your adjustments ๐Ÿ™‚

        Harvey Specter
        Posted at 18:51 July 9, 2018
        Owner
        Reply
        Author

        The license agreement does not allow to share Zstack source code.

          Harvey Specter
          Posted at 19:27 July 17, 2018
          John
          Author

          Can you tell me which sample? application you used as source for this router?
          And can you also tell me which symbols you used (like you described on the CC2530 based Zigbee coordinator and router blog)?

          Thanks in advance

          Harvey Specter
          Posted at 04:10 July 18, 2018
          Owner
          Author

          Hi,

          This is the sample “SampleLight” source code. It is necessary to change files in the “HAL-Target” group in the project workspace (compare with the ZNP project). I’ve used the following symbols:

          1
          2
          3
          4
          5
          6
          7
          8
          9
          10
          11
          12
          13
          14
          15
          16
          17
          18
          19
          20
          21
          22
          23
          24
          25
          26
          27
          28
          29
          30
          31
          32
          33
          34
          35
          SECURE=1
          TC_LINKKEY_JOIN
          NV_INIT
          NV_RESTORE
          xHOLD_AUTO_START
          xZTOOL_P1
          MT_TASK
          MT_APP_FUNC
          MT_SYS_FUNC
          xMT_ZDO_FUNC
          xLCD_SUPPORTED=DEBUG
          HAL_LCD=FALSE
          HAL_SPI=FALSE
          MULTICAST_ENABLED=FALSE
          ZCL_READ
          xZCL_WRITE
          ZCL_REPORT
          xZCL_EZMODE
          ZCL_BASIC
          xZCL_IDENTIFY
          ZCL_ON_OFF
          xZCL_SCENES
          xZCL_GROUPS
          xZCL_LEVEL_CTRL
          xZCL_DIAGNOSTIC
          ZCL_DISCOVER
          FEATURE_SYSTEM_STATS
          MT_UART_DEFAULT_BAUDRATE=HAL_UART_BR_115200
          MT_UART_DEFAULT_OVERFLOW=FALSE
          HAL_LED=TRUE
          MT_UTIL_FUNC
          HAL_KEY=TRUE
          ZSTACK_MANUFACTURER_CODE=4447
          BLINK_LEDS
          HAL_UART=FALSE
Harvey Specter
Posted at 05:12 July 9, 2018
kaelsaes
Reply
Author

Thanks.

But how can I check if the router works correct?
As I said I can’t see a positive effect when the router ist paired with the coordinator. Some devices are still having problems sending data to the coordinator even if the router is placed in the same room.

I flashed the third version of your firmware although I only use a CC2531 with a USB charger. Is this okay?

Thanks.

    Harvey Specter
    Posted at 05:21 July 9, 2018
    Owner
    Reply
    Author

    Yes, you need cc2531 and a power plug only for the router.

    The debug version of my firmware (with USB and diagnostic messages) can output debug messages to the USB port. You may use any com port terminal and capture these messages (a portable computer is required). There you may see devices in the field of view of the router. The Cc2531 router can cover 5-15 meters.

Harvey Specter
Posted at 18:45 July 9, 2018
kaelsaes
Reply
Author

Are your routers building up a mesh network?
Can I cascade several routers?

Is the CC2531 router only pairing with a CC2531 coordinator or can it also pair with a HUE ZigBee bridge?

Thanks

    Harvey Specter
    Posted at 18:52 July 9, 2018
    Owner
    Reply
    Author

    Mesh network: yes
    Cascade: yes
    HUE bridge: I don’t know. I didn’t use it.

Harvey Specter
Posted at 16:02 July 16, 2018
lolorc
Reply
Author

Hi,
I don’t really get what’s the purpose of SW1.
Any idea on why a CC2531 router pairs perfectly with a CC2531 coordinator and not with a CC2530+CC2591 coordinator ?

    Harvey Specter
    Posted at 17:09 July 16, 2018
    Owner
    Reply
    Author

    Is it possible a channel number is not 11?

Harvey Specter
Posted at 10:25 July 17, 2018
lolorc
Reply
Author

Hi,

I’ve read about this issue in the comment, but zigbee2mqtt says it’s using channel 11 and I’ve not specified any channel in its config;
I can try to force it to 11 in the config and see if I have to rebind the devices.

Harvey Specter
Posted at 11:06 July 17, 2018
lolorc
Reply
Author

I’ve just specified it to be 11 even it’s it’s the default in zigbee2mqtt, still working with the devices, still no luck with the router. I guess I should try to run a sniffer to see if it’s really using channel 11.
The firmware I’m using on the cc2530+CC2591 is https://github.com/Koenkk/Z-Stack-firmware/blob/master/coordinator/CC2530_CC2591/bin/CC2530_CC2591ZNP-Prod.hex

Harvey Specter
Posted at 22:09 July 17, 2018
lolorc
Reply
Author

hi,
as far as I tested the channel is 11, I’ve forced the channel to 11 with zigbee2mqtt, then devices were still paired. so I guess the channel is really 11. I’m trying to run a zigate (jn5168) a sniffer but documentation is *beeep* as hell. I guess my next tries will be to recompile cc2530+cc2591 firmware myself and see what I can alter/enable/disable to make them work all along.

    Harvey Specter
    Posted at 04:14 July 18, 2018
    Owner
    Reply
    Author

    Hi,

    Unfortunately, I don’t have this hardware device and I cannot test this coordinator. Did you try a firmware file where “Security LinkJoin” words exist in the file name? (like CC2531ZNP-Pro-Secure_LinkKeyJoin.hex)

      Harvey Specter
      Posted at 07:36 July 18, 2018
      lolorc
      Reply
      Author

      Hi,

      I haven’t found such firmware, I guess I’ll have to compile it myself.

        Harvey Specter
        Posted at 15:21 July 19, 2018
        John
        Reply
        Author

        If you download zstack then you can find it here: Z-Stack Home 1.2.2a.44539\Projects\zstack\ZAP\ZNP-HexFiles\CC2530

Harvey Specter
Posted at 09:04 August 14, 2018
TLu
Reply
Author

License preventing sharing share Zstack source code but we can still share diff files. With TI’s source & your patch files it would be possible to anyone to participate development and to it maybe a bit more better.

Example i’m interested to replace xiaome coordinator with any solution where source code is available as i need to maintain system 10-20 years and without source code it’s not really possible.
Im also interested to connect one wire temperature sensors directly to CC2531 but it’s not worth to do if system is not public. (I currently have my totally own made zigbee network in home and i can expand it but i would like use some not so proprietary stuff)

Harvey Specter
Posted at 09:39 August 15, 2018
baerengraben
Reply
Author

Thank you for your work! I got two Sticks (one coordinator and one router) working! Amazing Job, thumb up!!!

Harvey Specter
Posted at 14:19 September 1, 2018
Kirov Ilya
Reply
Author

Hey. Thanks for the router firmware.
I and many others use it. But there is one remark.
The current firmware does not send a list of nearby devices in response to the request of mgmtLqiReq, but the other zigbee-routers do this. As a result, the list of connected devices and the quality of communication to them are not visible. I use this to build a network map.
https://github.com/ioBroker/ioBroker.zigbee/issues/40#issuecomment-414063084

Could you share the source code of the firmware or a method how to assemble the firmware so that I can experimentally try to fix the situation. You can send it personally to the emal.
Or, try to assemble the firmware from MT_ZDO_MGMT, it is possible in this case will be sent the necessary information.

    Harvey Specter
    Posted at 05:42 September 2, 2018
    Owner
    Reply
    Author

    Hi Ilya,

    I’ve used the “SampleLight” example and didn’t remove anything. MT_ZDO_MGMT is not specified in the project settings (C compiler – Preprocessor).

    Harvey Specter
    Posted at 22:21 October 23, 2018
    Tiago
    Reply
    Author

    Hi Kirov,
    I’m having the same issue. Ever got to solve this?
    thanks
    Tiago

Harvey Specter
Posted at 13:49 October 2, 2018
kaelsaes
Reply
Author

Hi,

is it possible that my CC2531 with your new firmware connected inadvertently with my HUE bridge which uses zigbee channel 25 ?

Thanks.

    Harvey Specter
    Posted at 14:15 October 2, 2018
    Owner
    Reply
    Author

    Hi,

    Yes, this is possible if your bridge permits joining. The router connects to the first found network that permits joining.

Harvey Specter
Posted at 13:52 October 2, 2018
Kai
Reply
Author

Hi,

what are the numbers in the filename of the zip file?

Would it be possible to add the release date into the filename?

Thanks

    Harvey Specter
    Posted at 14:13 October 2, 2018
    Owner
    Reply
    Author

    Hi,

    The release data exists in the file path ๐Ÿ™‚

Harvey Specter
Posted at 17:52 October 6, 2018
John
Reply
Author

The router is blinking red every 4 seconds. I see this message through usb (I use diag_usb):
0/0x00158D0002280C3A,COORD,Depth:0,Assoc:0

Does this means the router is connected to my coordinator?
Should I also see messages from a sensor connected to the same coordinator through debug on this router?

Or will a sensor only connect through a router when it cannot connect to the gateway itself?

    Harvey Specter
    Posted at 12:01 October 7, 2018
    Owner
    Reply
    Author

    Hi,

    Yes, this info means that the router was connected to your coordinator. The router will also output info for neighbors.

      Harvey Specter
      Posted at 17:43 October 7, 2018
      John
      Reply
      Author

      Can I see when a sensor is connected to the router and the router is sending the sensor message to the coordinator?
      Or will a sensor only connect through a router when it cannot connect to the gateway itself?

        Harvey Specter
        Posted at 04:02 October 8, 2018
        Owner
        Reply
        Author

        The sensor searches for the best path to a coordinator. Therefore it may connect to your coordinator directly. If your sensor will appear in the field of view of your router you’ll see a message in router output.

Harvey Specter
Posted at 17:54 October 15, 2018
Peder
Reply
Author

Good job.
Been looking through description and comments as I was searching for a way to disable to red blinking every 4th second. It this possible anyhow? E.g. by sending a mqtt message?

    Harvey Specter
    Posted at 04:13 October 16, 2018
    Owner
    Reply
    Author

    Hello,

    I’m sorry, but this is not possible in the current version.

      Harvey Specter
      Posted at 19:56 October 21, 2018
      Peder
      Reply
      Author

      Okay. But would be an excellent feature.

      Also – my router sends: ‘zigbee2mqtt/0x00124b0018ed3c96’, payload: ‘{“state”:false,”linkquality”:115}’

      Is state:false correct?

Harvey Specter
Posted at 22:16 October 23, 2018
Tiago Marques
Reply
Author

Hello,
I’ve been using a cc2531 as a router, and noticed that some info gets lost when passing trough the router.
Checking graphviz output, the devices connected to the cc2531 router have no link information. They do work (if I take the router off they stop working) but without router info.

“0x00158d0001a64b58″ [label=”{0x00158d0001a64b58|EndDevice|Xiaomi Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)|online}”];
“0x00158d0001a36711″ [label=”{0x00158d0001a36711|EndDevice|Xiaomi Aqara temperature, humidity and pressure sensor (WSDCGQ11LM)|online}”];
“0x00158d0001a36711” -> “0x00124b0012022458″ [label=”41”]

In this example only the second sensor has the origin of the package. 0x00158d0001a36711 (xiaomi sensor) -> delivered to 0x00124b0012022458 (coordinator)

there should be a line for the 0x00158d0001a64b58 sensor like: “0x00158d0001a64b58” -> “0x00124b0012013a42″ [label=”41”], where 0x00124b0012013a42
is the CC2531 Router

Is there a way we can pass this info? I’ll leave the entire graphviz output in this link: https://hastebin.com/ipuhosidil.bash

thanks for your great work on this firmware

    Harvey Specter
    Posted at 04:01 October 24, 2018
    Owner
    Reply
    Author

    Hello. I’ve fixed this problem in the latest firmware. Please, re-download and re-flash it.

Leave a Reply

Navigation