logo elektroda
logo elektroda
X
logo elektroda

LN-CB3S Module Pinout and Flashing Issues on Tuya Wall Switch – Any Documentation?

patentjyp 840 19
Best answers

What is the pinout of the LN-CB3S module, and how do I put it into flash mode on a Tuya wall switch?

The module appears to be an LN882H-based LN-CB3S/LN-CB3S_V1.0 variant, and it can be flashed by pulling A9 to GND on boot; default RX/TX are used for flashing, while logs are on B9 [#21815999][#21884786] One user successfully flashed the module and confirmed that it works with both OpenBK/OBK and ESPHome [#21875743][#21877215] The posted pin functions for a BSEED 2-gang switch were PA0 backlight LED, PA2 right indicator LED, PA4 left indicator LED, PA6 relay 1, PA10 status LED, PA11 left button input, PB5 relay 2, and PB6 right button input [#21875863] A backup/readout was taken with BK7231GUIFlashTool / BK7231GUIFlashTool-style tooling, which also expects the chip in flashing mode with A9 grounded [#21815999]
Generated by the language model.
ADVERTISEMENT
  • #1 21815997
    patentjyp
    Level 5  
    Electronic module with labeled pins on a blue PCB, top view LN-CB3S electronic module with PCB antenna, CE marking, and QR code

    Any info on this module?

    I could not find any information by googling "LN-CB3S."

    It seems that this module has different pin labeling (and/or different pinouts) from CB3S module.

    I connected A2 and A3 pins to TX and RX (and also tried to RX and TX) of my USB-to-serial (and also CEN to GND), but I cannot get it to enter flash mode.

    This module is from a Tuya wall switch. Since I could not flash this module with any open-source firmware, I had to replace it with ESP-12F.

    Any info would be appreciated.
  • ADVERTISEMENT
  • #2 21815999
    insmod
    Level 31  
    Judging from module and pin names - LN882H.
    Default RX/TX are for flashing (and app uart, if used), log should be at B9.

    Backup can be taken with BK7231GUIFlashTool, chip enters flashing mode with A9 pulled down on boot
  • #3 21818982
    p.kaczmarek2
    Moderator Smart Home
    Interesting, looks like LN882H CB3S version. Can you try to take a backup with our flasher?
    https://github.com/openshwprojects/BK7231GUIFlashTool
    Helpful post? Buy me a coffee.
  • #4 21820714
    divadiow
    Level 38  
    Pinout diagram of an electronic module showing GPIO, UART, and 3.3V power connections
    Attachments:
    • CB3S_4layers.zip (262.84 KB) You must be logged in to download this attachment.
    • CB3S_2layers.zip (228.95 KB) You must be logged in to download this attachment.
  • #5 21875317
    bl00dy
    Level 7  
    any success to flash LN-CB3S ?
  • ADVERTISEMENT
  • #6 21875564
    divadiow
    Level 38  
    was that aimed at @patentjyp? If it behaves like a standard LN882H then there should be no issues reading or writing to this module
  • #8 21875746
    divadiow
    Level 38  
    Cool.

    Did you take a backup first? Would you be happy to share it for addition to our collection?
  • #9 21875863
    bl00dy
    Level 7  
    Hello,

    Yes, uploaded.

    Chip: LN-CB3S_V1.0
    Model: WL2H-U-2
    Device: DS-101JL, BSEED Wifi Touch Light Switches 2 Gang Smart Wall Switch
    PinFunctionDirectionInverted
    PA0Backlight LEDOutputyes
    PA2Right indicator LEDOutputyes
    PA4Left indicator LEDOutputyes
    PA6Relay 1 — Left LightOutputno
    PA10Status LEDOutputyes
    PA11Button LeftInput PULLUPyes
    PB5Relay 2 — Right LightOutputno
    PB6Button RightInput PULLUPyes

    Ed
  • ADVERTISEMENT
  • #10 21875955
    divadiow
    Level 38  
    thanks. Easy Flasher chokes on the KV extraction from that dump. Will fix.

    Screenshot of BK7231 Easy UART Flasher showing an error message and an empty JSON panel
  • #11 21875969
    bl00dy
    Level 7  
    When comparing two flash dumps from DS-101JL light switches (Tuya WL2H-U-2 module, LN882H chip),
    I found the following:

    Firmware is 100% identical between units

    Both devices came from the factory with exactly the same firmware. The app partition
    (0x007000–0x132FFF, 1.2 MB) is bit-for-bit identical.

    Flash partition layout (2 MB total)

    
      Partition   Offset      Size    D1 vs D2
      ---------   ------      ----    --------
      boot        0x000000    24 KB   IDENTICAL
      part_table  0x006000     4 KB   IDENTICAL
      app         0x007000   1.2 MB   IDENTICAL  ← same firmware on all units
      ota         0x133000   680 KB   different  (6306 bytes — MAC   provisioning)
      nvds        0x1DD000    12 KB   different  (1146 bytes — runtime state)
      kv          0x1E0000    16 KB   different  (3069 bytes)
      kvs         0x1E4000    32 KB   different  (4095 bytes)
      user        0x1EC000    80 KB   different  (77813 bytes)
      


    All differences are in the data area above 0x133000 — device-specific info only.

    MAC address location

    Both WiFi and BLE MACs are stored in the OTA partition region at offset 0x1C543C.
    The KV key names are readable in plaintext:

    
      Key name      Offset      D1                  D2
      --------      ------      --                  --
      6_sta_mac     0x1C543C    00:33:7A:2B:86:95   BC:35:1E:BE:41:EB
      24_ble_mac    0x1C5464*   00:33:7A:2B:86:96   BC:35:1E:BE:41:EC
    
      * stored in reversed byte order
      


    BLE MAC is always WiFi MAC 1. The OUI 00:33:7A belongs to Lightning Semiconductor,
    BC:35:1E belongs to Tuya.

    KV key names visible in plaintext around the MAC area

    
      it_magic     — KV entry separator/magic marker
      6_sta_mac    — WiFi (station) MAC address
      24_ble_mac   — BLE MAC address
      ty_ada_psk   — WiFi credentials (SSID   password, plaintext!)
      
  • #12 21876010
    divadiow
    Level 38  
    Code: JSON
    Log in, to see the code
  • ADVERTISEMENT
  • #13 21877066
    divadiow
    Level 38  
    boot log
    Code: Text
    Log in, to see the code


    Added after 9 [hours] 31 [minutes]:

    @bl00dy, to confirm, your BSEED 2G touch light switch device has a WL2H-U (WL2H-U-2?) module, not LN-CB3S, the original focus of this thread?

    did you go with OBK or ESPHome in the end? I see you posted here too https://github.com/libretiny-eu/libretiny/issues/338#issuecomment-4178208889

    if OBK, what does your OBK template look like, so it can be added to device list?
  • #14 21877215
    bl00dy
    Level 7  
    Hello,

    Let me send photo of chip:
    As you can see, it's LN-CB3S_V1.0 with WL2H-U-2 on it.
    I installed OBK on it, and also installed ESPHome. Both work.

    Ed
    Close-up of green PCB with LN-CB3S_V1.0 module and shielded WL2H-U-2 chip
  • #15 21877216
    divadiow
    Level 38  
    oh interesting. I see now. thanks
  • #16 21877224
    bl00dy
    Level 7  
    there are 2 images without attaching to my Wi-Fi, clean from vendor
    Attachments:
    • ln882h.zip (1.2 MB) You must be logged in to download this attachment.
  • #17 21877225
    divadiow
    Level 38  
    thanks for the updates. Did you go with OpenLN882H or with ESPHome/LT?
  • #18 21877756
    bl00dy
    Level 7  
    I fix static IP issue in a code and MAC address, and go with ESPHome, as I have more than 100 devices in ESPHome.
  • #19 21884532
    magikow
    Level 1  
    >>21877215 I have a similar circuit on my Smart Switch 4 channel - what settings to take in Flasher - what circuit to choose and do I short circuit A9 to ground when reading ?
  • #20 21884786
    bl00dy
    Level 7  
    Yes. Just A9 to ground when reading or writing chip.

Topic summary

✨ The LN-CB3S module, found in a Tuya wall switch, appears to differ in pin labeling and pinout from the standard CB3S module, complicating attempts to flash it with open-source firmware. Attempts to enter flash mode by connecting A2 and A3 pins to TX and RX of a USB-to-serial adapter, and grounding CEN, were unsuccessful. The module is identified as based on the LN882H chip. For flashing, the default RX/TX pins are used, with logs accessible at pin B9. To enter flashing mode, the A9 pin must be pulled low during boot. Backup operations can be performed using BK7231GUIFlashTool. Due to flashing difficulties, the original module was replaced with an ESP-12F.
Generated by the language model.
ADVERTISEMENT