logo elektroda
logo elektroda
X
logo elektroda

How to flash LN882H with open source Tasmota/Esphome style firmware - backup procedure included

p.kaczmarek2 46905 297
ADVERTISEMENT
📢 Listen (AI):
  • #31 20955962
    p.kaczmarek2
    Moderator Smart Home
    try doing the same but put the tool on the D partition, or any other partition outside C
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #32 20956217
    divadiow
    Level 35  
    >>20955951

    I think I saw this a few times and switched from fake FTDI to CH340 USB TTL. can't quite remember. do you have other USB-TTLs to try?
  • #33 20956401
    p.kaczmarek2
    Moderator Smart Home
    We've had already multiple reports on our forum saying that not all USB to UART converters are reliable and functional for flashing. Try using another converter.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #34 20956716
    voodoopt
    Level 9  
    But with my USB to TTL I can do DUMP
    USB to TTL adapter on a breadboard with wire connections.
    Do you think you can't write in the same way?
  • #35 20956896
    thatse
    Level 3  
    Hi all

    Thanks for you effort on the LN882H.

    Same situation here The Rx/Tx LED on my FTDI USB-to-Serial start blinking.
    But after a few seconds the LN882H_CMD_Tool retuns a fail.

    C:\Users\xxxxx\Downloads\LN882H_CMD_TOOL>LN882H_CMD_Tool.exe COM10 download flash 2000000 0x0 OpenLN882H_1.17.457.bin
    Fail. Error downloading file.

    I use the 3,3V of the USB-to-Serial as power supply for the LN822H Module

    Connections on a breadboard with FTDI USB-to-Serial module and LN882H chip.
  • ADVERTISEMENT
  • #36 20957094
    p.kaczmarek2
    Moderator Smart Home
    Both of you seem to have a different USB to UART converter than I have.
    USB to UART adapter with a yellow jumper for selecting 3.3V voltage.
    USB to UART converter with visible pins and labels.
    On this converter, I always use a jumper to connect VDD to 3.3V, because on this converter it is required to select 3.3V voltage levels.
    Helpful post? Buy me a coffee.
  • #37 20957173
    eikclan
    Level 3  
    @p.kaczmarek2 I'm using the same USB to TTL converter that you showed, and I get the same error.

    I'm starting to think it must be software related in some way, cause If i try to send the flash command with a random name for a .bin file that doesn't exist I still get the "Fail. Error downloading file"
  • #38 20957181
    p.kaczmarek2
    Moderator Smart Home
    Are you using Windows 10?
    Helpful post? Buy me a coffee.
  • #39 20957641
    eikclan
    Level 3  
    Yes, I'm using windows 10.
    And I've also tried using another PC with win10 for the flash procedure, with no luck.
  • #40 20957739
    p.kaczmarek2
    Moderator Smart Home
    Well, either you're doing something incorrectly, or your LN882H may be not flashable - but I think it should be flashable. Anyway, maybe you can just consider shipping it to me in a letter so I can check on my side?
    I am really running out of ideas.
    To be clear, you're flashing it outside the circuit?
    Helpful post? Buy me a coffee.
  • #41 20957824
    thatse
    Level 3  
    Hi,

    maybe to compare the settings we have:

    Win11 PC. LN882N Module is labeled "LN-02" it is desoldered from a Mini Smart Switch "RMW002". The chip is labeld:

    LIGHTNING
    LN882HKI
    749AY T16
    AAB M 2223

    I am using a USB to Serial with "FT232RL" chip. For VCC I select 3,3V with jumper.
    But a also tried to power the LN882N Module with a 3,3V lab supply to ensure sufficent peak power supply.
    Full power cycle before each programming attempt.

    If I execute:
    .\LN882H_CMD_Tool.exe COM10 download flash 2000000 0x0 OpenLN882H_1.17.457.bin
    Rx/Tx LED on the USB-to-Serial blink for 2...3 seconds, some action happening... But the return is "Fail. Error downloading file."

    If I execute:
    .\LN882H_CMD_Tool.exe COM10 download flash 2000000 0x0 test.bin
    And "test.bin" file isn't even existing, the tool still returns: "Fail. Error downloading file."

    If I remove TX-Pin, the LN882H_CMD_Tool is returning "Fail. Could not go in download mode.". --> Different error message, so I suspect the bootloading process is starting in my setup but then aborts.
  • #42 20957890
    p.kaczmarek2
    Moderator Smart Home
    That is the one I have flashed for upcoming YT video:
    Close-up of a modified integrated circuit with LN02 marking on a printed circuit board.
    Helpful post? Buy me a coffee.
  • #43 20957895
    voodoopt
    Level 9  
    this is my USB to TTL
    https://mauser.pt/catalog/product_info.php?products_id=096-7520

    Google Translate description
    "The USB-Serial TTL Converter PL2303 is an adapter that uses the Prolific PL2303HX chip to convert USB signals into TTL RS232 signals, which makes it extremely useful when you want to communicate between the computer and microcontrollers in general. The USB-Serial TTL Converter PL2303 is a board with reduced dimensions that has at one end a USB connector to be connected directly to the computer and at the other end a pin bar for easy connection with the board whose communication will be established, has voltages 3.3 and 5V, which allows you to work with a greater number of microcontrollers regardless of their power supply.

    For correct operation, the USB-Serial TTL PL2303 driver must be installed.

    Main features:
    - Dimensions: 50x15x7mm;
    - USB 2.0;
    - Standard USB type A male;
    - TTL output 5-pin connector (5V, 3V3, TXD, RXD and GND);"
  • ADVERTISEMENT
  • Helpful post
    #45 20958308
    fbill
    Level 1  
    Hi,

    I was the same problem. ("Fail. Error downloading file." )
    I chose downlad speed end the flash is OK!
    Try this:
    LN882H_CMD_Tool.exe COM7 download flash 115200 0x0 OpenLN882H_1.17.456.bin

    (I used cp2101 because faster than PL2303 )

    Best regards!
  • #47 20958504
    eikclan
    Level 3  
    I tried using a Win11 pc, with no luck.
    I already tried changing the baudrate to 115200, but I still get the same damn error.
    And yes, I'm trying to flash the module while is desoldered from the board.

    (Also tried putting the tool folder in the D:\ partition, same error appears)
  • #48 20958583
    p.kaczmarek2
    Moderator Smart Home
    Maybe try 57600 or 19200?
    Helpful post? Buy me a coffee.
  • #49 20958664
    voodoopt
    Level 9  
    D:\LN882H_CMD_TOOL>LN882H_CMD_Tool COM21 download flash 115200 0x0 OpenLN882H_1.17.457.bin
    Ok.
    D:\LN882H_CMD_TOOL>

    I got it, thank you. finally
    it had to be on disk D and with a speed of 115200
  • #50 20958708
    p.kaczmarek2
    Moderator Smart Home
    so it was not working on C drive, even with correct baud?
    Helpful post? Buy me a coffee.
  • #51 20958756
    dullu
    Level 5  
    Hi all,
    I am new here.
    I can confirm that LN882H can be flashed with NODE-MCU (esp8266) with CH340. Electronic board with long wires connected, lying on a colorful background.
  • #52 20958784
    thatse
    Level 3  
    Success!

    I had to switch to a USB to Serial with a CH430 chip (FTDI was not working for me). I also reduced the baud rate to 115200 while downloading.
  • #53 20958823
    eikclan
    Level 3  
    I have tried everything, but I can't get pass this error.
    This is really pissing me off, I think I will throw this damn chip in the garbage and replace it with a TYWE2.
  • #54 20958834
    voodoopt
    Level 9  
    >>20958708
    Work on c:
    the problem is correct baud 115200 ;)
  • #55 20958898
    p.kaczmarek2
    Moderator Smart Home
    dullu wrote:
    Electronic board with long wires connected, lying on a colorful background.

    Having such a long wires is bad practice, you should really shorten them. I already have seen many cases where just the length of the wires were breaking up the flashing. The first rule of good flashing setup is to keep wires short.
    Helpful post? Buy me a coffee.
  • #56 20959282
    dullu
    Level 5  
    Yes, you are 100% right!!
    Yesterday, I flashed it and it was working everything fine.
    and almost all function was working...only thing I noticed is ..... when I assign static IP and reboot, it will again come up with DHCP only.
    tried many times (assigned all like IP, Mask, GW, DNS) but it is not saved.
    Also, while applying with template for smart switch, it says Bad command ? "lfs_format" comand not found!!

    Anyways, I burned the LN822H last night because of loose long boot wire was by mistakenly touched somewhere in ESP baseboard connectors
    and I got some bad smell from the board and now no WiFi, no activities at all. :(

    Soooo... even I have flashed with long wires successfully, it is bad practice for other things too (like frying your chip).

    Now I am waiting for another from aliexpress.

    Thank you all for such a wonderful guidance.
  • #57 20965252
    voodoopt
    Level 9  
    I have a problem, I derived the MAC address
    But when I change the Mac it doesn't connect to my home WiFi
    I have to write the dump again, flash with new bin and try to configure it again. unsuccessful
  • #58 20966104
    divadiow
    Level 35  
    divadiow wrote:
    I ripped the pad off boot on my first LN-02 mini switch not moving it around delicately enough 😳


    ive gone back to this. desoldered from PCB and examined trace from where boot pad was. Scratched off the ink along the T in TX text to reveal the copper trace. Fluxed and tinned a little, then used pogo pins to ground boot. LN-02 now flashed to OpenBK.

    Also. I used fake FTDI USB adaptor, so didn't have to use CH340 as previously thought. Flashed without setting baud in cmd

    LN882H_CMD_Tool.exe COM10 download flash 2000000 0x0 OpenLN882H_1.17.432.bin


    USB Serial Port properties on COM10 settings. USB Serial Port (COM10) properties with FTDI driver information.

    Close-up of a PCB with exposed copper trace near the .BOOT label. Screenshot of OpenBK interface displayed in a browser.
  • #59 20979034
    voodoopt
    Level 9  
    no one else had problems with mac address?
  • #60 20979045
    divadiow
    Level 35  
    voodoopt wrote:
    no one else had problems with mac address?


    I have not. I've flashed 3 or 4 units now.
📢 Listen (AI):

Topic summary

The discussion focuses on flashing LN882H modules with open-source firmware similar to Tasmota/Esphome, enabling cloud-free operation and integration with Home Assistant. Flashing requires a USB to UART converter with reliable 3.3V power supply, connecting module TX to UART RX, RX to TX, GND to GND, and 3.3V to 3.3V. Users report challenges including access to the BOOT pin, interference from board components on RX/TX lines, and the necessity of short wiring to ensure stable flashing. Various USB to UART converters (CH340, FT232RL, PL2303, CP2101) have differing success rates; CH340 and CP2101 are recommended over some FTDI and PL2303 adapters. Correct baud rate (115200) and running the flashing tool from non-system drives (e.g., D:) improve success. The LN882H_CMD_Tool is used for flashing and dumping firmware; flashing requires power cycling and keeping BOOT grounded during operations. Users successfully dumped firmware but often encountered "Fail. Error downloading file" during flashing, resolved by adjusting baud rate, shortening cables, and using compatible USB-UART adapters.

Power-saving features are under active development; enabling PowerSave mode reduces power consumption and device temperature but may cause WiFi connection issues in some firmware versions. PowerSave commands can be set via startup commands or command tool, with better effect when applied directly via command tool. Temperature monitoring shows LN882H devices run hot (up to 74°C) without load, improved by PowerSave mode. Integration with energy metering (BL0937) is affected by PowerSave due to interrupt handling. Static IP assignment is currently unimplemented in firmware. DHT sensor support is partially implemented; drivers require manual start commands, and pin mapping must be correct. NTP client requires manual driver start and supports server IP configuration via commands. Safe mode can be triggered by power cycling to reset device settings. Firmware and tools are evolving with ongoing commits addressing power management, filesystem (LittleFS), and device stability.

Overall, flashing LN882H modules demands careful hardware setup, compatible USB-UART adapters, correct flashing parameters, and power cycling. Firmware features like power saving, sensor support, and network configuration are improving but still have limitations. Community contributions and testing continue to enhance LN882H open-source firmware usability and integration.
Summary generated by the language model.
ADVERTISEMENT