logo elektroda
logo elektroda
X
logo elektroda
Dostępna jest polska wersja

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

Flashing Connex Connect CC-P2000 10A Smart WiFi Switch with WB2S: A User's Journey

rudolfbyker 5583 34
Best answers

How can I flash a Connex Connect CC-P2000 WB2S module in circuit when the UART flasher never gets a reply?

Try shortening the UART wiring, prefer a full power-off/on reset over relying on CEN, and if the RX/TX lines seem to be held up by extra parts, remove the small capacitors on those lines if present [#20691644][#20694300][#20692794] The thread’s working solution was to flash the BK7231T/WB2S in-circuit with `hid_download_py` on Linux, using the `BK7231T UART Flash` firmware image and then cycling power or pulsing CEN to start flashing [#20699478] The Windows GUI flasher was unreliable in this case, including COM-port/opening failures and hangs while reading, while the Linux tool succeeded [#20693283][#20699326][#20699478]
Summary generated by AI based on the discussion content.
ADVERTISEMENT
  • #31 20699250
    rudolfbyker
    Level 4  
    Posts: 29
    Rate: 2

    The journey continues with the next 7 switches. I'm stubbornly trying to figure out how to flash them without desoldering, to save time. With the shorter wiring, I'm getting a tiny bit further than before. When I press the CEN button, it immediately says "Getting bus success!", but then hangs at "Reading 0x00". (Exactly the same if I do a power cycle.) When I check with my oscilloscope, I can see that the chip is replying with some data, and then goes silent. My oscilloscope is not good enough to allow me to check what is actually being sent/received both ways.

    Is there a way in software to monitor what is being sent/received as text?

    If not, I could buy two more USB-UART devices and connect one RX line of each to the TX-RX and RX-TX lines of the programming setup, just to monitor what is going both ways.

    Added after 17 [minutes]:

    I can create an intercepted UART using this command from https://unix.stackexchange.com/a/225904/28063
    socat /dev/ttyUSB0,raw,echo=0 SYSTEM:'tee in.txt | socat - "PTY,link=/tmp/ttyV0,raw,echo=0,waitslave" | tee out.txt'

    and then monitor it with
    tail -f in.txt
    in one terminal and
    tail -f in.txt
    in another terminal.

    But I can't set the flasher to use /tmp/ttyV0.
  • ADVERTISEMENT
  • #32 20699262
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14679
    Help: 656
    Rate: 12705
    Let's try another approach.

    Connect GND, RX, TX and then also connect 5V to the input of the onboard 3.3V regulator, so it outputs correct 3.3V for WiFi module.

    Then try resetting with power off and on.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #33 20699326
    rudolfbyker
    Level 4  
    Posts: 29
    Rate: 2
    OK, so that is the AMS1117 3.3V chip. Datasheet: http://www.advanced-monolithic.com/pdf/ds1117.pdf

    Close-up of an AMS1117 3.3V chip mounted on a PCB with attached wires.

    I get the same results when powering from the 5V pin, except that now the relay and LED are also on (as expected). I tested with CEN and with power cycle. I tested with USB 5V and with bench power supply (with very short wires). It hangs at "Reading 0x00".

    If I wait long enough, I get this:
    failed with serial.BytesToRead 4095 (expected 4111)
    The beginning of buffer in UART contains 040EFF01E0FCF4061009000000200043 data.
    Failed! There was no result to save.


    I'm also monitoring the 5V line with my oscilloscope, and it's not dropping, even by a µV, so it can't be a power supply issue.
  • ADVERTISEMENT
  • #34 20699383
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14679
    Help: 656
    Rate: 12705
    Does the same happen with hid_download_py Python tool? I had some reports saying that our GUI tool is less stable when run on Mono on non-Windows platform
    Helpful post? Buy me a coffee.
  • #35 20699478
    rudolfbyker
    Level 4  
    Posts: 29
    Rate: 2

    The Python flasher works in-circuit on Linux! Yay!

    Full steps for someone trying to replicate this:
    - Download the latest hid_download_py from GitHub here: https://github.com/OpenBekenIOT/hid_download_py
    - Extract it somewhere and cd into it.
    - Create a venv inside of it:
    python -m venv

    - Activate the venv:
    . venv/bin/activate

    - Install dependencies in the venv:
    pip install -r requirements.txt

    - Download the latest firmware from GitHub here: https://github.com/openshwprojects/OpenBK7231T_App/releases Make sure you get the "BK7231T UART Flash" version, e.g., "OpenBK7231T_UA_1.17.221.bin".
    - Run the flasher:
    ./uartprogram OpenBK7231T_UA_1.17.221.bin -w

    - Cycle power or press CEN button (i.e. connect CEN to GND momentarily)

    I tried reading/writing the OBK config using the GUI tool AFTER flashing successfully with `hid_download_py`, but it still fails with the same problem.

    I dual-boot Windows 10 and Linux Mint, but I can't get my USB-UART to work reliably on Windows (always getting errors about permissions or not being able to open the port). On Linux, it seems to work well.

    I also tried in a Windows 10 VirtualBox running on top of my Linux Mint, sharing the USB-UART device from Linux to the VM. I get the exact same errors as on the bare-metal Windows. So I'm highly suspecting that the problem is with the Windows 10 driver for my very old USB-UART converter!

    Starting read!
    Now is: Saturday, 19 August 2023 11:29:15 AM.
    Flasher mode: BK7231T
    Going to open port: COM3.
    Serial port open exception: System.IO.IOException: A device which does not exist was specified.
       at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
       at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
       at System.IO.Ports.SerialPort.Open()
       at BK7231Flasher.BK7231Flasher.openPort() in W:GITBK7231GUIFlashToolBK7231FlasherBK7231Flasher.cs:line 95
    Failed to open serial port!
    OBK config load failed.

Topic summary

✨ The discussion revolves around the flashing process of the Connex Connect CC-P2000 10A Smart WiFi Switch, which contains a WB2S module. The user initially faced challenges with wiring, UART connections, and firmware flashing. After troubleshooting, including using a USB-UART converter and examining the PCB, the user successfully extracted the device configuration and flashed the firmware using the hid_download_py tool on Linux. The device was eventually connected to WiFi after correcting the SSID issue. The user also configured additional features, such as a digital input for a toggle switch, and shared insights on the device's pin mapping and safety considerations regarding its non-isolated power supply.
Summary generated by AI based on the discussion content.

FAQ

TL;DR: For anyone flashing the Connex Connect CC-P2000, the decisive result was a 2MB backup first, then Linux flashing with hid_download_py; as one expert put it, "The Python flasher works in-circuit on Linux!" The final working map was BK7231T GPIO 6/7/8/26, and the Wi-Fi failure turned out to be a wrong 2.4GHz SSID rather than bad firmware. [#20699478]

Why it matters: This thread turns a frustrating WB2S smart-switch teardown into a repeatable OpenBeken workflow, including backup, flashing, GPIO mapping, Wi-Fi recovery, and mains-safety warnings.

Method Result in this thread Best use Main issue seen
BK7231GUIFlashTool on Windows Unreliable Backup or config work if COM port is stable COM port open failures
BK7231GUIFlashTool on Linux/Mono Partial Some reads, but unstable for this device Read hangs at 0x00
hid_download_py on Linux Successful in-circuit flash Preferred flashing path for this CC-P2000 Requires command-line setup
Desolder and flash separately Successful Fallback when in-circuit flashing fails Extra soldering time

Key insight: The hardest problem was not the WB2S hardware. The breakthrough came from using the right Linux flasher and correcting the router SSID, because the device had flashed correctly before Wi-Fi joined successfully. [#20695791]

Quick Facts

  • The extracted Tuya/OpenBeken mapping for this CC-P2000 was P6 = LED_n;1, P7 = Rel;1, P8 = Btn;1, P26 = WifiLED_n;0, on a WB2S module with a BK7231T chip. [#20696398]
  • A full 2MiB firmware backup was explicitly recommended before flashing, because it lets you recover the original image and extract GPIO roles from Tuya data. [#20692724]
  • OpenBeken safe mode was triggered by 5 quick power cycles or resets, and 2 seconds was suggested as a safe on/off interval. [#20694300]
  • The switch uses a non-isolated power supply, and the module ground can sit at mains neutral potential; in South Africa that means a wiring mistake can expose 220V–240V on added wires. [#20696508]
  • The user successfully added a normal wall toggle as a fixed-state input on an unused BK pin, so the relay still worked from both the physical switch and Home Assistant. [#20696398]

How do I flash a Connex Connect CC-P2000 10A Smart WiFi Switch with a WB2S module using OpenBeken?

Use the Linux hid_download_py method or desolder the WB2S and flash it directly. 1. Make a full 2MiB backup first. 2. Download hid_download_py, create a virtual environment, install requirements, and run ./uartprogram OpenBK7231T_UA_1.17.221.bin -w. 3. Power-cycle the board or pulse CEN to reset it, then configure Wi-Fi through OpenBeken. The user confirmed this exact flow worked in-circuit on Linux after earlier failures with the GUI tool. [#20699478]

Why might in-circuit flashing of a WB2S fail on the Connex Connect CC-P2000 even when TX, RX, CEN, 3.3V, and GND are connected?

In-circuit flashing can fail because timing, line loading, and tool stability all matter. The thread identified long wires, noisy wiring, unreliable CEN resets, onboard capacitors affecting UART or reset timing, and the board’s own power circuitry as likely causes. The user also saw the flash process hang at Reading 0x00, then report failed with serial.BytesToRead 4095 (expected 4111), which points to incomplete serial transfer rather than a dead module. [#20699326]

What are the correct BK7231T GPIO assignments for the Connex Connect CC-P2000, and how do they map to the WB2S pins?

The confirmed BK7231T assignments are GPIO6 = relay LED, GPIO7 = relay, GPIO8 = button, and GPIO26 = Wi-Fi LED. The user matched those to WB2S functions as PWM0, PWM1, PWM2, and PWM5 respectively, and later verified the relay LED needed inversion, so the final template used LED_n;1, Rel;1, Btn;1, and WifiLED_n;0. That mapping explains why the board appeared to use only a few WB2S pins. [#20696398]

Which works better for flashing a BK7231T/WB2S device on Linux: BK7231GUIFlashTool or hid_download_py?

hid_download_py worked better on Linux for this device. The GUI tool could back up and extract config in some cases, but it also hung during in-circuit reads and was reported as less stable under Mono on non-Windows systems. By contrast, the user stated, "The Python flasher works in-circuit on Linux!" after successfully flashing OpenBK7231T with ./uartprogram ... -w. That makes hid_download_py the safer choice for this CC-P2000 workflow. [#20699478]

What is OpenBeken safe mode, and how do the 5 quick power cycles or CEN resets trigger it?

OpenBeken safe mode is a recovery boot state that opens an access point after repeated incomplete boots. "Safe mode" is a firmware recovery mode that blocks normal startup after repeated failed boots, opens an emergency AP, and helps you reconfigure Wi-Fi or recover access without reflashing. The thread explains the logic: the boot counter increments at startup, and if the device restarts 5 times before the "boot ok mark" timeout, safe mode activates. A practical interval of about 2 seconds off and 2 seconds on was recommended. [#20694300]

How can I back up the full 2MB firmware from a Tuya WB2S device before flashing OpenBeken, and why is that backup useful?

Use the flasher’s firmware-backup option before writing OpenBeken, and save the entire 2MiB image. That backup matters because it preserves the stock firmware and lets you extract Tuya GPIO roles, which is exactly how this device’s button, relay, and LEDs were identified. The expert explicitly asked for a 2MB flash backup before flashing because those roles can be recovered "easily" from the image and then used to build the final OpenBeken template. [#20692724]

Where do I access the OpenBeken web interface after flashing a WB2S module, and when should I use 192.168.4.1 versus the DHCP IP address?

Use 192.168.4.1 when the module is in OpenBeken AP mode, and use the router-assigned DHCP address once it joins your Wi-Fi. The thread states that after flashing, you either connect directly to the OBK access point and open 192.168.4.1, or, if Wi-Fi credentials are already correct, the module joins your network and you browse to its DHCP IP. The user confirmed both paths during testing. [#20693893]

Why would an OpenBeken-flashed BK7231T device show WIFI_STA_DISCONNECTED and fail to join Wi-Fi even though the firmware flashed successfully?

A flashed device can still fail Wi-Fi because the SSID or network details are wrong. In this case, the debug log repeatedly showed WIFI_STA_DISCONNECTED, but the real cause was simple: the router appended 2.4GHz to the SSID, and the user had entered the unmodified name instead. Once the exact 2.4GHz SSID was corrected, the CC-P2000 connected normally. The firmware was fine; the network name was not. [#20695791]

What is PowerSave 1 in OpenBeken, and why was it recommended for this cheap Tuya-style smart switch power supply?

PowerSave 1 is an OpenBeken setting recommended here to reduce stress on weak low-cost power supplies. The expert advised enabling it because this switch looked very cheap and some Tuya-style power supplies reportedly need PowerSave 1 to work correctly without capacitor degradation over time. The final device template also included the startup command backlog PowerSave 1;, which shows that this was treated as part of the normal configuration for the CC-P2000. [#20695831]

How can I add a normal wall toggle switch to a BK7231T smart switch so it keeps a fixed ON/OFF meaning instead of acting like a momentary button?

Use an unused BK7231T GPIO as an input that tracks switch position instead of a pulse-style toggle. The user tested this successfully and explained the goal clearly: one physical position should always mean ON, and the other should always mean OFF. The expert noted that any unused BK7231 GPIO can be assigned flexibly, including extra buttons or inputs, and later suggested TglChannelOnToggle as an alternative if pure digital input was not desired. [#20696454]

What safety risks come with modifying the Connex Connect CC-P2000, especially since it uses a non-isolated power supply tied to mains neutral?

The main risk is electric shock from mains-referenced low-voltage wiring. The thread states that this model uses a non-isolated supply, so WB2S ground is tied directly to neutral. If live and neutral are swapped, any extra wire brought out from the module side could sit at live potential, around 220V–240V in South Africa. That makes external switches, test leads, and improvised headers dangerous unless you verify polarity with a multimeter first. [#20696508]

Why does the BK7231GUIFlashTool on Windows sometimes report COM port errors like 'A device which does not exist was specified' with older USB-UART adapters?

The likely cause is unstable Windows serial-driver behavior or another program holding the COM port. The user saw repeated System.IO.IOException: A device which does not exist was specified errors with an older PL2303HX-style USB-UART adapter, both on bare-metal Windows 10 and inside a Windows 10 VirtualBox VM. Linux handled the same adapter more reliably, which led the user to suspect the Windows driver rather than the WB2S itself. Background apps taking the port were also mentioned as a known cause. [#20699478]

What is a WB2S module, and how is it different from the BK7231T chip it contains?

A WB2S is the Wi-Fi module board, while BK7231T is the main SoC mounted on that module. "WB2S is a Tuya Wi-Fi module board that carries a BK7231T chip, onboard antenna, power-routing pads, and module pin names that differ from the raw BK7231T GPIO numbering used by OpenBeken templates." That distinction mattered in this thread because the user first traced WB2S pins like PWM0 and PWM5, then mapped them back to BK7231T GPIO numbers 6 and 26. [#20696093]

How do I create a proper OpenBeken device template JSON for the Connex Connect CC-P2000, including board, product, pins, keywords, and commands?

Use WB2S as the board, add the product URL, keep the chip as BK7231T, and define the confirmed pin roles. The completed template included vendor Connex Connect, model CC-P2000, keywords such as WIFI401-N-V1.2, OB2222MCP, AMS1117, and YX202-S-105D, plus the command backlog PowerSave 1;. The final working pin block was GPIO6 LED_n;1, GPIO7 Rel;1, GPIO8 Btn;1, and GPIO26 WifiLED_n;0, which was accepted as ready for a pull request. [#20696667]

Is there a software way to monitor the UART traffic as readable text during WB2S flashing, and what tools can help intercept TX/RX on Linux?

Yes, Linux can intercept UART traffic in software, although this thread did not show a finished decoded-text workflow. The user proposed a working-style setup using socat to create an intercepted pseudo-terminal, then tee plus tail -f to watch input and output logs live. When the GUI tool could not use /tmp/ttyV0, the practical workaround was to switch to the Python flasher, which completed the in-circuit flash successfully without needing extra USB-UART sniffers. [#20699250]
Summary generated by AI based on the discussion content.
ADVERTISEMENT