Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SONOFF ZBMINI (01MINIZB) with CC2652P can only work as CC2652R1 - by HW design #96

Closed
bojanpotocnik opened this issue Feb 15, 2022 · 30 comments

Comments

@bojanpotocnik
Copy link

This is probably not an issue with this firmware itself (I see that other users got CC2652P chips working with this FW), but it is a strange issue I cannot explain.

Last month, I received few ZBMINI modules from different AliExpress vendors, all of them containing CC2652 P1F chip:
ZBMINI-2022

I have mentioned this here Koenkk/zigbee2mqtt#10704 (comment), however I now noticed that the modules do not pair even with ZHA. If I set the Board type to CC2652R1 they work fine, if set to CC2652P/CC1352P2 they don't work.

Does anyone have any idea what could be the cause? I don't believe this would be fake P chips which are in fact R1... or?
I have XDS100v3 so I can also help with any debugging steps. Thank you.

@ptvoinfo
Copy link
Owner

Sorry, but I do not have these modules, and I cannot look at this problem in a debugger.

@bojanpotocnik
Copy link
Author

bojanpotocnik commented Feb 15, 2022

Can I do anything to help? This is the status in Flash Programmer 2, the chip is properly detected:
FlashProgrammer2
FCFG1.txt

Are there any hardware specifics, which could make CC2652P work on one PCB design but not on another? The crystal on this board is 48.000 MHz.

@bojanpotocnik
Copy link
Author

Just tried again using the newest release ptvo-firmware-2022-02-16.zip. Left all settings at their defaults, only made the following configuration changes:

  • Enable Status LED; P07, Inversed; Sending reports

Tried the following combinations:

  1. Board type: CC2652P/CC1352P2; Device type: End device without routing; Check Enable BSL (default)
  2. Board type: CC2652P/CC1352P2; Device type: End device without routing; Uncheck Enable BSL
  3. Board type: CC2652P/CC1352P2; Device type: Router; Check Enable BSL (default)
  4. Board type: CC2652P/CC1352P2; Device type: Router; Uncheck Enable BSL
  5. Board type: CC2652R1; Device type: End device without routing; Check Enable BSL (default)
  6. Board type: CC2652R1; Device type: End device without routing; Uncheck Enable BSL
  7. Board type: CC2652R1; Device type: Router; Check Enable BSL (default)
  8. Board type: CC2652R1; Device type: Router; Uncheck Enable BSL
  • In all cases, green LED blinks slightly faster than 1 Hz after flash (Erase All unprotected pages, Program Entire source file, Verify Readback) and power-cycle.
  • In cases 5, 6, 7 and 8 device pairs after 6 blinks, then LED turns OFF.
  • In cases 1, 2, 3 and 4 blinking never stops and the device never pairs (nothing in z2m logs on debug level).

Additional tests which can be helpful:

  • CC1352P2_CC2652P_launchpad_router_20210128.hex: LED is ON constantly, nothing in z2m.
  • CC1352P2_CC2652P_other_router_20210128.hex: LED is ON constantly, nothing in z2m.
  • CC2652R_router_20210128.hex: LED is OFF constantly, nothing in z2m.

I currently don't have additional ideas about what else to try 😞

@DJTerentjev
Copy link

@bojanpotocnik, I had same module zbmini with CC2652P. I was able to flush it only once connecting with needles. There is no TDO и TDI spots to solder. I see you used Flash programmer 2, but what hardware did you use?

@bojanpotocnik
Copy link
Author

bojanpotocnik commented Feb 20, 2022

I use TMS320-XDS100-V3 (bought it on Mouser because I didn't want to wait for it, but there are plenty on cheap clones available which should do the work) by connecting TCK and TMS (cJTAG protocol).

@DJTerentjev
Copy link

Hello. As you can see in PTVO telegram was able to flush ZBMINI with firmware configured to cc2652r.
Do you have original firmware? We want to see if original firmware have SBL pin configured, then it will be possible to flush ZBMINI with PTVO firmware using UART instead of buying XDS100.

@ptvoinfo
Copy link
Owner

@bojanpotocnik Could you please try firmware for CC2652P from the latest version with this module?

@bojanpotocnik
Copy link
Author

Do you have original firmware? We want to see if original firmware have SBL pin configured, then it will be possible to flush ZBMINI with PTVO firmware using UART instead of buying XDS100.

I have just tested with ZBMINI with the original FW. Using cc2538-bsl.py, RTS connected to RST, I connected DTR to all other available pins: KEY, LED, RELAY, TMS, TCK, S2 (S1 is GND), but none worked to access SBL. I also tested with adding --bootloader-sonoff-usb for a good measure, but it also didn't work.
With ptvo FW, it works with DTR connected to KEY (SBL mode activation pin = P23).

But I discovered another interesting thing: 2 modules side by side, one with the original FW, one with ptvo CC2652R1 FW (CC2652P still doesn't work with 63199af): they have identical LQI (29-32) 🤨

@bojanpotocnik
Copy link
Author

Considering that the original -P FW has identical LQI as the -R1 FW, I asked myself: would it be possible that ITead designed the hardware incorrectly for 20 dBm output, so they are also not using the high-power amplifier?

My doubts amplified after checking the Reference Design documents:

CC1352PEM-XD7793-XD24-PA24 Design Files
The CC1352PEM-XD7793-XD24-PA24 reference design provides schematic, layout and production files for the characterization board used for deriving the performance number found in this document. This board includes tuning for 2.4 GHz on the highpower PA output.
For the CC2652P device, the sub-1 GHz RF circuitry can be disregarded

Notice the top and bottom matching circuits and their connections, ignore the middle one:
CC2652P_connection

Notice the ZBMINI connections:
ZBMINI_connection

So this is not a FW but HW issue, @ptvoinfo sorry for me not checking this first.

@bojanpotocnik bojanpotocnik changed the title SONOFF ZBMINI (01MINIZB) with CC2652P working only as CC2652R1 SONOFF ZBMINI (01MINIZB) with CC2652P can only work as CC2652R1 - by HW design Mar 2, 2022
@V1pr
Copy link

V1pr commented Mar 3, 2022

@bojanpotocnik sorry, the conclusion is not clear for me. So, the ZBMINI cannot work as a router with the custom firmware OR just if I set the chip type to CC2652R1?

update: ZBMINI is working now, took ~20 mins to join the network (created FW as CC2652R1 + Router dev. type)

@Hedda
Copy link

Hedda commented Mar 9, 2022

sorry, the conclusion is not clear for me. So, the ZBMINI cannot work as a router with the custom firmware OR just if I set the chip type to CC2652R1?

I think that the conclusion is that can not configure the firmware to that it does to use power amplifier.

CC2652R does not have power amplifier so it is limited to 5 dBm maximum and thus using its configuration profile for a CC2652P chip it will never go over a TX transmit power of 5 dBm and thus not never try to make use of the power amplifier.

Manually configuring the TX transmit power to 5 dBm or less in the firmware should probably also work?

@glcos
Copy link

glcos commented Mar 9, 2022

Not sure if this can help, I have PTVO firmware running fine as router on a CC2652P device based on a RF Star module RF-BM-2652P2. I used a chinese clone of XDS110 to flash the device. I also have this firmware running fine on a different device based on E-BYTE E72-2G4M05S1F (CC2652RB) but this one is configured as end point (not router).
I'm waiting other modules to be delivered from China and I'm available to test when they arrive.

programmazione1

@bojanpotocnik
Copy link
Author

@glcos as ptvo mentioned in their blog post, the ptvo firmware itself works fine on the CC2652P chip and makes use of the +20 dBm power amplifier.
However, the hardware design of the module must also support using the power amplifier (see #96 (comment)), which is true for RF Star modules, but not true for 01MINIZB, S26R2ZB, and other cost-optimized devices containing CC2652P.

Manually configuring the TX transmit power to 5 dBm or less in the firmware should probably also work?

@ptvoinfo, do you need to manually enable TX Power Amplifier (e.g. before setting power higher than 5 dBm) or is it done automatically by the SDK if the set power is higher than 5 dBm?

@Hedda
Copy link

Hedda commented Mar 9, 2022

Not sure if this can help, I have PTVO firmware running fine as router on a CC2652P device based on a RF Star module RF-BM-2652P2. I used a chinese clone of XDS110 to flash the device. I also have this firmware running fine on a different device based on E-BYTE E72-2G4M05S1F (CC2652RB) but this one is configured as end point (not router).

@glcos You could maybe help by providing an end-device firmware with TX 5 dBm for users to test with "SONOFF ZBMINI-L"? See Koenkk/zigbee2mqtt#11676 and 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/

@glcos
Copy link

glcos commented Mar 9, 2022

@Hedda Unfortunately I have no idea how to provide a firmware with +5dBm output power. There is not such option in the PTVO GUI and I have no access to firmware sources.

@ptvoinfo
Copy link
Owner

ptvoinfo commented Mar 9, 2022

@glcos, The firmware for cc2652r has +5dBm output power by default. So, the firmware should be the same as for ZBMINI

@glcos
Copy link

glcos commented Mar 9, 2022

I do not own a SONOFF device to test

@Hedda
Copy link

Hedda commented Mar 10, 2022

The firmware for cc2652r has +5dBm output power by default. So, the firmware should be the same as for ZBMINI

But the "SONOFF ZBMINI" has a Zigbee Router config though and the "SONOFF ZBMINI-L" should have End Device config? See:

Koenkk/zigbee2mqtt#11676

and

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/

"SONOFF ZBMINI-L" is a device without neutral and thus not guaranteed to always have power so therefore config as End Device.

@ptvoinfo
Copy link
Owner

@Hedda
Yes, I think that the End Device config is more applicable for devices without a neutral line. PTVO has a special version with advanced power management (power saving mode -> PSM). Unfortunately, I do not have SONOFF ZBMINI-L and I cannot try it myself.

@Koenkk
Copy link

Koenkk commented Mar 26, 2022

@bojanpotocnik do you know the pin numbers off this device? P07 seems to be the LED as you mentioned but I have no clue how to find the other pins.

Update: nevermind, just found out this tool comes with a preset folder 😄

@Koenkk
Copy link

Koenkk commented Mar 26, 2022

@ptvoinfo would it be possible to generate a commandToggle instead of a commandOn/commandOff when binding it to another device? My use case it to put the sonoff mini behind a wall switch and let it control a Zigbee bulb directly. I've already tried checking toggle but this has no effect:

image

@V1pr
Copy link

V1pr commented Mar 26, 2022

@bojanpotocnik do you know the pin numbers off this device? P07 seems to be the LED as you mentioned but I have no clue how to find the other pins.

Update: nevermind, just found out this tool comes with a preset folder 😄

P07 - LED
P08 - INPUT (ext pullup)
P23 - Button/KEY
P27 - Relay

@ptvoinfo
Copy link
Owner

@Koenkk Currently, the firmware can only send on/off commands to a bound device. Does your wall switch have a button with two fixed positions, or it is a clickable button too?

@Koenkk
Copy link

Koenkk commented Mar 28, 2022

@ptvoinfo two fixed positions, it is connected to the s1 and s2 ports of the sonoff mini. I think this would be a very common use case, you will basically get a hue wall switch but than cheaper and with AC power instead of batteries.

@ptvoinfo
Copy link
Owner

@Koenkk Then, I do not understand why the switch (toggle off) & on/off commands do not work with that bulb?

@Koenkk
Copy link

Koenkk commented Mar 28, 2022

@ptvoinfo they will work, problem is that the bulb can also be controlled via zigbee2mqtt directly so the switch will be in a different state, a commandToggle would solve this

e.g.

  1. Bulb is on, sonoff mini is on
  2. Switch physical switch, sonoff mini turns off -> sends commandOff -> bulb turns off
  3. Turn bulb on via zigbee2mqtt -> bulb turns on
  4. Switch physical switch -> sonoff mini turons on -> sends commandOn -> nothing happens at the bulb since it was already on. You would expect it to turn off here.

@ptvoinfo
Copy link
Owner

@Koenkk Ok, I see. I've moved your suggestion into a separate issue (#104)

@robotsflo
Copy link

Hello @ptvoinfo, @Koenkk,

Did you think that is possible to flash with custom firmware an cheap Sonoff SNZB-01 push button to do the same functionnality that an hue wall switch
I would like to send "Toggle" command when i press on a bistable rocker switch

Today, in my experience, only the "hue wall switch" have this feature.

Thanks a lot for your reply.

image
image
image

@Hedda
Copy link

Hedda commented Feb 21, 2023

@robotsflo why not start a new seperate issue for that when your question is not related to the original issue?

@robotsflo
Copy link

@Hedda That right, it’s done #182.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants