Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BK7231Q WA2 Module effettive support #249

Open
dianlight opened this issue Jan 30, 2024 · 1 comment
Open

BK7231Q WA2 Module effettive support #249

dianlight opened this issue Jan 30, 2024 · 1 comment

Comments

@dianlight
Copy link

I have in my hands 3 no-name Tuya switches equipped with the WA2 module on which I can't actually find any information.
I anticipate that all the systems for reading or writing the flash have not worked. I tried with "cloudcutter" until soldering but it never seems to respond.

Let me start by saying that I have about 20 conversions from Tuya to ESPHome done with various modules and systems and this is the first time I have come across this type of module and I am stuck with it.

The module is the WA2 equipped with a BK BK7231Q referenced as Tuya but not present on tuya site :(

I haven't found many references online on libretiny that the card exists as supported while on the only forums I've found it seems that some are able to flash but without ever making it work.

Ref: https://www.elektroda.com/rtvforum/topic3929272.html
Ref: https://community.home-assistant.io/t/unkown-tuya-chip/153591/17

I'm on the first step... flashing! :(

All my attempts have failed and my doubt is that the bootloader is actually not usable and requires flashing via direct SPI.

Before doing so, however, I would like to understand if the module is actually supported and has anyone managed to use it or not. (in the second case I suggest inserting the note for posterity in the documentation! :) )

Every test with every system result always with the same result:

➜ Firmwares > ltchiptool flash read BK7231Q wifi-switch-module_tiya_orgfw.bin -d /dev/cu.usbserial-0001
I: Connecting to 'Beken 7231Q' on /dev/cu.usbserial-0001 @ 115200
I: Connect UART1 of the BK7231 to the USB-TTL adapter:
I:
I:     --------+        +------------------------
I:          PC |        | BK7231
I:     --------+        +------------------------
I:          RX | ------ | TX1 (GPIO11 / P11)
I:          TX | ------ | RX1 (GPIO10 / P10)
I:         RTS | ------ | CEN (or RST, optional)
I:             |        |
I:         GND | ------ | GND
I:     --------+        +------------------------
I:
I: Make sure to use a good 3.3V power supply, otherwise the adapter might
I: lose power during chip reset. Usually, the adapter's power regulator
I: is not enough and an external power supply is needed (like AMS1117).
I:
I: If you didn't connect RTS to CEN, after running the command you have
I: around 20 seconds to reset the chip manually. In order to do that,
I: you need to bridge CEN to GND with a wire.
E: TimeoutError: Timed out attempting to link with chip
E: |-- File "**/Library/Python/3.9/lib/python/site-packages/bk7231tools/serial/__init__.py", line 42, in connect

or

➜  Firmwares > ltchiptool flash read BK7231Q wifi-switch-module_tiya_orgfw.bin -d /dev/cu.usbserial-0001
I: Connecting to 'Beken 7231Q' on /dev/cu.usbserial-0001 @ 115200
I: Connect UART1 of the BK7231 to the USB-TTL adapter:
I:
I:     --------+        +------------------------
I:          PC |        | BK7231
I:     --------+        +------------------------
I:          RX | ------ | TX1 (GPIO11 / P11)
I:          TX | ------ | RX1 (GPIO10 / P10)
I:         RTS | ------ | CEN (or RST, optional)
I:             |        |
I:         GND | ------ | GND
I:     --------+        +------------------------
I:
I: Make sure to use a good 3.3V power supply, otherwise the adapter might
I: lose power during chip reset. Usually, the adapter's power regulator
I: is not enough and an external power supply is needed (like AMS1117).
I:
I: If you didn't connect RTS to CEN, after running the command you have
I: around 20 seconds to reset the chip manually. In order to do that,
I: you need to bridge CEN to GND with a wire.
E: ValueError: No response received
E: |-- File "/**/Library/Python/3.9/lib/python/site-packages/bk7231tools/serial/protocol.py", line 210, in command
➜  Firmwares > ltchiptool flash read BK7231Q wifi-switch-module_tiya_orgfw.bin -d /dev/cu.usbserial-0001
I: Connecting to 'Beken 7231Q' on /dev/cu.usbserial-0001 @ 115200
E: ValueError: No response received
E: |-- File "/**/Library/Python/3.9/lib/python/site-packages/bk7231tools/serial/protocol.py", line 210, in command

I'have already try to use a banch power supply to power the module.

L.

@kuba2k2
Copy link
Member

kuba2k2 commented Jan 30, 2024

BK7231Q is the oldest Beken chip, and is currently unsupported:
https://docs.libretiny.eu/docs/status/supported/#feature-support

The Beken "FreeRTOS BDK", which is the (formerly public) SDK used for BK7231T and N chips does only support T and N chips. BK7231Q support would require finding another SDK and writing another LibreTiny core from scratch.

Additionally, the bootloader is buggy and doesn't unprotect flash properly. Linking with the chip requires a power-cycle most of the times.

My post in the mentioned thread:
https://www.elektroda.com/rtvforum/viewtopic.php?p=20624538#20624538

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants