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

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

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

p.kaczmarek2 66210 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: 756
    Help: 48
    Rate: 187
    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: 14622
    Help: 655
    Rate: 12638
    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: 756
    Help: 48
    Rate: 187
    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: 14622
    Help: 655
    Rate: 12638
    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.
  • ADVERTISEMENT
  • #185 21064811
    max4elektroda
    Level 24  
    Posts: 756
    Help: 48
    Rate: 187
    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: 14622
    Help: 655
    Rate: 12638
    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.
  • ADVERTISEMENT
  • #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""}
    
  • #189 21066550
    max4elektroda
    Level 24  
    Posts: 756
    Help: 48
    Rate: 187
    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.
  • ADVERTISEMENT
  • #190 21067927
    max4elektroda
    Level 24  
    Posts: 756
    Help: 48
    Rate: 187
    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...
  • #191 21068612
    Piorun2002
    Level 15  
    Posts: 268
    Rate: 25
    Can you provide a link to download this build?
  • #192 21068623
    max4elektroda
    Level 24  
    Posts: 756
    Help: 48
    Rate: 187
    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: 14622
    Help: 655
    Rate: 12638
    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: 756
    Help: 48
    Rate: 187
    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: 14622
    Help: 655
    Rate: 12638
    @max4elektroda here is updated submodule, please merge it into your branch:
    https://github.com/openshwprojects/OpenBK7231...mmit/bbf502c39cd9bf6c3c5f11d57c200815f55c81d0
    Helpful post? Buy me a coffee.
  • #197 21069214
    max4elektroda
    Level 24  
    Posts: 756
    Help: 48
    Rate: 187
    I don't know how, but I think I made it: All images are built ...
  • #198 21069264
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14622
    Help: 655
    Rate: 12638
    How much has the binary increased after adding LFS?
    Helpful post? Buy me a coffee.
  • #199 21069454
    max4elektroda
    Level 24  
    Posts: 756
    Help: 48
    Rate: 187
    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: 14622
    Help: 655
    Rate: 12638
    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: 756
    Help: 48
    Rate: 187
    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: 14622
    Help: 655
    Rate: 12638
    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: 756
    Help: 48
    Rate: 187
    Last build some minutes ago was o.k. for me (only W800 failing)
  • #205 21069963
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14622
    Help: 655
    Rate: 12638
    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: 756
    Help: 48
    Rate: 187
    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: 14622
    Help: 655
    Rate: 12638
    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: 5065
    Help: 438
    Rate: 893
    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: 14622
    Help: 655
    Rate: 12638
    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: Need to flash LN882H and keep a recovery path? Use 5 wires and keep BOOT low; as one expert put it, "BOOT is like IO0". First dump the original flash, then write the regular firmware binary over UART, usually at 115200 baud if higher speeds fail. This FAQ is for OpenBeken/OpenLN882H users who need a practical flash, backup, OTA, and recovery workflow. [#20923772]

Dlaczego to ma znaczenie: LN882H can run cloud-free firmware, but success depends more on wiring discipline, baud rate, and power cycling than on the chip itself.

Opcja Typowe użycie Co działało w praktyce Główne ryzyko
LN882H_CMD_Tool.exe Flashowanie UART w Windows Często ruszało po zmianie na 115200 Błąd Fail. Error downloading file.
LN882H_Flash_Dumper.py Backup flash i OTP Tworzy dump przed zmianą firmware Długi odczyt, wymaga poprawnego BOOT
OTA z Web App Aktualizacja już działającego OBK Chrome/Chromium działały stabilniej niż Firefox Firefox mógł wywołać crash OTA
BK7231GUIFlashTool Nowsze narzędzie GUI Wspierane dla LN882H od aktualizacji 2026 Nadal wymaga tego samego okablowania

Najważniejszy wniosek: Najczęstsza przyczyna nieudanego flashowania LN882H nie była w module, tylko w procedurze: BOOT musi pozostać niski, po każdej próbie trzeba odłączyć i podłączyć zasilanie, a zejście do 115200 baud często rozwiązywało zapis. [#20958664]

Quick Facts

  • LN882H flashuje się przez UART podobnie do ESP8266: potrzebne są połączenia TX, RX, GND, 3.3V i BOOT/GPIOA9, a GPIOA9 musi pozostać w stanie niskim przez cały proces. [#20905518]
  • W praktyce zapis przy 2,000,000 baud często kończył się błędem, a kilka osób potwierdziło sukces dopiero po przejściu na 115200 baud. [#20958664]
  • PowerSave na LN882H potrafił mocno obniżyć temperaturę: w jednym teście spadek wyniósł z 64.0°C do 36.0°C po PowerSave 2, kosztem większych opóźnień sieciowych. [#21055421]
  • LittleFS jest systemem plików flash, który przechowuje pliki i skrypty, z odpornością na restart oraz małym narzutem pamięci. Na LN882H dodanie LittleFS zwiększało rozmiar binarki o około 42 KB. [#21069454]
  • OTA na LN882H bywało niestabilne w Firefox; po naprawce przetestowano poprawny update z buildu 1441_merge_6d6a6086fa18 do OpenLN882H_1.17.789_OTA.bin właśnie w Firefox 132.0.2. [#21332121]

How do I flash an LN882H module over UART and make a full backup of the original firmware first?

Flashowanie i backup robi się w dwóch etapach. 1. Podłącz TX↔RX, RX↔TX, GND, 3.3V oraz BOOT/GPIOA9 do GND. 2. Zrób kopię poleceniem python LN882H_Flash_Dumper.py COMx flashdump; narzędzie zapisze dump flash i OTP. 3. Wgraj nowy firmware poleceniem LN882H_CMD_Tool.exe COMx download flash 921000 0x0 flashimage.bin, a po zakończeniu odłącz BOOT od masy i zrestartuj zasilanie. Po starcie urządzenie wystawia AP na 192.168.4.1. [#20905518]

What is the BOOT pin on LN882H, and why does GPIOA9 have to stay low during the whole flashing process?

BOOT na LN882H to pin wejścia do bootloadera, a w praktyce jest nim GPIOA9. Musi pozostać niski przez cały proces, bo tylko wtedy układ pozostaje w trybie programowania; autor porównał go wprost: „BOOT is like IO0.” Odłączenie BOOT w trakcie potrafi przerwać procedurę lub zablokować kolejną próbę do czasu pełnego odcięcia zasilania. Dlatego BOOT zwiera się do GND przed podaniem zasilania i trzyma nisko do końca flashowania. [#20923772]

Why does LN882H_CMD_Tool show "Fail. Error downloading file." and what fixes actually worked, like using 115200 baud, shorter wires, or a different USB-to-TTL adapter?

Najczęściej ten błąd znikał po zmianie parametrów transmisji i procedury zasilania. Skuteczne poprawki to: użycie 115200 zamiast 2000000, skrócenie przewodów, pełne odłączenie zasilania i USB-TTL po każdej nieudanej próbie oraz podmiana adaptera USB-UART. Pomagało też upewnienie się, że wgrywany jest zwykły plik binarny, a nie plik OTA. Kilku użytkowników potwierdziło, że samo ustawienie 115200 natychmiast rozwiązało Fail. Error downloading file. [#20996463]

Which USB-to-UART adapters work best for LN882H flashing, and how do CH340, CP2101, FT232RL, PL2303, and NodeMCU compare in practice?

Najlepiej wypadały adaptery CH340 i CP2101, ale LN882H bywa wybredny. W wątku potwierdzono sukces na CH340, CP2101, adapterach FTDI w części konfiguracji oraz nawet na NodeMCU ESP8266 z CH340. FT232RL działał u jednych, a u innych nie; PL2303 też działał, ale częściej zgłaszano z nim problemy. Jeden użytkownik potwierdził, że LN882H można było flashować przez NodeMCU z CH340, a inny odzyskał stabilność dopiero po przejściu z FTDI na CH430/CH340. [#20958756]

What is LittleFS in OpenBeken/OpenLN882H, and what features depend on it on the LN882H platform?

LittleFS to system plików w pamięci flash, potrzebny do plików takich jak autoexec.bat, skryptów i funkcji opartych o lokalny storage. Na początku LN882H go nie miał, więc przycisk „List Filesystem” nic nie pokazywał, a tworzenie plików nie działało realnie. Po późniejszym wdrożeniu potwierdzono, że pliki przetrwały kilka aktualizacji OTA. Dodanie LittleFS zwiększało rozmiar binarki LN882H o około 42 KB, ale odblokowywało skrypty i trwałe pliki konfiguracyjne. [#21069454]

How can I flash an LN882H module without desoldering it from the PCB, and what board connections can interfere with RX, TX, or BOOT access?

Da się flashować bez wylutowania, jeśli masz fizyczny dostęp do BOOT i nic nie obciąża linii RX/TX. Problemem bywają przyciski, kondensatory debounce, ścieżki do innych układów lub trudny dostęp do samego BOOT. W takich przypadkach trzeba czasem przeciąć ścieżkę, usunąć kondensator albo bardzo precyzyjnie dolutować cienki przewód tylko na czas programowania. W wątku potwierdzono też przypadek, gdzie moduł LN-02 udało się zaprogramować in-circuit bez wylutowania i bez cięcia RX/TX. [#20924089]

What’s the difference between the regular LN882H firmware binary and the OTA file, and which one should be used for UART flashing versus Web App updates?

Do UART używa się zwykłego pliku binarnego, a do aktualizacji przez Web App używa się pliku OTA. Pomylenie ich jest częstą przyczyną błędów flashowania. Wprost zalecono: wybierz poprawny plik binarny do flashowania, nie plik OTA. Ta różnica wracała też przy Web App, gdzie użytkownicy trafiali na nie-OTA pliki i update nie przechodził. Reguła jest prosta: UART = pełny bin, Web App = OTA.bin. [#20955856]

How do I recover an LN882H device when I can no longer access the web UI, including safe mode, erase commands, and reflashing original firmware?

Najpierw spróbuj safe mode przez 5 szybkich cykli zasilania. 1. Wyłącz i włącz urządzenie 5 razy z krótką przerwą. 2. Po wejściu w safe mode połącz się z AP i popraw konfigurację. 3. Jeśli to nie pomoże, użyj LN882H_CMD_Tool.exe COM# flash erase_all albo wgraj z powrotem oryginalny firmware z backupu. W jednym przypadku dopiero reflashing oryginalnego firmware przywrócił dostęp do sieci domowej, gdy urządzenie po zmianach nie wracało do UI. [#21021640]

Why does changing the MAC address on some LN882H devices make them disappear from the network, and how can I verify the new IP afterward?

Po zmianie MAC urządzenie zwykle dostaje nowy lease DHCP, więc znika spod starego adresu IP. Samo ustawienie MAC może działać poprawnie, ale po zapisie trzeba szukać nowego IP w routerze albo skanerze sieci. Jeden użytkownik potwierdził zmianę MAC bez problemu i dodał, że trzeba upewnić się, że adres MAC jest prawidłowy, a następnie sprawdzić nowy adres w routerze. Jeśli urządzenie nadal znika, warto wrócić do dumpu i powtórzyć konfigurację od zera. [#20996463]

What is PowerSave on LN882H in OpenBeken, and how do PowerSave 0, 1, and 2 affect temperature, current draw, Wi-Fi stability, and BL0937 energy metering?

PowerSave zmniejsza pobór prądu i temperaturę LN882H, ale wpływa na sieć i pomiar energii. PowerSave 0 to tryb bez oszczędzania. PowerSave 1 obniżał temperaturę i prąd umiarkowanie. PowerSave 2 dawał największy efekt, np. spadek z 64.0°C do 36.0°C, ale podnosił ping do 56–73 ms i mógł psuć pomiary BL0937 oraz powodować reconnecty Wi‑Fi. Dla pojedynczego modułu raportowano też spadek poboru z około 90 mA do 50 mA przy trybie 1 i 35 mA przy trybie 2. [#21064064]

Why doesn’t static IP work on LN882H builds, and what is currently unimplemented in the wifi_init_sta code path?

Static IP nie działał, bo ścieżka LN882H była wtedy po prostu niezaimplementowana. Wprost wskazano funkcję wifi_init_sta(const char* oob_ssid, const char* connect_key, obkStaticIP_t *ip) jako miejsce wymagające aktualizacji w pliku hal_wifi_ln882h.c. Dlatego wpisy statycznego IP były ignorowane, a urządzenie wracało do DHCP. Dopóki ten fragment nie został uzupełniony, jedynym praktycznym obejściem było przypisanie stałego adresu po stronie routera. [#20997185]

How do I start and configure extra drivers like NTP, DHT, SSDP, or Wemo on LN882H, including backlog commands and startup command syntax?

Sterowniki uruchamiasz komendami, a kilka poleceń łączysz przez backlog. Przykład: backlog startDriver ntp; ntp_timeZoneOfs +2 albo backlog startDriver SSDP; startDriver Wemo. NTP wymaga ręcznego startu, a serwer ustawia się komendą ntp_setServer <IP>. DHT był obsługiwany per-pin, ale w części buildów LN882H nie był jeszcze aktywny. Wemo wymagał startu sterownika i sprawdzenia, czy działa endpoint /setup.xml, bo sam komunikat „OK” nie gwarantował wykrycia przez Alexę. [#21028427]

Why does OTA updating LN882H often fail in Firefox but work in Chrome or Chromium, and what was the root cause of the HTTP/OTA crash?

Problem nie leżał w samym pliku OTA, tylko w błędzie obsługi bufora HTTP/OTA po stronie LN882H. Firefox częściej wysyłał nagłówki i payload w układzie, który ujawniał błąd: kod OTA zbierał dane do bufora 4 KB, ale nie sprawdzał poprawnie sytuacji, gdy pojedynczy fragment mógł zapełnić bufor więcej niż raz. To kończyło się zapisem poza pamięcią i crashem wątku HTTP Clie. Po poprawce autorzy potwierdzili udane OTA w Firefox 132.0.2. [#21332121]

What’s the best way to remove or recover a forgotten OpenBeken web password on an LN882H device without losing control of it permanently?

Najpewniejsza metoda to wgranie przez UART builda bez wymuszania hasła albo builda recovery. Wskazano plik http_basic_auth.c i opcję kompilacji bez ALLOW_WEB_PASSWORD, co powoduje akceptację każdego połączenia. Później pojawiła się też wersja recovery: po restarcie i ponad 5 błędnych próbach logowania urządzenie mogło zaproponować pełny reset konfiguracji. To rozwiązanie było traktowane ostrożnie ze względów bezpieczeństwa, więc najbezpieczniejszy pozostaje własny build ratunkowy flashowany przez UART. [#21084206]

How can I flash LN882H from Linux or macOS instead of Windows, and which tools from the thread support that workflow?

Na Linuxie pojawiło się natywne narzędzie LN882Loader, opublikowane jako projekt do flashowania LN882H bez Windows. Wcześniej użytkownicy próbowali Wine, QEMU i VirtualBox z mieszanymi wynikami; GUI pod Windows działało w VM, ale bywało zawodne. Dla Windows później polecano też GUI flash tool, natomiast w samym wątku jedynym jasno wskazanym rozwiązaniem linuksowym był właśnie LN882Loader. Dla macOS nie podano gotowego natywnego narzędzia, więc praktyczna ścieżka z wątku to Linux tool albo Windows VM. [#21376296]
Generated by the language model.
ADVERTISEMENT