Koenkk / Z-Stack-firmware

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

Need Z-Stack 3.x.0 coordinator firmware capable of +10 dBm and +20 dBm output power on CC2652P and CC1352P based radio modules #323

Closed Hedda closed 2 years ago

Hedda commented 2 years ago

Request Z-Stack 3.x.0 coordinator firmware capable of Active mode TX at +10 dBm and +20 dBm RF output power on CC2652P and CC1352P based radios. Specifically request firmware preconfigured with 10 dBm transmit power as default as well as firmware preconfigured with 20 dBm transmit power working as default for example the new Sonoff Zigbee 3.0 USB Dongle Plus adapter by ITead.

Maybe maximum dBm transmission power for 2.4GHz Zigbee devices is different for FCC (North America) and CE (Western Europe) but sounds as if 10 dBm is the legal limit when a manufacturer is shipping commercially sold 2.4GHz Zigbee device products:

"The power output of the XBee-PRO RF Modules must not exceed 10 dBm. The power level is set using the PL command. The International Variant of this product is internally limited to 10 dBm." Though it should be noted that is specifically for a commercially sold product.

https://www.digi.com/resources/documentation/Digidocs/90000991/reference/r_certs_xb_europe.htm

However not sure if that same 10dBm transmission power limit applies to DIY devices and individual hobbyist who flash their own custom firmware as ETSI EN 300 328 V2.2.2 standard specification documentation states this:

"The RF output power for non-FHSS equipment shall be equal to or less than 20 dBm." which I can be interpreted that even 20 dBm is OK as long as the device does not rapidly change the carrier frequency among many distinct frequencies occupying a large spectral band.

https://www.etsi.org/deliver/etsi_en/300300_300399/300328/02.02.02_60/en_300328v020202p.pdf

Anyway, CC2652P and CC1352P do have an integrated power amplifier capable of 20 dBm output power, but currently, applications like Zigbee2MQTT and IoBroker (as well as zigpy based applications like the ZHA integration in Home Assistant and Jeedom Zigbee Plugin) can not utilize higher than 5 dBm amplification even if they enable it in their software (configuring transmit power setting to 20) since this configuration is hardcoded in firmware configuration before compiling and there is not yet a Koenkk community firmware for C2652P and CC1352P based Zigbee coordinator adapters/dongles with a higher transmit power configured.

The issue is that to be able to actually use 10dBm or 20dBm output TX power we need to flash a firmware that either allows it to be configured via software or separate firmware builds with different hardcoded default config for desired transmission power.

Btw, maybe also a good idea to update both README.md files with information about utilizing integrated power amplifiers?

https://github.com/Koenkk/Z-Stack-firmware/blob/master/coordinator/README.md

https://github.com/Koenkk/Z-Stack-firmware/blob/master/coordinator/Z-Stack_3.x.0/bin/README.md

FYI, this was brought up in this discussion about capability and testing of new SONOFF Zigbee 3.0 USB Dongle Plus adapter:

https://github.com/Koenkk/zigbee2mqtt/discussions/8840

Originally posted by @chiakikato in https://github.com/Koenkk/zigbee2mqtt/discussions/8840#discussioncomment-1545985

I got two SBDongle and wrote CC1352P2_CC2652P_launchpad_coordinator_20210708. But two of them performance is almost same or a little bit worth to zzh! which say 5dBm.

I wonder if there are extra settings other than experimental: transmit_power: 20

or anything I can check?

Originally posted by @chiakikato in https://github.com/Koenkk/zigbee2mqtt/discussions/8840#discussioncomment-1549977

My test method is using TI Packet Sniffer to monitoring the zigbee signal RSSI. I confirmed setting 'transmit_power:' as 5 and above till 20 won't make difference on RSSI values. Of course, checked below 5 to get smaller RSSI result. Besides, I checked SONOFF dongle's RF switch control signal by oscilloscope. It looks no activity which means no 20dBm PA signal is not used.

I wonder the firmware is not compatible with SONOFF dongle.
I can see https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/Z-Stack_3.x.0/bin mentioned the RF switch control pin part marked '?' now.

Originally posted by @chiakikato in https://github.com/Koenkk/zigbee2mqtt/discussions/8840#discussioncomment-1550021

I check the trace of SONOFF. DIO_29: 20dBm PA is connected. but DIO_28: is N.C. it uses PE4259 or compatible's SC-70 6P RF switch which does not have 3 RF signals input for 2.4GHz 5dBm, 2.4GHz 20dBm and SubGHz.
I think it is a reason DIO_28 is not connected.

Originally posted by @chiakikato in https://github.com/Koenkk/zigbee2mqtt/discussions/8840#discussioncomment-1550148

I set RF switch control as HIGH by external hardwired method and got -22~-19dBm worth result. It means the firmware's RF switch control has no problem. SONOFF RF antenna and/or RF circuit need to be doubted.

Hedda commented 2 years ago

@digiblur will update router fw later

@digiblur , any progress?

FYI, there are some experimental router firmware versions posted on #273 that have been hardcoded for 20 dBm TX power output.

PS: Again, also submitted a separate request for Zigbee router firmware with remotely configurable TX power output level -> #341

sintei commented 2 years ago

@digiblur will update router fw later

@digiblur , any progress?

FYI, there are some experimental router firmware versions posted on #273 that have been hardcoded to 20 dBm TX power output.

PS: Again, also submitted a separate request for Zigbee router firmware with remotely configurable TX power output level -> #341

I saw this but I'm new to Github so have some troubles following all threads :) Thanks @Hedda for clarifying it to me! I will be following #341 :)

digiblur commented 2 years ago

@digiblur will update router fw later

@digiblur , any progress?

Looked yesterday and muat have missed it. Will look again later today.

tannisroot commented 2 years ago

Does anyone maybe have a version of 20211217 that defaults to 20dbm instead of 9? Due to https://github.com/zigpy/zigpy-znp/issues/119, I can't really see any improvement in LQI with ZHA, and I would really like to try higher tx power without switching to z2m.

puddly commented 2 years ago

119 isn't an issue with zigpy-znp, it's just an observation that changing the TX power doesn't affect LQI (as expected).

Though it could be that the TX power setting needs to be set after the network is started, not before. I'll double check.

tannisroot commented 2 years ago

Though it could be that the TX power setting needs to be set after the network is started, not before. I'll double check.

Thank you, I actually wanted to check if there is an issue of some sort with tx power setting in zigpy-znp by comparing LQI with tx_power: 20 and stock 20211217 firmware and modified 20211217 firmware in which the default is 20dbm instead of 9.

tannisroot commented 2 years ago

I would compile it myself but TI's website is "under maintenance" :(

puddly commented 2 years ago

@tannisroot Here's what I see when cycling through the power levels on startup and sending a broadcast (repeated ten times):

image

My nRF52840 dongle seems to drop packets after they exceed a certain RSSI but the TX power setting definitely has an impact.

That being said, changing the TX power will only impact the link quality of packets being sent from the coordinator to the device, since the coordinator is only "shouting louder", not "listening better". This can be verified empirically with a network with a single router:

image

The blue line is what you see in ZHA & Z2M as the device's LQI. It's only the link quality of packets received by the coordinator, coming "from" the device (really the device's last-hop router).

I suspect that increasing the TX power may cause new devices to prefer joining directly to the coordinator, but what will happen when they try sending packets back and the coordinator can't hear them? Also, will the increased TX power level cause broadcasts/multicasts to propagate slower due to the coordinator's re-transmissions being heard by more of the network at once, causing congestion?

Cranking up the TX power to 100 and focusing on just the LQI may not have a positive impact on network stability.

Hedda commented 2 years ago

@digiblur will update router fw later

@digiblur , any progress?

Looked yesterday and muat have missed it. Will look again later today.

No news on router firmware. Keep watch on https://github.com/Koenkk/Z-Stack-firmware/tree/develop/router/Z-Stack_3.x.0/bin

KameDomotics commented 2 years ago

I'm sorry, how many db does the antenna supplied with the Sonoff plus 3.0 stick have? 3dbi?

Are there better antennas on the market to use with the CC2652 dongle?

Thanks

tannisroot commented 2 years ago

Are there better antennas on the market to use with the CC2652 dongle?

Some people in the community really like this one, and I was personally able to get noticeable improvement in LQI with it: https://aliexpress.com/item/1005001968013220.html

digiblur commented 2 years ago

12 dbi? That seems oddly high for the size. If it is that high I am sure the donut effect is nuts.

tannisroot commented 2 years ago

Oh I am sure those are "chinese" 12 dbi but the antenna does seem to have slightly better reception than stock one, at least based on LQI.

digiblur commented 2 years ago

That high of gain in an omni starts to really have some weird coverage.

Hedda commented 2 years ago

If using an omnidirectional antenna then should really rely on adding more Zigbee router devices to maximize coverage, see:

https://github.com/Koenkk/Z-Stack-firmware/issues/316 (and https://github.com/Koenkk/Z-Stack-firmware/issues/341)

I am sure the donut effect is nuts.

Sure many people don't know about different radiation patterns which can especially be important in multi-level houses.