logo elektroda
logo elektroda
X
logo elektroda

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

p.kaczmarek2 63516 297

TL;DR

  • LN882H modules can be flashed over UART with open-source Tasmota/Esphome-style firmware to free cloud-controlled devices and integrate them with Home Assistant.
  • Wire module TX, RX, GND, 3V3, and BOOT/GPIOA9 to ground, and keep GPIOA9 low throughout the entire flashing process.
  • Backup uses `python LN882H_Flash_Dumper.py COMx flashdump`, and the firmware flash command is `LN882H_CMD_Tool.exe COMx download flash 921000 0x0 flashimage.bin`.
  • After flashing, power-cycle the module, disconnect BOOT from ground, and open 192.168.4.1 to configure it like other OpenBeken/Tasmota-style devices.
  • A reliable external 3.3V supply is recommended because powering directly from the USB-to-UART adapter’s 3.3V pin may fail.
Generated by the language model.
ADVERTISEMENT
📢 Listen (AI):
  • #181 21064556
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    I didn't think about this point, but just gave it a try with delaying only if (Main_IsConnectedToWiFi() == 0) && (Main_IsOpenAccessPointMode() ==0).

    I think we can safely ignore this case ;-)
    [WLIB_E]This operation is prohibited in current WiFi mode(1)!


    Added after 2 [minutes]:

    ... and the module draws a current from almost 100 mA in AP mode
  • ADVERTISEMENT
  • #182 21064574
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14413
    Help: 650
    Rate: 12361
    So they didn't even bother to allow AP mode optimization, I see. Ok, so the PR is ready to merge?
    Helpful post? Buy me a coffee.
  • #183 21064629
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    I can't see why not.
    We should just point out, that "powerSave 2"
    - breaks power measurement with BL0937 and
    - might lead to sporadic WiFi reconnects
  • #184 21064688
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14413
    Help: 650
    Rate: 12361
    Merged, thank you!
    The PowerSave actually also breaks BL0937 on other platforms, like on Beken, but in that case even PowerSave 1 breaks it. And as far as I know Tuya is also not using PowerSave on BL0937 devices. This is because BL0937 works by counting pulses with a GPIO interrupt...

    Ok, so what's next for LN882H? Hm, isn't LittleFS still missing?
    Helpful post? Buy me a coffee.
  • #185 21064811
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    Yes, I remember I said I will try LittleFS...
    Since I'm waiting for some tests on the clock implementation, I'll go for this next.
  • #186 21064865
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14413
    Help: 650
    Rate: 12361
    Before I forget, that little fix is also awaiting testing:
    https://github.com/openshwprojects/OpenBK7231T_App/pull/1189
    Regarding LittleFS, here is the same process done for BL602:
    https://github.com/openshwprojects/OpenBK7231T_App/pull/1159/files
    And here are flash routines for LN882H:
    https://github.com/openshwprojects/OpenBK7231.../main/src/hal/ln882h/hal_flashConfig_ln882h.c
    Helpful post? Buy me a coffee.
  • #188 21065231
    Piorun2002
    Level 15  
    Posts: 268
    Rate: 25
    How is the LN882H name designated for MQTT?
    In the configuration, I have entered different names than those broadcast in the 'Native', tasmota and hass modes.
    
    Config:
    ShortName 'SwitchC2A795XX'
    Full Name 'Switch C2A795XX (Test)'
    
    MQTT
    Native name 'Switch_C2A795XX' 
    Switch_C2A795XX/1/get 0
    
    Tasmota name: 'Switch_C2A795XX'
    tele/Switch_C2A795XX/STATE {":-38,"LinkCount":21,"Downtime":"0T06:13:34"}}
    
    Hass name: 'Switch_C2A795XX_(Test)'
    homeassistant/sensor/Switch_C2A795XX_(Test)_uptime/config {"dev":{"ids":["Switch C2A795XX (Test)"],"name":"SwitchC2A795XX""}
    
  • ADVERTISEMENT
  • #189 21066550
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    p.kaczmarek2 wrote:
    Ok, so what's next for LN882H? Hm, isn't LittleFS still missing?

    I made a new PR for this (PR #1191), which will fail for LN882H, because the littleFS files are missing in OpenLN882Hs CMakeList.txt
    @p.kaczmarek2: I think I remember you mentioned, how to fix this with some git force command... Maybe you would be so nice to do this?

    What I did in my local code:
    diff --git a/project/OpenBeken/CMakeLists.txt b/project/OpenBeken/CMakeLists.txt
    index 0fd392e..8f29744 100644
    --- a/project/OpenBeken/CMakeLists.txt
    +++ b/project/OpenBeken/CMakeLists.txt
    @@ -109,9 +109,9 @@ set(PROJ_ALL_SRC
     #    app/src/i2c/drv_i2c_mcp23017.c
     #    app/src/i2c/drv_i2c_tc74.c
         app/src/jsmn/jsmn.c
    -#    app/src/littlefs/lfs_util.c
    -#    app/src/littlefs/lfs.c
    -#    app/src/littlefs/our_lfs.c
    +    app/src/littlefs/lfs_util.c
    +    app/src/littlefs/lfs.c
    +    app/src/littlefs/our_lfs.c
         app/src/logging/logging.c
     #    app/src/memory/memtest.c
    



    During my affords I struggled with some strange findings:

    Even before the compiler reached my additions to the littlefs source the compilation was aborted.
    E.g.: Simply defining LittleFS (#define ENABLE_LITTLEFS 1) for LN882H leads to a bunch of (misleading) errors, I couldn't really understand.
    Mostly some (incorrect, from my point of view) complaints about conflicting types like the first error occuring:

     27%] Building C object project/OpenBeken/CMakeFiles/OpenBeken.elf.dir/app/src/cmnds/cmd_main.obj
    cd /OpenBK7231T_App/sdk/OpenLN882H/build/project/OpenBeken && /usr/bin/arm-none-eabi-gcc -DARM_MATH_CM4 -DLN882H -DPLATFORM_LN882H=1 -DUSER_SW_VER=\"dev_20240501_101247\" -I/OpenBK7231T_App/sdk/OpenLN882H/components/kernel -I/OpenBK7231T_App/sdk/OpenLN882H/components/kernel/osal -I/OpenBK7231T_App/sdk/OpenLN882H/components/kernel/FreeRTOS_Adapter -I/OpenBK7231T_App/sdk/OpenLN882H/components/kernel/FreeRTOS/Source/include -I/OpenBK7231T_App/sdk/OpenLN882H/components/kernel/FreeRTOS/Source/portable/GCC/ARM_CM4F -I/OpenBK7231T_App/sdk/OpenLN882H/components/ln_at -I/OpenBK7231T_App/sdk/OpenLN882H/components/ln_at/adapter -I/OpenBK7231T_App/sdk/OpenLN882H/components/ln_at/cmd -I/OpenBK7231T_App/sdk/OpenLN882H/components/ln_at/parser -I/OpenBK7231T_App/sdk/OpenLN882H/components/ln_at/transfer -I/OpenBK7231T_App/sdk/OpenLN882H/components/ln_at_cmd -I/OpenBK7231T_App/sdk/OpenLN882H/components/net/ping -I/OpenBK7231T_App/sdk/OpenLN882H/components/net/iperf -I/OpenBK7231T_App/sdk/OpenLN882H/components/fs/kv/kv -I/OpenBK7231T_App/sdk/OpenLN882H/components/fs/kv/kv_port -I/OpenBK7231T_App/sdk/OpenLN882H/components/fs/nvds -I/OpenBK7231T_App/sdk/OpenLN882H/components/fs/partition_mgr -I/OpenBK7231T_App/sdk/OpenLN882H/components/fota/ota_agent -I/OpenBK7231T_App/sdk/OpenLN882H/components/utils -I/OpenBK7231T_App/sdk/OpenLN882H/components/utils/runtime -I/OpenBK7231T_App/sdk/OpenLN882H/components/utils/reboot_trace -I/OpenBK7231T_App/sdk/OpenLN882H/components/utils/fifo -I/OpenBK7231T_App/sdk/OpenLN882H/components/utils/debug -I/OpenBK7231T_App/sdk/OpenLN882H/components/utils/debug/CmBacktrace -I/OpenBK7231T_App/sdk/OpenLN882H/components/utils/linux_compat -I/OpenBK7231T_App/sdk/OpenLN882H/components/serial -I/OpenBK7231T_App/sdk/OpenLN882H/mcu/ln882h -I/OpenBK7231T_App/sdk/OpenLN882H/mcu/CMSIS_5.3.0 -I/OpenBK7231T_App/sdk/OpenLN882H/mcu/driver_ln882h -I/OpenBK7231T_App/sdk/OpenLN882H/mcu/driver_ln882h/reg -I/OpenBK7231T_App/sdk/OpenLN882H/components/wifi/wifi_manager -I/OpenBK7231T_App/sdk/OpenLN882H/components/wifi/wifi_lib_import -I/OpenBK7231T_App/sdk/OpenLN882H/components/wifi/wifi_lib_export -I/OpenBK7231T_App/sdk/OpenLN882H/project/OpenBeken/app -I/OpenBK7231T_App/sdk/OpenLN882H/project/OpenBeken/app/include -I/OpenBK7231T_App/sdk/OpenLN882H/project/OpenBeken/bsp -I/OpenBK7231T_App/sdk/OpenLN882H/project/OpenBeken/cfg -I/OpenBK7231T_App/sdk/OpenLN882H/components -I/OpenBK7231T_App/sdk/OpenLN882H/components/net/lwip-2.1.3/src/include -I/OpenBK7231T_App/sdk/OpenLN882H/components/net/lwip-2.1.3/src/include/lwip -I/OpenBK7231T_App/sdk/OpenLN882H/components/net/lwip-2.1.3/src/include/lwip/prot -I/OpenBK7231T_App/sdk/OpenLN882H/components/net/lwip-2.1.3/src/include/lwip/priv -I/OpenBK7231T_App/sdk/OpenLN882H/components/net/lwip-2.1.3/src/include/netif -I/OpenBK7231T_App/sdk/OpenLN882H/components/net/lwip-2.1.3/src/include/posix -I/OpenBK7231T_App/sdk/OpenLN882H/components/net/lwip-2.1.3/src/include/posix/sys -I/OpenBK7231T_App/sdk/OpenLN882H/components/net/lwip-2.1.3/src/port/ln_osal/include -I/OpenBK7231T_App/sdk/OpenLN882H/components/net/dhcpd  -mthumb  -mabi=aapcs  -mcpu=cortex-m4  -mfpu=fpv4-sp-d16  -mfloat-abi=hard        -MD -MP     -ffunction-sections -fdata-sections -fno-strict-aliasing  -O1 -DNDEBUG   -std=gnu99 -o CMakeFiles/OpenBeken.elf.dir/app/src/cmnds/cmd_main.obj   -c /OpenBK7231T_App/sdk/OpenLN882H/project/OpenBeken/app/src/cmnds/cmd_main.c
    /OpenBK7231T_App/sdk/OpenLN882H/project/OpenBeken/app/src/cmnds/cmd_main.c:47:6: error: conflicting types for 'g_powersave'
       47 | bool g_powersave;
          |      ^~~~~~~~~~~
    In file included from /OpenBK7231T_App/sdk/OpenLN882H/project/OpenBeken/app/src/cmnds/cmd_local.h:4,
                     from /OpenBK7231T_App/sdk/OpenLN882H/project/OpenBeken/app/src/cmnds/cmd_main.c:6:
    /OpenBK7231T_App/sdk/OpenLN882H/project/OpenBeken/app/src/cmnds/cmd_public.h:33:13: note: previous declaration of 'g_powersave' was here
       33 | extern bool g_powersave;
          |             ^~~~~~~~~~~
    


    In the end, I "solved" this by moving the place of import of littlefs/our_lfs.h in relation to other includes.
    #if ENABLE_LITTLEFS
    #include "../littlefs/our_lfs.h"
    #endif


    And then in src/new_cfg.c, the defines from the included files where not present (here LFS_BLOCKS_DEFAULT_LEN was indicated "undefined"), so I had to do a nasty hack here:


    uint32_t CFG_GetLFS_Size() {
    #ifndef LFS_BLOCKS_DEFAULT_LEN // nasty hack. There is something strange with the includes of littlefs in conjunction with LN882H - this define is included in our_lfs.h but not there ?!?!? 
    #define LFS_BLOCKS_DEFAULT_LEN 0x8000
    #endif


    The last thing to mention is probably a size issue: the OTA image I flashed was not applied after a reboot.
    So I reduced the size of the image by un-defining all the other drivers (but file size was way below the OTA partition size)???

    But in the end, with all these hacks, I have successfully created a file which I could access after a reboot:

    LittleFS file system interface on a webpage.
  • #190 21067927
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    Thanks to git user @giedriuslt , I could resolve the strange compiler issues.
    I turned out to be different type definitions for bool, so the conflicts were real ;-)

    LFS compiles fine now, the lfs_tests1-3 succeeded and the contents of LFS where still present after several OTA updates...
  • ADVERTISEMENT
  • #191 21068612
    Piorun2002
    Level 15  
    Posts: 268
    Rate: 25
    Can you provide a link to download this build?
  • #192 21068623
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    Since the build needs including an aditional source file it will fail, until this modification is made in the OpenLN882H part.
    But I can build an actual firmware later and attach it.

    Added after 2 [hours] 13 [minutes]:

    Here you are
    Attachments:
    • OpenLN882H_dev_20240503_155700_OTA.bin (351.18 KB) You must be logged in to download this attachment.
  • #193 21068793
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14413
    Help: 650
    Rate: 12361
    Good job @max4elektroda, but can you submit your changes to SDK as a PR?

    max4elektroda wrote:

    I made a new PR for this (PR #1191), which will fail for LN882H, because the littleFS files are missing in OpenLN882Hs CMakeList.txt
    @p.kaczmarek2: I think I remember you mentioned, how to fix this with some git force command... Maybe you would be so nice to do this?

    What I did in my local code:
    diff --git a/project/OpenBeken/CMakeLists.txt b/project/OpenBeken/CMakeLists.txt
    index 0fd392e..8f29744 100644
    --- a/project/OpenBeken/CMakeLists.txt
    +++ b/project/OpenBeken/CMakeLists.txt
    @@ -109,9 +109,9 @@ set(PROJ_ALL_SRC
     #    app/src/i2c/drv_i2c_mcp23017.c
     #    app/src/i2c/drv_i2c_tc74.c
         app/src/jsmn/jsmn.c
    -#    app/src/littlefs/lfs_util.c
    -#    app/src/littlefs/lfs.c
    -#    app/src/littlefs/our_lfs.c
    +    app/src/littlefs/lfs_util.c
    +    app/src/littlefs/lfs.c
    +    app/src/littlefs/our_lfs.c
         app/src/logging/logging.c
     #    app/src/memory/memtest.c
    

    Or should I add it myself? Then I can update the SDK in the main repository.
    This is how I do it: https://www.theserverside.com/blog/Coffee-Tal...ies-and-Opinions/How-to-update-Git-submodules
    Helpful post? Buy me a coffee.
  • #194 21068799
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    Let me try it, always good to try/learn something new.
    I'll ask you to do it, if I don't manage to do it.

    Added after 1 [hours] 48 [minutes]:

    I didn't manage this with the submodules, I kept getting errors.
    So I made a PR for OpenLN882H: PR #14
  • #195 21068951
    Piorun2002
    Level 15  
    Posts: 268
    Rate: 25
    Works for me :)
    I tested auto switch off:
    --------
    // This aliased command will turn off relay on CH1 after 10 seconds
    // addRepeatingEvent [IntervalSeconds][RepeatsOr-1][CommandToRun]
    alias turn_off_after_time addRepeatingEvent 10 1 setChannel 1 0
    // this will run the turn off command every time that CH1 becomes 1
    addChangeHandler Channel1 == 1 turn_off_after_time
    ----------
  • #196 21069119
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14413
    Help: 650
    Rate: 12361
    @max4elektroda here is updated submodule, please merge it into your branch:
    https://github.com/openshwprojects/OpenBK7231...mmit/bbf502c39cd9bf6c3c5f11d57c200815f55c81d0
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #197 21069214
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    I don't know how, but I think I made it: All images are built ...
  • #198 21069264
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14413
    Help: 650
    Rate: 12361
    How much has the binary increased after adding LFS?
    Helpful post? Buy me a coffee.
  • #199 21069454
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    I will do another build later, actualy I had test commands enabled, too.
    Build (including test commands) used 654KB, the actual release is 610 KB.
    So it should be ~40 KB

    Added after 8 [minutes]:

    W/o test commands size is 652KB, so LFS adds 42KB
    But, to be honest, it's more than LFS, since also all this code for scripting is enabed, if LFS is present, which is not related to LFS itself...
  • #200 21069522
    Piorun2002
    Level 15  
    Posts: 268
    Rate: 25
    Piorun2002 wrote:
    Works for me :)
    I tested auto switch off:

    Build on May 3 2024 15:57:10 version dev_20240503_155700
    Something is wrong with this build - after 1-2 hours, ping works, but web management does not (I also use PowerSave 2)
  • #201 21069620
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14413
    Help: 650
    Rate: 12361
    But is the problem related to LFS merge? Maybe it was present before?

    Such a problem usually indicates that there is not enough heap space to alloc buffers for HTTP server:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/src/httpserver/http_tcp_server.c
    Screenshot of code in http_tcp_server.c with highlighted section regarding buffer allocation.
    Helpful post? Buy me a coffee.
  • #202 21069900
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    max4elektroda wrote:

    W/o test commands size is 652KB, so LFS adds 42KB

    Hmm, latest build (OpenLN882H_1191_merge_0dd0446be0aa.bin) is only 638KB ??
  • #203 21069902
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14413
    Help: 650
    Rate: 12361
    Actually it seems that online building has broken today somehow:
    
    Error: Cannot find module 'conventional-changelog-conventionalcommits
    

    All my builds are now failing with this message...
    Helpful post? Buy me a coffee.
  • #204 21069957
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    Last build some minutes ago was o.k. for me (only W800 failing)
  • #205 21069963
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14413
    Help: 650
    Rate: 12361
    I will rerun the latest build and see:
    Dialog window with the option to rerun a job in the CI/CD workflow.
    Helpful post? Buy me a coffee.
  • #206 21070245
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    Piorun2002 wrote:
    Something is wrong with this build - after 1-2 hours, ping works, but web management does not (I also use PowerSave 2)

    I tried here, "PowerSave 2", even installed the autoexec.bat you used.
    Control panel screen for OpenLN882H showing status OFF with options for configuration and restart.
  • #207 21070551
    Piorun2002
    Level 15  
    Posts: 268
    Rate: 25
    I'm using it now Build on May 4 2024 15:20:53 version 1191_merge_eb591d9a473a
    I turned off some test MQTT options (hass / tele discovery) and it seems to work well

    there is 95K free space
    Info:MAIN:Time 1787, idle 0/s, free 95856, MQTT 1(2), bWifi 1, secondsWithNoPing 1, socks 0/0 POWERSAVE
    Info:MAIN:Time 1788, idle 0/s, free 95856, MQTT 1(2), bWifi 1, secondsWithNoPing 1, socks 0/0 POWERSAVE 


    --- update
    after enabling the options:
    Flag 27 - [HASS] Invoke HomeAssistant discovery on change to ip address, configuration
    Flag 30 - [MQTT] Enable Tasmota TELE etc publishes (for ioBroker etc)


    the problem started occurring again
  • #208 21072408
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14413
    Help: 650
    Rate: 12361
    Guys, do you have B9 gpio working on your LN882Hs? For me, it's in high state all the time and OBK can't control it.
    Helpful post? Buy me a coffee.
  • #209 21072502
    divadiow
    Level 38  
    Posts: 4854
    Help: 424
    Rate: 859
    p.kaczmarek2 wrote:
    Guys, do you have B9 gpio working on your LN882Hs? For me, it's in high state all the time and OBK can't control it.


    B9 is always high for me no matter what I set in here

    Screenshot of a software interface with P25 settings.

    Added after 15 [minutes]:

    A12, also default PU, is able to PD
  • #210 21072598
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14413
    Help: 650
    Rate: 12361
    Yea I just noticed that, I am making LN882H dev board out of scrap and I was suprised to see that this particular pin is always high for me.
    Circuit board from scrap with electronic components, including capacitors and a USB port.
    Close-up of an electronic board with various components and a coil of wires.
    I almost got HD2015 display working.
    Helpful post? Buy me a coffee.
📢 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.
Generated by the language model.

FAQ

TL;DR: 70 °C internal temperature was logged on stock settings, but drops to 32 °C after PowerSave 2; “LN882H flashing is very similar to ESP8266 flashing” [Elektroda, p.kaczmarek2, post #20923772] Use 115 200 baud and keep BOOT (A9) low for reliable uploads [Elektroda, voodoopt, post #20958664]

Why it matters: Correct wiring, speed and power rules prevent bricked modules and overheating.

Quick Facts

• Flash size: 2 MB NOR, dump script trimmed to 0x200000 bytes [Elektroda, divadiow, post #21284784] • Stable upload speed: 115 200 baud; 2 Mbit/s often fails [Elektroda, voodoopt, post #20958664] • BOOT=A9 must stay at GND from power-on until flashing ends [Elektroda, p.kaczmarek2, post #20905518] • PowerSave 2 cuts idle current from ≈55 mA to 35 mA (-36 %) [Elektroda, max4elektroda, post #21064064] • OTA bug fixed in releases ≥1.17.789; Firefox now works [Elektroda, divadiow, post #21332121]

1. What minimum hardware is required to flash an LN882H module?

  1. USB-to-UART adapter that outputs true 3 V3 (CH340 or CP2102 proven). 2. Solid 3 V3 supply ≥300 mA; many adapters sag. 3. Five leads: 3 V3, GND, RX, TX, BOOT (A9). 4. Optional: pogo pins or fine wires for in-circuit work [Elektroda, p.kaczmarek2, post #20905518]

2. Which pins go where?

• Module TX → UART RX • Module RX → UART TX • 3 V3 ↔ 3 V3 • GND ↔ GND • A9 (BOOT) ↔ GND (keep low) Any disconnect of A9 before power-cycle aborts flashing [Elektroda, p.kaczmarek2, post #20905518]

3. How do I enter download mode every time?

  1. Hold A9 at GND. 2. Remove and re-insert USB power to both UART and module. 3. Start flash command. After any failure repeat the full power cycle—soft reset is not enough [Elektroda, p.kaczmarek2, post #20933029]

4. Flash tool stops with “Fail. Error downloading file”. Fix?

Set baud to 115 200 bps; many CH340/FTDI clones error at 2 000 000 bps. Example: “Ok.” after lowering speed on COM21 [Elektroda, voodoopt, post #20958664]

5. Can I flash without desoldering the module?

Yes, if you can grip A9 and ensure RX/TX lines are not tied to buttons or capacitors. Cut the trace or lift parts if debouncing cap blocks UART [Elektroda, p.kaczmarek2, post #20923772]

6. Quick 3-step firmware backup before experimenting?

  1. python LN882H_Flash_Dumper.py COMx flashdump 2. Wait ~5 min for 2 MB readout. 3. Verify flashdump_flash.bin size == 2097152 bytes [Elektroda, divadiow, post #21284784]

8. How do I enable PowerSave automatically?

Add in Startup Command: backlog delay_s 5; PowerSave 2. From release 1.17.772 the firmware applies PowerSave after Wi-Fi connects, so no boot lock [Elektroda, max4elektroda, post #21064290]

9. Edge-case: BL0937 energy meter shows 125 V after PowerSave.

PowerSave disables the interrupt clock BL0937 needs. Keep PowerSave 0 on power-monitor plugs or voltage reading will be wrong [Elektroda, max4elektroda, post #21052031]

10. OTA upload crashes when I use Firefox. Work-around?

Firmware ≤1.17.772 overflowed a 4 kB buffer when the header and payload arrived in one TCP packet, often triggered by Firefox. Patched in 1.17.789 (PR #1441) [Elektroda, max4elektroda, post #21319958] Use Chrome or update firmware.

11. How can I reset a forgotten Web-UI password?

From 1.17.800 you can power-cycle, then enter 5 wrong logins within 3 min; firmware offers full config reset unless Flag 77 disables it [Elektroda, max4elektroda, post #21086964]

13. Linux/Mac flashing tool available?

Yes. Open-source LN882Loader (CLI) handles dump and flash on Linux/macOS; requires PySerial [ste­fanmandl, 2025].

15. How do I change a duplicate MAC address?

mac write xx:xx:xx:xx:xx:xx works but device reboots with new IP. Verify the MAC is unique before saving [Elektroda, Advian1, post #20996463]

16. Quick How-To: flash in 3 steps

  1. Hold A9 → GND, power module.
  2. LN882H_CMD_Tool COMx download flash 115200 0x0 OpenLN882H_xxx.bin
  3. Power-cycle, release A9, connect to AP 192.168.4.1 and configure.
Generated by the language model.
ADVERTISEMENT