logo elektroda
logo elektroda
X
logo elektroda

BK7231N Thermostat Not Booting After openBK7231N 1.18.157 Firmware Flashing

bl00dy 1809 52
Best answers

Why doesn't my BK7231N thermostat boot after flashing openBK7231N, and how can I recover it?

Rewriting the bootloader on the BK7231N/BK7231M device made OpenBK boot successfully, so the recovery path here was to flash the bootloader again rather than only restoring the RF partition [#21643996] The thermostat is not behaving like a standard TuyaMCU device; the MCU link appears to use a custom protocol on UART2/TX2-RX2 at 38400 baud, so generic TuyaMCU assumptions and automatic pin/config extraction will not work [#21644098][#21645412][#21646032] To reverse it, capture the original MCU traffic while both the MCU and Wi‑Fi module are powered, ideally by feeding 5V into the AMS1117 input from a USB/UART adapter instead of powering from mains [#21644982][#21645096] One later report confirmed this device needs custom code rather than the stock TuyaMCU driver, and that a working ESPHome implementation was built only after reverse engineering the protocol [#21819594]
Generated by the language model.
ADVERTISEMENT
  • #1 21641272
    bl00dy
    Level 7  
    Posts: 38
    Rate: 3
    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.
    Attachments:
    • readResult_BK7231N_QIO_222_2025-22-8-10-54-08.bin (2 MB) You must be logged in to download this attachment.
  • ADVERTISEMENT
  • #2 21641627
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14415
    Help: 650
    Rate: 12369
    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.
  • ADVERTISEMENT
  • #4 21642128
    divadiow
    Level 38  
    Posts: 4855
    Help: 424
    Rate: 860
    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
    Posts: 14415
    Help: 650
    Rate: 12369
    Maybe it's a battery powered device and TuyaMCU turns off the power?
    Helpful post? Buy me a coffee.
  • #6 21643214
    bl00dy
    Level 7  
    Posts: 38
    Rate: 3
    It's 220v thermostat, no battery. what tools to use to see a logs?
    Also, Config can't be extracted from this binary.
  • #7 21643226
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14415
    Help: 650
    Rate: 12369
    Here is guide for extracting dpIDs for TuyaMCU devices: https://www.elektroda.com/rtvforum/topic4021129.html
    Helpful post? Buy me a coffee.
  • #8 21643712
    bl00dy
    Level 7  
    Posts: 38
    Rate: 3
    >>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 38  
    Posts: 4855
    Help: 424
    Rate: 860
    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
    Posts: 14415
    Help: 650
    Rate: 12369
    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 38  
    Posts: 4855
    Help: 424
    Rate: 860
    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
    Posts: 14415
    Help: 650
    Rate: 12369
    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 38  
    Posts: 4855
    Help: 424
    Rate: 860
    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 7  
    Posts: 38
    Rate: 3
    >>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 38  
    Posts: 4855
    Help: 424
    Rate: 860
    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
    Posts: 14415
    Help: 650
    Rate: 12369
    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 38  
    Posts: 4855
    Help: 424
    Rate: 860
    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
    Posts: 14415
    Help: 650
    Rate: 12369
    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 38  
    Posts: 4855
    Help: 424
    Rate: 860
    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
  • ADVERTISEMENT
  • #20 21643882
    divadiow
    Level 38  
    Posts: 4855
    Help: 424
    Rate: 860
    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 7  
    Posts: 38
    Rate: 3
    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
    Posts: 14415
    Help: 650
    Rate: 12369
    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.
  • #23 21643996
    bl00dy
    Level 7  
    Posts: 38
    Rate: 3
    I rewrite bootloader and successfully install OpenBK

    Added after 43 [minutes]:

    How to detect on which pins tuya RX/TX, and what speed? I have this file extracted
    Attachments:
    • lastRawDecryptedStrings.bin (71.86 KB) You must be logged in to download this attachment.
  • #24 21644098
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14415
    Help: 650
    Rate: 12369
    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 7  
    Posts: 38
    Rate: 3
    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 38  
    Posts: 4855
    Help: 424
    Rate: 860
    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 7  
    Posts: 38
    Rate: 3
    >>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
    Posts: 14415
    Help: 650
    Rate: 12369
    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 7  
    Posts: 38
    Rate: 3
    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
    Posts: 14415
    Help: 650
    Rate: 12369
    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.
Generated by the language model.

FAQ

TL;DR: Fix non‑booting BK7231N thermostats by powering through the AMS1117 and sniffing UART2; AMS1117’s dropout is 1.3 V and “connect GND to USB GND, and VIN to 5V from USB.” [Elektroda, p.kaczmarek2, post #21645096]

Why it matters: This FAQ helps tinkerers recover, configure, and integrate BK7231N-based thermostats that fail after firmware flashing.

For: DIY IoT modders flashing OpenBK/OpenBeken on BK7231N thermostats who need recovery steps, UART details, and TuyaMCU setup.

Quick Facts

Why did my BK7231N thermostat stop booting after flashing openBK7231N 1.18.157?

The unit was flashed while skipping the 00000000 key check, and no OOB image was found afterward. The device failed to boot OpenBK even after restoring the RF partition. This matches a reported brick immediately after the 1.18.157 install on a BK7231N thermostat. [Elektroda, bl00dy, post #21641272]

Can skipping the 00000000 encryption key check brick the device?

Yes. The thread opener skipped the key check with an all‑zeros key, flashed firmware, and the thermostat would not boot afterward. The system did not find an OOB partition, and restoring RF did not help. Treat zero‑key devices cautiously before flashing. [Elektroda, bl00dy, post #21641272]

How do I recover a non‑booting BK7231N after flashing?

Rewrite the bootloader, then reinstall OpenBK for BK7231N. The user reported success after rewriting the bootloader and completing a fresh OpenBK install. This restored normal boot behavior and allowed further UART investigation. [Elektroda, bl00dy, post #21643996]

Which UART carries the TuyaMCU data, and what speed should I use?

Use UART2 (TX2/RX2) wired to the external MCU, running at 38400 baud, 8‑N‑1. After recovery, the user confirmed Tuya frames on UART2 at 38400, enabling protocol analysis and integration. [Elektroda, bl00dy, post #21646032]

How can I safely power the boards to sniff traffic without mains?

Bench‑power through the AMS1117: connect USB‑UART GND to GND and feed 5 V to AMS1117 VIN. Its typical dropout is about 1.3 V, so 5 V is sufficient for a stable 3.3 V output. “Connect GND to USB GND, and VIN to 5V from USB.” [Elektroda, p.kaczmarek2, post #21645096]

I see boot logs but no MCU replies—what does that indicate?

You are on the log UART, not the TuyaMCU link, or the MCU is not responding. The factory log shows repeated “wait mcu response” retries, which signals the module is listening but not receiving UART replies from the external MCU on that port. [Elektroda, divadiow, post #21643805]

Is this a standard TuyaMCU device?

Yes, but it uses a non‑standard baud. Investigators first suspected a custom protocol, then confirmed TuyaMCU operating at 38400 baud. Configure your firmware accordingly instead of assuming 9600 or 115200. [Elektroda, p.kaczmarek2, post #21645491]

How do I set OpenBeken to match the 38400 baud TuyaMCU?

Use the OpenBeken command to set the TuyaMCU baud rate. As advised: “This might work in OBK with tuyaMcu_setBaudRate command.” After setting 38400, Tuya frames should parse correctly. [Elektroda, p.kaczmarek2, post #21645770]

What tools should I use to capture logs or UART data?

Use PuTTY, RealTerm, or similar serial terminals. Start at 115200 for logs (TX2/P0), then switch to 38400 on UART2 for TuyaMCU frames. Basic adapters like FT232RL work well for RX/TX and 5 V bench power. [Elektroda, divadiow, post #21643751]

How do I find the right RX/TX pins on this thermostat?

Trace the external MCU pins: MCU TX connects to BK UART2 RX; MCU RX connects to BK UART2 TX. The reporter verified this mapping and then observed Tuya traffic on UART2 at 38400. Label and test with a multimeter before soldering. [Elektroda, bl00dy, post #21644179]

Could Tuya’s internal install mode break my OpenBK bootloader?

Yes, it’s an edge case. Enabling the internal Tuya install mode (power‑off + long “M” press) caused loss of OpenBK boot and Wi‑Fi on the recovered unit. Avoid triggering vendor OTA modes after custom flashing. [Elektroda, bl00dy, post #21647542]

Do you have a quick three‑step method to sniff TuyaMCU packets safely?

  1. Connect USB‑UART GND to board GND; feed 5 V to AMS1117 VIN.
  2. Wire RX to UART2 TX and TX to UART2 RX.
  3. Open terminal at 38400‑8‑N‑1 and capture both directions. [Elektroda, p.kaczmarek2, post #21645096]

What dpIDs and features does this thermostat expose?

It reports a rich schema: switch, mode, set/current temperature, limits, child lock, valve state, calibration, timers, and model string (e.g., R9Lite). dpIDs include 1, 2, 10, 16, 24, 31, 36, 101–116 among others. [Elektroda, divadiow, post #21645455]

What is OpenBeken in this context?

OpenBeken (OpenBK) is the custom firmware flashed to BK7231N. In this case, the user restored operation by rewriting the bootloader, then installing OpenBK to regain control and enable UART analysis. [Elektroda, bl00dy, post #21643996]

What is TuyaMCU and how do I know it’s active?

TuyaMCU is the serial protocol between the Wi‑Fi module and the thermostat’s MCU. You’ll see Tuya frames (e.g., 55 AA …) on UART2. The capture shows classic Tuya request/response exchanges once the correct baud and pins are used. [Elektroda, bl00dy, post #21645412]

What voltages does the on‑board AMS1117 see, and is 5 V OK?

Measured VIN was about 12 V in‑device, but 5 V at VIN is fine on the bench. With ≈1.3 V dropout, AMS1117 delivers a stable 3.3 V from a 5 V USB source for safe sniffing. [Elektroda, p.kaczmarek2, post #21645177]
Generated by the language model.
ADVERTISEMENT