Open shzlww opened 8 months ago
Well, that certainly is an oddity. That firmware is unencrypted, and appears to have the BK7231N 1.0.11 bootloader, and doesn't have Tuya firmware, but some other 3rd party. I'm not sure if the M
is a misprint or not, but there are references to both BK7231N
and BK7231M
in the strings.
I'm guessing this would already work with a custom coeff for unencrypted, but I'm unsure what that looks like (and the corresponding ota key/iv and possible ota offset), so I'll leave that to @kuba2k2 to advise on.
This device indeed appears to be unencrypted. ESPHome config for this device:
esphome:
name: my-device
platformio_options:
board_build.bkcrypt_coeffs: 00000000000000000000000000000000
board_build.bkota.key: 0123456789ABCDEF0123456789ABCDEF
board_build.bkota.iv: 0123456789ABCDEF
board_flash.download: "0x132000+0xAE000"
@kuba2k2 compile and flash well,but can not run.No wifi connection and No ap .
Linking .pioenvs/bk7231m/raw_firmware.elf
|-- Image 1: raw_firmware.elf
| |-- image_bk7231n_app.0x011000.rbl
| | |-- raw_firmware.bin
| |-- image_bk7231n_app.0x011000.crc
| |-- image_bk7231n_app.0x129F0A.rblh
| |-- image_bk7231n_app.ota.rbl
| |-- image_bk7231n_app.ota.ug.bin
RAM: [==== ] 35.8% (used 93944 bytes from 262144 bytes)
Flash: [======= ] 72.3% (used 783240 bytes from 1083136 bytes)
Building UF2 OTA image
|-- esphome_2023.12.5_generic-bk7231n-qfn32-tuya_bk7231n_lt1.4.1.uf2
|-- firmware.uf2
|-- firmware.bin
esphome:
name: bk7231m
platformio_options:
board_build.bkcrypt_coeffs: "00000000000000000000000000000000"
board_build.bkota.key: "0123456789ABCDEF0123456789ABCDEF"
board_build.bkota.iv: "0123456789ABCDEF"
board_flash.download: "0x132000+0xAE000"
#board_flash.download: "0x1E0000"
bk72xx:
board: generic-bk7231n-qfn32-tuya
logger:
web_server:
captive_portal:
mdns:
api:
password: ""
ota:
password: ""
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
How did you flash the firmware, and what file did you flash?
Please connect UART to TX2 and capture log outputs from the device. Otherwise we can't even tell if it's running or not.
@kuba2k2 I try to flash the bk7231m by using many ways, same result: no wifi,no ap,no uart log 1.flash bk7231m.uf2 by ltchiptool 2.flash bk7231m-0x011000.rbl by bk7231_flasher finally,I flash it back to the original factory firmware by bk7231_flasher, I got the uart log,BTW the original factory firmware use BLE to config the wifi by default ,it do not launch an AP to config wifi ,this seems different from other tuya cb2s devices, .
bk_misc_init_start_type 0 0
prvHeapInit-start addr:0x40c328, size:146648
[Flash]id:0xeb6015
[Flash]init over
sctrl_sta_ps_init
SDK Rev: 3.0.56 fa12785
[THD]app:[tcb]40ccf8 [stack]40c4f0-40ccf0:2048:5
[THD]extended_app:[tcb]40d568 [stack]40cd60-40d560:2048:4
[THD]idle:[tcb]40d9d8 [stack]40d5d0-40d9d0:1024:0
[THD]timer_thd:[tcb]40e360 [stack]40db58-40e358:2048:2
OSK Rev: F-3.0.35 fa12785
cset:0 0 0 0
bandgap_calm_in_efuse=0x3e
[load]bandgap_calm=0x20->0x1e,vddig=4->5
[FUNC]rwnxl_init
chip id=7231c device id=20521028
IP Rev: W4-3.0.56-P0
txdesc flush
[FUNC]intc_init
[FUNC]calibration_main
get rfcali_mode:1
device_id=0x20521028
calibration_main over
flash txpwr table:0x1f
dif g and n20 ID in flash:4
dif g and n40 ID in flash:4
load txpwr tabe n20 in flash
read txpwr tab from flash success
uncali adc value:[00 00 00]
temp in flash is:321
[THD]temp_detct:[tcb]40e950 [stack]40e548-40e948:1024:3
lpf_i & q in flash is:113, 107
found flash XTAL:66
xtal in flash is:66
xtal_cali:66
--init_xtal = 66
[FUNC]ps_init
int watchdog enabled, period=10000
task watchdog enabled, period=60000
[FUNC]func_init_extended OVER!!!
start_type:0
[THD]kmsgbk:[tcb]40f218 [stack]40ea10-40f210:2048:6
[THD]init_thread:[tcb]40fa58 [stack]40f280-40fa50:2000:5
Initializing TCP/IP stack
tcp_port:62049
[THD]tcp/ip:[tcb]4104a8 [stack]40fca0-4104a0:2048:7
[THD]wpas_thread:[tcb]411970 [stack]410968-411968:4096:4
bk_wlan_app_init finished
[THD]core_thread:[tcb]4128d0 [stack]4120c8-4128c8:2048:7
[THD]rf_arbitrate:[tcb]413238 [stack]412a30-413230:2048:8
rf_thread_init ok
[THD]ble:[tcb]413b50 [stack]413348-413b48:2048:5
ble mac:bc-fd-0c-78-5d-df
xvr_reg_init
h4tl_init-1 ok
hci_init ok
!!!!!!init_type=0
rwble_hl_init ok
BLE Rev: B5-3.0.56-P0
rwble_init ok
rwip_driver_init ok
enter normal mode
EM_BLE_END:0x1b40
!!!!!!init_type=1
llm_init:312
[gapm_cmp_evt_handler] conidx:0,operation:0x1,status:0x0
cmd->addr.addr[5] :0
!!!!!!init_type=2
[gapm_cmp_evt_handler] conidx:0,operation:0x3,status:0x0
gapm_cmp_evt:GAPM_SET_DEV_CONFIG
gapm_cmp_evt:wait GAPM_GEN_RAND_NB
[gapm_cmp_evt_handler] conidx:0,operation:0x1a,status:0x0
gapm_cmp_evt:GAPM_GEN_RAND_NB
[gapm_cmp_evt_handler] conidx:0,operation:0x1a,status:0x0
gapm_cmp_evt:GAPM_GEN_RAND_NB
[gapm_cmp_evt_handler] conidx:0,operation:0x28,status:0x0
gapm_cmp_evt:BLE_STACK_OK
[THD]cli:[tcb]414eb0 [stack]4146a8-414ea8:2048:3
======>> INIT COMPLETE
ENTRY app MAIN
[THD]app_main:[tcb]415f20 [stack]414f18-415f18:4096:5
[0;32m[I MAIN][app_main.c:37]Prod: 1, Version: 1.0.4, Compile time: 07:54:13 Sep 13 2023
[0m[MAGIC_HEX]
4A 58 4D 41 47 49 43 4E
[MAGIC_HEX]
4A 58 4D 41 47 49 43 4E
[0;32m[I ELEC][bll_elec.c:272]Use elec part 0, num: 1, int_val: 0, f_val: 0
[0m[0;32m[I MAIN][bll_dev_prod_test.c:640]15min flag is true, ignore auth test
[0m[THD]key_detect_thread:[tcb]416508 [stack]416100-416500:1024:6
[THD]key_process_thread:[tcb]416b78 [stack]416570-416b70:1536:6
[THD]led_thread:[tcb]417140 [stack]416c38-417138:1280:6
[0;34m[D MNG][bll_dev_common.c:147]load burning info
[0m[0;34m[D MNG][bll_dev_common.c:148]burninfo.cmei: 111092600011649
[0m[0;34m[D MNG][bll_dev_common.c:149]burninfo.sn: 1716059038400011648
[0m[0;34m[D MNG][bll_dev_common.c:150]burninfo.manu_data: 2023-09
[0m[0;34m[D MNG][bll_dev_common.c:151]burninfo.wifimac: bc-fd-0c-78-5d-de
[0m[0;34m[D MNG][bll_dev_common.c:154]burninfo.blemac: bc-fd-0c-78-5d-df
[0m[0;32m[I MAIN][bll_dev_prod_test.c:666]cali test IN
[0m[THD]app_main:[tcb]40d550 [stack]40c548-40d548:4096:5
[0;34m[D MAIN][bll_dev_prod_test.c:847]15 min flag is true
[0m[0;32m[I MAIN][bll_dev_prod_test.c:668]cali test OUT
[0m[0;34m[D BL0937][fml_bl0937b_int.c:709]user cali
[0m[0;34m[D BL0937][fml_bl0937b_int.c:717]work mode: 16
[0m[0;34m[D BL0937][fml_bl0937b_int.c:718]cali, p_ref: 870, v_ref: 2200, i_ref: 395, e_ref: 260
[0m[0;34m[D BL0937][fml_bl0937b_int.c:719]cali, p_ref_time: 15734, v_ref_time: 569, i_ref_time: 29028
[0m[0;32m[I BLE_PROTO][device.c:59]Create dev_g_mutex suc
[0m[0;32m[I ELEC][bll_elec.c:350]READ node, part: 8, num: 1, int_val: 0, f_val: 0
[0m[0;32m[I MNG][bll_dev_common.c:256]Use the last config
[0m[0;32m[I MNG][bll_dev_common.c:262]Read childrenLock fail, use default
[0m[0;32m[I MNG][bll_dev_common.c:284]pwCutMemory: 1, signalLight: 1, childrenLock, 0
[0m[0;32m[I MNG][bll_dev_common.c:285]energy: 0.000000, relay: 0
[0m[0;32m[I MNG][bll_dev_common.c:286]userBind: 0
[0m[THD]elec_manage_thread:[tcb]40f310 [stack]417218-417c18:2560:6
[0;32m[I ELEC][bll_elec_manage.c:186]get elec last: 0.000000
[0m[THD]bll_dev_manage:[tcb]40f3d0 [stack]417c20-419220:5632:6
[0;34m[D MNG][bll_fota.c:415]next_chktime: 0
[0m[THD]fota_thread:[tcb]40f438 [stack]419228-41a228:4096:6
[0;33m[W MAIN][fml_led.c:113]set LED: 2, 4
[0mtemperature_type=2
temp_code:12 - adc_code:346 - adc_trend:[13]:321->[10]:348
init_xtal:66, delta:5, last_xtal:66
[0;33m[W NET][bll_ble_network.c:592]+++>> app ble is ready
[0m[0;34m[D NET][bll_ble_network.c:574]+++>> app main entry <<+++
[0m[THD]ble_net_thread:[tcb]40c548 [stack]41a230-41ba30:6144:6
ble create new db
ble_env->start_hdl = 0x10
[gapm_profile_added_ind_handler] prf_task_id:0x78,prf_task_nb:9,start_hdl:16,state:0x1
conidx:0x0,role:0x0,dest_id:0x3,src_id:0x7,param->status:0x0
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 8
[0m[0;34m[D NET][bll_ble_network.c:198]BLE_5_CREATE_DB: prf_id:0, status:0
[0m[gapm_cmp_evt_handler] conidx:0,operation:0x1b,status:0x0
[gapm_cmp_evt_handler] conidx:0,operation:0xa0,status:0x0
[0;34m[D NET][bll_ble_network.c:279]cmd:1 idx:0 status:0
[0m[gapm_cmp_evt_handler] conidx:0,operation:0xa9,status:0x0
[0;34m[D NET][bll_ble_network.c:279]cmd:2 idx:0 status:0
[0m[gapm_cmp_evt_handler] conidx:0,operation:0xaa,status:0x0
[0;34m[D NET][bll_ble_network.c:279]cmd:3 idx:0 status:0
[0m[gapm_cmp_evt_handler] conidx:0,operation:0xa4,status:0x0
[0;34m[D NET][bll_ble_network.c:279]cmd:4 idx:0 status:0
[0mtemp_code:14 - adc_code:341 - adc_trend:[10]:348->[11]:339
init_xtal:66, delta:4, last_xtal:71
[gapc_connection_req_ind_handler]ble_slave conn_idx:0
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 5
[0m[0;34m[D NET][bll_ble_network.c:178]BLE_5_CONNECT_EVENT: conn_idx:0, addr_type:1, peer_addr:f4:c0:10:25:b9:53
[0m[gapm_activity_stopped_ind_handler]conidx:0
gapc_le_pkt_size_ind_handler msgid:0xe2c,dest_id:0x3,src_id:0x8
conidx:0,1max_rx_octets = 251
1max_rx_time = 2120
1max_tx_octets = 251
1max_tx_time = 2120
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 4
[0m[0;34m[D NET][bll_ble_network.c:173]BLE_5_MTU_CHANGE: conn_idx:0, mtu_size:527
[0mgapc_get_dev_info_req_ind_handler,req:0x0
length:0,name:
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:5, len:2, data[0]:01
[0m[NET_HEX]
01 00
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:8, len:2, data[0]:02
[0m[NET_HEX]
02 00
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 2
[0m[0;34m[D NET][bll_ble_network.c:155]BLE_5_READ_EVENT: conn_idx:0, prf_id:0, add_id:12
[0m[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 2
[0m[0;34m[D NET][bll_ble_network.c:155]BLE_5_READ_EVENT: conn_idx:0, prf_id:0, add_id:14
[0m[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:2, len:11, data[0]:00
[0m[NET_HEX]
00 00 10 00 0F 01 04 57 60 4E 99
[0;34m[D BLE_PROTO][fml_ble_protol.c:227]ble config timer start
[0m[0;32m[I BLE_PROTO][fml_ble_protol.c:271]pid: 0, fid: 0, t: 1000, tfrm: 15, plen: 260
[0m[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:2, len:20, data[0]:00
[0m[NET_HEX]
00 00 7B 22 6F 70 22 3A 22 73 65 6E 64 57 69 66 69 43 6F 6E
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:2, len:20, data[0]:00
[0m[NET_HEX]
00 01 66 69 67 22 2C 22 76 65 72 73 69 6F 6E 22 3A 22 31 2E
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:2, len:20, data[0]:00
[0m[NET_HEX]
00 02 30 22 2C 22 64 61 74 61 22 3A 7B 22 70 61 73 73 77 6F
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:2, len:20, data[0]:00
[0m[NET_HEX]
00 03 72 64 22 3A 22 31 39 38 38 31 30 32 35 22 2C 22 65 6E
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:2, len:20, data[0]:00
[0m[NET_HEX]
00 04 63 72 79 70 74 22 3A 22 22 2C 22 43 47 57 22 3A 7B 22
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:2, len:20, data[0]:00
[0m[NET_HEX]
00 05 67 77 41 64 64 72 65 73 73 22 3A 22 63 67 77 2E 6B 6F
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:2, len:20, data[0]:00
[0m[NET_HEX]
00 06 6D 65 63 74 2E 63 6F 6D 3A 35 36 38 33 22 2C 22 67 77
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:2, len:20, data[0]:00
[0m[NET_HEX]
00 07 41 64 64 72 65 73 73 32 22 3A 22 68 74 74 70 73 3A 2F
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:2, len:20, data[0]:00
[0m[NET_HEX]
00 08 2F 63 67 77 2E 6B 6F 6D 65 63 74 2E 63 6F 6D 3A 34 34
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:2, len:20, data[0]:00
[0m[NET_HEX]
00 09 33 22 2C 22 75 73 65 72 5F 6B 65 79 22 3A 22 61 62 66
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:2, len:20, data[0]:00
[0m[NET_HEX]
00 0A 64 63 33 65 36 38 66 32 32 34 36 65 62 61 35 33 34 34
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:2, len:20, data[0]:00
[0m[NET_HEX]
00 0B 63 39 31 30 64 37 35 33 66 32 37 22 7D 2C 22 63 68 61
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:2, len:20, data[0]:00
[0m[NET_HEX]
00 0C 6E 6E 65 6C 22 3A 22 30 22 2C 22 65 78 74 72 61 22 3A
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:2, len:20, data[0]:00
[0m[NET_HEX]
00 0D 7B 7D 2C 22 53 53 49 44 22 3A 22 4C 69 6E 6B 73 79 73
[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 1
[0m[0;34m[D NET][bll_ble_network.c:512]BLE_5_WRITE_EVENT: conn_idx:0, prf_id:0, add_id:2, len:10, data[0]:00
[0m[NET_HEX]
00 0E 30 33 32 36 35 22 7D 7D
[0;34m[D BLE_PROTO][fml_ble_protol.c:237]ble config timer stop
[0m[0;32m[I BLE_PROTO][fml_ble_protol.c:338]do handle a pkg
[0m[0;34m[D BLE_PROTO][fml_ble_protol.c:121]WIFI:
[0m[0;34m[D BLE_PROTO][fml_ble_protol.c:122]wifi.ssid: ******
[0m[0;34m[D BLE_PROTO][fml_ble_protol.c:123]wifi.pass_word: ******
[0m[0;34m[D BLE_PROTO][fml_ble_protol.c:124]wifi.encrypt:
[0m[0;34m[D BLE_PROTO][fml_ble_protol.c:125]wifi.channel: 0
[0m[0;34m[D BLE_PROTO][fml_ble_protol.c:126]CGW:
[0m[0;34m[D BLE_PROTO][fml_ble_protol.c:127]cgw.user_key: abfdc3e68f2246eba5344c910d753f27
[0m[0;34m[D BLE_PROTO][fml_ble_protol.c:128]cgw.gw_address: cgw.******.com:5683
[0m[0;34m[D BLE_PROTO][fml_ble_protol.c:129]cgw.gw_address2: https://cgw.******.com:443
[0mtimer has deleted
[0;32m[I MNG][bll_dev_manage.c:650]dev manage task start
[0m[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 9
[0m[0;34m[D NET][bll_ble_network.c:497]===>> notify complete
[0m[0;34m[D MNG][bll_dev_manage.c:70]wifi connect timer start
[0m[THD]wifi_state_thread_handle:[tcb]40ccb0 [stack]40c8a8-40cca8:1024:6
[sa_sta]MM_RESET_REQ
txdesc flush
[sa_sta]ME_CONFIG_REQ
[sa_sta]ME_CHAN_CONFIG_REQ
[sa_sta]MM_START_REQ
[THD]pskc:[tcb]40d150 [stack]40cd48-40d148:1024:4
PSKCsize: ssid of(wpa_supplicant)=848
******, passphras
mm_add_if_req_handler:0
e ******
hapd_intf_add_vif,type:2, s:0, id:0
wpa_dInit
wpa S: DISCONNECTED -> INACTIVE
wpa S: INACTIVE -> DISCONNECTED
enter low level!
mac bc:fd: c:78:5d:de
leave low level!
[net]addvif_idx:0
wpa_supplicant_req_scan
Setting scan request: 0.000000 sec
wpa_supplicant_scan
wpa S: DISCONNECTED -> SCANNING
wpa_drv_scan
wpa_send_scan_req
no ht in scan
scan_start_req_handler
wpa_driver_scan_start_cb
wpa rx E SCAN_STARTED
temp_code:21 - adc_code:329 - adc_trend:[11]:339->[12]:330
init_xtal:66, delta:3, last_xtal:70
wpa_driver_scan_cb
wpa rx E SCAN_RESULTS
Scan completed in 1.124000 seconds
wpa_get_scan_rst:1
cipher2security 2 2 16 16
cipher2security 2 2 16 16
PSKC: end
cipher2security 2 2 16 16
cipher2security 2 2 16 16
wpa_supplicant_connect
Cancelling scan request
wpa S: SCANNING -> ASSOCIATING
wpa_driver_associate: auth_alg 0x1
found scan rst rssi -43 > -50 0
sta_mgmt_register: mac 6a:db:54:e6:04:93
sm_auth_send:1
sm_auth_handler
in assoc req 40000000 1
sm_assoc_rsp_handler
rc_init: station_id=0 format_mod=0 pre_type=0 short_gi=0 max_bw=0
rc_init: nss_max=0 mcs_max=255 r_idx_min=0 r_idx_max=11 no_samples=10
mm_set_vif_state_req_handler
chan_bcn_detect_start
---------SM_CONNECT_IND_ok, aid 40, bssid 6a:db:54:e6:04:93
wpa rx E ASSOC
wpa S: ASSOCIATING -> ASSOCIATED
Cancelling scan request
new ie: 0 : 4c 69 6e 6b 73 79 73 30 33 32 36 35
new ie: 1 : 2 4 b 16 12 24 48 6c
new ie: 3 : b
new ie: 30 : 1 0 0 f ac 4 1 0 0 f ac 4 1 0 0 f ac 2 0 0
wpa S: ASSOCIATED -> 4WAY_HANDSHAKE
WPA: TK 444180255d6f806dea97eb16c19a8d02
wpa S: 4WAY_HANDSHAKE -> 4WAY_HANDSHAKE
----------------------------------abs2_timeout_reset_agc
__l2_packet_send: send failed
hapd_intf_add_key CCMP
add sta_mgmt_get_sta
sta:0, vif:0, key:0
sta_mgmt_add_key
add hw key idx:24
wpa S: 4WAY_HANDSHAKE -> GROUP_HANDSHAKE
WPA: GTK acb8b537cab6737361912732080ccfc5
hapd_intf_add_key CCMP
add is_broadcast_ether_addr
sta:255, vif:0, key:1
add hw key idx:1
wpa S: GROUP_HANDSHAKE -> COMPLETED
ctrl_port_hdl:1
me_set_ps_disable:906 0 0 0 0 1
dis set ps 1!!
WLAN_EVENT_CONNECTED
sta_ip_start
configuring interface mlan (with DHCP client)
dhcp_check_status_init_timer:20000
writed fci to flash
wpa S: COMPLETED -> 4WAY_HANDSHAKE
wpa S: 4WAY_HANDSHAKE -> GROUP_HANDSHAKE
WPA: GTK acb8b537cab6737361912732080ccfc5
wpa S: GROUP_HANDSHAKE -> COMPLETED
IP up: 192.168.1.153
[0;32m[I MNG][bll_dev_manage.c:321]connect wifi success
[0m[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 9
[0m[0;34m[D NET][bll_ble_network.c:497]===>> notify complete
[0m[0;32m[I MNG][bll_dev_manage.c:460]bootstrap start
[0m[0;34m[D HTTP][fml_http.c:106]post len: 617
[0m[SSL]ssl create session,url:cgw.******.com,port:443
[TLS]mbedtls client struct init success...
[TLS]Loading the CA root certificate success...
[TLS][MBEDTLS]mbedtls_client_context,139
[TLS]mbedtls client context init success...
ssl socket timeout:6s-10sec
[TLS]Connected cgw.******.com:443 success...
[TLS]Certificate verified success...
[0;34m[D HTTP][fml_http.c:118]http send ok
[0m[0;32m[I MNG][bll_dev_manage.c:857]set regist information
[0m[0;34m[D MNG][bll_dev_manage.c:861]reg_info.andlink_token: 5VCkKALqeXWd1ysO
[0m[0;34m[D MNG][bll_dev_manage.c:862]reg_info.device_id: CMCC-590384-BCFD0C785DDE
[0m[0;34m[D MNG][bll_dev_manage.c:863]reg_info.device_token: 80f6c18c61884d11
[0m[0;34m[D MNG][bll_dev_manage.c:864]reg_info.dm_token: KVGF0rNlq85xSFayyAo2EdH8V6m1pEtG3S0L0zYi0XA=
[0m[0;34m[D MNG][bll_dev_manage.c:865]reg_info.gw_token: 14T/qrPZ1CiK8TkN
[0m[0;34m[D MNG][bll_dev_manage.c:866]reg_info.user_id: 280982658
[0m[0;34m[D MNG][bll_dev_manage.c:869]device bootstrap success
[0m[0;34m[D MNG][bll_dev_manage.c:873]FreeHeapSize 84944
[0m[0;34m[D MNG][bll_dev_manage.c:883]FreeHeapSize 87528
[0m[0;32m[I MNG][bll_dev_manage.c:462]bootstrap success
[0m[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 9
[0m[0;34m[D NET][bll_ble_network.c:497]===>> notify complete
[0m[0;32m[I MNG][bll_dev_manage.c:480]boot start
[0m[0;34m[D MNG][bll_dev_manage.c:930]FreeHeapSize 84944
[0m[0;34m[D HTTP][fml_http.c:106]post len: 411
[0m[SSL]ssl create session,url:cgw.******.com,port:443
[TLS]mbedtls client struct init success...
[TLS]Loading the CA root certificate success...
[TLS][MBEDTLS]mbedtls_client_context,139
[TLS]mbedtls client context init success...
ssl socket timeout:6s-10sec
[TLS]Connected cgw.******.com:443 success...
[TLS]Certificate verified success...
[0;34m[D HTTP][fml_http.c:118]http send ok
[0m[0;34m[D MNG][bll_dev_manage.c:1030]FreeHeapSize 84944
[0m[0;32m[I MNG][bll_dev_manage.c:1084]time synchronized 17099639050
[0m[0;32m[I UTC][fml_time.c:104]SET Time: 1709963905, last_time: 0
[0m[0;34m[D MNG][bll_dev_manage.c:1089]mng_info.device_manage_url: https://cgw.******.com/device-manage/device/inform/dmReport
[0;34m[D MNG][bll_dev_manage.c:1090]mng_info.mqtt_url: ssl://cgw.******.com:8883
[0m[0;34m[D MNG][bll_dev_manage.c:1091]mng_info.mqtt_user: deviceOfALC2018
[0m[0;34m[D MNG][bll_dev_manage.c:1092]mng_info.mqtt_pass_word: 4kAVHkSjPNKzX1zE
[0m[0;34m[D MNG][bll_dev_manage.c:1093]mng_info.mqtt_client_id: CMCC-590384-BCFD0C785DDE
[0m[0;34m[D MNG][bll_dev_manage.c:1107]FreeHeapSize 87528
[0m[0;32m[I MNG][bll_dev_manage.c:484]boot success
[0m[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 9
[0m[0;34m[D NET][bll_ble_network.c:497]===>> notify complete
[0m[0;34m[D NET][bll_ble_network.c:130]+++>> ble notice, 9
[0m[0;34m[D NET][bll_ble_network.c:497]===>> notify complete
[0m[0;33m[W MAIN][fml_led.c:113]set LED: 2, 1
[0m[0;34m[D MNG][bll_dev_manage.c:81]wifi connect timer stop
[0msend msg to ble thread exit
ble thread exit
timer has [THD]ble:[tcb]40ce80 [stack]415658-415e58:2048:5
[0;32m[I MQTT][bll_dev_mqtt.c:863]mqtt init start
[0m[0;34m[D MQTT][bll_dev_mqtt.c:864]FreeHeapSize 92008
[0m[THD]mqtt-core:[tcb]40c548 [stack]41a230-41b230:4096:3
[THD]MQTT_recv:[tcb]40c780 [stack]41b238-41b838:1536:6
[THD]MQTT_send:[tcb]40c7e8 [stack]41b840-41c440:3072:6
[0;32m[I MQTT][bll_dev_mqtt.c:900]mqtt session init success
[0m[0;34m[D MQTT][bll_dev_mqtt.c:204]mqtt host: cgw.******.com, port: 8883
[0m[SSL]ssl create session,url:cgw.******.com,port:8883
[TLS]mbedtls client struct init success...
[TLS]Loading the CA root certificate success...
[TLS][MBEDTLS]mbedtls_client_context,139
[TLS]mbedtls client context init success...
ble mac:bc-fd-0c-78-5d-df
xvr_reg_init
h4tl_init-1 ok
hci_init ok
!!!!!!init_type=0
rwble_hl_init ok
BLE Rev: B5-3.0.56-P0
rwble_init ok
rwip_driver_init ok
enter normal mode
EM_BLE_END:0x1b40
69:mqtt_core_handler_thd
deleted
ssl socket timeout:6s-10sec
[TLS]Connected cgw.******.com:8883 success...
[TLS]Certificate verified success...
ssl connect succeed
netport.socket:0
[0;34m[D MQTT][bll_dev_mqtt.c:314]mqtt_client_id: CMCC-590384-BCFD0C785DDE
[0m[0;34m[D MQTT][bll_dev_mqtt.c:315]mqtt_user: deviceOfALC2018
[0m[0;34m[D MQTT][bll_dev_mqtt.c:316]mqtt_pass_word: 4kAVHkSjPNKzX1zE
[0m[0;34m[D MQTT][bll_dev_mqtt.c:317]mqtt_keep_alive: 60
[0mnetport.socket:0
[0;34m[D MQTT][bll_dev_mqtt.c:144]inter mqtt_connect_callback!
[0mSubscribe #0 /device/CMCC-590384-BCFD0C785DDE/downward OK!
[0;34m[D MQTT][bll_dev_mqtt.c:148]inter mqtt_online_callback!
[0m[0;34m[D MNG[0;32m[I MQTT][bll_dev][bll_fota.c:295]check _mqtt.c:529]MQTT send: fota states
[0m[0;32m0, i: 0
[0m[I MQTT][bll_dev_mqtt.c:327]mqtt connect success
[0mpacket_type:4
[0;34m[D MQTT][bll_dev_mqtt.c:181]mqtt nitice event 2
[0m[0;32m[I MQTT][bll_dev_mqtt.c:623]MQTT send ret: 0
[0m[0;34m[D MQTT][bll_dev_mqtt.c:636]FreeHeapSize 56552
[0m[0;32m[I MQTT][bll_dev_mqtt.c:908]mqtt online success
[0m[0;34m[D MQTT][bll_dev_mqtt.c:914]FreeHeapSize 56464
[0m[0;34m[D ELEC][bll_elec_manage.c:246]upload CHECK
[0m[0;34m[D ELEC][bll_elec_manage.c:266]up all, engy: 0.000 Kwh, vol: 0.000 V, cur: 0.000 A, power: 0.000 W
[0m[0;32m[I MQTT][bll_dev_mqtt.c:529]MQTT send: 5, i: 0
[0mlen: [371]
{"data":{"params":[{"paramCode":"power","paramValue":"0.000"},{"paramCode":"volts","paramValue":"0.000"},{"paramCode":"current","paramValue":"0.000"},{"paramCode":"powerConsumption","paramValue":"0.000"}]},"deviceId":"CMCC-590384-BCFD0C785DDE","childDeviceId":"","eventType":"ParamChange","timestamp":1.709963907e+12,"deviceType":"590384","seqId":"DEV_28098265808197294"}
packet_type:4
[0;34m[D MQTT][bll_dev_mqtt.c:181]mqtt nitice event 2
[0m[0;32m[I MQTT][bll_dev_mqtt.c:623]MQTT send ret: 0
[0m[0;34m[D MQTT][bll_dev_mqtt.c:636]FreeHeapSize 56552
[0mtemp_code:24 - adc_code:323 - adc_trend:[12]:330->[13]:321
init_xtal:66, delta:0, last_xtal:69
[0;32m[I MNG][bll_dev_manage.c:523]dmreport start
[0m[0;35m[V MNG][bll_dev_manage.c:1178]dmreport content
[0m[0;34m[D MNG][bll_dev_manage.c:1185]FreeHeapSize 53456
[0m[0;34m[D HTTP][fml_http.c:106]post len: 885
[0m[SSL]ssl create session,url:cgw.******.com,port:443
[TLS]mbedtls client struct init success...
[TLS]Loading the CA root certificate success...
[TLS][MBEDTLS]mbedtls_client_context,139
[TLS]mbedtls client context init success...
ssl socket timeout:6s-10sec
[TLS]Connected cgw.******.com:443 success...
[TLS]Certificate verified success...
[0;34m[D HTTP][fml_http.c:118]http send ok
[0m[0;33m[W MAIN][fml_led.c:113]set LED: 2, 2
[0mtimer has deleted
[0;34m[D MNG][bll_dev_manage.c:1238]FreeHeapSize 53512
[0m[0;34m[D MNG][bll_dev_manage.c:1298]dm report success
[0m[0;34m[D MNG][bll_dev_manage.c:1310]FreeHeapSize 56608
[0m[0;32m[I MNG][bll_dev_manage.c:526]dmreport success
[0m[0;34m[D MNG][bll_dev_manage.c:575]dmreport next, 43611 sec
[0m[0;34m[D MNG][bll_dev_manage.c:182]sync last status, pwCutMemory, signalLight, childrenLock, outletStatus
[0m[0;32m[I MQTT][bll_dev_mqtt.c:529]MQTT send: 3, i: 0
[0mlen: [363]
{"data":{"params":[{"paramCode":"pwCutMemory","paramValue":"1"},{"paramCode":"signalLight","paramValue":"1"},{"paramCode":"childrenLock","paramValue":"0"},{"paramCode":"outletStatus","paramValue":"0"}]},"deviceId":"CMCC-590384-BCFD0C785DDE","childDeviceId":"","eventType":"Inform","timestamp":1.709963908e+12,"deviceType":"590384","seqId":"DEV_28098265879901289"}
packet_type:4
[0;34m[D MQTT][bll_dev_mqtt.c:181]mqtt nitice event 2
[0m[0;32m[I MQTT][bll_dev_mqtt.c:623]MQTT send ret: 0
[0m[0;34m[D MQTT][bll_dev_mqtt.c:636]FreeHeapSize 56592
[0mtimer has stopped
[0;32m[I MNG][bll_fota.c:335]next upgrade check, 1709964501
[0m[0;34m[D ELEC][bll_elec_manage.c:246]upload CHECK
[0mMQTT RECV {"data":{"params":[{"paramCode":"outletStatus","paramValue":"1"}]},"function":"Control","deviceId":"CMCC-590384-BCFD0C785DDE","seqId":"HJQI_17605323062_8d235a37"}
[0;34m[D MPRT][fml_mqtt_protocol.c:115]funcion: Control
[0m[0;34m[D MPRT][fml_mqtt_protocol.c:134]paramCode: outletStatus, paramValue: 1
[0m[0;34m[D MQTT][bll_dev_mqtt.c:748]handle: 0
[0m[0;33m[W MAIN][fml_led.c:113]set LED: 2, 1
[0m[0;32m[I MQTT][bll_dev_mqtt.c:529]MQTT send: 4, i: 0
[0mlen: [210]
{"data":{"params":[{"paramCode":"outletStatus","paramValue":"1"}]},"deviceId":"CMCC-590384-BCFD0C785DDE","childDeviceId":"","eventType":"ParamChange","timestamp":1.709963929e+12,"seqId":"DEV_28098265869987103"}
packet_type:4
[0;34m[D MQTT][bll_dev_mqtt.c:181]mqtt nitice event 2
[0m[0;32m[I MQTT][bll_dev_mqtt.c:623]MQTT send ret: 0
[0m[0;34m[D MQTT][bll_dev_mqtt.c:636]FreeHeapSize 56592
[0mMQTT RECV {"data":{"params":[{"paramCode":"outletStatus","paramValue":"0"}]},"function":"Control","deviceId":"CMCC-590384-BCFD0C785DDE","seqId":"HJQI_17605323062_67007637"}
[0;34m[D MPRT][fml_mqtt_protocol.c:115]funcion: Control
[0m[0;34m[D MPRT][fml_mqtt_protocol.c:134]paramCode: outletStatus, paramValue: 0
[0m[0;34m[D MQTT][bll_dev_mqtt.c:748]handle: 0
[0m[0;33m[W MAIN][fml_led.c:113]set LED: 2, 2
[0m[0;32m[I MQTT][bll_dev_mqtt.c:529]MQTT send: 4, i: 0
[0mlen: [209]
{"data":{"params":[{"paramCode":"outletStatus","paramValue":"0"}]},"deviceId":"CMCC-590384-BCFD0C785DDE","childDeviceId":"","eventType":"ParamChange","timestamp":1.70996393e+12,"seqId":"DEV_28098265830419824"}
packet_type:4
[0;34m[D MQTT][bll_dev_mqtt.c:181]mqtt nitice event 2
[0m[0;32m[I MQTT][bll_dev_mqtt.c:623]MQTT send ret: 0
[0m[0;34m[D MQTT][bll_dev_mqtt.c:636]FreeHeapSize 56592
[0m
I didn't mean UART log of the stock firmware, it's not useful. If it's not Tuya, it's not unusual that it doesn't use AP mode to connect.
We need UART logs after flashing either the UF2 file by ltchiptool or the RBL file by bkflasher. So, choose either of these methods (one that works), flash the file, then dump the flash again. Attach here the UART log after flashing and the resulting dump file after flashing.
@kuba2k2 no uart log by normal flash the uf2 or rbl . So I did some hex trick on the dumped flash bin file (pre-flashed with uf2), I copy the stock firmware bin [0x0~ 0x00011115] to the dumped uf2[0x0 ~ 0x00011115] , and then flash the modified uf2 bin file into bk7231m by bkflasher ,It actually started running!!!!! The hex area is bootloader?? uf2 dump file: ltchiptool_bk72xx_2024-03-09_19-17-01-bk7231m.bin.gz modified uf2 dump file: ltchiptool_bk72xx_2024-03-09_19-17-01-bk7231m-mod.bin.gz
log:
[1;32mI [ 0.000] [0mLibreTiny v1.4.1 on generic-bk7231n-qfn32-tuya, compiled at Mar 8 2024 21:48:43, GCC 10.3.1 (-O1)
[0;32m[I][logger:399]: Log initialized[0m
[0;35m[C][ota:473]: There have been 2 suspected unsuccessful boot attempts.[0m
[0;36m[D][lt.preferences:104]: Saving 1 preferences to flash...[0m
[0;36m[D][lt.preferences:132]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed[0m
[0;32m[I][app:029]: Running through setup()...[0m
[0;35m[C][wifi:038]: Setting up WiFi...[0m
[0;35m[C][wifi:051]: Starting WiFi...[0m
[0;35m[C][wifi:052]: Local聽MAC: C8:47:8C:42:00:48[0m
€[1;32mI [ 0.000] [0mLibreTiny v1.4.1 on generic-bk7231n-qfn32-tuya, compiled at Mar 8 2024 21:48:43, GCC 10.3.1 (-O1)
[0;32m[I][logger:399]: Log initialized[0m
[0;35m[C][ota:473]: There have been 3 suspected unsuccessful boot attempts.[0m
[0;36m[D][lt.preferences:104]: Saving 1 preferences to flash...[0m
[0;36m[D][lt.preferences:132]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed[0m
[0;32m[I][app:029]: Running through setup()...[0m
[0;35m[C][wifi:038]: Setting up WiFi...[0m
[0;35m[C][wifi:051]: Starting WiFi...[0m
[0;35m[C][wifi:052]: Local聽MAC: C8:47:8C:42:00:48[0m
[0;35m[C][wifi:250]: Setting up AP...[0m
[0;35m[C][wifi:252]: AP SSID: 'bk7231m hotspot'[0m
[0;35m[C][wifi:253]: AP Password: '******'[0m
[0;35m[C][wifi:262]: IP Address: 192.168.4.1[0m
[0;36m[D][wifi:455]: Starting scan...[0m
[0;35m[C][web_server:123]: Setting up web server...[0m
[0;35m[C][ota:097]: Over-The-Air Updates:[0m
[0;35m[C][ota:098]: Address: bk7231m.local:8892[0m
[0;33m[W][ota:106]: Last Boot was an unhandled reset, will proceed to safe mode in 7 restarts[0m
[0;35m[C][api:025]: Setting up Home Assistant API server...[0m
[0;32m[I][app:062]: setup() finished successfully![0m
[0;32m[I][app:102]: ESPHome version 2023.12.5 compiled on Mar 8 2024, 21:47:48[0m
[0;35m[C][logger:443]: Logger:[0m
[0;35m[C][logger:444]: Level: DEBUG[0m
[0;35m[C][logger:445]: Log Baud Rate: 115200[0m
[0;35m[C][logger:447]: Hardware UART: UART2[0m
[0;35m[C][captive_portal:088]: Captive Portal:[0m
[0;35m[C][wifi:573]: WiFi:[0m
[0;35m[C][wifi:405]: Local MAC: C8:47:8C:42:00:48[0m
[0;35m[C][wifi:410]: SSID: [5m''[6m[0m
[0;35m[C][wifi:411]: IP Address: 0.0.0.0[0m
[0;35m[C][wifi:412]: BSSID: [5m00:00:00:00:00:00[6m[0m
[0;35m[C][wifi:414]: Hostname: 'bk7231m'[0m
[0;35m[C][wifi:416]: Signal strength: 0 dB [0;32m鈻傗杽鈻嗏枅[0m[0m
[0;35m[C][wifi:420]: Channel: 0[0m
[0;35m[C][wifi:421]: Subnet: 0.0.0.0[0m
[0;35m[C][wifi:422]: Gateway: 0.0.0.0[0m
[0;35m[C][wifi:423]: DNS1: 0.0.0.0[0m
[0;35m[C][wifi:424]: DNS2: 0.0.0.0[0m
[0;35m[C][web_server:168]: Web Server:[0m
[0;35m[C][web_server:169]: Address: bk7231m.local:80[0m
[0;35m[C][mdns:115]: mDNS:[0m
[0;35m[C][mdns:116]: Hostname: bk7231m[0m
[0;35m[C][ota:097]: Over-The-Air Updates:[0m
[0;35m[C][ota:098]: Address: bk7231m.local:8892[0m
[0;33m[W][ota:106]: Last Boot was an unhandled reset, will proceed to safe mode in 7 restarts[0m
[0;35m[C][api:139]: API Server:[0m
[0;35m[C][api:140]: Address: bk7231m.local:6053[0m
[0;35m[C][api:144]: Using noise encryption: NO[0m
[0;35m[C][lt.component:013]: LibreTiny:[0m
[0;35m[C][lt.component:014]: Version: v1.4.1 on generic-bk7231n-qfn32-tuya, compiled at Mar 8 2024 21:47:00, GCC 10.3.1 (-O1)[0m
[0;35m[C][lt.component:015]: Loglevel: 3[0m
[1;33mW [ 181.394] [0mrx timeout 4
[0;32m[I][captive_portal:031]: Captive Portal Requested WiFi Settings Change:[0m
[0;32m[I][captive_portal:032]: SSID='******'[0m
[0;32m[I][captive_portal:033]: Password=[5m'******'[6m[0m
[0;36m[D][lt.preferences:104]: Saving 1 preferences to flash...[0m
[0;36m[D][lt.preferences:132]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed[0m
[0;36m[D][wifi:455]: Starting scan...[0m
[1;33mW [ 185.518] [0mrx timeout 4
[0;33m[W][wifi_lt:286]: Event: Disconnected ssid='' bssid=[5m00:00:00:00:00:00[6m reason='Association Leave'[0m
[1;33mW [ 190.894] [0mack timeout 4
[0;32m[I][captive_portal:031]: Captive Portal Requested WiFi Settings Change:[0m
[0;32m[I][captive_portal:032]: SSID='******'[0m
[0;32m[I][captive_portal:033]: Password=[5m'******'[6m[0m
[0;36m[D][lt.preferences:104]: Saving 1 preferences to flash...[0m
[0;36m[D][lt.preferences:132]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed[0m
[0;36m[D][wifi:455]: Starting scan...[0m
[0;36m[D][wifi:470]: Found networks:[0m
[0;32m[I][wifi:513]: - '******' [5m(6A:DB:54:E6:04:93) [6m[0;32m鈻傗杽鈻嗏枅[0m[0m
[0;36m[D][wifi:515]: Channel: 11[0m
[0;36m[D][wifi:516]: RSSI: -44 dB[0m
[0;36m[D][wifi:518]: - [5m'QQ'[6m [5m(30:A1:FA:14:AA:DC) [6m[0;33m鈻傗杽[0;37m鈻嗏枅[0m[0m
[0;36m[D][wifi:518]: - [5m'chao'[6m [5m(28:77:77:0D:98:5E) [6m[0;33m鈻傗杽[0;37m鈻嗏枅[0m[0m
[0;36m[D][wifi:518]: - [5m'CMCC-S53F'[6m [5m(50:6F:77:D1:4A:8C) [6m[0;33m鈻傗杽[0;37m鈻嗏枅[0m[0m
[0;36m[D][wifi:518]: - [5m'360WiFi-D6E8'[6m [5m(C8:5B:A0:18:D6:E8) [6m[0;33m鈻傗杽[0;37m鈻嗏枅[0m[0m
[0;36m[D][wifi:518]: - [5m'xiaobai'[6m [5m(68:77:24:C8:0C:EB) [6m[0;33m鈻傗杽[0;37m鈻嗏枅[0m[0m
[0;36m[D][wifi:518]: - [5m''[6m [5m(72:77:24:C8:0C:EB) [6m[0;33m鈻傗杽[0;37m鈻嗏枅[0m[0m
[0;36m[D][wifi:518]: - [5m'TP-LINK_4D54'[6m [5m(18:F2:2C:97:4D:54) [6m[0;33m鈻傗杽[0;37m鈻嗏枅[0m[0m
[0;36m[D][wifi:518]: - [5m'skwang'[6m [5m(14:59:C0:87:FC:5F) [6m[0;33m鈻傗杽[0;37m鈻嗏枅[0m[0m
[0;36m[D][wifi:518]: - [5m'TP-LINK_5F85瀛?[6m [5m(78:44:FD:8B:5F:85) [6m[0;33m鈻傗杽[0;37m鈻嗏枅[0m[0m
[0;36m[D][wifi:518]: - [5m'9-1001'[6m [5m(98:00:6A:28:EF:6E) [6m[0;33m鈻傗杽[0;37m鈻嗏枅[0m[0m
[0;36m[D][wifi:518]: - [5m''[6m [5m(44:55:C4:DC:D8:91) [6m[0;33m鈻傗杽[0;37m鈻嗏枅[0m[0m
[0;36m[D][wifi:518]: - [5m'@PHICOMM_E1'[6m [5m(76:7D:24:92:83:E3) [6m[0;33m鈻傗杽[0;37m鈻嗏枅[0m[0m
[0;36m[D][wifi:518]: - [5m''[6m [5m(A6:A9:30:A0:92:AA) [6m[0;33m鈻傗杽[0;37m鈻嗏枅[0m[0m
[0;36m[D][wifi:518]: - [5m'Jiang'[6m [5m(34:F7:16:E5:3F:98) [6m[0;33m鈻傗杽[0;37m鈻嗏枅[0m[0m
[0;36m[D][wifi:518]: - [5m'CU_XDDY'[6m [5m(E0:A1:CE:0D:D2:98) [6m[0;33m鈻傗杽[0;37m鈻嗏枅[0m[0m
[0;36m[D][wifi:518]: - [5m'ChinaNet-R5xz'[6m [5m(C0:B1:01:89:00:78) [6m[0;31m鈻?[0;37m鈻勨枂鈻?[0m[0m
[0;32m[I][wifi:300]: WiFi Connecting to '******'...[0m
[0;33m[W][component:214]: Component wifi took a long time for an operation (0.16 s).[0m
[0;33m[W][component:215]: Components should block for at most 20-30ms.[0m
[0;32m[I][wifi:587]: WiFi Connected![0m
[0;35m[C][wifi:405]: Local MAC: C8:47:8C:42:00:48[0m
[0;35m[C][wifi:410]: SSID: [5m'******'[6m[0m
[0;35m[C][wifi:411]: IP Address: 192.168.1.125[0m
[0;35m[C][wifi:412]: BSSID: [5m6A:DB:54:E6:04:93[6m[0m
[0;35m[C][wifi:414]: Hostname: 'bk7231m'[0m
[0;35m[C][wifi:416]: Signal strength: -42 dB [0;32m鈻傗杽鈻嗏枅[0m[0m
[0;35m[C][wifi:420]: Channel: 11[0m
[0;35m[C][wifi:421]: Subnet: 255.255.255.0[0m
[0;35m[C][wifi:422]: Gateway: 192.168.1.1[0m
[0;35m[C][wifi:423]: DNS1: 192.168.1.1[0m
[0;35m[C][wifi:424]: DNS2: 192.168.1.1[0m
[0;36m[D][wifi:596]: Disabling AP...[0m
[0;33m[W][component:214]: Component wifi took a long time for an operation (0.06 s).[0m
[0;33m[W][component:215]: Components should block for at most 20-30ms.[0m
[0;32m[I][ota:117]: Boot seems successful, resetting boot loop counter.[0m
[0;36m[D][lt.preferences:104]: Saving 1 preferences to flash...[0m
[0;36m[D][lt.preferences:132]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed[0m
Interesting, the UF2 file doesn't modify the bootloader area. Have you been flashing OpenBeken QIO binary in the meantime? The QIO contains an encrypted bootloader, which will not work on your device and will prevent any firmware from running, unless you reflash the stock bin file.
Also, can you attach a screenshot of "Read chip info" from ltchiptool? This might help troubleshoot the CRC errors you were getting.
@kuba2k2
Have you been flashing OpenBeken QIO binary in the meantime?
OpenBeken QIO binary do not work,same as uf2 binary, no wifi/no ap/no uart log I always flash back to stock firmware ,then flash the new 3rd party firmware
I use ltchiptool to flash back to stock firmware(ps:the name of stockfirmware in the picture has been renamed,it is not the OpenBeken QIO binary) ,it tell me the chip is Realtek.... so I can only use bkflasher to flash stock firmware.
I'm not sure if those hex tricks have bugs, because I saw some errors from the esphome logs,like:
�[0;35m[C][wifi:411]: IP Address: 0.0.0.0�[0m
�[0;35m[C][wifi:412]: BSSID: �[5m00:00:00:00:00:00�[6m�[0m
�[0;35m[C][wifi:414]: Hostname: 'bk7231m'�[0m
�[0;35m[C][wifi:416]: Signal strength: 0 dB �[0;32m鈻傗杽鈻嗏枅�[0m�[0m
�[0;35m[C][wifi:420]: Channel: 0�[0m
�[0;35m[C][wifi:421]: Subnet: 0.0.0.0�[0m
�[0;35m[C][wifi:422]: Gateway: 0.0.0.0�[0m
�[0;35m[C][wifi:423]: DNS1: 0.0.0.0�[0m
�[0;35m[C][wifi:424]: DNS2: 0.0.0.0�[0m
There have been 2 suspected unsuccessful boot attempts
Last Boot was an unhandled reset, will proceed to safe mode in 7 restarts
You should be able to flash the .bin file by ltchiptool if you uncheck the "auto detect" box and clear the start address, skip offset and writing length boxes. Also set the chip family to BK72xx.
That being said, because your chip is unrecognized, it will fail all CRC checks because BK7231N does this differently. There is a pending update of bk7231tools that addresses this issue.
@kuba2k2
You should be able to flash the .bin file by ltchiptool if you uncheck the "auto detect" box and clear the start address, skip offset and writing length boxes. Also set the chip family to BK72xx.
I just use ltchiptool to flash back to stock firmware ,process 100%,get crc error,but the stock firmware can work normally.May be the way of crc different between ltchiptool and bkflasher,this stock firmware was dumped by bkflasher, I think this crc error does not matter.
@kuba2k2 After re-flashed a new device with bk7231m, I think my previous description about flashing was wrong. I should re-describe about it: 1.At the beginning, I use ltchiptool to flash .uf2 into bk7231m,but always get an CRC error. 2.Then, I use bkflasher to flash OpenBK7231N_QIO.bin into it , flash successfully ,but it can not work. 3.After then,I use ltchiptool to flash .uf2, flash successfully without CRC error. it can not work,either. 4.In step 3, I notice that ltchiptool flash .uf2 starting from 0x011000, so I think the hex data before 0x011000 should be bootloader,then I dump the flash of bk7231m by bkflasher. 5.I copy the bootloader of stock firmware (0x0~0x010FFF) to the same area of dumped binary file. 6.At last,I flash this strange combination binary file into bk7231m.Out of my expectation,all components work well, including wifi,ap,dhcp,uartlog,webserver,ota,etc.. 7.The only issue is that all mac addresses of bk7231m are the same after flashed. I solved it by using bkflasher(Restore RF) to generate a new random mac address.
In step 2, where you flashed OpenBeken QIO - that's the mistake. OpenBeken's files currently will not work with your device. Doing that, you overwrite the bootloader (0x0-0x11000) with the wrong one, which makes your device fail to boot.
ad. 7.: your device might be using a different RF partition address. BkFlasher's "Restore RF" function might indeed generate a random MAC address, however it will NOT write the correct Wi-Fi calibration data. You might get reduced Wi-Fi range and/or performance, or other issues.
The correct solution would be to update ESPHome/LibreTiny's partition layout:
esphome:
name: my-device
platformio_options:
board_build.bkcrypt_coeffs: 00000000000000000000000000000000
board_build.bkota.key: 0123456789ABCDEF0123456789ABCDEF
board_build.bkota.iv: 0123456789ABCDEF
board_flash.download: "0x132000+0xA6000"
board_flash.kvs: "0x1D8000+0x8000"
board_flash.calibration: "0x1E0000+0x1000"
board_flash.tlv: "0x1E1000+0x1000"
board_flash.net: "0x1E2000+0x1000"
board_flash.userdata: "0x1E3000+0x1D000"
(taken from BK7231T default partition layout, offsets match your device)
If that doesn't work, restore the stock firmware and try again.
@kuba2k2 Should I modify the board_flash.app? I found there are some data before 0x132000 in the stock firmware binary file.
No, this is part of the app partition. This is the RBL header, it's not even important for running the app. You don't need to change the app partition.
@kuba2k2 it always get a CRC error when flash the uf2 file with ltchiptool, so I copy all data of bk7231m-1-0x011000.rbl to the stock firmware(2M),and then flash this new 2Mb file to the bk7231m. I just tried this method: ap work ok, but it can not scan wifi.
UART LOG : local mac address is correct,but wifi scan timeout.
[1;32mI [ 0.000] [0mLibreTiny v1.4.1 on generic-bk7231n-qfn32-tuya, compiled at Mar 12 2024 02:00:25, GCC 10.3.1 (-O1)
[0;32m[I][logger:399]: Log initialized[0m
[0;35m[C][status_led:014]: Setting up Status LED...[0m
[0;35m[C][ota:473]: There have been 0 suspected unsuccessful boot attempts.[0m
[0;36m[D][lt.preferences:104]: Saving 1 preferences to flash...[0m
[0;36m[D][lt.preferences:132]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed[0m
[0;32m[I][app:029]: Running through setup()...[0m
[0;35m[C][switch.gpio:011]: Setting up GPIO Switch 'Relay 1'...[0m
[0;36m[D][switch:016]: 'Relay 1' Turning OFF.[0m
[0;36m[D][switch:055]: 'Relay 1': Sending state OFF[0m
[0;36m[D][light:036]: 'id_light_relay' Setting:[0m
[0;36m[D][light:041]: Color mode: [0m
[0;36m[D][switch:016]: 'Relay 1' Turning OFF.[0m
[0;36m[D][binary_sensor:034]: 'binary_switch': Sending initial state OFF[0m
[0;35m[C][light:035]: Setting up light 'id_light_relay'...[0m
[0;36m[D][light:036]: 'id_light_relay' Setting:[0m
[0;35m[C][hlw8012:014]: Setting up HLW8012...[0m
[0;35m[C][wifi:038]: Setting up WiFi...[0m
[0;35m[C][wifi:051]: Starting WiFi...[0m
[0;35m[C][wifi:052]: Local聽MAC: BC:FD:0C:78:77:8C[0m
[0;35m[C][wifi:250]: Setting up AP...[0m
[0;35m[C][wifi:252]: AP SSID: 'bk7231m-1'[0m
[0;35m[C][wifi:253]: AP Password: ''[0m
[0;35m[C][wifi:262]: IP Address: 192.168.4.1[0m
[0;36m[D][wifi:455]: Starting scan...[0m
[0;35m[C][web_server:123]: Setting up web server...[0m
[0;35m[C][ota:097]: Over-The-Air Updates:[0m
[0;35m[C][ota:098]: Address: bk7231m-1.local:8892[0m
[0;35m[C][api:025]: Setting up Home Assistant API server...[0m
[0;32m[I][app:062]: setup() finished successfully![0m
[0;36m[D][sensor:093]: 'Uptime': Sending state 0.44000 s with 0 decimals of accuracy[0m
[0;36m[D][sensor:093]: 'Heap Free': Sending state 25240.00000 B with 0 decimals of accuracy[0m
[0;36m[D][sensor:093]: 'Heap Max Block': Sending state 0.00000 B with 0 decimals of accuracy[0m
[0;32m[I][app:102]: ESPHome version 2023.12.5 compiled on Mar 12 2024, 01:59:52[0m
[0;35m[C][logger:443]: Logger:[0m
[0;35m[C][logger:444]: Level: DEBUG[0m
[0;35m[C][logger:445]: Log Baud Rate: 115200[0m
[0;35m[C][logger:447]: Hardware UART: UART2[0m
[0;35m[C][status_led:019]: Status LED:[0m
[0;35m[C][status_led:020]: Pin: 11[0m
[0;35m[C][gpio.output:010]: GPIO Binary Output:[0m
[0;35m[C][gpio.output:011]: Pin: 10[0m
[0;35m[C][switch.gpio:068]: GPIO Switch 'Relay 1'[0m
[0;35m[C][switch.gpio:090]: Restore Mode: always OFF[0m
[0;35m[C][switch.gpio:031]: Pin: 8[0m
[0;35m[C][uptime.sensor:031]: Uptime Sensor 'Uptime'[0m
[0;35m[C][uptime.sensor:031]: Device Class: 'duration'[0m
[0;35m[C][uptime.sensor:031]: State Class: 'total_increasing'[0m
[0;35m[C][uptime.sensor:031]: Unit of Measurement: 's'[0m
[0;35m[C][uptime.sensor:031]: Accuracy Decimals: 0[0m
[0;35m[C][uptime.sensor:031]: Icon: 'mdi:timer-outline'[0m
[0;35m[C][gpio.binary_sensor:015]: GPIO Binary Sensor 'binary_switch'[0m
[0;35m[C][gpio.binary_sensor:016]: Pin: 24[0m
[0;35m[C][light:103]: Light 'id_light_relay'[0m
[0;35m[C][restart:068]: Restart Switch 'Restart Switch'[0m
[0;35m[C][restart:070]: Icon: 'mdi:restart'[0m
[0;35m[C][restart:090]: Restore Mode: always OFF[0m
[0;35m[C][hlw8012:037]: HLW8012:[0m
[0;35m[C][hlw8012:038]: SEL Pin: 26[0m
[0;35m[C][hlw8012:039]: CF Pin: 6[0m
[0;35m[C][hlw8012:040]: CF1 Pin: 7[0m
[0;35m[C][hlw8012:041]: Change measurement mode every 8[0m
[0;35m[C][hlw8012:042]: Current resistor: 1.0 m鈩?[0m
[0;35m[C][hlw8012:043]: Voltage Divider: 800.0[0m
[0;35m[C][hlw8012:044]: Update Interval: 5.0s[0m
[0;35m[C][hlw8012:045]: Voltage 'BL0937 Voltage'[0m
[0;35m[C][hlw8012:045]: Device Class: 'voltage'[0m
[0;35m[C][hlw8012:045]: State Class: 'measurement'[0m
[0;35m[C][hlw8012:045]: Unit of Measurement: 'V'[0m
[0;35m[C][hlw8012:045]: Accuracy Decimals: 1[0m
[0;35m[C][hlw8012:046]: Current 'BL0937 Current'[0m
[0;35m[C][hlw8012:046]: Device Class: 'current'[0m
[0;35m[C][hlw8012:046]: State Class: 'measurement'[0m
[0;35m[C][hlw8012:046]: Unit of Measurement: 'A'[0m
[0;35m[C][hlw8012:046]: Accuracy Decimals: 2[0m
[0;35m[C][hlw8012:047]: Power 'BL0937 Power'[0m
[0;35m[C][hlw8012:047]: Device Class: 'power'[0m
[0;35m[C][hlw8012:047]: State Class: 'measurement'[0m
[0;35m[C][hlw8012:047]: Unit of Measurement: 'W'[0m
[0;35m[C][hlw8012:047]: Accuracy Decimals: 1[0m
[0;35m[C][hlw8012:048]: Energy 'BL0937 Energy'[0m
[0;35m[C][hlw8012:048]: Device Class: 'energy'[0m
[0;35m[C][hlw8012:048]: State Class: 'total_increasing'[0m
[0;35m[C][hlw8012:048]: Unit of Measurement: 'Wh'[0m
[0;35m[C][hlw8012:048]: Accuracy Decimals: 1[0m
[0;35m[C][captive_portal:088]: Captive Portal:[0m
[0;35m[C][wifi:573]: WiFi:[0m
[0;35m[C][wifi:405]: Local MAC: BC:FD:0C:78:77:8C[0m
[0;35m[C][wifi:410]: SSID: [5m''[6m[0m
[0;35m[C][wifi:411]: IP Address: 0.0.0.0[0m
[0;35m[C][wifi:412]: BSSID: [5m00:00:00:00:00:00[6m[0m
[0;35m[C][wifi:414]: Hostname: 'bk7231m-1'[0m
[0;35m[C][wifi:416]: Signal strength: 0 dB [0;32m鈻傗杽鈻嗏枅[0m[0m
[0;35m[C][wifi:420]: Channel: 0[0m
[0;35m[C][wifi:421]: Subnet: 0.0.0.0[0m
[0;35m[C][wifi:422]: Gateway: 0.0.0.0[0m
[0;35m[C][wifi:423]: DNS1: 0.0.0.0[0m
[0;35m[C][wifi:424]: DNS2: 0.0.0.0[0m
[0;35m[C][web_server:168]: Web Server:[0m
[0;35m[C][web_server:169]: Address: bk7231m-1.local:80[0m
[0;35m[C][mdns:115]: mDNS:[0m
[0;35m[C][mdns:116]: Hostname: bk7231m-1[0m
[0;35m[C][ota:097]: Over-The-Air Updates:[0m
[0;35m[C][ota:098]: Address: bk7231m-1.local:8892[0m
[0;35m[C][api:139]: API Server:[0m
[0;35m[C][api:140]: Address: bk7231m-1.local:6053[0m
[0;35m[C][api:144]: Using noise encryption: NO[0m
[0;35m[C][lt.component:013]: LibreTiny:[0m
[0;35m[C][lt.component:014]: Version: v1.4.1 on generic-bk7231n-qfn32-tuya, compiled at Mar 12 2024 01:58:58, GCC 10.3.1 (-O1)[0m
[0;35m[C][lt.component:015]: Loglevel: 3[0m
[0;36m[D][text_sensor:064]: 'LibreTiny Version': Sending state 'v1.4.1 on generic-bk7231n-qfn32-tuya, compiled at Mar 12 2024 01:58:58, GCC 10.3.1 (-O1)'[0m
[0;35m[C][debug:064]: Debug component:[0m
[0;35m[C][debug:066]: Device info 'Device Info'[0m
[0;35m[C][debug:066]: Icon: 'mdi:chip'[0m
[0;35m[C][debug:069]: Free space on heap 'Heap Free'[0m
[0;35m[C][debug:069]: State Class: ''[0m
[0;35m[C][debug:069]: Unit of Measurement: 'B'[0m
[0;35m[C][debug:069]: Accuracy Decimals: 0[0m
[0;35m[C][debug:069]: Icon: 'mdi:counter'[0m
[0;35m[C][debug:070]: Largest free heap block 'Heap Max Block'[0m
[0;35m[C][debug:070]: State Class: ''[0m
[0;35m[C][debug:070]: Unit of Measurement: 'B'[0m
[0;35m[C][debug:070]: Accuracy Decimals: 0[0m
[0;35m[C][debug:070]: Icon: 'mdi:counter'[0m
[0;36m[D][debug:076]: ESPHome version 2023.12.5[0m
[0;36m[D][debug:080]: Free Heap Size: 14744 bytes[0m
[0;36m[D][debug:356]: LibreTiny Version: 1.4.1[0m
[0;36m[D][debug:357]: Chip: BK7231N (7b1c) @ 120 MHz[0m
[0;36m[D][debug:358]: Chip ID: 0x8C7778[0m
[0;36m[D][debug:359]: Board: generic-bk7231n-qfn32-tuya[0m
[0;36m[D][debug:360]: Flash: 2048 KiB / RAM: 256 KiB[0m
[0;36m[D][debug:361]: Reset Reason: Power-On[0m
[0;36m[D][text_sensor:064]: 'Device Info': Sending state '2023.12.5|Version: v1.4.1 on generic-bk7231n-qfn32-tuya, compiled at Mar 12 2024 01:58:53, GCC 10.3.1 (-O1)|Reset Reason: Power-On|Chip Name: BK7231N|Chip ID: 0x008c7778|Flash: 2048 KiB|RAM: 256 KiB'[0m
[0;36m[D][text_sensor:064]: 'Reset Reason': Sending state 'Power-On'[0m
[1;32mI [ 0.000] [0mLibreTiny v1.4.1 on generic-bk7231n-qfn32-tuya, compiled at Mar 12 2024 02:00:25, GCC 10.3.1 (-O1)
[0;32m[I][logger:399]: Log initialized[0m
[0;35m[C][status_led:014]: Setting up Status LED...[0m
[0;35m[C][ota:473]: There have been 1 suspected unsuccessful boot attempts.[0m
[0;36m[D][lt.preferences:104]: Saving 1 preferences to flash...[0m
[0;36m[D][lt.preferences:132]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed[0m
[0;32m[I][app:029]: Running through setup()...[0m
[0;35m[C][switch.gpio:011]: Setting up GPIO Switch 'Relay 1'...[0m
[0;36m[D][switch:016]: 'Relay 1' Turning OFF.[0m
[0;36m[D][switch:055]: 'Relay 1': Sending state OFF[0m
[0;36m[D][light:036]: 'id_light_relay' Setting:[0m
[0;36m[D][light:041]: Color mode: [0m
[0;36m[D][switch:016]: 'Relay 1' Turning OFF.[0m
[0;36m[D][binary_sensor:034]: 'binary_switch': Sending initial state OFF[0m
[0;35m[C][light:035]: Setting up light 'id_light_relay'...[0m
[0;36m[D][light:036]: 'id_light_relay' Setting:[0m
[0;35m[C][hlw8012:014]: Setting up HLW8012...[0m
[0;35m[C][wifi:038]: Setting up WiFi...[0m
[0;35m[C][wifi:051]: Starting WiFi...[0m
[0;35m[C][wifi:052]: Local聽MAC: BC:FD:0C:78:77:8C[0m
[0;35m[C][wifi:250]: Setting up AP...[0m
[0;35m[C][wifi:252]: AP SSID: 'bk7231m-1'[0m
[0;35m[C][wifi:253]: AP Password: ''[0m
[0;35m[C][wifi:262]: IP Address: 192.168.4.1[0m
[0;36m[D][wifi:455]: Starting scan...[0m
[0;35m[C][web_server:123]: Setting up web server...[0m
[0;35m[C][ota:097]: Over-The-Air Updates:[0m
[0;35m[C][ota:098]: Address: bk7231m-1.local:8892[0m
[0;35m[C][api:025]: Setting up Home Assistant API server...[0m
[0;32m[I][app:062]: setup() finished successfully![0m
[0;36m[D][sensor:093]: 'Uptime': Sending state 0.44000 s with 0 decimals of accuracy[0m
[0;36m[D][sensor:093]: 'Heap Free': Sending state 25224.00000 B with 0 decimals of accuracy[0m
[0;36m[D][sensor:093]: 'Heap Max Block': Sending state 0.00000 B with 0 decimals of accuracy[0m
[0;32m[I][app:102]: ESPHome version 2023.12.5 compiled on Mar 12 2024, 01:59:52[0m
[0;35m[C][logger:443]: Logger:[0m
[0;35m[C][logger:444]: Level: DEBUG[0m
[0;35m[C][logger:445]: Log Baud Rate: 115200[0m
[0;35m[C][logger:447]: Hardware UART: UART2[0m
[0;35m[C][status_led:019]: Status LED:[0m
[0;35m[C][status_led:020]: Pin: 11[0m
[0;35m[C][gpio.output:010]: GPIO Binary Output:[0m
[0;35m[C][gpio.output:011]: Pin: 10[0m
[0;35m[C][switch.gpio:068]: GPIO Switch 'Relay 1'[0m
[0;35m[C][switch.gpio:090]: Restore Mode: always OFF[0m
[0;35m[C][switch.gpio:031]: Pin: 8[0m
[0;35m[C][uptime.sensor:031]: Uptime Sensor 'Uptime'[0m
[0;35m[C][uptime.sensor:031]: Device Class: 'duration'[0m
[0;35m[C][uptime.sensor:031]: State Class: 'total_increasing'[0m
[0;35m[C][uptime.sensor:031]: Unit of Measurement: 's'[0m
[0;35m[C][uptime.sensor:031]: Accuracy Decimals: 0[0m
[0;35m[C][uptime.sensor:031]: Icon: 'mdi:timer-outline'[0m
[0;35m[C][gpio.binary_sensor:015]: GPIO Binary Sensor 'binary_switch'[0m
[0;35m[C][gpio.binary_sensor:016]: Pin: 24[0m
[0;35m[C][light:103]: Light 'id_light_relay'[0m
[0;35m[C][restart:068]: Restart Switch 'Restart Switch'[0m
[0;35m[C][restart:070]: Icon: 'mdi:restart'[0m
[0;35m[C][restart:090]: Restore Mode: always OFF[0m
[0;35m[C][hlw8012:037]: HLW8012:[0m
[0;35m[C][hlw8012:038]: SEL Pin: 26[0m
[0;35m[C][hlw8012:039]: CF Pin: 6[0m
[0;35m[C][hlw8012:040]: CF1 Pin: 7[0m
[0;35m[C][hlw8012:041]: Change measurement mode every 8[0m
[0;35m[C][hlw8012:042]: Current resistor: 1.0 m鈩?[0m
[0;35m[C][hlw8012:043]: Voltage Divider: 800.0[0m
[0;35m[C][hlw8012:044]: Update Interval: 5.0s[0m
[0;35m[C][hlw8012:045]: Voltage 'BL0937 Voltage'[0m
[0;35m[C][hlw8012:045]: Device Class: 'voltage'[0m
[0;35m[C][hlw8012:045]: State Class: 'measurement'[0m
[0;35m[C][hlw8012:045]: Unit of Measurement: 'V'[0m
[0;35m[C][hlw8012:045]: Accuracy Decimals: 1[0m
[0;35m[C][hlw8012:046]: Current 'BL0937 Current'[0m
[0;35m[C][hlw8012:046]: Device Class: 'current'[0m
[0;35m[C][hlw8012:046]: State Class: 'measurement'[0m
[0;35m[C][hlw8012:046]: Unit of Measurement: 'A'[0m
[0;35m[C][hlw8012:046]: Accuracy Decimals: 2[0m
[0;35m[C][hlw8012:047]: Power 'BL0937 Power'[0m
[0;35m[C][hlw8012:047]: Device Class: 'power'[0m
[0;35m[C][hlw8012:047]: State Class: 'measurement'[0m
[0;35m[C][hlw8012:047]: Unit of Measurement: 'W'[0m
[0;35m[C][hlw8012:047]: Accuracy Decimals: 1[0m
[0;35m[C][hlw8012:048]: Energy 'BL0937 Energy'[0m
[0;35m[C][hlw8012:048]: Device Class: 'energy'[0m
[0;35m[C][hlw8012:048]: State Class: 'total_increasing'[0m
[0;35m[C][hlw8012:048]: Unit of Measurement: 'Wh'[0m
[0;35m[C][hlw8012:048]: Accuracy Decimals: 1[0m
[0;35m[C][captive_portal:088]: Captive Portal:[0m
[0;35m[C][wifi:573]: WiFi:[0m
[0;35m[C][wifi:405]: Local MAC: BC:FD:0C:78:77:8C[0m
[0;35m[C][wifi:410]: SSID: [5m''[6m[0m
[0;35m[C][wifi:411]: IP Address: 0.0.0.0[0m
[0;35m[C][wifi:412]: BSSID: [5m00:00:00:00:00:00[6m[0m
[0;35m[C][wifi:414]: Hostname: 'bk7231m-1'[0m
[0;35m[C][wifi:416]: Signal strength: 0 dB [0;32m鈻傗杽鈻嗏枅[0m[0m
[0;35m[C][wifi:420]: Channel: 0[0m
[0;35m[C][wifi:421]: Subnet: 0.0.0.0[0m
[0;35m[C][wifi:422]: Gateway: 0.0.0.0[0m
[0;35m[C][wifi:423]: DNS1: 0.0.0.0[0m
[0;35m[C][wifi:424]: DNS2: 0.0.0.0[0m
[0;35m[C][web_server:168]: Web Server:[0m
[0;35m[C][web_server:169]: Address: bk7231m-1.local:80[0m
[0;35m[C][mdns:115]: mDNS:[0m
[0;35m[C][mdns:116]: Hostname: bk7231m-1[0m
[0;35m[C][ota:097]: Over-The-Air Updates:[0m
[0;35m[C][ota:098]: Address: bk7231m-1.local:8892[0m
[0;35m[C][api:139]: API Server:[0m
[0;35m[C][api:140]: Address: bk7231m-1.local:6053[0m
[0;35m[C][api:144]: Using noise encryption: NO[0m
[0;35m[C][lt.component:013]: LibreTiny:[0m
[0;35m[C][lt.component:014]: Version: v1.4.1 on generic-bk7231n-qfn32-tuya, compiled at Mar 12 2024 01:58:58, GCC 10.3.1 (-O1)[0m
[0;35m[C][lt.component:015]: Loglevel: 3[0m
[0;36m[D][text_sensor:064]: 'LibreTiny Version': Sending state 'v1.4.1 on generic-bk7231n-qfn32-tuya, compiled at Mar 12 2024 01:58:58, GCC 10.3.1 (-O1)'[0m
[0;35m[C][debug:064]: Debug component:[0m
[0;35m[C][debug:066]: Device info 'Device Info'[0m
[0;35m[C][debug:066]: Icon: 'mdi:chip'[0m
[0;35m[C][debug:069]: Free space on heap 'Heap Free'[0m
[0;35m[C][debug:069]: State Class: ''[0m
[0;35m[C][debug:069]: Unit of Measurement: 'B'[0m
[0;35m[C][debug:069]: Accuracy Decimals: 0[0m
[0;35m[C][debug:069]: Icon: 'mdi:counter'[0m
[0;35m[C][debug:070]: Largest free heap block 'Heap Max Block'[0m
[0;35m[C][debug:070]: State Class: ''[0m
[0;35m[C][debug:070]: Unit of Measurement: 'B'[0m
[0;35m[C][debug:070]: Accuracy Decimals: 0[0m
[0;35m[C][debug:070]: Icon: 'mdi:counter'[0m
[0;36m[D][debug:076]: ESPHome version 2023.12.5[0m
[0;36m[D][debug:080]: Free Heap Size: 16464 bytes[0m
[0;36m[D][debug:356]: LibreTiny Version: 1.4.1[0m
[0;36m[D][debug:357]: Chip: BK7231N (7b1c) @ 120 MHz[0m
[0;36m[D][debug:358]: Chip ID: 0x8C7778[0m
[0;36m[D][debug:359]: Board: generic-bk7231n-qfn32-tuya[0m
[0;36m[D][debug:360]: Flash: 2048 KiB / RAM: 256 KiB[0m
[0;36m[D][debug:361]: Reset Reason: WDT Reset[0m
[0;36m[D][text_sensor:064]: 'Device Info': Sending state '2023.12.5|Version: v1.4.1 on generic-bk7231n-qfn32-tuya, compiled at Mar 12 2024 01:58:53, GCC 10.3.1 (-O1)|Reset Reason: WDT Reset|Chip Name: BK7231N|Chip ID: 0x008c7778|Flash: 2048 KiB|RAM: 256 KiB'[0m
[0;32m[I][captive_portal:031]: Captive Portal Requested WiFi Settings Change:[0m
[0;32m[I][captive_portal:032]: SSID='Linksys03265'[0m
[0;32m[I][captive_portal:033]: Password=[5m'12345678'[6m[0m
[0;36m[D][lt.preferences:104]: Saving 1 preferences to flash...[0m
[0;36m[D][lt.preferences:132]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed[0m
[0;36m[D][wifi:455]: Starting scan...[0m
[1;33mW [ 41.462] [0mWIFI: Scan timeout, discarding
[1;31m[E][wifi:463]: Scan timeout![0m
[0;36m[D][wifi:455]: Starting scan...[0m
[1;33mW [ 76.490] [0mWIFI: Scan timeout, discarding
[0;33m[W][component:214]: Component wifi took a long time for an operation (5.00 s).[0m
[0;33m[W][component:215]: Components should block for at most 20-30ms.[0m
@shzlww are you able to test this BK7231M with the latest version of ltchiptool? In particular, I'm curious if the flashing succeeds now, as well as the "Chip ID" from "Read chip info". I'd appreciate a screenshot of the chip info dialog.
@kuba2k2 1.screenshot of the chip info.
2.The stock firmware plug ,Flash uf2 success,no CRC error.Here is the yaml
esphome:
name: bk7231m-1
name_add_mac_suffix: false
platformio_options:
board_build.bkcrypt_coeffs: "00000000000000000000000000000000"
board_build.bkota.key: "0123456789ABCDEF0123456789ABCDEF"
board_build.bkota.iv: "0123456789ABCDEF"
board_flash.download: "0x132000+0xA6000"
board_flash.kvs: "0x1D8000+0x8000"
board_flash.calibration: "0x1E0000+0x1000"
board_flash.tlv: "0x1E1000+0x1000"
board_flash.net: "0x1E2000+0x1000"
board_flash.userdata: "0x1E3000+0x1D000"
bk72xx:
board: generic-bk7231n-qfn32-tuya
logger:
web_server:
captive_portal:
mdns:
api:
reboot_timeout: 0s
ota:
wifi:
reboot_timeout: 0s
ap:
3.It can launch ap hotspot ,but no wifi results found in 192.168.4.1 bk7231m-uart.log update: After short circuit the CEN and GND, wifi scan normally,but can not connect. bk7231m-uart-2.log
有没有后续了?
The pcb design in the photo looks very much like the Arlec PC191HA Series 2 Smart plug with energy monitoring, which is sold by Bunnings in Australia (yours I am guessing is probably a different brand etc, and the Arlec ones have tuya on them, however...).
Your board layout looks familiar, plus the symptoms of flashing are also similar, in that folks with the PC191HA plugs often find that the flashing appears to go through OK, but then the device still boots up with the old firmware. This is happening even after the initial flash to esphome/libretiny using cloudcutter, and on subsequent OTA flashes.
What someone else discovered and I've found works reliably is that after successfully flashing, you need to remove power from the device, then hold down the button while applying power again (then releasing). This seems to cause the unit to take a while longer to boot, during which time it appears to apply the new firmware image.
I don't know if perhaps it's keeping separate firmware partitions or something, but it seems that without the button held down during power-on it's quite random as to whether the new firmware just flashed will "stick".
I don't know if this will actually relate to your issues since your device is definitely different in some ways, but given the board layout similarity it might be worth trying that procedure to see if it improves things for you.
Describe the bug I have a smart plug(not Tuya version) with cb2s module ,but the module is using a BK7231M. I try to flash it with ltchiptool,but i get CRC error at 28%, never success,then I try to flash it with bk7231flasher of OpenBeken, When selecting BK7231N, the Module would flash just fine, but when power cycling it, it would not boot and the AP would not come up.
So, Could BK7231M be support by libretiny?
Screenshots
Additional context Original firmware dump by bk7231flasher_1.1.6 readResult_BK7231N_QIO_2024-02-3-18-21-04.bin.gz
logs from bk7231flasher_1.1.6: