logo elektroda
logo elektroda
X
logo elektroda

[Youtube] LN882H module pinout and setup for flashing - step by step video guide

p.kaczmarek2 5334 172
ADVERTISEMENT
📢 Listen (AI):
  • #61 21579867
    p.kaczmarek2
    Moderator Smart Home
    WiFi is the responsibility of a platform's SDK, so stable WiFi on the BK7231N has nothing to do with WiFi on the LN882H. The OBK only offers common application code, which then separately builds on each MCU's SDK.

    WiFi could potentially be affected by PowerSave, although I have not encountered a situation where it has caused harm. Additionally, there's a Quick Connect flag (recommended - unless there's a connection problem just after a reboot), and that's probably all the options available.

    Additionally, a potential source of problems could be doing a full erase flash before flashing the OBK - because the OBK only overwrites the applications, it doesn't remove the RF calibration section on the BK7231. I don't know about the LN882H, it's a fairly unknown platform and not a lot of testing has been done there.

    WiFi stability could also be affected by the power supply, maybe add a 100nF capacitor or something.

    Also a question, do these LN882H's only have problems at a colleague's site, or on any network? Noise in the ether matters a lot, neighbours' networks etc.

    Another thing - do they get disconnected from WiFi, or do they reboot completely? What does their uptime look like there? Is MQTT enabled?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #62 21579876
    @GUTEK@
    Level 31  
    I uploaded OpenBK with this GUI flasher, I don't know if it deletes any calibrations.
    Tried without PowerSave and 1 and 2, no change.

    With the capacitor it could also be a clue, as he has a PV and I wonder if his inverter is sowing something. He lives in the mountains, so I wouldn't suspect a big siphon in the ether.
    The problem is only with a colleague, at my place I had one LN882H connected to WiFi and MQTT and for 3 days nothing happened - also with PowerSave on, it worked perfectly.

    They only disconnect from WiFi, they don't reboot. Uptime doesn't matter, it could be 2 minutes after switching on, or it could suddenly start working and only disconnect after 2 hours. There is no rule. MQTT connected to Mosqiutto in addition to HA.
  • #64 21581324
    @GUTEK@
    Level 31  
    It is difficult to talk about any kind of overload when the device, as soon as it is switched on, with the relay switched off, is able to break the connection.

    There is something strange going on there at all. For example, the BK7231N with PowerSave 1 switched on reaches 70C, with RSSI: -60dBm. Only that it doesn't lose connection.This is a mini switch lying on a desk, at my place the same one stuck in a box under the switch, i.e. without ventilation, is 52C.

    I have also noticed that on 1.18.110 the web interface works much worse than, say, 1.18.11.
    It can stop responding and after switching on you have to wait a while for it to start working, even though the device is already connected to WiFi.
  • #65 21581333
    p.kaczmarek2
    Moderator Smart Home
    @GUTEK@ wrote:
    .
    I also noticed that on 1.18.110 the web interface works much worse than, for example, 1.18.11.

    On which platform? With what can you narrow down more where things went wrong?
    Helpful post? Buy me a coffee.
  • #66 21593114
    blacksun2
    Level 8  
    Hello,

    I bought the same smart switch as in the YouTube video. However, the LN882HK1 is mounted directly on the circuit board.
    GND, 3.3V, and EN are present and labeled as contact points. But where are Tx and Rx?


    [Youtube] LN882H module pinout and setup for flashing - step by step video guide

    Big thanks.
  • #68 21605288
    p.kaczmarek2
    Moderator Smart Home
    @divadiow what is the state of this tool by @stefanmandl1 https://github.com/mandl/LN882Loader ? According to readme on Github, it can both flash and read the firmware. Is it functional?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #69 21605639
    divadiow
    Level 34  
    p.kaczmarek2 wrote:
    Is it functional?

    Yes, last time I checked it was working. Flash backup was much quicker than py/exe CMD line tool but still took maybe 10+ mins. Home in a couple of hours so can confirm behaviour and time soon.

    Added after 4 [minutes]:

    divadiow wrote:
    fdump address range expanded to cover 2mb. It takes approximately 14 minutes to dump 2mb, despite self.ser.baudrate = 115200 being set. Any higher and the script errors with:


    Added after 3 [hours] 58 [minutes]:

    https://github.com/mandl/LN882Loader flashes fine. stub required like RTL. Script doesn't do backup as-is but here is my thing from months ago that does do dump. I have it running now with timer.

    https://www.elektroda.com/rtvforum/topic4096854.html#21381159
  • ADVERTISEMENT
  • #70 21605883
    divadiow
    Level 34  
    I wonder if the other stubs will allow faster dumping in the place of LN882H_RAM_BIN.bin
    Screenshot of a terminal showing LN882H_RAM_BIN.bin file transfer results and baud rate change.

    maybe @stefanmandl1 already looked into those

    Added after 4 [minutes]:

    divadiow wrote:
    OK, so with the attached, which contains h.changeBaudrate(921600), the speed is still not 921600, but the 2mb was finished at ~9 mins 50s

    so baud rate change looks to have made a difference but dumps seems not to really be 921600. I'll try the other stubs

    Added after 8 [minutes]:

    h.changeBaudrate(115200) / LN882H_RAM_BIN.bin = 14minutes 20s to dump 2mb flash
  • #71 21605898
    p.kaczmarek2
    Moderator Smart Home
    Where do these come from? Github? Gitee? Maybe a search could give some info?
    Helpful post? Buy me a coffee.
  • #72 21605903
    divadiow
    Level 34  
    they're bundled in with various flashers
    A snippet of C source code displayed in a text editor.

    LN882Loader repo already appears to use the larger stub, though its code isn't identical to the 3 above

    Added after 23 [minutes]:

    ah, so the 9 minute 2mb dump is if you use stub LN882H_RAM_ADVANCE_BIN.bin

    Added after 1 [minutes]:

    Code: Text
    Log in, to see the code


    trying higher but it doesn't seem to faster

    Added after 36 [minutes]:

    wait. The Tuya SDKs for LN882H contains source for bootloader and ramcode?

    [Youtube] LN882H module pinout and setup for flashing - step by step video guide
    Source code fragment in an editor with a highlighted section related to migrations.

    Code: Text
    Log in, to see the code
  • #73 21606559
    p.kaczmarek2
    Moderator Smart Home
    Ok, I ported the basic handshake, but I don't have LN882H at the moment. Can you give it a go?
    https://github.com/openshwprojects/SharpLN882HTool
    Helpful post? Buy me a coffee.
  • #74 21606637
    divadiow
    Level 34  
    v5
    Code: Text
    Log in, to see the code


    sat waiting for ACK at the moment

    Added after 16 [minutes]:

    lmk if you want video of whole ln882loader stock flasher and or dumper experience in ubuntu terminal
  • #75 21606658
    p.kaczmarek2
    Moderator Smart Home
    Try V6. It will dump packet. If still not ACK, then open YModem.py and add this:
    [Youtube] LN882H module pinout and setup for flashing - step by step video guide
    
            print("SEND PACKET:", ' '.join(f'{b:02X}' for b in data_for_send))
    


    Added after 1 [minutes]:

    I have a mistake in packet header and comparing bytes may help
    Helpful post? Buy me a coffee.
  • #76 21606676
    divadiow
    Level 34  
    v6 original
    Code: Text
    Log in, to see the code


    ymodem.py is not part of the project code though?
  • #77 21606677
    p.kaczmarek2
    Moderator Smart Home
    ymodem.py is the code I base on:
    https://github.com/mandl/LN882Loader
    Helpful post? Buy me a coffee.
  • #78 21606689
    divadiow
    Level 34  
    Code: Text
    Log in, to see the code
  • #79 21606692
    p.kaczmarek2
    Moderator Smart Home
    Oh no, so the CRC is bad?

    01 00 FF 4C 4E 38 38 32 48 5F 52 41 4D 5F 42 49 4E 2E 62 69 6E 00 33 37 38 37 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 A6 E8


    01 00 FF 4C 4E 38 38 32 48 5F 52 41 4D 5F 42 49 4E 2E 62 69 6E 00 33 37 38 37 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 99 E5


    Added after 5 [minutes]:

    Wait, CRC functions are ok. Do I calculate CRC for a correct bytes range?
    [Youtube] LN882H module pinout and setup for flashing - step by step video guide
    Helpful post? Buy me a coffee.
  • #80 21606838
    divadiow
    Level 34  
    Rhetorical question? I don't know the answer. What can I do?

    Added after 7 [minutes]:

    ymodem.h
    Code: C / C++
    Log in, to see the code
  • #81 21606857
    divadiow
    Level 34  
    ymodem.c
    Code: Text
    Log in, to see the code


    Added after 59 [seconds]:

    in cmd_mode.h
    Code: Text
    Log in, to see the code
  • ADVERTISEMENT
  • #82 21606890
    p.kaczmarek2
    Moderator Smart Home
    Ah... I see, ok retry. Check the upcoming build?
    Helpful post? Buy me a coffee.
  • #83 21606898
    divadiow
    Level 34  
    Code: Text
    Log in, to see the code



    etc etc etc
  • #84 21606900
    p.kaczmarek2
    Moderator Smart Home
    ah i forgot to turn off the debug messages, but it seems to go futher
    Helpful post? Buy me a coffee.
  • #86 21606907
    divadiow
    Level 34  
    v8
    Code: Text
    Log in, to see the code
  • #87 21606943
    p.kaczmarek2
    Moderator Smart Home
    Nice, next step, but I didn't even manage to check this.
    
                // Erase: SharpLN882HTool.exe -p COM3 -ef
                // Read: SharpLN882HTool.exe -p COM3 -rf 0x200000 dump.bin
                // Write: SharpLN882HTool.exe -p COM3 -wf obk.bin
    
    Helpful post? Buy me a coffee.
  • #88 21606950
    divadiow
    Level 34  
    v8
    Code: Text
    Log in, to see the code


    flash was not erased. previous OBK booted up after power cycle

    Code: Text
    Log in, to see the code


    it's not getting to the next bits after stub

    Added after 1 [minutes]:

    write file with no obk.bin present doesn't error

    Code: Text
    Log in, to see the code


    Added after 1 [minutes]:

    would be interesting to know what this is doing for such a quick erase. hmm
    gif

    [Youtube] LN882H module pinout and setup for flashing - step by step video guide
  • #89 21606959
    p.kaczmarek2
    Moderator Smart Home
    Oops, it seems I can do only one command after RAM code is uploaded, that's why futher commands failed. Update and retry.

    Added after 1 [minutes]:

    Flash erase just sends command to loader:
    Code: C#
    Log in, to see the code
    Helpful post? Buy me a coffee.
  • #90 21606965
    divadiow
    Level 34  
    v10
    Code: Text
    Log in, to see the code


    i'll move onto v11

    Added after 1 [minutes]:

    v11
    Code: Text
    Log in, to see the code


    Added after 1 [minutes]:

    Code: Text
    Log in, to see the code


    Added after 2 [minutes]:

    Code: Text
    Log in, to see the code


    Added after 28 [minutes]:

    v12
    Code: Text
    Log in, to see the code


    Code: Text
    Log in, to see the code


    Code: Text
    Log in, to see the code
📢 Listen (AI):

Topic summary

The discussion centers on flashing the LN882H (specifically LN882HKI) module using open-source tools and firmware such as OpenBeken and OpenBK7231T_App, with detailed guides and video tutorials available. Flashing involves grounding the BOOT pin and using UART communication, which employs ASCII commands and the YMODEM protocol for data transfer. Several tools have been developed and shared, including LN882Loader (Linux-based) and Windows GUI wrappers, with ongoing improvements to support faster flash reading and dumping via commands like "fdump." Users report challenges with UART adapters, power supply stability, and correct COM port usage, highlighting the importance of proper hardware setup (e.g., CH340G vs. FTDI232 UART adapters). SSDP support and Home Assistant integration are discussed, with SSDP requiring IGMP flag enabling and driver activation in firmware. GPIO pin behavior and limitations are examined, noting that certain pins (A13 to B2) are reserved for QSPI flash and should not be used as GPIO outputs. Firmware versions and SDK updates are tracked, with reverse engineering efforts revealing internal flash structures and configuration data. WiFi stability issues on LN882H modules are reported, potentially linked to power supply quality or environmental factors, distinct from BK7231N platform behavior. Pinout details for LN882HK1 modules are clarified, identifying UART TX and RX pins and the BOOT pin for flashing mode entry. Overall, the community collaborates on improving flashing tools, firmware features, and hardware understanding to enable cloud-free operation and integration with smart home systems.
Summary generated by the language model.
ADVERTISEMENT