logo elektroda
logo elektroda
X
logo elektroda

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

p.kaczmarek2 5292 172
ADVERTISEMENT
📢 Listen (AI):
  • #31 21441525
    niterian
    Level 9  
    p.kaczmarek2 wrote:

    @niterian Are you looking for other tools because flashing does not work for you? Then please show your connections. I don't think that the tool is at fault.


    I don't think it's the tool's fault either. I was looking at other tools to try to understand what I'm supposed to see on the wires.
    I've flashed 6 BK7231N/BK7231T/T34 based devices, all through uartprogram. I wasn't able to get the "official" Windows-based GUI tool to work correctly under Linux and just decided that a simpler open-source tool is easier to debug.

    I'm not ready to ask for help. I have a few things to try. My main suspicion is that my 3.3V supply is not good enough. I had way easier time flashing when I was able to reuse the on-board AMS1117 voltage regulator than powering from my cheap PSU (Yihua 305D). When reading would often start talking talking to the flash and then after a few seconds fail. Writes wouldn't even start, I assume they are more power intensive.

    I have a few spare AMS1117s, so the next step is to try it.
  • ADVERTISEMENT
  • #32 21443865
    niterian
    Level 9  
    >>21441525

    I was finally able to flash LN882H (WL2S).

    I've switched to powering it from https://botland.store/power-modules/1482-supp...ontact-plates-mb102-33v-5v-5904422300739.html which is really just AMS1117-3.3V in a convenient form with all the necessary capacitors. Later it turned out to be unnecessary. My PSU worked just fine.

    I had to pull out my logic analyzer to finally find out that my FTDI232-based UART wasn't actually sending anything on the TX line.
    I've changed it to a CH340G-based UART ( https://pl.aliexpress.com/item/1005006880183678.html , CH340G-2) and it worked just fine with LN882Loader.
    I've also tried another FTDI232-based UART ( https://pl.aliexpress.com/item/1005006157753097.html , Red) and it also worked.
    Strange, given that I've flashed 6 BK7231 chips with the old FTDI232 UART.

    I've tried running the LN882H_V1.0.16 Windows-based tool under wine on Linux with no luck. It might be that I don't know how to pass the correct COM port, given that a Linux equivalent is /dev/ttyUSB0 or similar.

    The tyutool_cli successfully communicates with the chip, but it just doesn't allow reads. It exits with "Don't support read.".
  • #33 21446370
    p.kaczmarek2
    Moderator Smart Home
    Good job @niterian

    I'm testing another LN882H device and I have a question to anyone who can do checks on another LN882H piece - can you click through all pins in GPIO doctor without getting WDT reboot?
    User interface of the GPIO Doctor tool with visible GPIO pins and configuration options.
    @divadiow (I'm not sure who else has LN882H at hand)
    I'm on 1.18.42
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #34 21446397
    divadiow
    Level 34  
    from memory GPIO dr does cause some issues for me and I sometimes have to power off/on but I don't recall investigating the cause and seeing WDT. I put it down to some GPIOs not being happy about high or low pulling, but that's an assumption.
  • #35 21446441
    p.kaczmarek2
    Moderator Smart Home
    Do you have LN882H to investigate it with me? I will try to create a test PR soon.
    Helpful post? Buy me a coffee.
  • #37 21446468
    niterian
    Level 9  
    >>21446370

    My LN882H consistently crashes on "Set Output High" on P13 on 1.18.42.
  • ADVERTISEMENT
  • #38 21446503
    p.kaczmarek2
    Moderator Smart Home
    It crashes but only while setting to digital output, right? dInput and dInput without pull up works for me:
    User interface for managing GPIO signal settings.
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/src/hal/ln882h/hal_pins_ln882h.c
    Code: C / C++
    Log in, to see the code

    Maybe some pins don't like GPIO_HIGH_SPEED?
    https://github.com/search?q=repo%3Aopenshwprojects%2FOpenLN882H%20hal_gpio_init&type=code
    Code: C / C++
    Log in, to see the code
    Helpful post? Buy me a coffee.
  • #39 21446533
    insmod
    Level 25  
    It's not that, gpios from A13 to B2 shouldn't be used at all, they are reserved(?) for QSPI, which i believe is internal flash.
    I, of course, could be wrong. But that is what i believe. There is also no FULLMUX for them.
  • #40 21446543
    p.kaczmarek2
    Moderator Smart Home
    I'm not sure. I'm confused at the moment. I've just flashed this LN882H bulb:
    https://www.elektroda.com/rtvforum/topic4107260.html
    and I am almost sure that I am unable to find the RGB pins, I have only CW working. And I really feel like I saw greenish tint for a moment while playing near P14 or P13, not sure.
    I will retry.

    Of course, taking out the board of this bulb could help to follow the traces, but I don't want to damage it.

    Added after 2 [minutes]:

    Checking right now ,starting from the end of the list., Crashed at P18:
    Screenshot showing ping command results in a console and pin settings in an application.
    Screenshot of the web interface with configuration options for LN882H bulb.
    Of course, the separate issue is that it's not really P18, those are Beken labels, they weren't changed for LN882H yet.

    Added after 2 [minutes]:

    Maybe I can try to use the photos I took...
    Close-up of a circuit board with a LIGHTNING LN882HK1 chip.
    Pin layout diagram of LN882HKx chip from Lightning Semiconductor.

    Added after 4 [minutes]:

    Update: I've found other PWM pins, so it seems that everything is ok except the fact that we need to disable those few pins in HAL so they don't crash
    Helpful post? Buy me a coffee.
  • #41 21446557
    insmod
    Level 25  
    I feel like we need a separate check for gpio, something similar to HAL_PIN_CanThisPinBePWM, but if it can be input or output.
    Something like void HAL_PIN_CheckGPIODirs(int index, bool* input, bool* output)
  • ADVERTISEMENT
  • #42 21446564
    p.kaczmarek2
    Moderator Smart Home
    It could be added with weak linking so we don't have to repeat each time for HAL.

    We also need to expose PWM names (or generic aliases) to Configure Module tab:
    Screenshot of OpenLN882H_C25E1088 pin configuration with PWM settings.
    And get correct names for the Web App:
    User interface for managing GPIO pins with various settings and values.
    For the Web App, I think we could get away with hardcoding those names in VUE files.... we don't really need to fetch them via API from OBK, or do we? Hardcoding them in Web Page may be less elegant but that is also lesser stress for WiFi module and it has no extra api requirement.
    Helpful post? Buy me a coffee.
  • #44 21447375
    divadiow
    Level 34  
    Seems like code changes needed before I have anything to try..
  • #45 21447718
    p.kaczmarek2
    Moderator Smart Home
    @insmod I saw PWM option missing from few pins and assumed that not all pins are PWM but now I see they are the QSPI pins we mentioned before....
    So basically we just can't set QSPI pins to outputs.
    At first I've been thinking about hiding Rel roles (and similar) from dropdown lists, but that's not perfect, we also set GPIO manually in many drivers...
    I've decided to go for the simplest fix now:
    https://github.com/openshwprojects/OpenBK7231...mmit/80111be27e34a3df00b532e6c64a6c08647e86fc
    If you can @divadiow, try it, I will also try in a moment. I also need to make sure I didn't disable too many pins by accident.

    Added after 24 [seconds]:

    PS: I ordered two more bulbs, let's see if I will get LN882H again?
    Helpful post? Buy me a coffee.
  • #46 21448676
    divadiow
    Level 34  
    p.kaczmarek2 wrote:
    If you can @divadiow, try it, I will also try in a moment

    I've gone through and set output to high on each and then cleared before moving onto the next. Nothing attached to any GPIO though. No crashes
  • #47 21456136
    p.kaczmarek2
    Moderator Smart Home
    @divadiow I've checked what we spoke about and it seems the flash read was not present for Web App on LN882H, I will try to add it now:
    https://github.com/openshwprojects/OpenBK7231T_App/pull/1547

    Added after 5 [minutes]:

    I also figured out why it returned log content on unsupported platform - buffer has random garbage from ram that was there before alloc...

    Screenshot from GitHub showing a pull request about a code fix.
    Helpful post? Buy me a coffee.
  • #48 21456168
    divadiow
    Level 34  
    yes, that's better.

    I've read from offset 0x1D4000 and length 180224 bytes in the web app and compared the saved result to a fresh dump of the whole flash of the LN882H.
    it's almost the same so not sure why a little different. I'll wipe and start again to be sure

    Two hex panels with decoded text for binary files.

    the first offset difference when comparing:
    Comparison of two files with hexadecimal data and text.

    Added after 22 [minutes]:

    hmm. it's a bit weird. The second attempt was:

    -erase full Tuya flash from 0x0
    -do not boot
    -flash OBK to 0x0
    -boot OBK and dump from 0x1D4000 and length 180224 bytes

    compare 0x1D4000-0x2000000 from Tuya bin to extract = not identical. Assuming OBK is perhaps making changes in its boot between 0x1D4000-0x2000000 I next tried:

    -extract from 0x1EB000 (where it seem the Tuya config starts) for 86016 bytes and compare to the same range on original flash. Comparing looks OK at the beginning

    Screenshot of two opened binary files in a HEX editor.

    but then goes off the rails. the "test" and "1234abcd" is the AP it's connected to. Is something console/log still finding its way into the dump?
    Two program windows displaying binary data and text.

    Added after 1 [minutes]:

    files for own comparison
  • #49 21456215
    p.kaczmarek2
    Moderator Smart Home
    It should not if read works, but maybe it fails at some point. I can fill buffer with 0x00 just to be sure.

    Code snippet with version differences, showing changes in memory allocation and initialization.
    Helpful post? Buy me a coffee.
  • #51 21456320
    p.kaczmarek2
    Moderator Smart Home
    divadiow wrote:
    75246500_1740513401.png]Screenshot of two opened binary files in a HEX editor.[/url]

    but then goes off the rails. the "test" and "1234abcd" is the AP it's connected to. Is something console/log still finding its way into the dump?
    Two program windows displaying binary data and text.

    I've looked closer and hey, it's our OBK config! It's added by OBK on OBK start.
    Fragment of C source code with a configuration function.
    Source code snippet with macro definitions in C language.
    CFG (ascii text) is the ident of OBK config structure.

    So it seems everything is okay.
    Helpful post? Buy me a coffee.
  • #53 21511837
    rufus4
    Level 10  
    Hi, don't know where to post the best.

    I found this nice flasher. Everything is isolated from USB. So it might pretent failures based on different potencials.
    Isolation transformer DC/DC has got 200mA at 5V max. , and the Mosfet is rated with 300mA at 3.3V
    If this is still not enought it would be possible to remove the transformer and use a external powersource. Full isolation to USB will be still the same.
    (CA-IS3722HS dual-channel-isolator, B0505LS-1W dc-dc-converter, 662K voltage-regulator)

    [Youtube] LN882H module pinout and setup for flashing - step by step video guide
    https://www.aliexpress.com/item/1005007511243530.html
  • #54 21523289
    Ogurezzz
    Level 5  
    stefanmandl1 wrote:
    I wrote a flashing tool for Linux.

    https://github.com/mandl/LN882Loader


    It's perfect! My Windows 10 setup doesn't finish firmware dump. Error after several hundreds of bytes. Python version works perfect.
    Done Dump. Done flashing of fresh "OpenLN882H_1.18.85.bin"

    P.S. it will be nice to add more info and avaliable parameters to README.md of Loader.
  • #56 21564938
    divadiow
    Level 34  
    literally about to post here about your GH after seeing your mandl repo message.

    Command prompt window showing progress of Python script dumping LN882H flash memory.

    it still uses LN882H_CMD_Tool.exe though so it seems to be the same speed as before, but it's a much nicer progress output

    Added after 1 [minutes]:

    I didn't understand the connection to mandl's LN882Loader though because that doesn't use the exe and is all ymodem?
  • #57 21564993
    spleefer90
    Level 7  
    > I didn't understand the connection to mandl's LN882Loader though

    It's the same chip, it would be nicer for the repos to be crosslinked for discoverability.
  • #58 21565095
    divadiow
    Level 34  
    yep yep, sure. anyway, thanks for making/sharing.
  • #60 21579857
    @GUTEK@
    Level 31  
    Hello,
    Are there any settings in OpenBeken for the Wifi connection apart from the ability to enable Power Save?
    Recently purchased cheap mini switches from Ali turned out to be built on an LN-02 module, LN882HKI chip. And unfortunately at a colleague's place they notoriously disconnect from the network. I don't see anything unusual in the router settings, and interestingly the same version of OpenBeken uploaded in NK7231N doesn't disconnect.
    I know the logs could tell something, but he doesn't solder to the rx/tx.
📢 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