Skip to content

[beken-72xx] Support BK7238#360

Draft
kuba2k2 wants to merge 8 commits intomasterfrom
feature/bk7238
Draft

[beken-72xx] Support BK7238#360
kuba2k2 wants to merge 8 commits intomasterfrom
feature/bk7238

Conversation

@kuba2k2
Copy link
Copy Markdown
Member

@kuba2k2 kuba2k2 commented Feb 7, 2026

This PR adds support for BK7238. It requires BDK 3.0.78 to function.

@kuba2k2 kuba2k2 added enhancement New feature or request new platform About support for new chips/platforms BK7231 Beken BK72xx family labels Feb 7, 2026
@kuba2k2 kuba2k2 mentioned this pull request Feb 7, 2026
@kuba2k2 kuba2k2 closed this Mar 29, 2026
@kuba2k2 kuba2k2 reopened this Mar 29, 2026
@kuba2k2
Copy link
Copy Markdown
Member Author

kuba2k2 commented Apr 8, 2026

BK7238 should already be supported in this PR.

To use in ESPHome, put this in your YAML:

bk72xx:
  board: generic-bk7238-tuya # use this if you have a Tuya device, remove "-tuya" suffix if you don't (unlikely)
  family: BK7231N # workaround for ESPHome not knowing what a BK7238 is, doesn't cause any problems
  framework: 
    version: 0.0.0
    source: https://github.com/libretiny-eu/libretiny#feature/bk7238

esphome:
  platformio_options:
    custom_versions.beken-bdk: 3.0.78

Note that there are some problems in ESPHome 2026.3.x which make it harder to compile with BDK 3.0.78 (required for BK7238). If having issues, try ESPHome 2026.2.x instead.

The most important difference between BK7231 and BK7238 (on Tuya devices) is the OTA protocol - it has been implemented, but everyone is welcome to test and report if it works correctly.

@drwormy
Copy link
Copy Markdown

drwormy commented Apr 9, 2026

Thanks!! It needed ESPhome 2026.2.0, and i needed to flash with BK7231EasyUARTFlasher (using esphome with run command couldnt find the device in bootloader mode).

Through lots of trial and error the .rbl file worked when custom flashed with an offset of 0x11000

Now the raw device turns up in HA!

@christopherwit
Copy link
Copy Markdown

Thanks for all your hard work! I tried my best to get through the compiler. Used bare config as mentioned above. And tried esphome versions 2026.2.4 and 2026.2.0 as mentioned by drwormy. Logfile of freertos related error is attached as I wasn't able to post it in decent formatted code block.
logs_ssw2_compile.txt. I'm lacking knowledge to fix this, but am very open to test instructions.

@kuba2k2
Copy link
Copy Markdown
Member Author

kuba2k2 commented Apr 13, 2026

Not sure what that's about... however, try clearing PlatformIO cache (~/.platformio/packages). Sometimes the wrong versions of some packages are left there. Also try deleting all instances of LibreTiny in ~/.platformio/platforms/libretiny.

@drwormy
Copy link
Copy Markdown

drwormy commented Apr 13, 2026

I was careful to also use an older version of Python - 3.12.10.

And work in a venv

@dext0r
Copy link
Copy Markdown

dext0r commented Apr 14, 2026

Flashed some Tuya relay on T1-2S-NL with no problem (simple esphome run). OTA also works. Great work!

python 3.13.5, esphome 2026.2.4

I: Connecting to 'Beken 72xx' on /dev/tty.usbserial-140 @ 115200
W: Unknown bootloader CRC - 0xF42F8C32 - please report this on GitHub issues!
I: |-- Success! Chip info: BK7238
I: Reading chip info...
I: Chip: BK7238
I: +-----------------------+-------------------------------------+
I: | Name                  | Value                               |
I: +-----------------------+-------------------------------------+
I: | Protocol Type         | FULL                                |
I: | Chip Type             | BK7238                              |
I: | Bootloader Type       | Unrecognized                        |
I: | Chip ID               | 0x7238                              |
I: | Boot Version String   | N/A                                 |
I: |                       |                                     |
I: | Flash ID              | 85 20 15                            |
I: | Flash Size (by ID)    | 2 MiB                               |
I: | Flash Size (detected) | 2 MiB                               |
I: |                       |                                     |
I: | Encryption Key        | 00f57700 00f57700 00f57700 00f57700 |
I: +-----------------------+-------------------------------------+

@christopherwit
Copy link
Copy Markdown

Not sure what that's about... however, try clearing PlatformIO cache (~/.platformio/packages). Sometimes the wrong versions of some packages are left there. Also try deleting all instances of LibreTiny in ~/.platformio/platforms/libretiny.

As of your recommendations I did both, but most likely deleting all LibreTiny versions did the trick.
It is now working on a T1-S2-NL (LSC 3202087.1 powerplug). Your work is much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BK7231 Beken BK72xx family enhancement New feature or request new platform About support for new chips/platforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants