logo elektroda
logo elektroda
X
logo elektroda

Flashing OpenBeken Firmware on WL2S Module with Lightning LN882HK Chip for ELIVCO LSPA9

sithyoda 32568 180
ADVERTISEMENT
  • #1 20773678
    sithyoda
    Level 7  

    Just got some ELIVCO LSPA9 modules and wanted to flash it with OpenBeken firmware.
    ELIVCO LSPA9 module with technical information on the casing

    After disassembling I had to find out that the installed microcontroller board is named WL2S and the chip used is LIGHTNING LN882HK.
    Close-up of a module with a WL2S microcontroller board and LIGHTNING LN882HK chip.

    Unfortunately, this one seems to be quite new and I did not find a lot of information about it, except on some tuya sites: Link
    Link

    Is there any chance to get it supported, even it seems not to be beken chip based?
  • ADVERTISEMENT
  • #2 20774142
    p.kaczmarek2
    Moderator Smart Home
    That's something totally new to me! I would love to support that chip. Have you tried to at least capture debug log from UART?
    Helpful post? Buy me a coffee.
  • #3 20774969
    sithyoda
    Level 7  

    Yes, of course. Unfortunately, with no luck so far.
    I tried many different baud rates, but it seems that there is absolutely nothing coming out from the TX pin. I'm not quite sure if there is any other pin that has to be connected except VCC, RX, TX, and GND to get at least some bootlog.
    LED's are flashing during bootup and remain stable. With CEN pin to GND, the chip can be rebooted, just like the beken chips.

    Added after 1 [hours] 34 [minutes]:

    I might give it a try in the lab after desoldering the module from the main board.
  • ADVERTISEMENT
  • #4 20775137
    p.kaczmarek2
    Moderator Smart Home
    How does the back of the module look like?
    Helpful post? Buy me a coffee.
  • #5 20775964
    sithyoda
    Level 7  
    Here a pic of the back of the desoldered module.
    Back of an unsoldered module with pin labels.

    Bootlog is output on TXD1 pin:
    adc raw:  764, temp_IC: 22, cap:0x9D331D00, rf43:0x0005, reg74:0x0228
    
    bootloader build time: 13:48:19
    config item not found perip_param value
    -- tuya project compile time: Jun 27 2023 16:30:24--
    ble mac[62:7c:4c:50:de:18]
    [BLIB_I]BLIB Ver: 1.0.3 [build time:Jan 19 2023 12:14:45][0x010003ff]
    xTaskCreate, name: rw_task, priority: 9, stack size: 2048
    xTaskCreate, name: worker, priority: 2, stack size: 1536
    xTaskCreate, name: ty_main, priority: 3, stack size: 4096
    xTaskCreate, name: IDLE, priority: 0, stack size: 1024
    xTaskCreate, name: Tmr Svc, priority: 10, stack size: 2048
    Before enter tuya_main, Total:165888; Free:153552
    GPIOA_9 high level, will enter Normal mode!
    Failed to enter ate mode! Start tuya user main.
    xTaskCreate, name: tuya_app_main, priority: 4, stack size: 4096
    xTaskCreate, name: TUYA_TCPIP, priority: 9, stack size: 2048
    tkl_ethernetif_init
    tkl_ethernetif_init
    [01-01 00:00:00 ty I][lr:0x100b662b] mqc app init ...
    xTaskCreate, name: wq_system, priority: 3, stack size: 5120
    [01-01 00:00:00 ty I][tal_thread.c:184] thread_create name:wq_system,stackDepth:5120,totalstackDepth:7168,priority:3
    xTaskCreate, name: wq_highpri, priority: 4, stack size: 4096
    [01-01 00:00:00 ty I][tal_thread.c:184] thread_create name:wq_highpri,stackDepth:4096,totalstackDepth:11264,priority:4
    xTaskCreate, name: sys_timer, priority: 5, stack size: 4096
    [01-01 00:00:00 ty D][tal_thread.c:203] Thread:wq_highpri Exec Start. Set to Running Stat
    [01-01 00:00:00 ty D][tal_thread.c:203] Thread:sys_timer Exec Start. Set to Running Stat
    [01-01 00:00:00 ty I][tal_thread.c:184] thread_create name:sys_timer,stackDepth:4096,totalstackDepth:15360,priority:5
    [01-01 00:00:00 ty D][lr:0x10078c65] init fs. Path: null
    [01-01 00:00:00 ty D][lr:0x100aa331] *****************kvs_init.
    [01-01 00:00:00 ty D][lr:0x100cdbe1] protected init. addr:0x001eb000
    [01-01 00:00:00 ty D][lr:0x100cd9f1] init protected data length 495
    [01-01 00:00:00 ty N][lr:0x100ac72b] key_addr: 0x1ec000   block_sz 4096
    [01-01 00:00:00 ty N][lr:0x100aca05] get key:
    0x64 0x39 0x64 0x72 0x12 0x67 0x36 0xa3 0x12 0x3a 0xc6 0xe1 0x41 0xa7 0x2e 0x8a
    [01-01 00:00:00 ty D][lr:0x100cdbff] protected verify begin
    [01-01 00:00:00 ty D][lr:0x100cdc61] check [gw_bi][282]
    [01-01 00:00:00 ty D][lr:0x100cdc61] check [gw_wsm][141]
    [01-01 00:00:00 ty D][lr:0x100cdc81] protected verify end
    [01-01 00:00:00 ty D][lr:0x100ab97f] begin try update kv version
    [01-01 00:00:00 ty D][lr:0x100ab99b] pre kv version is 2
    [01-01 00:00:00 ty D][lr:0x100acea1] 111 k=1  i=3 1
    [01-01 00:00:00 ty N][lr:0x100b2729] uni_random_init...
    [01-01 00:00:00 ty N][lr:0x100b29cd] tuya_tls_rand_init ok!
    [01-01 00:00:00 ty D][lr:0x10090ef9] init watchdog, interval: 60
    ----- tkl_watchdog_init
    wdg shift_left_num:0x10, set num:65535, top:0x0d
    [01-01 00:00:00 ty D][lr:0x10090e4b] add new node,type:0
    [01-01 00:00:00 ty D][lr:0x10090e4b] add new node,type:1
    [01-01 00:00:00 ty D][lr:0x10090e4b] add new node,type:2
    [01-01 00:00:00 ty D][lr:0x10090e4b] add new node,type:3
    [01-01 00:00:00 ty D][lr:0x10090e4b] add new node,type:4
    [01-01 00:00:00 ty D][lr:0x10090e4b] add new node,type:5
    [01-01 00:00:00 ty D][lr:0x10090e4b] add new node,type:6
    [01-01 00:00:00 ty D][lr:0x10090e4b] add new node,type:7
    [01-01 00:00:00 ty D][lr:0x10090e4b] add new node,type:8
    [01-01 00:00:00 ty D][lr:0x10091009] watch_dog_interval:60, monitor_detect_interval:600
    xTaskCreate, name: health_monitor, priority: 5, stack size: 1536
    [01-01 00:00:00 ty D][tal_thread.c:203] Thread:health_monitor Exec Start. Set to Running Stat
    [01-01 00:00:00 ty I][tal_thread.c:184] thread_create name:health_monitor,stackDepth:1536,totalstackDepth:16896,priority:5
    [01-01 00:00:00 ty D][lr:0x100b6531] mq_pro:5 cnt:1
    [01-01 00:00:00 ty D][lr:0x100b6531] mq_pro:31 cnt:2
    [01-01 00:00:00 ty D][lr:0x100b15b5] svc online log init success
    [01-01 00:00:00 ty E][lr:0x100b5d3f] logseq empty
    [01-01 00:00:00 ty N][lr:0x1006afcf] < TuyaOS V:3.5.4 BS:40.00_PT:2.3_LAN:3.5_CAD:1.0.5_CD:1.0.0 >
    < BUILD AT:2023_01_09_16_12_01 BY ci_manage FOR tuyaos-iot AT ln882h >
    IOT DEFS < WIFI_GW:1 DEBUG:1 KV_FILE:0 LITTLE_END:1 SL:0 OPERATING_SYSTEM:98 RELIABLE_TRANSFER:0 >
    
    [01-01 00:00:00 ty N][lr:0x1006afd9] ln_elec_plug:1.0.4
    [01-01 00:00:00 ty N][lr:0x1006afe3] firmware compiled at Jul  5 2023 15:01:06
    [01-01 00:00:00 ty N][lr:0x1006affd] REST INFORMATION IS 0
    [01-01 00:00:00 ty N][lr:0x1006b25f] ,over_vol: is 0
    [01-01 00:00:00 ty N][lr:0x1006b25f] ,lose_vol: is 0
    [01-01 00:00:00 ty N][lr:0x1006b25f] ,over_cur: is 20000
    [01-01 00:00:00 ty N][lr:0x1006b28f] ,chip_type: is 0
    [01-01 00:00:00 ty N][lr:0x1006b28f] ,ele_fun_en: is 1
    [01-01 00:00:00 ty N][lr:0x1006b25f] ,ele_pin: is 26
    [01-01 00:00:00 ty N][lr:0x1006b25f] ,vi_pin: is 8
    [01-01 00:00:00 ty N][lr:0x1006b25f] ,sel_pin_lv: is 1
    [01-01 00:00:00 ty N][lr:0x1006b25f] ,sel_pin_pin: is 24
    [01-01 00:00:00 ty N][lr:0x1006b25f] ,resistor: is 1
    [01-01 00:00:00 ty N][lr:0x1006b28f] ,vol_def: is 0
    [01-01 00:00:00 ty D][lr:0x1006b1dd] ,zero_select: is not exsit  1
    [01-01 00:00:00 ty D][lr:0x1006b1dd] ,zero_t: is not exsit  1
    [01-01 00:00:00 ty D][lr:0x1006b1dd] ,zero_io_pin: is not exsit  1
    [01-01 00:00:00 ty N][lr:0x1006b28f] ,ffc_select: is 0
    [01-01 00:00:00 ty N][lr:0x1006b28f] ,rl1_type: is 0
    [01-01 00:00:00 ty D][lr:0x1006b1dd] ,rl_type: is not exsit  1
    [01-01 00:00:00 ty D][lr:0x1006b1dd] ,rl1_drvtime: is not exsit  1
    [01-01 00:00:00 ty D][lr:0x1006b1dd] ,rl_drvtime: is not exsit  1
    [01-01 00:00:00 ty N][lr:0x1006b28f] ,jv: is 1.0.4
    [01-01 00:00:00 ty N][lr:0x1006b28f] ,module: is CB2S
    [01-01 00:00:00 ty N][lr:0x1006b28f] ,net_trig: is 4
    [01-01 00:00:00 ty D][lr:0x1006b1dd] ,total_led_lv: is not exsit  1
    [01-01 00:00:00 ty D][lr:0x1006b1dd] ,total_led_pin: is not exsit  1
    [01-01 00:00:00 ty D][lr:0x1006b1dd] ,total_bt_lv: is not exsit  1
    [01-01 00:00:00 ty D][lr:0x1006b1dd] ,total_bt_pin: is not exsit  1
    [01-01 00:00:00 ty D][lr:0x1006b1dd] ,bt_type: is not exsit  1
    [01-01 00:00:00 ty N][lr:0x1006b28f] ,bt1_type: is 0
    [01-01 00:00:00 ty N][lr:0x1006b25f] ,netled1_lv: is 0
    [01-01 00:00:00 ty N][lr:0x1006b25f] ,netled1_pin: is 7
    [01-01 00:00:00 ty N][lr:0x1006b28f] ,nety_led: is 0
    [01-01 00:00:00 ty N][lr:0x1006b28f] ,netn_led: is 1
    [01-01 00:00:00 ty N][lr:0x1006b28f] ,netled_reuse: is 0
    [01-01 00:00:00 ty N][lr:0x1006b25f] ,reset_t: is 5
    [01-01 00:00:00 ty N][lr:0x1006b28f] ,ch1_stat: is 2
    [01-01 00:00:00 ty D][lr:0x1006b1dd] ,total_stat: is not exsit  1
    [01-01 00:00:00 ty N][lr:0x1006b25f] ,ch_num: is 1
    [01-01 00:00:00 ty N][lr:0x1006b131] channal num is 1
    [01-01 00:00:00 ty N][lr:0x1006b38b] ,rl1_lv: is 1
    [01-01 00:00:00 ty N][lr:0x1006b38b] ,rl1_pin: is 6
    [01-01 00:00:00 ty D][lr:0x1006b31d] ,rl_on1_lv: is not exsit 5
    [01-01 00:00:00 ty D][lr:0x1006b31d] ,rl_on1_pin: is not exsit 5
    [01-01 00:00:00 ty D][lr:0x1006b31d] ,rl_off1_lv: is not exsit 5
    [01-01 00:00:00 ty D][lr:0x1006b31d] ,rl_off1_pin: is not exsit 5
    [01-01 00:00:00 ty N][lr:0x1006b38b] ,bt1_lv: is 0
    [01-01 00:00:00 ty N][lr:0x1006b38b] ,bt1_pin: is 10
    [01-01 00:00:00 ty N][lr:0x1006b38b] ,led1_lv: is 0
    [01-01 00:00:00 ty N][lr:0x1006b38b] ,led1_pin: is 23
    [01-01 00:00:00 ty N][lr:0x1006b38b] ,ch_dpid1: is 1
    [01-01 00:00:00 ty N][lr:0x1006b38b] ,ch_cddpid1: is 9
    [01-01 00:00:00 ty D][lr:0x1006b1dd] ,ble_pair_time: is not exsit  1
    [01-01 00:00:00 ty D][lr:0x1006b6b3] get_measure_chip_type is 0
    [01-01 00:00:00 ty D][lr:0x1006b727] get_standard_vol is 0
    [01-01 00:00:00 ty D][lr:0x1006b6b3] get_measure_chip_type is 0
    [01-01 00:00:00 ty N][lr:0x1006b929] product have measure , chip is 0 vol is 2200  res is 1
    [01-01 00:00:00 ty D][lr:0x10078c65] init fs. Path: null
    [01-01 00:00:00 ty D][lr:0x100aa331] *****************kvs_init.
    [01-01 00:00:00 ty N][lr:0x10097513] mf is open need stop fastconnect
    [01-01 00:00:00 ty D][lr:0x1007b151] mf_core_init success
    [01-01 00:00:00 ty D][lr:0x100cde05] protected read [gw_bi]
    [01-01 00:00:00 ty D][lr:0x100cde93] protected read ret:0 length:282
    [01-01 00:00:00 ty D][lr:0x1008e8eb] gw_bi read ret:0
    set work mode 1, is open 0, current ln mode: 0
    wifi not start, turn on first
    adapt wifi start <m:1>, hw_ready:0
    start rf preprocess and image cal
    [WLIB_E]idx=00, iq_hex_cal=0x807E, i=128, q=126, iavg= 46, qavg= 82
    [WLIB_E]idx=01, iq_hex_cal=0x817E, i=129, q=126, iavg= 61, qavg= 21
    [WLIB_E]idx=02, iq_hex_cal=0x847F, i=132, q=127, iavg= 44, qavg= 48
    [WLIB_E]idx=03, iq_hex_cal=0x887F, i=136, q=127, iavg= 56, qavg= 78
    [WLIB_E]idx=04, iq_hex_cal=0x8D7F, i=141, q=127, iavg=  4, qavg= 53
    [WLIB_E]idx=05, iq_hex_cal=0x807E, i=128, q=126, iavg= 31, qavg= 75
    [WLIB_E]idx=06, iq_hex_cal=0x827E, i=130, q=126, iavg= 69, qavg= 13
    [WLIB_E]idx=07, iq_hex_cal=0x847F, i=132, q=127, iavg=  0, qavg= 56
    [WLIB_E]idx=08, iq_hex_cal=0x897F, i=137, q=127, iavg= 31, qavg= 89
    [WLIB_E]idx=09, iq_hex_cal=0x8E7F, i=142, q=127, iavg= 12, qavg= 60
    [WLIB_E]idx=10, iq_hex_cal=0x807E, i=128, q=126, iavg= 27, qavg= 73
    [WLIB_E]idx=11, iq_hex_cal=0x827E, i=130, q=126, iavg= 62, qavg= 14
    [WLIB_E]idx=12, iq_hex_cal=0x857F, i=133, q=127, iavg=  6, qavg= 55
    [WLIB_E]idx=13, iq_hex_cal=0x897F, i=137, q=127, iavg= 20, qavg= 93
    [WLIB_E]idx=14, iq_hex_cal=0x8F7F, i=143, q=127, iavg=  2, qavg= 53
    [WLIB_E]idx=15, iq_hex_cal=0x807E, i=128, q=126, iavg= 25, qavg= 77
    [WLIB_E]idx=16, iq_hex_cal=0x827E, i=130, q=126, iavg= 65, qavg= 18
    [WLIB_E]idx=17, iq_hex_cal=0x857F, i=133, q=127, iavg=  7, qavg= 50
    [WLIB_E]idx=18, iq_hex_cal=0x897F, i=137, q=127, iavg= 34, qavg= 66
    [WLIB_E]idx=19, iq_hex_cal=0x8E7F, i=142, q=127, iavg= 22, qavg= 29
    [WLIB_E]idx=20, iq_hex_cal=0x7F7E, i=127, q=126, iavg= 83, qavg=  9
    [WLIB_E]idx=21, iq_hex_cal=0x807F, i=128, q=127, iavg= 66, qavg=119
    [WLIB_E]idx=22, iq_hex_cal=0x8182, i=129, q=130, iavg= 46, qavg= 52
    [WLIB_E]idx=23, iq_hex_cal=0x8485, i=132, q=133, iavg= 50, qavg= 50
    [WLIB_E]idx=24, iq_hex_cal=0x888A, i=136, q=138, iavg= 28, qavg= 62
    xTaskCreate, name: wifi_cfg, priority: 5, stack size: 2048
    xTaskCreate, name: mac_task, priority: 9, stack size: 2048
    [WLIB_I]cap_comp = -6, xtal_capbank_tab:[0]:34 [1]:29 [2]:29 [3]:29 [4]:44 [5]:64 [6]:64 [7]:64
    [WLIB_I][original]phy_tab_1f:0x56, phy_tab_20:0x3C
    [WLIB_I][efuse]phy_tab_1f:0x52, phy_tab_20:0x38
    [WLIB_I][flash]phy_tab_1f:0x47, phy_tab_20:0x33, tx_pwr_comp_all=0, tx_pwr_comp_b=-5, tx_pwr_comp_gn=-11
    [WLIB_I]==>temp_sect:2,phy_tab_1f:0x47,phy_tab_20:0x33
    [WLIB_I]<==temp_sect:2,phy_tab_1f:0x47,phy_tab_20:0x33
    wifi stop
    wifi sta start
    [WLIB_I]LN882H WiFi Lib Ver: 1.1.3 [build time:Apr 20 2023 13:54:22][0x010103ff]
    [WLIB_I]STA_Startup.
    STA startup!
    [WLIB_I]Disconnected.
    [WLIB_I]HwInd:UKI:0
    [WLIB_I]Disconnected.
    current work mode 0
    No need to switch mode, mode:0
    [01-01 00:00:00 ty D][lr:0x100b7043] prodtest_listen_start success
    [01-01 00:00:00 ty D][lr:0x100b7121] prodtest_identify_listen_start success
    xTaskCreate, name: mf_test, priority: 4, stack size: 5120
    [01-01 00:00:00 ty I][tal_thread.c:184] thread_create name:mf_test,stackDepth:5120,totalstackDepth:22016,priority:4
    [01-01 00:00:00 ty D][tal_thread.c:200] enter Thread:mf_test func call
    [01-01 00:00:00 ty D][tal_thread.c:203] Thread:mf_test Exec Start. Set to Running Stat
    [01-01 00:00:00 ty D][tal_thread.c:203] Thread:wq_system Exec Start. Set to Running Stat
    [01-01 00:00:00 ty I][tal_thread.c:184] thread_create name:tuya_app_main,stackDepth:4096,totalstackDepth:26112,priority:4
    adapt wifi start <m:2>, hw_ready:1
    [01-01 00:00:01 ty N][lr:0x1006a7f7] mf_init succ
    [01-01 00:00:01 ty N][lr:0x1006d359] init wfled
    [01-01 00:00:01 ty N][lr:0x1006d387] [switch] wifi led init ok
    [01-01 00:00:01 ty E][lr:0x10070951] OPRT_INVALID_PARM
    [01-01 00:00:01 ty N][lr:0x1006e1f1] RLY TYPE IS 0
    [01-01 00:00:01 ty N][lr:0x1006d3cf] channel 0 Init ok
    [01-01 00:00:01 ty N][lr:0x1006d52d] tuya_ele_hw_init success
    [01-01 00:00:01 ty N][lr:0x1006ac11] need scan ssid: tuya_mdev_test2 to enter product test repeatedly.
    tkl_thread_release, name: mf_test
    set work mode 2, is open 1, current ln mode: 0
    current work mode 0
    No need to switch mode, mode:0
    [01-01 00:00:01 ty N][lr:0x1006a88d] current product ssid name:tuya_mdev_test2
    --- 569 start scan tuya_mdev_test2
    [WLIB_I]Disconnected.
    reboot type(0:power-on;1:soft-rst;2:wdt-rst): 0
    reboot count: 0
    [ln_ty_sdk_ver: 0.0.5_alpha or 0x00000500] [build time:2022-05-17_14:57:03]
    [Git info: develop_198ece8]
    [BLIB Ver: 1.0.3 or 0x010003ff] [build time:Jan 19 2023 12:14:45]
    scan complete
    AP cnt:9
    [WLIB_I]Disconnected.
    [WLIB_I]Disconnected.
    [WLIB_I]Disconnected.
     sta_disconnected 225: STA disconnected to target AP!
     __tkl_wifi_disconnect_cb 225
    [01-01 00:00:02 ty N][lr:0x1006ac41] frame goto init!
    [01-01 00:00:02 ty N][lr:0x10096ba5] wifi status changed to 2
    [01-01 00:00:02 ty N][lr:0x10093993] wifi soc init. pid:uqehhcrmk5depvtl firmwarekey:NULL ver:1.0.4
    [01-01 00:00:02 ty N][lr:0x100970b5] start wifi link params validate, nc_tp:10 md:0
    [01-01 00:00:02 ty N][lr:0x1009713d] gw_wsm.nc_tp:10
    [01-01 00:00:02 ty N][lr:0x10097147] gw_wsm.md:0
    [01-01 00:00:02 ty E][lr:0x1009a2ab] read wf start mode err:-6
    [01-01 00:00:02 ty N][lr:0x1008dc39] Last reset reason: 0
    [01-01 00:00:02 ty N][lr:0x1008dcc9] gw_cntl->gw_wsm.stat:0
    [01-01 00:00:02 ty N][lr:0x1008dd63] gw_cntl->gw_if.abi:0 input:0
    [01-01 00:00:02 ty N][lr:0x1008dd71] gw_cntl->gw_if.product_key:uqehhcrmk5depvtl, input:uqehhcrmk5depvtl
    [01-01 00:00:02 ty N][lr:0x1008dd7d] gw_cntl->gw_if.tp:0, input:0
    [01-01 00:00:02 ty N][lr:0x1008e395] enter success_proc
    [tkl_wifi_get_mac:1227] if: 0, mac: 18:de:50:4c:7c:61
    ble_mac: 62:7c:4c:50:de:18
    [01-01 00:00:02 ty N][lr:0x1008e3a9] serial_no:18de504c7c61
    [01-01 00:00:02 ty E][lr:0x1009a2ab] read wf start mode err:-6
    [01-01 00:00:02 ty E][lr:0x100cba2d] uf_open LIGHT_MODE err 8
    [01-01 00set work mode 3, is open 1, current ln mode: 0
    current:00:02 ty E][lr:0x1006e481] uf file LIGHT_MODE can't open and read data!
     work mode 0
    [WLIB_I]Disconnected.
    [01-01 00:00:02 ty E][lr:0x100cba2d] uf_open RLY_INIT err 8
    [01-01 00:00:02 ty E][lr:0x1006e481] uf file RLY_INIT can't open and read data!
    [01-01 00:00:02 ty N][lr:0x1006d7b3] tuya_get_relay_init_type is 2
    [01-01 00:00:02 ty N][lr:0x1006da8d] __read_saved_stat
    [01-01 [WLIB_I]LN882H WiFi Lib Ver: 1.1.3 [build time:Apr 20 00:00:02 ty E][lr:0x1006ceb9] ch_idx:[0] is over!
    [01-01 00:00:02 ty E][lr:0x1006e72023 13:54:22][0x010103ff]
    91] input over range
    [01-01[WLIB_I]SoftAP_Startup.
    SoftAP startup!
     00:00:02 ty N][lr:0x1006e9ad] start tuya_inch_time_init..
    [0[WLIB_I]HwInd:UKI:0
    [WLIB_I]Channel scanning not needed
    [WLIB_I]User Preferred channel idx 5-0
    [WLIB_I]Selecting 20MHz ch from One of ... 0 1 2 3 4 5
    [WLIB_I]Selected Channel Tbl Idx 5-0
    [WLIB_I]AP: Starting network in 5-0
    [WLIB_I]Connected.
    [WLIB_I]Status: Start Successful. Entering Enable State.
    1-01 00:00:02 ty N][lr:0x1006ea5b] init read inch info is null!
    [01-01 00:00:02 ty N][lr:0x1006ce45] init read quick info is null!
    [01-01 00:00:02 ty N][lr:0x100723c5] get prod test result!:1
    [01-01 00:00:02 ty N][lr:0x10072561] dltj start success
    [01-01 00:00:02 ty N][lr:0x1006adbb] tuya_measure_chip ok
    [01-01 00:00:02 ty E][lr:0x100cba2d] uf_open temp_energy err 8
    [01-01 00:00:02 ty E][lr:0x1006e481] uf file temp_energy can't open and read data!
    [01-01 00:00:02 ty N][lr:0x10070b37] LOAD NO TIME energy: 0
    [01-01 00:00:03 ty E][lr:0x100cba2d] uf_open day_energy err 8
    [01-01 00:00:03 ty E][lr:0x1006e481] uf file day_energy can't open and read data!
    [01-01 00:00:03 ty N][lr:0x10070b89] have storage ele data: -1
    [01-01 00:00:03 ty N][lr:0x10070b65] LOAD loc_data_energy: 0
    [01-01 00:00:03 ty N][lr:0x10070b6d] LOAD loc_data_time: 0
    [01-01 00:00:03 ty N][lr:0x10070b65] LOAD loc_data_energy: 0
    [01-01 00:00:03 ty N][lr:0x10070b6d] LOAD loc_data_time: 0
    [01-01 00:00:03 ty N][lr:0x10070b65] LOAD loc_data_energy: 0
    [01-01 00:00:03 ty N][lr:0x10070b6d] LOAD loc_data_time: 0
    [01-01 00:00:03 ty N][lr:0x10070b65] LOAD loc_data_energy: 0
    [01-01 00:00:03 ty N][lr:0x10070b6d] LOAD loc_data_time: 0
    [01-01 00:00:03 ty N][lr:0x10070b65] LOAD loc_data_energy: 0
    [01-01 00:00:03 ty N][lr:0x10070b6d] LOAD loc_data_time: 0
    [01-01 00:00:03 ty N][lr:0x10070b65] LOAD loc_data_energy: 0
    [01-01 00:00:03 ty N][lr:0x10070b6d] LOAD loc_data_time: 0
    [01-01 00:00:03 ty N][lr:0x10070b65] LOAD loc_data_energy: 0
    [01-01 00:00:03 ty N][lr:0x10070b6d] LOAD loc_data_time: 0
    [01-01 00:00:03 ty N][lr:0x10070b65] LOAD loc_data_energy: 0
    [01-01 00:00:03 ty N][lr:0x10070b6d] LOAD loc_data_time: 0
    [01-01 00:00:03 ty N][lr:0x10070b65] LOAD loc_data_energy: 0
    [01-01 00:00:03 ty N][lr:0x10070b6d] LOAD loc_data_time: 0
    [01-01 00:00:03 ty N][lr:0x10070b65] LOAD loc_data_energy: 0
    [01-01 00:00:03 ty N][lr:0x10070b6d] LOAD loc_data_time: 0
    [01-01 00:00:03 ty E][lr:0x100cba2d] uf_open over_charge err 8
    [01-01 00:00:03 ty E][lr:0x1006e481] uf file over_charge can't open and read data!
    [01-01 00:00:03 ty N][lr:0x100710b9] read overcharge function: 0
    [01-01 00:00:03 ty N][lr:0x1006adfb] tuya_dltj_init ok
    xTaskCreate, name: timer_task, priority: 3, stack size: 4096
    [01-01 00:00:03 ty I][tal_thread.c:184] thread_create name:timer_task,stackDepth:4096,totalstackDepth:30208,priority:3
    [01-01 00:00:03 ty N][lr:0x100702ef] wd_common_read failed op_ret:-6
    [01-01 00:00:03 ty N][lr:0x100702ef] wd_common_read failed op_ret:-6
    [01-01 00:00:03 ty N][lr:0x100702ef] wd_common_read failed op_ret:-6
    [01-01 00:00:03 ty N][lr:0x1006ae99] device_init ok  free_mem_size:112344
    [WLIB_I]Disconnected.
    [WLIB_I]Channel scanning not needed
    [WLIB_I]User Preferred channel idx 5-0
    [WLIB_I]Selecting 20MHz ch from One of ... 0 1 2 3 4 5
    [WLIB_I]Selected Channel Tbl Idx 5-0
    [WLIB_I]AP: Starting network in 5-0
    [WLIB_I]Connected.
    [WLIB_I]Status: Start Successful. Entering Enable State.
    tkl_thread_release, name: tuya_app_
    [tkl_wifi_get_mac:1227] if: 0, mac: 18:de:50:4c:7c:61
    ble_mac: 62:7c:4c:50:de:18
    [tkl_wifi_get_mac:1227] if: 1, mac: 18:de:50:4c:7c:60
    ble_mac: 62:7c:4c:50:de:18
    ssid:SmartLife-7C61; pwd:; channel:6, ecn:0, max conn:1, hidden:0beacon:100, mac:18:de:50:4c:7c:60; start:1
    [WLIB_I]Disconnected.
    ip info:
            ip:      192.168.176.1
            gw:      192.168.176.1
            netmask: 255.255.255.0
    server config:
            ip:       192.168.176.1
            ip start: 192.168.176.2
            ip end:   192.168.176.2
    port:67
    lease:2880
    renew:2880
    max client:1
    [WLIB_I]LN882H WiFi Lib Ver: 1.1.3 [build time:Apr 20 2023 13:54:22][0x010103ff]
    [WLIB_I]SoftAP_Startup.
    SoftAP startup!
    ap_startup_cb 137, wifi softap up
    ------- dhcp stop ----------
    -------DUMP DHCP SERVER_CONFIG----------
    server_config.server=192.168.176.1
    server_config.port=67
    server_config.lease=2880
    server_config.renew=2880
    server_config.ip_start=192.168.176.2
    server_config.ip_end=192.168.176.2
    server_config.max=1
    -----------------END--------------
    IP_POOL: i=0 192.168.176.2
    xTaskCreate, name: dhcpd, priority: 4, stack size: 1280
    dhcpd_task start...
    [WLIB_I]HwInd:UKI:0
    [WLIB_I]Channel scanning not needed
    [WLIB_I]User Preferred channel idx 5-0
    [WLIB_I]Selecting 20MHz ch from One of ... 0 1 2 3 4 5
    [WLIB_I]Selected Channel Tbl Idx 5-0
    [WLIB_I]AP: Starting network in 5-0
    [WLIB_I]Connected.
    [WLIB_I]Status: Start Successful. Entering Enable State.
    [WLIB_I]Disconnected.
    [WLIB_I]Channel scanning not needed
    [WLIB_I]User Preferred channel idx 5-0
    [WLIB_I]Selecting 20MHz ch from One of ... 0 1 2 3 4 5
    [WLIB_I]Selected Channel Tbl Idx 5-0
    [WLIB_I]AP: Starting network in 5-0
    [WLIB_I]Connected.
    [WLIB_I]Status: Start Successful. Entering Enable State.
    [01-01 00:00:03 ty N][lr:0x10097d5b] cur stat:13  0x1006c7f1 -->>
    [01-01 00:00:03 ty N][lr:0x10097d95] wifi netstat changed to:13  -->>
    [01-01 00:00:03 ty N][lr:0x10097dab] report wifi netstat[13] to callback  -->>
    [01-01 00:00:03 ty N][lr:0x1006c813] net stat 13 change free_mem_size:114872
    [01-01 00:00:03 ty N][lr:0x10099fd5] timer stated, short timer:0x0, long timer:0x10099e15
    [01-01 00:00:03 ty N][lr:0x100bba03] bt startup attr:ff
    [01-01 00:00:03 ty N][lr:0x1007cb87] upd product_id type:0 uqehhcrmk5depvtl
    xTaskCreate, name: host_main_thread_hdl, priority: 8, stack size: 5120
    [01-01 00:00:03 ty I][tal_thread.c:184] thread_create name:host_main_thread_hdl,stackDepth:5120,totalstackDepth:35328,priority:8
    [01-01 00:00:03 ty I][lr:0x100a7915] le acl buf sz = 251,max buf = 5
    
    [01-01 00:00:03 ty I][lr:0x100a6333] acl buf sz = 251, max pkt = 5, avail pkt = 5
    
    [01-01 00:00:03 ty I][lr:0x100a7ddd] GAP init: stop adv
    [01-01 00:00:03 ty I][lr:0x10075085] ble_hs_timer reset:100
    [01-01 00:00:03 ty I][lr:0x100777e9] Stack sync
    [01-01 00:00:03 ty I][lr:0x100777c9] Init/Deinit Event
    [01-01 00:00:03 ty N][lr:0x1007cb49] ty bt sdk init success finish
    [01-01 00:00:03 ty N][lr:0x100a8303] Start Adv
    [01-01 00:00:03 ty N][lr:0x1008e6a7] __devos_init_evt success
    [01-01 00:00:03 ty I][lr:0x100a7ddd] GAP init: stop adv
    [01-01 00:00:03 ty I][lr:0x10075085] ble_hs_timer reset:0
    [01-01 00:00:03 ty N][lr:0x100a8303] Start Adv
    [01-01 00:00:03 ty N][lr:0x1007c6f9] ble adv updated
    xTaskCreate, name: TCP_ap_v4, priority: 5, stack size: 3584
    [01-01 00:00:03 ty I][tal_thread.c:184] thread_create name:TCP_ap_v4,stackDepth:3584,totalstackDepth:38912,priority:5
    [tkl_wifi_get_mac:1227] if: 0, mac: 18:de:50:4c:7c:61
    ble_mac: 62:7c:4c:50:de:18
    [tkl_wifi_get_mac:1227] if: 1, mac: 18:de:50:4c:7c:60
    ble_mac: 62:7c:4c:50:de:18
    [01-01 00:00:03 ty E][lr:0x10095691] timer is not run,wait
    [01-01 00:00:03 ty I][lr:0x10075189] ble_hs_timer_exp:
    adc raw:  773, temp_IC: 26, cap:0x9D331D00, rf43:0x0005, reg74:0x0228


    Added after 3 [hours] 1 [minutes]:

    Just tried to read flash via RXD1/TXD1 with bk7231flasher, but no luck.
  • ADVERTISEMENT
  • #7 20811099
    hard3d
    Level 7  

    Good afternoon! Got a relay on this chip. The CozyLife program is needed for management.

    Top view of a relay module with electrical specification markings. Close-up of a circuit board with various electronic components. Close-up of an LN-02 integrated circuit on a black background. Close-up of an electronic board with blue capacitors and a chip.
  • #8 20822301
    sithyoda
    Level 7  

    @p.kaczmarek2 Did you find time to have a look at the SDK for this chip? If yes, do you think it might be possible to make openbeken for it?
  • #9 20822315
    p.kaczmarek2
    Moderator Smart Home
    Not yet, but if you have this chip, can you please try if the flasher for this chip works with UART? Is it possible to read firmware dump or flash new one?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #10 20824130
    sithyoda
    Level 7  

    Ok, there seems to be a chance to flash it with J-Link (JTAG). I'll give it a try.
  • #12 20824160
    sithyoda
    Level 7  

    I'm not quite sure. But I found this on a Tuya site, that makes me confident:
    Screenshot of a Tuya page with documentation on GPIO and connector descriptions.
  • #13 20824192
    p.kaczmarek2
    Moderator Smart Home
    Tuya may have it's own bootloader that is separate from the LN882HK SDK, but we may not have access to it yet.

    Here is machine-translated readme from SDK:
    
    LN882H SDK Introduction
    Compilation Methods
    
    Keil MDK
    Environment Setup
    Refer to the document LN882H Keil ARMCC Development Environment Setup Guide.pdf for environment setup.
    User Project Selection
    The user project is located in project/xxxx, for example, the wifi_mcu_basic_example project. Open the Keil project in the subdirectory, and click the Compile, Download, Debug buttons in the Keil IDE interface to perform the corresponding functions.
    
    CMake+GCC
    Environment Setup
    Refer to the document lightningsemi_sdk_cross_build_setup.pdf for environment setup.
    User Project Selection
    The project is organized using the CMakeLists.txt file. The top-level CMakeLists.txt selects the user project with the following instruction:
    
    ################################################################################
    ######################### NOTE: select user project here ####################
    ################################################################################
    set(USER_PROJECT wifi_mcu_basic_example)
    User Project Compilation and Download
    Initiate compilation and download actions using the script start_build.py. Usage is as follows:
    
    *****************************  usage  *****************************
    argv[1] -- build action, such as clean/config/build/rebuild/jflash.
    Example:
                python3   start_build.py   rebuild
    *******************************************************************
    Clean results: python3 start_build.py clean
    Configure project: python3 start_build.py config
    Compile project: python3 start_build.py build
    Clean, configure, and compile combined: python3 start_build.py rebuild
    Flash the image file: python3 start_build.py jflash
    


    Added after 1 [minutes]:

    Here is flash script, as seen in SDK:
    Code: Python
    Log in, to see the code
    Helpful post? Buy me a coffee.
  • #14 20826012
    sithyoda
    Level 7  

    With a Segger J-Link, I'm able to erase/flash the chip via SWD. So I flashed the SPI image OpenBK7231T_QIO_1.17.318.bin, but no bootup messages. I guess the bootloader does not fit this device.
    Can you suggest an image that I could try to flash?

    According to https://github.com/lightningsemi/ln882h/tree/master/project/bootcode, it should be possible to flash via UART too.
  • #15 20826038
    p.kaczmarek2
    Moderator Smart Home
    Hey, it's a totally different chip, BK image will not work on that.

    Still, it's a very good news that you managed to flash it, can you show your connections on the board?

    The next step would be to see if we can compile a hello world sample from their SDK and then get that hello world binary and flash on the chip. Can you try that?

    I can help with porting OBK later.
    Helpful post? Buy me a coffee.
  • Helpful post
    #16 20826073
    sithyoda
    Level 7  
    Here the pinout I use:
    Pinout diagram showing connections between a connector and a module.


    Just installed KEIL and try to follow instructions of the manual on how to install development environment.
    There are some sample projects in the SDK, I will try to compile and flash some.
  • #17 20835290
    voodoopt
    Level 9  

    Hello, I have the same problem. I was trying to understand how I can put something 100% local
    Like OpenWrt or Tasmota ;)
    Close-up of a circuit board with a chip labeled LIGHTNING LN882HKI.
    my ic
  • #18 20835317
    p.kaczmarek2
    Moderator Smart Home
    We need to check if the sample codes are compiling and is it possible to flash them
    Helpful post? Buy me a coffee.
  • #19 20836818
    voodoopt
    Level 9  

    p.kaczmarek2 wrote:
    We need to check if the sample codes are compiling and is it possible to flash them

    how can I help ?
  • #20 20836820
    p.kaczmarek2
    Moderator Smart Home
    If you have C experience, try to compile and flash examples from the SDK mentioned in previous posts. This could speed up things and give me a base for my OBK port.
    Helpful post? Buy me a coffee.
  • #21 20836870
    voodoopt
    Level 9  
    I don't have much knowledge of programming....
  • #22 20839607
    sithyoda
    Level 7  

    I was able to set up KEIL and compile the project from the SDK. Unfortunately, the compiled size exceeds the limit of the free KEIL version.
    So I have to think about something else, maybe Segger Embedded Studio.
    @p.kaczmarek2 Can you suggest a (free) product?
  • #23 20840280
    protectivedad
    Level 7  
    sithyoda wrote:

    I was able to set up KEIL and compile the project from the SDK. Unfortunately, the compiled size exceeds the limit of the free KEIL version.
    So I have to think about something else, maybe Segger Embedded Studio.
    @p.kaczmarek2 Can you suggest a (free) product?


    What is the size limitation? Is it compiling or uploading to the chip? I'm not familiar with KEIL. This just popped up in github AI-Thinker. I was able to grab the toolchain from that and compile the combo_mcu_basic_example into a firmware file flashimage.bin. But I don't have a J-whatever to upload it and I don't know how to OTA or UART the LN882H. I have the LN-02 board off the mini switches that were being sold on AliExpress (1.99 USD) for the last month. Can I use a cheap knockoff J-?? off Amazon to write it? I've only ever done UART. Not sure how they work. Pointing me at some affordable hardware to help me write these things would be appreciated.


    Added after 2 [hours] 9 [minutes]:

    I thought I updated this with more information. I don't have any messages saying I did wrong so I'll try it again. AI-Thinker has two modules that use the LN882H I wasn't able to find information on flashing them other than the pull down gpioA9 to put into burn mode. I did find a firmware file. I have also put my card in burning mode and I can type and get a response:
    Quote:
    unknown cmd!


    So to recap:
    I can see the CozyLife firmware start. I can talk to the CozyLink firmware using netcat to set it up and control it. I can put it into burning mode and get responses from it. I can compile the demos. I just can't get them on the module. Oh, and my module doesn't have the gpioA4 accessible which makes using J-Link a problem. So until there is some more information on commands to try, OTA or I solder the gpioA4 and get a J-Link whatever, I guess I am stuck.

    PS:
    This thread has the most information about LN882H so although I am working on the LN-02 and not the WL2S I hope it is okay to post here. Since they seem to be very closely related.
  • #24 20841102
    sithyoda
    Level 7  

    Finally, I managed to compile an example from the SDK in KEIL and was able to successfully upload it to the chip.
    Screenshot of SEGGER J-Flash showing a firmware project and flash memory operation log.

    If you tell me how to compile OpenBK, I'll give it a try.
  • #25 20841164
    p.kaczmarek2
    Moderator Smart Home
    Can you first test whether this example binary works? Are there any examples, like hello world demu, like UART sample, blink LED, WiFi demo?
    Helpful post? Buy me a coffee.
  • #26 20843185
    protectivedad
    Level 7  

    sithyoda wrote:
    Finally, I managed to compile an example from the SDK in KEIL and was able to successfully upload it to the chip.


    Were you able to connect to your AP with the wifi_mcu_basic_example?
  • #27 20844958
    voodoopt
    Level 9  
    >>20841102
    Spectacular, if you need someone to test it, I'm available to try it
  • #28 20845482
    sithyoda
    Level 7  

    I can confirm that the basic examples from the SDK compile fine, can be flashed, and the chip boots up.
    Here is a sample of the output on UART TX:
    ------  wifi_mcu_basic_example  ------
    TCP/IP initialized.
    LN882H SDK Ver: 1.8 [build time: Dec 4 2023 06:11:55][0x010800ff]
    [WLIB_I] LN882H WiFi Lib Ver: 1.1.3 [build time: Apr 17 2023 10:46:01][0x010103ff]
    [WLIB_I] cap_comp = 0, xtal_capbank_tab:[0]:40 [1]:35 [2]:35 [3]:35 [4]:50 [5]:70 [6]:90 [7]:110
    [WLIB_I][original] phy_tab_1f:0x4C, phy_tab_20:0x3C
    [WLIB_I][efuse] phy_tab_1f:0x48, phy_tab_20:0x38
    [WLIB_I][flash] phy_tab_1f:0x48, phy_tab_20:0x38, tx_pwr_comp_all=0, tx_pwr_comp_b=0, tx_pwr_comp_gn=0
    [WLIB_I]==>temp_sect:2, phy_tab_1f:0x48, phy_tab_20:0x38
    [WLIB_I]<==temp_sect:2, phy_tab_1f:0x48, phy_tab_20:0x38
    [WLIB_I] STA_Startup.
    STA startup!
    [WLIB_I] Disconnected.
    [WLIB_E] HwEr:UKI:0
    [WLIB_I] Disconnected.
    psk value :
    00000000: C2 D3 69 7D ED DE 80 22 69 2F CC 4D 7C 0E 43 64 ..i}..."i/.M|.Cd
    00000010: CF 7D 84 56 B5 BF 6B 6C 25 B4 D8 80 8E EA 38 A5 .}.V..kl%.....8.
    00000020: 7F 39 74 A3 F7 8F 27 03                           .9t...' .
            CH= 6, RSSI= -51, BSSID:[60:E2:23:5D:DC:11], SSID:"NETWORK1"
            CH= 1, RSSI= -60, BSSID:[94:9B:2D:02:A8:FF], SSID:"NETWORK2"
            CH= 6, RSSI= -51, BSSID:[60:E2:23:5D:DC:11], SSID:"NETWORK1"
            CH= 1, RSSI= -60, BSSID:[94:9B:2C:02:A8:FF], SSID:"NETWORK2"
    

  • #29 20845539
    p.kaczmarek2
    Moderator Smart Home
    Porting OBK to new chip is very simple, you just need to create separate directory in hal:
    https://github.com/openshwprojects/OpenBK7231T_App/tree/main/src/hal
    and stub all the functions, like we did for W800:
    https://github.com/openshwprojects/OpenBK7231T_App/tree/main/src/hal/w800
    Create files like your hal_generic_YourPlatform.c, etc:
    Screenshot of a GitHub directory with files for platform W800 in the OpenBK7231T_App project.
    Implement wrappers for WIFI and GPIO control, etc.
    You also need to create a 1 second timer for "every second" in main, but you can see all that in the HALs for different platforms.

    For compiling itself, we usually put whole OpenBK7231T_App dir into a "parent" project from given SDK, for example for T platform, we put OpenBK7231T_App in OpenBK7231T SDK project.

    Added after 29 [seconds]:

    Is there LWIP library available in LN882HK SDK? We use that across the SDKs for networking
    Helpful post? Buy me a coffee.
  • #30 20845587
    sithyoda
    Level 7  

    p.kaczmarek2 wrote:
    Is there an LWIP library available in LN882HK SDK? We use that across the SDKs for networking

    I'd say yes:
    Screenshot of a GitHub repository containing library files related to the ln882h project.

    Puh... The rest sounds quite complicated for someone who is not into C programming so deep.

Topic summary

The discussion revolves around flashing OpenBeken firmware on the ELIVCO LSPA9 module, which utilizes the WL2S microcontroller and the LIGHTNING LN882HK chip. Users share their experiences with UART and JTAG flashing methods, debugging issues, and the challenges of obtaining and compiling the necessary firmware. Several users successfully managed to flash the firmware, enabling functionalities such as WiFi connectivity and relay control. The conversation also touches on power consumption, temperature management, and the implementation of power-saving features. Additionally, users discuss the integration of the BL0937 power metering chip and the development of a comprehensive template for the device.
Summary generated by the language model.
ADVERTISEMENT