logo elektroda
logo elektroda
X
logo elektroda

Teardown and Reflashing of Tuya Smart Socket EU20A with LN882HKI Chip Analysis

bogdanelhh 13293 75
ADVERTISEMENT
  • ADVERTISEMENT
  • #62 21796755
    max4elektroda
    Level 23  
    You will need the correct pin configuration for your plug to get the power meters readings.
    Can you trace the BL0937 pins to the pins of the LN882H?


    Pinout diagram and pin function descriptions for BL0937 IC
  • #63 21797420
    GoldMember
    Level 12  
    max4elektroda wrote:

    Can you trace the BL0937 pins to the pins of the LN882H?


    Do you mean physical connection between BL0937 and LN882H?
  • ADVERTISEMENT
  • #64 21797531
    max4elektroda
    Level 23  
    GoldMember wrote:
    Do you mean physical connection between BL0937 and LN882H?

    Yes, you will need to know, which of the BL0937 pins SEL, SEL1 and CF is connected to which LN882H IO pin.
    You might be lucky that someone which exactly the same device than yours allready figured this out or need to do it by yourself.
    Depending on your device you might also "guess" them, if you have a separate LN882H module with only a handful of connections and can "easily" find the relay with IO doctor (you will hear the clicking sound) if you found the right one, then you might also just try all possible permutations. But since the BL0937 usually has the pins easily accessible, it should be possible to check the connections by eye (following the PCB connections) or with a multimeter.
  • #65 21799115
    p.kaczmarek2
    Moderator Smart Home
    I think Counter role can be also used to find BL0937. Counter pin counts pulses in the channel and BL0937 works by sending pulses on CF and CF1 pins. So that only would leave SEL to be found.
    Helpful post? Buy me a coffee.
  • #66 21799303
    GoldMember
    Level 12  
    BL0937 pin - LN 882H pin
    6 --------------- 25
    7 --------------- 26
    8 --------------- 27
  • ADVERTISEMENT
  • #67 21799304
    divadiow
    Level 38  
    if you took backup of Tuya firmware does Easy Flasher not extract config?
  • ADVERTISEMENT
  • #68 21799311
    insmod
    Level 31  
    >>21799304
    No LN device contains pin settings in tuya config.
  • #69 21799322
    divadiow
    Level 38  
    >>21799311

    darn, oh yes ;)

    example
    Code: JSON
    Log in, to see the code
  • #70 21799323
    max4elektroda
    Level 23  
    GoldMember wrote:
    BL0937 pin - LN 882H pin
    6 --------------- 25
    7 --------------- 26
    8 --------------- 27

    According to this

    Pin layout diagram of the LN882HKx chip by Lightning Semiconductor (QFN32)

    It should be

    CF (Pin 6) = B4 (Pin 25)
    CF1 (Pin 7) = B5 (Pin 26)
    SEL (Pin 8) = B6 (Pin 27)

    Does it work with this assignment?
  • #71 21799463
    GoldMember
    Level 12  
    Yes, it works. Configuration has to be like that:

    Interface with dropdown menus and numeric fields for ports A6–B6
  • #72 21831876
    mariuszkowa
    Level 4  
    I have a similar Smart Socket with LN882HKI (it's CozyLife XLD01 10A; check the attached pictures).
    I would really appreciate it if anyone could help me find where I can attach RX, TX, 3.3 V, GND, CEN wires for flashing.
    I've also checked the bottom side of the PCB; nothing useful is there, unfortunately.

    Round XLD01 smart socket PCB with LN882HKI chip, capacitors, and power components
    Close-up of PCB with Lightning LN882HKI chip and a 40.000 MHz crystal oscillator
    Disassembled smart socket: green XLD01 PCB next to a white housing with a power button
    Disassembled smart socket: plug with printed specs and empty white housing on a red background
  • #73 21832324
    max4elektroda
    Level 23  
    You will need A2 and A3 (Rx and Tx) and A9 needs to be connected to GND for flashing.

    Tried to add the info to your image:

    Close-up of a PCB with a “LIGHTNING” IC and red arrows labeling pins A2 Rx, A3 Tx, and A9→GND for flashing

    If these pins are not connected (maybe there are contacts on the other side of PCB ? but it doesn't look like this) you will need to solder or use some needles...
  • #74 21832378
    mariuszkowa
    Level 4  
    >>21832324
    Thank you so much @max4elektroda!
    Wondering if there's any place to attach 3.3 V and CEN for reset during flashing. I guess plugging the socket normally and quickly off/on power when needed may also work?
  • #75 21832386
    max4elektroda
    Level 23  
    I hope it's clear that flashing should NEVER be done while the plug is connected to high voltage?

    LN882H doesn't need reconnecting or CEN, this is only needed with Beken, if I'm not mistaken.
    For this chip, only A9 needs to be connected to GND for flashing.

    I would use LDO (the voltage regulator) for supply of 3.3 V. Your power supply should be capable of delivering enough current to drive the chip, usually output of an USB Uart is not enough!
    On your first picture I see an AMS1117 3.3 on the upper left. Pin 1 (the left one, below the "3.3") is GND, Pin 2 (middle and the big one on the upper side) is +3.3V.
    You might also try "using" the LDO by using a 5V source on the input of the LDO. The 5V should be attached to pin 3, the one to the right while GND is the same (Pin 1).
    If you are unsure, ask again, much better than breaking something with a wrong connection...
  • #76 21832928
    mariuszkowa
    Level 4  
    >>21832386
    Thank you very much @max4elektroda! I have all the information I needed now. Once I get some free time, I'll give it a try and let you know about effects. Big thanks again!

Topic summary

The discussion focuses on the teardown and reflashing process of the Tuya Smart Socket EU20A, which uses the LN882HKI chip and supports power monitoring via the Smart Life app with Google Assistant and Alexa integration. The original poster successfully soldered wires to the chip's UART pins (notably A9 to GND for download mode) and flashed the device using an external 3.3V power supply and a CH340 USB-to-serial adapter. Key UART pins identified include RX0/TX0 on A3/A2 (pins 11 and 10) and RX1/TX1 on B8/B9. The reflashing process involves entering download mode by pulling A9 to ground, with LED behavior indicating mode status. Users reported challenges with unstable web configuration interfaces and long firmware dump times (~40 minutes). A configuration template was shared, mapping pins for LED, button, relay, and BL0937 power metering chip signals. Calibration of the BL0937 chip is necessary for accurate power measurement, achievable via the device's web app tools. Backup of original firmware before flashing is recommended but often difficult due to instability. Alternative flashing methods and device variants with different chips (e.g., T34, BK7231N) were noted, with OpenBeken firmware supporting multiple chipsets. Practical advice includes using short cables, lowering serial baud rates (e.g., 115200 or 921000), and ensuring solid ground connections to improve flashing reliability. The community provided links to related resources, firmware repositories, and configuration guides to assist in reflashing and configuring the device for custom use cases such as solar panel energy monitoring.
Summary generated by the language model.
ADVERTISEMENT