logo elektroda
logo elektroda
X

BK7231N Thermostat Not Booting After openBK7231N 1.18.157 Firmware Flashing

bl00dy 735 48
ADVERTISEMENT
  • #1 21641272
    bl00dy
    Level 5  
    Hello,

    I have a thermostat device, which is using bk7231N chip:
    Information window with BK7231N chip details, including MAC address and encryption key

    It uses Encryption key: 00000000 00000000 00000000 00000000

    I download firmware, and skip key check.
    But system does not find any OOB, and actually device does not boot after openBK7231N 1.18.157 install. Restoring RF partition does not help. Lost device.
  • ADVERTISEMENT
  • #2 21641627
    p.kaczmarek2
    Moderator Smart Home
    Hey, can you show a photo of your device?

    Probably this can help: How to flash BK7231M/BL2028N non-Tuya devices with 000000 keys?
    Helpful post? Buy me a coffee.
  • #4 21642128
    divadiow
    Level 36  
    This is a curious case.

    I flashed your backup to a CB3S yesterday and it booted. CB33 was from Tuya device with standard Tuya keys.

    Do you get any log out on boot from TX at all?
  • #5 21642142
    p.kaczmarek2
    Moderator Smart Home
    Maybe it's a battery powered device and TuyaMCU turns off the power?
    Helpful post? Buy me a coffee.
  • #6 21643214
    bl00dy
    Level 5  
    It's 220v thermostat, no battery. what tools to use to see a logs?
    Also, Config can't be extracted from this binary.
  • ADVERTISEMENT
  • #7 21643226
    p.kaczmarek2
    Moderator Smart Home
    Here is guide for extracting dpIDs for TuyaMCU devices: https://www.elektroda.com/rtvforum/topic4021129.html
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #8 21643712
    bl00dy
    Level 5  
    >>21642128 binary, which I upload it's an original binary, I downloaded as backup. this one boot to me also. I can't boot OpenBK, and can't extract gpi config
  • ADVERTISEMENT
  • #9 21643751
    divadiow
    Level 36  
    bl00dy wrote:
    what tools to use to see a logs?


    PuTTY, Realterm etc

    What are these pads labelled as?


    Close-up of a PCB with four pads circled in green marker

    also, have you tried overwriting bootloader in N/M modes to see if it boots then?

    Screenshot of BK7231 Easy UART Flasher with bootloader overwrite checkbox visible
  • #10 21643770
    p.kaczmarek2
    Moderator Smart Home
    There are no pins/config to extract if that's TuyaMCU. For TuyaMCU, you should rather do: https://www.elektroda.com/rtvforum/topic4021129.html
    Helpful post? Buy me a coffee.
  • #11 21643788
    divadiow
    Level 36  
    This is factory boot log as far as it will go on dev board

    Code: Text
    Log in, to see the code


    I'm curious about how standard the TuyaMCU is though because it will not talk to Tuya Module Debugging Assistant as I would expect with a standard TuyaMCU device.

    It'd be good if you could capture the full factory firmware boot log from real device with it able to talk to MCU.
  • #12 21643800
    p.kaczmarek2
    Moderator Smart Home
    Well, then maybe you're able to capture what is actually send from UART by this particular firmware? UART1 - the TuyaMCU/programming one, not debug log.
    Helpful post? Buy me a coffee.
  • #13 21643805
    divadiow
    Level 36  
    good point. will do.

    here's a little bit more printed from TXD1/P11

    Code: Text
    Log in, to see the code
  • #14 21643809
    bl00dy
    Level 5  
    >>21643751
    Hello, No, I did not try to rewrite bootloader, as it's written, not recommended for N/M devices. but I can try.
    pinouts are in the picture.

    Close-up of a PCB with labeled MCU-TX and MCU-RX pins and connected cables
  • #15 21643814
    divadiow
    Level 36  
    divadiow wrote:
    here's a little bit more printed from TXD1/P11

    that seems to be the extent of it

    Code: Text
    Log in, to see the code


    maybe it's waiting for something from MCU first before sending anything?
  • #16 21643846
    p.kaczmarek2
    Moderator Smart Home
    Which baud is it? Maybe it's using alternate baud. This looks random for me?
    Helpful post? Buy me a coffee.
  • #17 21643850
    divadiow
    Level 36  
    p.kaczmarek2 wrote:
    This looks random for me?

    that hex apparently = the ascii seen in previous post. that was 115200

    Screenshot showing decoded TUYA boot log messages displayed as plain text

    at 9600 baud it looks like

    Code: Text
    Log in, to see the code
  • #18 21643862
    p.kaczmarek2
    Moderator Smart Home
    Wait, that's indeed ASCII! So you captured from wrong port - it should be from UART port, and not from log.

    Added after 1 [minutes]:

    Wait, but you said...
    divadiow wrote:

    here's a little bit more printed from TXD1/P11

    I am confused now. TX2 is log output and TX1 is TuyaMCU comm...
    Helpful post? Buy me a coffee.
  • #19 21643868
    divadiow
    Level 36  
    p.kaczmarek2 wrote:
    Wait, but you said...


    yes

    TX1/P11:

    Code: Text
    Log in, to see the code


    TX2/P0 is main boot log in previous post
  • #20 21643882
    divadiow
    Level 36  
    it does appear to be listening on RX1/P10. If you listen on TX1 and send random TuyaMDA commands to RX1 it will respond with:

    Code: Text
    Log in, to see the code


    The command is too long error in TuyaMCU emulator with MCU data transmissions visible
  • #21 21643948
    bl00dy
    Level 5  
    I connect to original firmware, but only power bk chip:
    [01-01 00:00:00 TUYA I][module_main.c:935] --------------------module_main start--------------------

    [01-01 00:00:00 TUYA I][tal_thread.c:184] thread_create name:module_main,stackDepth:3072,totalstackDepth:22528,priority:5
    [01-01 00:00:00 TUYA I][tal_thread.c:184] thread_create name:log_service,stackDepth:1536,totalstackDepth:24064,priority:3
    calibration_main over
    calibrate low value:[6d9]
    calibrate high value:[dae]
    temp in flash is:350
    xtal in flash is:95
    [FUNC]func_init_extended OVER
    Version:
    app_init finished
    [01-01 00:00:03 TUYA I][module_main.c:224] [uart] wait mcu response retry = 1
    [01-01 00:00:06 TUYA I][module_main.c:224] [uart] wait mcu response retry = 2
    [01-01 00:00:09 TUYA E][module_main.c:222] [uart] can't receive mcu response, ignore

    not sure, how I can read logs, and power connect to see full logs.
  • #22 21643980
    p.kaczmarek2
    Moderator Smart Home
    Is it even using UART? Maybe it's SPI or I2C?

    Can you try to power the devicely in a safe manner (not from mains, to avoid making short and an explosion), from, I don't know, maybe 5V could be injected somewhere in the board, just to the input of 3.3V LDO, if that's present, and try to capture the communication?
    Helpful post? Buy me a coffee.
  • #24 21644098
    p.kaczmarek2
    Moderator Smart Home
    Well, just as I said in my previous message - you probably need to capture original communication and analyze it. Currently it doesn't look like a typical TuyaMCU device.

    You can also try to start TuyaMCU driver in OBK but I am not sure if it will work... this device may be using other protocol
    Helpful post? Buy me a coffee.
  • #25 21644179
    bl00dy
    Level 5  
    I just install ESPHome, and try to debug UART1 (p10/11) and UART2 (P1/0) with different baud rates. but unfortunately MCU chip is not respond. by the pins, I see MCU TX/TX connected to UART2
  • #26 21644810
    divadiow
    Level 36  
    I'm glad you got OpenBK to boot. Was that with with BK7231N QIO or BK7231M?

    In order to fully work out the protocol the MCU uses I'm afraid it is probably the case that the factory firmware needs to re-flashed to device and the communications in both directions be sniffed out.
  • #27 21644960
    bl00dy
    Level 5  
    >>21644810 I install BK7231N with bootloader rewrite.
    But now I can't find any possibilities to read MCU. On board MCU TX is connected to UART2 RX, and MCU RX is connected to PIN UART2 TX. I try to have different speed, changing RX/TX, no success, even I try to send MCU activations
    - uart.write: { id: mcu_uart, data: [0x55,0xAA,0x00,0x03,0x00,0x01,0x03,0x07] }
    - delay: 100ms
    - uart.write: { id: mcu_uart, data: [0x55,0xAA,0x00,0x01,0x00,0x00,0x01] }
    - delay: 100ms
    - uart.write: { id: mcu_uart, data: [0x55,0xAA,0x00,0x08,0x00,0x00,0x08] }

    But no success :(
  • #28 21644976
    p.kaczmarek2
    Moderator Smart Home
    This makes no sense, and we don't provide support for esphome. You're also trying things blindly, no suprise it's not working.

    I think we have already established that this isn't TuyaMCU protocol and you need to make packets capture, then we can write you a driver for it in OBK.
    Helpful post? Buy me a coffee.
  • #29 21644981
    bl00dy
    Level 5  
    I am not sure, how I can sniff packets.

    Not sure if this help. i can connect chip to 3.3V and possible connect my Rx and Tx to MCU RX/TX pins, is this works?

    Ed
  • #30 21644982
    p.kaczmarek2
    Moderator Smart Home
    As I said - you can sniff packets if you power both MCU and WiFi module. You need to check how MCU is powered. Also, is there AMS1117-3.3V on board? Or how is the device powered?

    What are the markings here?
    Close-up of connector on red PCB with GND and 3.3V markings
    Can you make a clear photo? Maybe one of the lines is GND and second is 3.3V or 5V... and then you could safely power it, without connecting to mains. Then we could help you with packets capture and write a driver for it for OBK?
    Helpful post? Buy me a coffee.

Topic summary

A thermostat device based on the BK7231N chip failed to boot after flashing openBK7231N firmware version 1.18.157. The device uses an encryption key of all zeros (00000000 00000000 00000000 00000000). Despite downloading the firmware and bypassing the key check, the system does not detect any Out-Of-Box (OOB) configuration, and restoring the RF partition did not resolve the boot issue, resulting in a non-functional device. A suggestion was made to provide a photo of the device and referred to a guide on flashing BK7231M/BL2028N non-Tuya devices with zeroed encryption keys, which might offer relevant flashing procedures or troubleshooting steps.
Summary generated by the language model.
ADVERTISEMENT