logo elektroda
logo elektroda
X

NiceMCU XH-WB3S BK7238 Flashing, Testing, Pinout, Development, Porting

divadiow 11967 339
ADVERTISEMENT
  • #241 21641874
    insmod
    Level 29  
    >>21641862
    Yes, see https://github.com/openshwprojects/OpenBK7231T_App/issues/1769

    Added after 1 [hours] 42 [minutes]:

    3.0.78 builds
    https://github.com/NonPIayerCharacter/OpenBK7231T_App/actions/runs/17167633393
    Used BK7231N wpa supplicant for BK7231U/T and BK7252.
    BK7231T works with it.
    Last release - 510kb. This one - 497kb

    Removed wolfssl dependency from original libs with ar -d
    Size increased by 1792 bytes, but there would be no hidden surprises that way.
    A bug i've seen - on every seconds timer triggered several times instantly during OTA
    Info:MAIN:Time 2021, idle 142052/s, free 88000, MQTT 0(105), bWifi 1, secondsWithNoPing -1, socks 3/24 
    Info:MAIN:Time 2022, idle 116612/s, free 88000, MQTT 0(105), bWifi 1, secondsWithNoPing -1, socks 3/24 
    Info:MAIN:Time 2023, idle 1698/s, free 88000, MQTT 0(105), bWifi 1, secondsWithNoPing -1, socks 3/24 
    Info:MAIN:Time 2024, idle 1315/s, free 88000, MQTT 0(105), bWifi 1, secondsWithNoPing -1, socks 3/24 
    Info:MAIN:Time 2025, idle 98963/s, free 88000, MQTT 0(105), bWifi 1, secondsWithNoPing -1, socks 3/24 
    Info:MAIN:Time 2026, idle 135908/s, free 88000, MQTT 0(105), bWifi 1, secondsWithNoPing -1, socks 3/24 
    Info:MAIN:Time 2027, idle 136134/s, free 88000, MQTT 0(105), bWifi 1, secondsWithNoPing -1, socks 3/24 
    


    Added after 9 [minutes]:

    @divadiow
    There is a 'bug' in your beken_freertos_sdk_release repo.
    Since you probably just unpacked newer version on top of the older one (like i did for mine), some files that were deleted/moved remained.
    I've had build error with BK7252, because audio_pub.h was in two folders at once, and older version was included.
    Older: https://github.com/divadiow/beken_freertos_sd...blob/3.0.78/beken378/driver/audio/audio_pub.h
    Latest: https://github.com/divadiow/beken_freertos_sd...ob/3.0.78/beken378/driver/include/audio_pub.h
  • ADVERTISEMENT
  • #242 21642035
    divadiow
    Level 36  
    insmod wrote:
    There is a 'bug' in your beken_freertos_sdk_release repo.
    Since you probably just unpacked newer version on top of the older one (like i did for mine), some files that were deleted/moved remained.


    damn yes. I was after a nice way to see the differences between versions but actually the correct way would have been to delete the lot between branches? Hmm.

    Added after 57 [minutes]:

    Anyway, anything caught your interest in .78 vs .76?
  • #243 21642058
    insmod
    Level 29  
    >>21642035
    It became possible to use mbedtls exclusively (without wolfssl) on BK7231U/T and BK7252.
    That reduced binary size significantly.
    Plus an idea came to me to play with mbedtls config. I removed some unneeded things to cut binary size.
    Plus i tried mbedtls 2.27.0 (default is 2.6.0). Binary size was increased some, but there were more free heap, + there were more idle cycles (?) (from 140-150k to ~170k).
  • ADVERTISEMENT
  • #244 21642253
    divadiow
    Level 36  
    insmod wrote:
    Plus fixed UART.

    _3.0.78_72c0170f2c72

    yay. maybe i can finish soil sensor


    MCU communication logs with Wi-Fi module in Tuya debug interface
  • #245 21642257
    p.kaczmarek2
    Moderator Smart Home
    Great! @insmod , a question - I didn't do SSL on LWIP on any of the platforms yet, so far I only used HTTPS on ESP, but now I am wondering... would it be possible to move SSL to shared app, like you did with mqtt.c? I don't know currently how SSL is done under the hood, but isn't it just relying on LWIP raw TCP sockets, nothing more? Wouldn't it be possible to have SSL added to obk shared app once and have it working for all platforms (if enabled)?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #248 21642803
    p.kaczmarek2
    Moderator Smart Home
    I would rather want to have more streamlined solution for enabling SSL for MQTT (that was in PR for Beken and supposedly works, but is disabled) and for HTTP (sendGet/SendPost). If possible, in obk_config.h, but then we would need to inject it in LWIP? So probably no obk_config, but a build switch at compile time.

    With HTTPS enabled, we could try to fetch OTA files directly from Github (instead of asking user to download it and drag and drop).

    Of course, HTTPS would be disabled by default - just leave it as an option
    Helpful post? Buy me a coffee.
  • #249 21644736
    insmod
    Level 29  
    3.0.78 ready?
    Disabled many unnecessary features in mbedtls.
    RBL sizes:
    BK7231T_ALT - 1.18.158 522736 | 1775_merge_ae487f10134d 496224
    BK7231N_ALT - 1.18.158 511120 | 1775_merge_ae487f10134d 492528
    BK7238 - 1.18.158 510592 | 1775_merge_ae487f10134d 498752

    BK7231T_ALT is 26512 bytes lighter
    BK7231N_ALT is 18592 bytes lighter
    BK7238 is 11840 bytes lighter

    + used mbedtls 2.27, instead of 2.6.
    This resulted in a speed increase? (by 5-10k idle cycles on BK7238) and 2k less free heap compared to last release (most likely the result of disabling MBEDTLS_AES_ROM_TABLES to save flash size).

    Were there irRemoteESP tests done with https://github.com/openshwprojects/OpenBK7231T_App/pull/1771 ?
  • #250 21644776
    divadiow
    Level 36  
    insmod wrote:
    Were there irRemoteESP tests done with https://github.com/openshwprojects/OpenBK7231T_App/pull/1771 ?

    not by me. can do

    insmod wrote:
    3.0.78 ready?


    I have only seen BK7231N boot from QIO flash and tested BK7238 UART/TuyaMCU with 3.0.78

    is there anything specific you need to know or just that it boots on all BK covered by this SDK?
  • ADVERTISEMENT
  • #251 21644778
    insmod
    Level 29  
    >>21644776
    Well, it boots for me on T and 7238.
    So other most likely work as well.
    Plus there are new bootloaders for 7231U/7252/7238.
    But they probably work fine too.
  • #252 21644780
    divadiow
    Level 36  
    insmod wrote:
    Plus there are new bootloaders for 7231U/7252/7238


    on the BL for BK7252U, do you know why it seems i have to splice in older test BL for the Tuya BK7252U flavour to boot?

    re https://www.elektroda.com/rtvforum/topic4073760.html#21617297

    Added after 19 [minutes]:

    BK7252U
    OTA
    1.18.158 -> 1775_merge_ae487f10134d -> 1.18.158 ✅
  • #253 21644794
    insmod
    Level 29  
    >>21644780
    I see that Tuya version has the same bootloader as normal one - unencrypted.
  • #254 21644799
    divadiow
    Level 36  
    insmod wrote:
    I see that Tuya version has the same bootloader as normal one - unencrypted.

    OK sure. That would be consistent with the experience.

    BK7252N
    OTA
    1680_merge_55ebe0a12aba -> 1.18.158 -> 1775_merge_ae487f10134d -> 1.18.158 ✅
  • Helpful post
    #255 21644819
    insmod
    Level 29  
    Tuya BK7252 QIO is fixed, i believe.
    Bootloader was first encrypted, then added default partition table on top of it.

    Added after 1 [hours] 17 [minutes]:

    Well, it turns out sendPin in myIRsend was never set to anything.

    Added after 10 [minutes]:

    Fix uploaded, logic analyzer shows that behaviour is the same as in 1.18.153.
    I also disabled https://github.com/openshwprojects/OpenBK7231...015edf449a6d048d028b1a0f/src/new_pins.c#L2155
    No effect on PWM for me.

    Added after 1 [hours] 24 [minutes]:

    IRSend NEC-1-18-1
    On RTL87X0C, it looks very similar to BK7238 in logic analyzer.
    Except on BK7238 frequency is shown to be 38.1 kHz, and on RTL87X0C it is 38.46 kHz.
    And some delays are different.
    In ESPHome that command is decoded into "Received NEC: address=0xFE01, command=0xE718 command_repeats=1".
    So, IRSend is now working on Realteks.

    Added after 8 [minutes]:

    I don't know if IRRecv works properly on RTL87X0C, but it somewhat recognizes my air conditioner (it shows ELECTRA_AC, same as in tasmota).

    Added after 3 [minutes]:

    And it really works on RTL87X0C.
    Info:IR:IR SAMSUNG 7 7 1
    Info:IR:IR SAMSUNG,32,0xE0E0E01F
    Info:MAIN:Time 428, idle 0/s, free 76312, MQTT 0(27), bWifi 1, secondsWithNoPing 361, socks 2/21 
    Info:IR:IR SAMSUNG 7 B 1
    Info:IR:IR SAMSUNG,32,0xE0E0D02F
    Info:MAIN:Time 429, idle 0/s, free 76312, MQTT 0(27), bWifi 1, secondsWithNoPing 362, socks 2/21 
    Info:MAIN:Time 430, idle 0/s, free 76312, MQTT 0(27), bWifi 1, secondsWithNoPing 363, socks 2/21 
    Info:MAIN:Time 431, idle 0/s, free 76144, MQTT 0(27), bWifi 1, secondsWithNoPing 364, socks 2/21 
    Info:MAIN:Time 432, idle 0/s, free 75976, MQTT 0(27), bWifi 1, secondsWithNoPing 365, socks 2/21 
    Info:MAIN:Time 433, idle 0/s, free 75976, MQTT 0(27), bWifi 1, secondsWithNoPing 366, socks 2/21 
    Info:MAIN:Time 434, idle 0/s, free 76144, MQTT 0(27), bWifi 1, secondsWithNoPing 367, socks 2/21 
    Info:MAIN:Time 435, idle 0/s, free 75976, MQTT 0(27), bWifi 1, secondsWithNoPing 368, socks 2/21 
    Info:MAIN:Time 436, idle 0/s, free 75976, MQTT 0(27), bWifi 1, secondsWithNoPing 369, socks 2/21 
    Info:MAIN:Time 437, idle 0/s, free 76144, MQTT 0(27), bWifi 1, secondsWithNoPing 370, socks 2/21 
    Info:IR:IR SAMSUNG 7 7 1
    Info:IR:IR SAMSUNG,32,0xE0E0E01F
    Info:MAIN:Time 438, idle 0/s, free 76312, MQTT 0(27), bWifi 1, secondsWithNoPing 371, socks 2/21 
    Info:IR:IR SAMSUNG 7 7 1
    Info:IR:IR SAMSUNG,32,0xE0E0E01F
    Info:IR:IR SAMSUNG 7 7 1
    Info:IR:IR SAMSUNG,32,0xE0E0E01F
    Info:MAIN:Time 439, idle 0/s, free 76312, MQTT 0(27), bWifi 1, secondsWithNoPing 372, socks 2/21 
    Info:IR:IR SAMSUNG 7 7 1
    Info:IR:IR SAMSUNG,32,0xE0E0E01F
    Info:MQTT:mqtt_host empty, not starting mqtt
    Info:MAIN:Time 440, idle 0/s, free 76312, MQTT 0(28), bWifi 1, secondsWithNoPing 373, socks 2/21 

    Samsung TV volume keys.
  • #256 21645015
    divadiow
    Level 36  
    insmod wrote:
    Tuya BK7252 QIO is fixed, i believe.
    Bootloader was first encrypted, then added default partition table on top of it.


    Confirmed good now. Tuya QIO 1775_merge_90d1ca590908.
    QIO to blank doorbell from 0. great stuff

    just re-flashing to redo OTA test. REST wouldn't start or log anything and HTTP would flash but then boot loop with

    Code: Text
    Log in, to see the code


    Added after 4 [minutes]:

    initial OpenBK7252_Tuya_QIO_1775_merge_90d1ca590908.bin boot and client joining AP
    Spoiler:
    BK7251_1.0.15
    REG:cpsr spsr r13 r14
    SVC:0x000000D3 0xEC60C462 0x53906404
    IRQ:0x000000D2 0x00000010 0x63799D40 0x0D8DA088
    FIR:0x000000D1 0x00000010 0x40BBDADF 0xE479B02A
    SYS:0x000000DF 0xFFBFFFFF 0x2B08CCB2
    ST:0x8EB592C5
    [I/FAL] Fal(V0.4.0)success
    [I/OTA] RT-Thread OTA package(V0.2.8-beken-1133282d-20220604) initialize success.
    [E/OTA] (ota_main:178) App verify failed! Need to recovery factory firmware.


    go os_addr(0x10000)..........
    prvHeapInit-start addr:0x419318, size:158952
    prvHeapInit-start addr:0x900000, size:262144
    [Flash]id:0xb4016
    --write status reg:4804,2--
    [Flash]init over
    QSPi_init
    QSPi_init1
    sctrl_sta_ps_init
    SDK Rev: 3.0.78 ee8639d
    OSK Rev: F-3.0.51 ee8639d
    cset:0 0 0 0
    No TLV header found in flash
    [FUNC]rwnxl_init
    chip id=7221a device id=18221020
    IP Rev: W4-3.0.78-P0
    txdesc flush
    [FUNC]intc_init
    [FUNC]calibration_main
    No TLV header found in flash

    rfcali_mode:1, 0
    *********** finally result **********
    gtx_dcorMod : 0x8
    gtx_dcorPA : 0xa
    gtx_pre_gain : 0x10
    gtx_i_dc_comp : 0x1fd
    gtx_q_dc_comp : 0x203
    gtx_i_gain_comp : 0x3ff
    gtx_q_gain_comp : 0x3ff
    gtx_ifilter_corner over: 0x12
    gtx_qfilter_corner over: 0x12
    gtx_phase_comp : 0x1ea
    gtx_phase_ty2 : 0x200
    gbias_after_cal : 0x15
    gav_tssi : 0x0
    g_rx_dc_gain_tab 0 over: 0x807c807c
    g_rx_dc_gain_tab 1 over: 0x80788078
    g_rx_dc_gain_tab 2 over: 0x84708470
    g_rx_dc_gain_tab 3 over: 0x90488c58
    g_rx_dc_gain_tab 4 over: 0x904a9044
    g_rx_dc_gain_tab 5 over: 0x90488f4a
    g_rx_dc_gain_tab 6 over: 0x90479048
    g_rx_dc_gain_tab 7 over: 0x92469147
    grx_amp_err_wr : 0x20e
    grx_phase_err_wr : 0x364
    **************************************
    NO RF TLV in flash, write def tab
    calibration_main(2f455c121) over
    NO TXPWR_TAB_TAB found in flash
    Load default txpwr for b:0xc8d20
    Load default txpwr for g:0xc8d56
    fit n20 table with dist:2
    Load default txpwr for n40:0xc8d64
    Load default txpwr for ble:0xc8d2e
    NO TXID found in flash, use lpf i&q:18, 18
    NO TXID found in flash, use def xtal:16
    xtal in flash is:16
    xtal_cali:16
    rwnx_tpc_pa_map_init
    [FUNC]ps_init
    int watchdog enabled, period=10000
    task watchdog enabled, period=60000
    [FUNC]func_init_extended OVER!!!

    start_type:0
    Initializing TCP/IP stack
    rf_thread_inbk_wlan_app_init finished
    it ok
    OpenBK7252, version 1775_merge_90d1ca590908
    Entering initLog()...
    Commands registered!
    initLog() done!
    Info:MAIN:Main_Init_Before_Delay
    --write status reg:a00,2--
    --write status reg:a7c,2--
    Error:CFG:flash_vars_valid - not our magic, erase
    --write status reg:a00,2--
    --write status reg:a7c,2--
    --write status reg:a00,2--
    --write status reg:a7c,2--
    --write status reg:a00,2--
    --write status reg:a7c,2--
    --write status reg:a00,2--
    --write status reg:a7c,2--
    Info:CFG:new flash vars
    --write status reg:a00,2--
    --write status reg:a7c,2--
    --write status reg:a00,2--
    --write status reg:a7c,2--
    Info:CFG:####### Boot Count 1 #######
    --write status reg:a00,2--
    --write status reg:a7c,2--
    --write status reg:a00,2--
    --write status reg:a7c,2--
    --write status reg:a00,2--
    --write status reg:a7c,2--
    Warn:CFG:CFG_InitAndLoad: Config crc or ident mismatch. Default config will be loaded.
    Info:CFG:CFG_SetDefaultLEDCorrectionTable: setting defaults
    --write status reg:a00,2--
    --write status reg:a7c,2--
    Error:CMD:lfs is absent
    Info:GEN:PIN_SetupPins pins have been set up.
    Info:MAIN:Main_Init_Before_Delay done
    Main_Init_Before_Delay done
    Info:MAIN:Main_Init_Delay
    Main_Init_Delay

    delaying start
    #Startup delayed 0ms#
    #Startup delayed 10ms#
    #Startup delayed 20ms#
    #Startup delayed 30ms#
    #Startup delayed 40ms#
    #Startup delayed 50ms#
    #Startup delayed 60ms#
    #Startup delayed 70ms#
    #Startup delayed 80ms#
    #Startup delayed 90ms#

    starting....
    Info:MAIN:Main_Init_Delay done
    Main_Init_Delay done
    Info:MAIN:Main_Init_After_Delay
    Info:MAIN:Using SSID []
    Info:MAIN:Using Pass []
    Info:MQTT:MQTT_RegisterCallback called for bT obk8C428848/ subT obk8C428848/+/set
    Info:MQTT:MQTT_RegisterCallback called for bT obks/ subT obks/+/set
    Info:MQTT:MQTT_RegisterCallback called for bT cmnd/obk8C428848/ subT cmnd/obk8C428848/+
    Info:MQTT:MQTT_RegisterCallback called for bT cmnd/obks/ subT cmnd/obks/+
    Info:MQTT:MQTT_RegisterCallback called for bT obk8C428848/ subT obk8C428848/+/get
    Info:CMD:CMD_StartScript: started @startup at the beginning
    Error:CMD:LFS_ReadFile: lfs is absent
    Info:CMD:CMD_StartScript: failed to get file autoexec.bat
    Info:MAIN:Main_Init_After_Delay done
    Info:HTTP:TCP server listening
    Info:MAIN:Time 1, idle 220062/s, free 384392, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/24
    Info:MAIN:Time 2, idle 188383/s, free 384392, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/24
    Info:MAIN:Time 3, idle 188958/s, free 384392, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/24
    Info:MAIN:Time 4, idle 192142/s, free 384392, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/24
    Soft_AP_start
    [saap]MM_RESET_REQ
    txdesc flush
    [saap]ME_CONFIG_REQ
    [saap]ME_CHAN_CONFIG_REQ
    [saap]MM_START_REQ
    csa clear 0:0
    mm_add_if_req_handler:0
    hapd_intf_add_vif,type:3, s:0, id:0
    apm start with vif:0
    ------beacon_int_set:100 TU
    set_active param 0
    [msg]APM_STOP_CFM
    mm updating bcn
    mm_set_vif_state_req_handler
    vif_idx:0, ch_idx:0, bcmc_idx:2
    sending broadcast_deauth:5
    hapd_intf_del_key: mac ff:ff:ff:ff:ff:ff, hw key idx 65
    hapd_intf_del_key: mac ff:ff:ff:ff:ff:ff, hw key idx 65
    hapd_intf_del_key: mac ff:ff:ff:ff:ff:ff, hw key idx 65
    hapd_intf_del_key: mac ff:ff:ff:ff:ff:ff, hw key idx 65
    mm updating bcn
    enter low level!
    mac c8:47:8c:42:88:49
    leave low level!
    [net]addvif_idx:0
    uap_ip_start

    configuring interface uap (with Static IP)WARN: TCPIP mutex is NOT locked (1) caller 6D57F
    sending broadcast_deauth:5
    Info:MAIN:Time 5, idle 188744/s, free 384392, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/24
    Info:MAIN:no flash configuration, use default
    Info:MAIN:set ip info: 192.168.4.1,255.255.255.0,192.168.4.1
    Info:MAIN:ssid:OpenBK7252_8C428848 key: mode:0
    --write status reg:a00,2--
    --write status reg:a7c,2--
    --write status reg:a00,2--
    --write status reg:a7c,2--
    --write status reg:a00,2--
    --write status reg:a7c,2--
    Info:MAIN:Time 6, idle 172086/s, free 377632, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:MAIN:Boot complete time reached (5 seconds)
    Info:CFG:####### Set Boot Complete #######
    Info:MAIN:Time 7, idle 189698/s, free 377632, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:MAIN:Time 8, idle 190214/s, free 377632, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:MAIN:Time 9, idle 190281/s, free 377632, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:MAIN:Time 10, idle 194561/s, free 377632, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:GEN:dhcp=0 ip=0.0.0.0 gate=0.0.0.0 mask=0.0.0.0 mac=00:00:00:00:00:00
    Info:GEN:sta: 0, softap: 1, b/g/n
    Info:GEN:softap:ssid=OpenBK7252_8C428848,channel=1,dhcp=1,cipher_type:OPEN
    Info:GEN:ip=192.168.4.1,gate=192.168.4.1,mask=255.255.255.0,dns=192.168.4.1
    Info:MAIN:Time 11, idle 185775/s, free 377632, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:MAIN:Time 12, idle 190826/s, free 377632, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:MAIN:Time 13, idle 194061/s, free 377632, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:MAIN:Time 14, idle 189759/s, free 377632, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:MAIN:Time 15, idle 190489/s, free 377632, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    hapd_intf_sta_add: aid 1, vif 0, mac 38:7a:0e:e3:6b:7e
    sta_mgmt_register: mac 38:7a:0e:e3:6b:7e
    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
    sta_idx:0, pm_state:0
    wpa_hostapd_no_password_connected
    ap_index:0
    sta_id:0
    send connected msg
    Mac addr: 38:7a:0e:e3:6b:7e, ip: 192.168.4.100
    WARN: TCPIP mutex is NOT locked (1) caller 6BE7F
    WARN: TCPIP mutex is NOT locked (1) caller 6CA69
    WARN: TCPIP mutex is NOT locked (1) caller 6BEA5
    Info:MAIN:Time 16, idle 190350/s, free 377320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:MAIN:Time 17, idle 188876/s, free 377320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:MAIN:Time 18, idle 187022/s, free 377320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:MAIN:Time 19, idle 192982/s, free 377320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:MAIN:Time 20, idle 189362/s, free 377320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:GEN:dhcp=0 ip=0.0.0.0 gate=0.0.0.0 mask=0.0.0.0 mac=00:00:00:00:00:00
    Info:GEN:sta: 0, softap: 1, b/g/n
    Info:GEN:softap:ssid=OpenBK7252_8C428848,channel=1,dhcp=1,cipher_type:OPEN
    Info:GEN:ip=192.168.4.1,gate=192.168.4.1,mask=255.255.255.0,dns=192.168.4.1
    Info:MAIN:Time 21, idle 187299/s, free 377320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:MAIN:Time 22, idle 193927/s, free 377320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:MAIN:Time 23, idle 189569/s, free 377320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24
    Info:MAIN:Time 24, idle 190633/s, free 377320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/24


    Added after 3 [minutes]:

    REST OTA DOES work, but

    Spoiler:
    [Flash]id:0xb4016
    --write status reg:4a04,2--
    [Flash]init over
    --write status reg:a00,2--
    Info:OTA:init OTA, startaddr 0x132000
    Info:OTA:132000
    Info:OTA:133000
    Info:OTA:134000
    Info:OTA:135000
    Info:OTA:136000
    Info:OTA:137000
    Info:OTA:138000
    Info:OTA:139000
    Info:OTA:13a000
    Info:MAIN:Time 118, idle 167723/s, free 329856, MQTT 0(7), bWifi 1, secondsWithNoPing 52, socks 3/24
    Info:OTA:13b000
    Info:OTA:13c000
    Info:OTA:13d000
    Info:OTA:13e000
    Info:OTA:13f000
    Info:OTA:140000
    Info:OTA:141000
    Info:OTA:142000
    Info:OTA:143000
    Info:OTA:144000
    Info:OTA:145000
    Info:OTA:146000
    Info:OTA:147000
    Info:OTA:148000
    Info:OTA:149000
    Info:OTA:14a000
    Info:OTA:14b000
    Info:OTA:14c000
    Info:OTA:14d000
    Info:OTA:14e000
    Info:OTA:14f000
    Info:OTA:150000
    Info:OTA:151000
    Info:OTA:152000
    Info:OTA:153000
    Info:OTA:154000
    Info:OTA:155000
    Info:MAIN:Time 119, idle 27784/s, free 321344, MQTT 0(7), bWifi 1, secondsWithNoPing 53, socks 3/24
    Info:OTA:156000
    Info:OTA:157000
    Info:OTA:158000
    Info:OTA:159000
    Info:OTA:15a000
    Info:OTA:15b000
    Info:OTA:15c000
    Info:OTA:15d000
    Info:OTA:15e000
    Info:OTA:15f000
    Info:OTA:160000
    Info:OTA:161000
    Info:OTA:162000
    Info:OTA:163000
    Info:OTA:164000
    Info:OTA:165000
    Info:OTA:166000
    Info:OTA:167000
    Info:OTA:168000
    Info:OTA:169000
    Info:MAIN:Time 120, idle 29615/s, free 329856, MQTT 0(7), bWifi 1, secondsWithNoPing 54, socks 3/24
    Info:GEN:dhcp=0 ip=192.168.1.202 gate=192.168.1.1 mask=255.255.255.0 mac=c8:47:8c:42:88:48
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-72,ssid=,bssid=20:b0:01:af:a0:cd,channel=1,cipher_type:CCMP
    Info:OTA:16a000
    Info:OTA:16b000
    Info:OTA:16c000
    Info:OTA:16d000
    Info:OTA:16e000
    Info:OTA:16f000
    Info:OTA:170000
    Info:OTA:171000
    Info:OTA:172000
    Info:OTA:173000
    Info:OTA:174000
    Info:OTA:175000
    Info:OTA:176000
    Info:OTA:177000
    Info:OTA:178000
    Info:OTA:179000
    Info:OTA:17a000
    Info:OTA:17b000
    Info:OTA:17c000
    Info:OTA:17d000
    Info:MAIN:Time 121, idle 29487/s, free 329856, MQTT 0(7), bWifi 1, secondsWithNoPing 55, socks 3/24
    Info:OTA:17e000
    Info:OTA:17f000
    Info:OTA:180000
    Info:OTA:181000
    Info:OTA:182000
    Info:OTA:183000
    Info:OTA:184000
    Info:OTA:185000
    Info:OTA:186000
    Info:OTA:187000
    Info:OTA:188000
    Info:OTA:189000
    Info:OTA:18a000
    Info:OTA:18b000
    Info:OTA:18c000
    Info:OTA:18d000
    Info:OTA:18e000
    Info:OTA:18f000
    Info:OTA:190000
    Info:OTA:191000
    Info:MAIN:Time 122, idle 30831/s, free 321552, MQTT 0(7), bWifi 1, secondsWithNoPing 56, socks 3/24
    Info:OTA:192000
    Info:OTA:193000
    Info:OTA:194000
    Info:OTA:195000
    Info:OTA:196000
    Info:OTA:197000
    Info:OTA:198000
    Info:OTA:199000
    Info:OTA:19a000
    Info:OTA:19b000
    Info:OTA:19c000
    Info:OTA:19d000
    Info:OTA:19e000
    Info:OTA:19f000
    Info:OTA:1a0000
    Info:OTA:1a1000
    Info:OTA:1a2000
    Info:OTA:1a3000
    Info:OTA:1a4000
    Info:MAIN:Time 123, idle 28846/s, free 329856, MQTT 0(7), bWifi 1, secondsWithNoPing 57, socks 3/24
    Info:OTA:1a5000
    Info:OTA:1a6000
    Info:OTA:1a7000
    Info:OTA:1a8000
    Info:OTA:1a9000
    Info:OTA:1aa000
    Info:OTA:1ab000
    Info:OTA:1ac000
    Info:OTA:1ad000
    Info:OTA:1ae000
    Info:OTA:1af000
    Info:OTA:1b0000
    Info:OTA:1b1000
    Info:OTA:1b2000
    Info:OTA:
    Info:OTA:close OTA, additional 0x8b0 FF added
    Info:OTA:1b3000
    Info:OTA:close OTA, addr 0x1b3400
    --write status reg:4a04,2--
    --write status reg:a00,2--
    --write status reg:a7c,2--
    Info:MAIN:Time 124, idle 65796/s, free 359888, MQTT 0(7), bWifi 1, secondsWithNoPing 58, socks 2/24
    Info:MAIN:Time 125, idle 130233/s, free 359888, MQTT 0(7), bWifi 1, secondsWithNoPing 59, socks 2/24
    Info:MAIN:Module reboot in 2...
    Info:MAIN:Time 126, idle 206181/s, free 359888, MQTT 0(7), bWifi 1, secondsWithNoPing 60, socks 2/24
    Info:MAIN:Module reboot in 1...
    bk_reboot(1)
    wdt reboot
    BK7251_1.0.15
    REG:cpsr spsr r13 r14
    SVC:0x000000D3 0x00403C20 0x00011A08
    IRQ:0x000000D2 0x00000010 0x00403448 0x000787B6
    FIR:0x000000D1 0x00000010 0x00402458 0x00011300
    SYS:0x000000DF 0x0041CC38 0x0007A8C7
    ST:0x00000001
    [I/FAL] Fal(V0.4.0)success
    [I/OTA] RT-Thread OTA package(V0.2.8-beken-1133282d-20220604) initialize success.
    [E/OTA] (rt_ota_check_upgrade:438) Get 'app' partition firmware header failed! This partition will be forced to upgrade.
    [I/OTA] OTA firmware(app) upgrade startup.
    [I/OTA] total_len((808021) >= size_raw(808021), _STREAM_END

    [I/OTA] The partition 'app' is erasing.
    ###############BBBBBBBBBBBB#####[I/OTA] The partition 'app' erase success.
    [I/OTA] OTA Write: [> ] 0%
    [I/OTA] OTA Write: [> ] 0%
    [I/OTA]
    [I/OTA] OTA Write: [> ] 0%
    [I/OTA]
    [I/OTA] OTA Write: [=> ] 1%
    [I/OTA]
    [I/OTA] OTA Write: [=> ] 1%
    [I/OTA] OTA Write: [==================================================================================================> ] 98%
    decompress error: incorrect data check -3
    [I/OTA]
    [I/OTA] OTA Write: [===================================================================================================>] 99%
    [I/OTA]
    [I/OTA] OTA Write: [====================================================================================================] 100%
    [E/OTA] (rt_ota_upgrade:975) OTA upgrade failed! Download data copy to partition(app) error!
    [E/OTA] (ota_main:144) OTA upgrade failed!
    [E/OTA] (ota_main:178) App verify failed! Need to recovery factory firmware.


    go os_addr(0x10000)..........
    [ARM ANOMALY][2]
    psr r13 r14
    SVC:0x000000D3 0x0043F7B8 0x00001CD5
    IRQ:0x000000D2 0x00000010 0x0043FC10 0x00001AB0
    FIR:0x000000D1 0x00000010 0x00440000 0x00011300
    SYS:0x000000DF 0x0043B820 0x0007A8C7
    ST:0xBEDEAD12
    [I/FAL] Fal(V0.4.0)success
    [I/OTA] RT-Thread OTA package(V0.2.8-beken-1133282d-20220604) initialize success.
    [E/OTA] (rt_ota_check_upgrade:438) Get 'app' partition firmware header failed! This partition will be forced to upgrade.
    [E/OTA] (rt_ota_part_fw_verify:389) Verify firmware CRC32(calc.crc: 6e447eeb != hdr.crc: f44f1951) failed on partition 'download'.
    [E/OTA] (ota_main:178) App verify failed! Need to recovery factory firmware.


    go os_addr(0x10000)..........
    [ARM ANOMALY][2]
    BK7251_1.0.15
    REG:cpsr spsr r13 r14
    SVC:0x000000D3 0x0043F7B8 0x00001CD5
  • Helpful post
    #257 21645033
    insmod
    Level 29  
    >>21645015
    Pushed an update, bootloader partitions were "incorrect"? Now matches with default BK7252, but even then it should've worked as it is now.
  • Helpful post
    #258 21645053
    divadiow
    Level 36  
    cheers. unfortunately it now performs OTA over and over

    Code: Text
    Log in, to see the code


    Added after 1 [minutes]:

    rbl files are encryption agnostic right? which is why we have one rbl for M and N..
  • #260 21645099
    divadiow
    Level 36  
    insmod wrote:
    Does it work on non-Tuya?

    seems it did

    https://www.elektroda.com/rtvforum/topic4127023.html#21584765

    will solder that BK7252U-48 back up to try latest

    Added after 4 [minutes]:

    divadiow wrote:
    BK7252U
    OTA
    1.18.158 -> 1775_merge_ae487f10134d -> 1.18.158 ✅


    and earlier but that would have had old BL

    Added after 12 [minutes]:

    firstly, OTA with the Naxclow and the old PR it had

    Jun 20 2025 07:50:43 version 1680_merge_55ebe0a12aba -> 1.18.158 -> Aug 26 2025 10:54:46 version 1775_merge_053176ee60a7 -> 1.18.158 ✅

    Added after 47 [minutes]:




    SPI OpenBK7252_QIO_1775_merge_90d1ca590908.bin -> OTA 1775_merge_90d1ca590908 -> 1.18.158 ✅
  • #263 21645610
    insmod
    Level 29  
    It seems bootloader is not encryption ota on unpacking.
    Try to flash BK7231N 1.0.1 bootloader.

    Added after 2 [hours] 18 [minutes]:

    @p.kaczmarek2
    irRemoteESP fix can be merged (https://github.com/openshwprojects/OpenBK7231T_App/pull/1771)
    BK7238 works ok
    RTL87X0C works ok (both recv and send)
    RTL8720D doesn't work (send pwm is always on, recv doesn't work for me.)
    RTL8721DA doesn't work (send delays are too long, recv unknown, but consistent).

    Disabling PWM update in PIN_ticks has no effect on smooth led transition (flag 18). Continues to work as before.

    Added after 5 [hours] 11 [minutes]:

    BL602 irRemoteESP build: https://github.com/NonPIayerCharacter/OpenBK7231T_App/actions/runs/17257858816
    send works for me.
    receive - in this build it doesn't, but if i disable pull up here (set it to false), then it starts working for me.
  • #264 21645715
    p.kaczmarek2
    Moderator Smart Home
    I saw report that this irRemote issue is fixed, what was wrong? Looks like... you're culling repetitive calls to PWM?

    Now second call to HAL_PIN_PWM_Start will get culled... interestingly enough, you set g_periods[pwmIndex] before culling?
    Helpful post? Buy me a coffee.
  • #265 21645718
    insmod
    Level 29  
    >>21645715
    The issue was that sendPin in myIRsend was never set. So HAL calls did nothing.
  • #266 21645720
    p.kaczmarek2
    Moderator Smart Home
    That's this fix:
    Source code diff showing changes to myIRsend class function in a C++ file.
    So what is the purpose of g_pwm_on?
    Helpful post? Buy me a coffee.
  • #267 21645722
    insmod
    Level 29  
    >>21645720
    So that pwm is not reinitialized on every enableIROut call.
    It wasn't before moving to HALs.
    Plus it simplifies setting g_periods[pwmIndex], compared to what was before.
  • #268 21645732
    p.kaczmarek2
    Moderator Smart Home
    But with this:
    Code: C / C++
    Log in, to see the code

    This will ignore period change on repeated init start.... however I'm not sure if it affects anything.

    I'll merge it for now, just curious.
    Helpful post? Buy me a coffee.
  • #269 21645738
    insmod
    Level 29  
    >>21645732
    Doesn't affect anything, since period is used HAL_PIN_PWM_Update.
  • #270 21645742
    p.kaczmarek2
    Moderator Smart Home
    Ok, acceptable, let me know if there are any more PRs to merge.

    Regarding BK7238 - I will probably try testing it soon with multiple WS2812 clones, I have some similar strips that may have different timings.
    Helpful post? Buy me a coffee.

Topic summary

The discussion centers on the NiceMCU XH-WB3S development board featuring the BK7238 SoC, initially suspected to be BK7231T but confirmed as BK7238. Users share experiences with flashing, testing, and porting firmware, including challenges with encryption keys, flash IDs, and bootloader compatibility. The BK7238 uses 2MB flash with varying encryption keys per chip, complicating universal firmware flashing. Tools like BKFIL and Easy Flasher (EF) are used for backup and restore, with EF supporting full flash erase and restore including bootloader. Flash ID support was extended to include missing flash chips to avoid CRC errors. Arduino SDK and Beken FreeRTOS SDK (version 3.0.70.1 and newer 3.0.76) are referenced for development, with partial support for BK7238 and related chips (BK7231N, BK7231U, BK7252). Porting efforts include adapting delay functions for 160MHz BK7238, resolving flashvars alignment issues due to 64-bit time_t, and addressing HTTP server and TCP socket stability problems in LWIP. OTA updates are functional but require correct image types and bootloader versions. Power save modes and their impact on peripherals like BL0937 energy meter and DS18B20 sensors are discussed, with some instability noted under power save. SPI flashing and UART flashing methods are compared, with SPI preferred for some devices. BK7231U (CC8000 chip) support is emerging, with builds available but some undefined references and boot issues. BK7252 camera module support is experimental, with encrypted flash complicating firmware use. Users report issues with DS18B20 sensor timing on BK7238 due to delay_us inaccuracies, partially fixed by new SDK delay implementations. Logging and MQTT load affect system stability and sensor reading consistency. The community shares flash dumps, toolchain links, and SDK forks to aid development and testing. Overall, the thread provides detailed technical insights into BK7238-based NiceMCU boards' flashing, SDK porting, peripheral support, and firmware development challenges and progress.
Summary generated by the language model.
ADVERTISEMENT