Koenkk / Z-Stack-firmware

Compilation instructions and hex files for Z-Stack firmwares
MIT License
2.32k stars 643 forks source link

TX power for CC1352P2 CC2652P router firmware #273

Closed bkupidura closed 3 years ago

bkupidura commented 3 years ago

Hey, Can you please share what tx power is set in CC1352P2_CC2652P_other_router_20210128.hex?

Currently im tessting CC2652P as a router, it works stable but i think that it has lower radio tx power than my old CC2530+CC2591 - which is surprising ;)

Koenkk commented 3 years ago

5dbm, currently this is not configurable, to change you have recompile: https://github.com/Koenkk/Z-Stack-firmware/blob/master/coordinator/Z-Stack_3.x.0/COMPILE.md

bkupidura commented 3 years ago

Ok, will try to build new firmware. As i dont have any experience with CCS (and zigbee firmware), any hints how to adjust tx power before compilation?

UPDATE: So afaik i was able to change TX power. But not sure how to compile router code. Im able to build firmware, but stick is not trying to join network. My guess is that i have cordinator firmware.

TX power change:

+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/MAC/HighLevel/mac_cfg.c
@@ -109,6 +109,10 @@
 #endif
 #endif

+#ifndef PHY_TX_POWER_FREQ_2_4_G
+#define PHY_TX_POWER_FREQ_2_4_G 5
+#endif
+
 /* ------------------------------------------------------------------------------------------------
  *                                           Global Variables
  * ------------------------------------------------------------------------------------------------
@@ -183,7 +187,7 @@ const macPib_t macPibDefaults =
 #ifndef FREQ_2_4G
   14,                                         /* phyTransmitPower */
 #else
-  5,                                          /* phyTransmitPower */
+  PHY_TX_POWER_FREQ_2_4_G,                    /* phyTransmitPower */
 #endif
 #ifndef FREQ_2_4G
   MAC_CHAN_LOWEST,                            /* logicalChannel */

+++ b/znp_CC1352P_2_LAUNCHXL_tirtos_ccs/Stack/Config/znp_cnf.opts
@@ -2,6 +2,7 @@
 -DMAC_CFG_TX_DATA_MAX=5
 -DMAC_CFG_TX_MAX=8
 -DMAC_CFG_RX_MAX=5
+-DPHY_TX_POWER_FREQ_2_4_G=20

I tried to set different defines for router fw (ZG_DEVICE_RTRONLY_TYPE, DEVICE_BUILD_ROUTER, ZSTACK_ROUTER_BUILD, DEVICE_LOGICAL_TYPE), but for now no luck.

UPDATE2: Looks it works. I used zr_genericapp_CC1352P_2_LAUNCHXL_tirtos_ccs instead of znp. Testing since yesterday and looks fine (but CC2530+CC2591 still have better range).

r312645 commented 3 years ago

Can you please share your firmware?

bkupidura commented 3 years ago

Sure, but please remember that this is "test" firmware, im dont know much about this board. I cant guarantee anything (except that it works in my network). But still power is better on CC2530+CC2591, can you confirm?

Changes:

zb_firmware_CC1352P_2.zip

gio-dot commented 3 years ago

Sure, but please remember that this is "test" firmware, im dont know much about this board. I cant guarantee anything (except that it works in my network). But still power is better on CC2530+CC2591, can you confirm?

Changes:

  • TX power set to 20
  • Red LED always turn on

zb_firmware_CC1352P_2.zip

Wich hardware are you using?

Alfiegerner commented 3 years ago

@bkupidura - thanks, appears to be working for me.

I have two of these CC2652P routers, and the one flashed with your firmware is reporting approx double the LQI in the same location.

Finger crossed this change makes its way through.

bkupidura commented 3 years ago

@Alfiegerner my firmware for sure will not be part of "official" zigbee2mqtt firmware available for CC1352P2. As it have some issues with introspection.

But maybe @Koenkk can just introduce two firmwares created by him (5 and 20 DB tx power).

cjsteward commented 3 years ago

@Alfiegerner @bkupidura Have either of you had any issues since you've been running the modified firmware? I've installed it on a couple of tubes routers the other day and they seem to be working perfectly so far. And pardon my ignorance here @bkupidura , but what did you mean by "issues with introspection"?

Alfiegerner commented 3 years ago

No issues from me @cjsteward, looking good. I don't get any updates on last seen in the z2m frontend but I don't think I did pre custom flash either. Network map show sitting connections and connected endpoints all good.

bkupidura commented 3 years ago

@cjsteward board with that firmare is running in my network for last 1.5 month without issue.

Regarding introspection i mentioned, when you are pairing board with zigbee2mqtt, you will see error in log message about missing endpoint. Except that error, everything else (i hope) is working.

cjsteward commented 3 years ago

Just wanted to follow up here - I've been running the modified firmware for over two weeks now and everything is still stable, but I just wanted to call out a few oddities I've noticed:

I'm hoping there will be production ready firmware released with the Tx power increase because besides the issues above, I've been really happy with the performance.

bkupidura commented 3 years ago

@cjsteward regarding pairing issue, i dont think its related to router firmware. As in my network i added new enddevices while router with custom firmware is running.

You can easly test that by just removeing router from network (and powering it off after that, to be sure) and try to pair new device.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

Alfiegerner commented 3 years ago

Missed stale bot - I think this would be a great feature.

TSKnuhtsen commented 3 years ago

I'm using a CC1352P-2 LAUNCHPAD. The coordinator firmware works perfectly on my device. But when I load @bkupidura 's firmware or firmware from the Z2M Z-STACK Firmware Repo, the device does will not attempt to interview and join the network.

Anyone have any ideas on how I can get my device to interview and pair with my coordinator?

EDIT: After sniffing zigbee traffic with CC2531, I realized that CC1352P-2 was sending "Beacon Request) appropriately and that the issue resided with my coordinator. I erased and updated the firmware on my CC2562R coordinator and I am now able to pair CC1352P-2 Launchpad with latest firmware (*_20210128.hex) every time I plug in the device.

SOLVED.

thiscantbeserious commented 2 years ago

Succesfully flashed the 20dBm variant above and got double the lqi now ... only issue I have is that no matter what I do not a single device will ever join the router even if I specifically put it on top of it ...

cjsteward commented 2 years ago

@thiscantbeserious I had the same issue and ended up reverting back to the stable firmware. I hope someone smarter than me can figure this out because besides the pairing issue, the increase in performance and range was really nice. It also seems like a waste having nice routers if they can only perform at 1/4 of their rated power.

ptvoinfo commented 2 years ago

Can someone test my router firmware? It supports CC2562 and CC1352P-2, custom LED configuration, etc. I am primarily interested in signal strength. https://ptvo.info/download/ptvo-firmware-latest.zip

thiscantbeserious commented 2 years ago

Can someone test my router firmware? It supports CC2562 and CC1352P-2, custom LED configuration, etc. I am primarily interested in signal strength. https://ptvo.info/download/ptvo-firmware-latest.zip

Will do. Give me a week, maybe a day :)

bkupidura commented 2 years ago

@ptvoinfo can you build firmware which reports rssi to z2m in some (1/5/10m) intervals? Im currently using Conbee as cordinator, and to be honest im not trusting signal strenght reported by z2m.

ptvoinfo commented 2 years ago

@bkupidura The coordinator receives RSSI with every message from a device. You can define a virtual output with a virtual pin or an output for a LED pin and enable periodic reports with the necessary interval. But I'm not sure if Conbee can receive messages from a DIY device.

ruimarinho commented 2 years ago

@ptvoinfo what's the difference between psm-cc2652p.hex and cc2652p.hex? Not sure which one to flash.

ptvoinfo commented 2 years ago

@ruimarinho You cannot flash these files directly. It is necessary to configure the firmware for your board. https://ptvo.info/cc2652r1-cc2652rb-cc2652p-cc1352p2-configurable-router-firmware-748/

irakhlin commented 2 years ago

@ruimarinho You cannot flash these files directly. It is necessary to configure the firmware for your board. https://ptvo.info/cc2652r1-cc2652rb-cc2652p-cc1352p2-configurable-router-firmware-748/

I have tested your router firmware on multiple cc2652p sticks, including the sonoff, zigstar and a custom router I am working on with a SHT35 and some other sensors. I am seeing a significant increase in LQI across my entire network. It would be hard to give an exact figure but previously my mesh had some distance end device sensors sitting at ~15, currently the lowest is ~70. I was however experience this issue: 10282. Earlier today I re-flashed most of the routers with the newest firmware and all are still responding and pinging as expected.

Just a few things I wanted to comment on... In your configuration utility all settings are saved between opening and closing the application, except "serial bootloader enable SBL". I ran into an issue as I was going back and forth modifying the firmware a few times, enabled the feature, closed the app, reopened it and only changed a setting on the main page without realizing that this setting does not get saved. Ended up having to flash with jtag, not a huge deal just a minor point. Unrelated to tx power, but it would also be amazing to be able to configure sensors to use the reporting functionality based on change example (https://www.zigbee2mqtt.io/devices/KMPCIL_RES005.html#kmpcil-kmpcil_res005). This would allow me to configure router devices with less frequent "periodic updates" but still get good sensor values.

As a follow up question, if you do not mind sharing what version of the TI simplelink SDK are you using for these firmwares? I only ask out of interest as I was working on one for the experience.

Hedda commented 2 years ago

currently this is not configurable, to change you have recompile

FYI, submitted a separate feature request for Zigbee router firmware with remotely configurable TX power output level -> https://github.com/Koenkk/Z-Stack-firmware/issues/341

ruimarinho commented 2 years ago

@ptvoinfo would be great to test a pre-compiled version for TubesZB based on these schematics.

irakhlin commented 2 years ago

@ruimarinho

@ptvoinfo would be great to test a pre-compiled version for TubesZB based on these schematics.

I can confirm I am using the firmware on two of those units for a few day now. With the following configuration.. just note in the second image I've blacked out Manufacturer ID, Name, Model and Icon as I have simply just set my own custom information here to make it easier and identify all units in my network running "custom" firmware I have deployed. You should be able to use anything. After simply hit "save custom converter to Z2M" which will generate a converter file that you will need to set in zigbee2mqtt before joining the device. Also do not forget to enable serial bootloader SBL or you will lock the bootloader and need to reflash via jtag.

edit: I should note I am also using this configuration on a zigstar v4, sonoff 3 plus and CircuitSetup's CC2652P2 sticks.

tube tube2

ruimarinho commented 2 years ago

Thanks @ptvoinfo but I use ZHA so it would probably need its own quirk :/ plus I don't have access to a Windows machine..

digiblur commented 2 years ago

Can someone test my router firmware? It supports CC2562 and CC1352P-2, custom LED configuration, etc. I am primarily interested in signal strength. https://ptvo.info/download/ptvo-firmware-latest.zip

Where's the setting for the power output or is it hardcoded to 20?

irakhlin commented 2 years ago

Can someone test my router firmware? It supports CC2562 and CC1352P-2, custom LED configuration, etc. I am primarily interested in signal strength. https://ptvo.info/download/ptvo-firmware-latest.zip

Where's the setting for the power output or is it hardcoded to 20?

He had confirmed previously on his website that i

Can someone test my router firmware? It supports CC2562 and CC1352P-2, custom LED configuration, etc. I am primarily interested in signal strength. https://ptvo.info/download/ptvo-firmware-latest.zip

Where's the setting for the power output or is it hardcoded to 20?

Set to 20DB atleast for cc2562 https://github.com/ptvoinfo/zigbee-configurable-firmware/issues/75

digiblur commented 2 years ago

Can someone test my router firmware? It supports CC2562 and CC1352P-2, custom LED configuration, etc. I am primarily interested in signal strength. https://ptvo.info/download/ptvo-firmware-latest.zip

Where's the setting for the power output or is it hardcoded to 20?

He had confirmed previously on his website that i

Can someone test my router firmware? It supports CC2562 and CC1352P-2, custom LED configuration, etc. I am primarily interested in signal strength. https://ptvo.info/download/ptvo-firmware-latest.zip

Where's the setting for the power output or is it hardcoded to 20?

Set to 20DB atleast for cc2562 ptvoinfo/zigbee-configurable-firmware#75

Interesting double jones'ing

daufinsyd commented 2 years ago

I have tested your router firmware on multiple cc2652p sticks, including the sonoff, zigstar and a custom router I am working on with a SHT35 and some other sensors. I am seeing a significant increase in LQI across my entire network. It would be hard to give an exact figure but previously my mesh had some distance end device sensors sitting at ~15, currently the lowest is ~70. I was however experience this issue: 10282. Earlier today I re-flashed most of the routers with the newest firmware and all are still responding and pinging as expected.

Hi @irakhlin is it now working stable or do you still have disconnections ? Did you also flashed the coordinator ? or how did you solve the issue with devices routers (eg plugs) ?

cjsteward commented 2 years ago

Just wanted to report back - I've flashed both Tube's cc2652p router and Sonoff's Dongle Plus with PTVO's router firmware while following the options in @irakhlin post above and everything has been perfectly stable for about a week or so now. I've noticed a significant increase in LQI with my 3 routers (mix of Tube's and Sonoff's), especially after being paired with my Tube's usb cc2652p coordinator that's flashed with the 20 db firmware from Koenkks dev branch. Sensors and routers pair faster and more easily, sensors located at further points in my house and garage are more responsive, Z2M network map loads up quick and accurately, and nothing has dropped off. This is the end game zigbee solution that I've been trying to achieve for literally years. I can't thank everyone enough for all the hard work that has gone into this project, including all the custom firmware. Seriously amazing stuff.

Side Note: For anyone following this thread PLEASE PLEASE pay attention to the BSL option in the firmware configuration tool. I took a stab at installing PTVO's router firmware a month ago when he first posted it here and I ended up killing a router due to my ignorance. If you do goof up like I did it can be recovered, but unless you already have the flashing tools required it's probably cheaper to just buy a new Sonoff. Hard lesson learned for me but the payoff here was completely worth it. Seriously, thank you again!

ruimarinho commented 2 years ago

@cjsteward which firmware are you referring to with +20dBm hardcoded? I believe the one posted on the dev branch was +9dBm only.

irakhlin commented 2 years ago

@cjsteward which firmware are you referring to with +20dBm hardcoded? I believe the one posted on the dev branch was +9dBm only.

@ruimarinho I think he is talking about the ptvoinfo custom firmware configuration tool. I posted a screenshot of the settings I am using for generating that firmware and I can also report my network has been incredibly stable.

@daufinsyd I did not flash my firmware on the coordinator but I did flash all my 'custom' routers and a few usb powered sensors I am working on, all of which are cc2652p chips. The coordinator I am using is tube's ethernet cc2652. For the last week my network has been stable and the firmware provides a very significant increase in LQI. I now believe the issue I was having with routers going offline was due to 3 zigbee powered sensors that where running very old firmware. I am not positive about this but I have removed them from the network and no issues thus far, I will probably know in the next few days.

ruimarinho commented 2 years ago

Thanks @irakhlin. Would be great if you could do a side-by-side test with the firmware compiled by @bkupidura above (link)!

irakhlin commented 2 years ago

Thanks @irakhlin. Would be great if you could do a side-by-side test with the firmware compiled by @bkupidura above (link)!

@ruimarinho I did not use his specific file but about a month or so ago I did make compile the same firmware with the changes he posted above. I saw an increase in LQI but the issue of not responding to pings/network map requests was very annoying. It also caused significant delay on restarts of zigbee2mqtt. It seemed like it would wait for a ping timeout from all routers running thr firmware before the web ui would start to load.

digiblur commented 2 years ago

Fun with higher power zigbee https://youtu.be/4aLxw48ZCQo

cjsteward commented 2 years ago

@ruimarinho I may be mistaken, and I have no real way to measure it, but I was under the impression that the dev branch coordinator firmware defaults to 9 but allows you to set it higher with "transmit_power" in the config file.

If I'm wrong then I guess I have more improvements to look forward to in the future.

irakhlin commented 2 years ago

@ruimarinho I may be mistaken, and I have no real way to measure it, but I was under the impression that the dev branch coordinator firmware defaults to 9 but allows you to set it higher with "transmit_power" in the config file.

If I'm wrong then I guess I have more improvements to look forward to in the future.

@cjsteward I think the discussion here was regarding various versions of the router firmware. As it stands now that value is compiled into the firmware. There are a few different versions floating around with values from 5db to 20db (for the cc2652p) chips.

cjsteward commented 2 years ago

@irakhlin Yeah, the discussion here is for sure focused on the router firmware. I was just responding to ruimarinho because he was asking about the 20db coordinator firmware from the dev branch that I mentioned in my previous post.

ruimarinho commented 2 years ago

I've switched to @ptvoinfo's firmware as well and my network has been rock solid too. I've never had an issue with @bkupidura's one too. I'm using ZHA and a Tubes coordinator and router.

mortenmoulder commented 2 years ago

I'm getting a solid ~190 LQI between my two Sonoff sticks both running 20 dBm firmwares. The router is using PTVO's firmware. I tried a large antenna from a router, as well as the antenna that came with the Sonoff stick, and I couldn't see a difference between them.

The two sticks are between a thick concrete wall and the coordinator is plugged into my server without an extension cable. Still lots of options for better LQI, but 190 is very, very good.

wojciechczyz commented 2 years ago

@ruimarinho You cannot flash these files directly. It is necessary to configure the firmware for your board. https://ptvo.info/cc2652r1-cc2652rb-cc2652p-cc1352p2-configurable-router-firmware-748/

Hi @ptvoinfo can you please help in correct configuration for https://github.com/egony/cc2652p_cc1352p_RF-STAR/tree/main/firmware/router RF-Star Stick? I found pins to be described here: https://github.com/Koenkk/Z-Stack-firmware/blob/master/coordinator/Z-Stack_3.x.0/bin/README.md

ZigStar Stick v4 CC2652P (RFSTAR RF-BM-2652P2) CC1352P2_CC2652Plaunchpad*.zip DIO_15 Only for CH340C ver. DIO_28: 2.4Ghz DIO_29: 20dBm PA DIO_6 (Green) DIO_7 (Red)

Thank you, Wojciech

KipK commented 2 years ago

@wojciechczyz , can't we flash with usb using koenkk bootloader? Would it overwrite the bl ?

Hedda commented 2 years ago

Can someone test my router firmware? It supports CC2562 and CC1352P-2, custom LED configuration, etc. I am primarily interested in signal strength. https://ptvo.info/download/ptvo-firmware-latest.zip

@ptvoinfo could you perhaps build a +9 TX router OTA firmware for ITead's new SONOFF ZBMINI-L Zigbee 3.0 Smart Switch?

https://itead.cc/product/sonoff-zbmini-l-zigbee-smart-switch-no-neutral-wire-required/

https://sonoff.tech/product/diy-smart-switch/zbmini-l/

It has been confirmed its radio board uses exact same model of CC2652P chip as ITead SONOFF Zigbee 3.0 USB Dongle Plus:

https://community.home-assistant.io/t/sonoff-zbmini-l-zigbee-3-0-smart-switch-by-itead-works-without-neutral-wire-and-based-on-cc2652p-so-should-be-a-good-zigbee-router/384644/

PS: Not recieved mine yet but latest information is firmware ITead is shipping is configured as "End Device" (and not "Router").

bojanpotocnik commented 2 years ago

latest information is firmware ITead is shipping is configured as "End Device" (and not "Router").

@Hedda, this may be because ZBMINI-L does not have guaranteed power budget, but it can be dependent on what load it is switching (check Shelly Bypass for Shelly 1L). Operating as End Device means lower power consumption -> more stable operation in more use cases. Operating as Router - even more with increased output power - would increase the chance of brownout resets, which would also be more impactful/noticeable when operating as a Router.

ZBMINI (with neutral wire) uses the same chip and does not have these limitations, but for some strange reason none of the router firmwares in this repository work with it - check last part of this comment.

nickwild-999 commented 2 years ago

@ptvoinfo @Hedda Is there a version of the firmware for the regular ZBMINI?

ptvoinfo commented 2 years ago

@nickwild-999 https://ptvo.info/custom-firmware-for-sonoff-zbmini-01minizb-and-ewelink-switch-zr-02-923/

nickwild-999 commented 2 years ago

Thanks @ptvoinfo so if we select the chip type to CC2652R it works? Are there any means of getting your firmware working on the Sonoff S26R2ZB plug too? Problems with this plug are on #10282