Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamI'm getting an error trying to flash my WB2S board via UART. I can read the firmware just fine and also erase, but writing it fails with an error. This is the log output:
All selected sectors erased!
Going to do erase, start 1970176, sec count 1!
Erasing sector 1970176... ok!
All selected sectors erased!
failed with serial.BytesToRead 0 (expected 15)
The beginning of buffer in UART contains data.
Writing sector 0x11000... Writing sector 69632 failed!
Writing file data to chip failed.
Your WB2S is most likely not failing because of a bad flash offset or a dead flash sector. The log indicates a write-phase UART timeout: the tool sends the first application block at 0x11000 and then never receives the expected bootloader ACK. On WB2S, 0x11000 is the normal app start address for BK7231T, so failing there usually means power instability, UART signal integrity, wrong chip/file selection, or tool/baud-rate issues rather than a defective sector. (docs.libretiny.eu)
Most likely fixes, in order:
The important clue in your log is this sequence:
serial.BytesToRead 0 (expected 15)That means the ROM/download loader link is good enough to establish communication and accept erase/read commands, but during the first real data program transaction the chip stops replying. That specific address is significant because for WB2S/BK7231T, the application partition begins at 0x011000, so this is simply the first application write, not an unusual location. (docs.libretiny.eu)
From an electronics perspective, flash program operations are much more demanding than reads. During programming, the flash circuitry and internal charge-pump activity produce transient current demand and tighter timing requirements. If your 3.3 V rail dips briefly, the BK7231T can reset or fall out of download mode before it sends the expected response frame. LibreTiny’s BK72xx documentation explicitly warns that most flashing problems are caused by voltage drops during intensive flash operations or bad/loose wires, and also notes that the UART adapter’s 3.3 V regulator is usually not enough. (docs.libretiny.eu)
There is another BK7231T-specific behavior that matches your failure pattern: BK7231T exits download mode when it cannot communicate with the flasher. So if one block is corrupted on the wire, or the device browns out briefly, the bootloader session can collapse immediately and the PC then sees exactly what your tool reports: no ACK bytes returned. (docs.libretiny.eu)
The UART side also matters. WB2S flashing is done on UART1, using P10/RX1 and P11/TX1. The same UART may also be connected to external circuitry such as a TuyaMCU or other host electronics in the product. That means in-circuit flashing can be electrically “good enough” for read/erase yet marginal for sustained writes if another device loads the lines, injects traffic, or distorts edges. This is an engineering inference supported by the platform documentation stating that UART1 is used both for flashing and for external components. (docs.libretiny.eu)
The chip/file selection must also be correct. WB2S is documented as a BK7231T module with 2 MiB flash, and the normal app partition starts at 0x11000. If the tool is told BK7231N instead of BK7231T, or if you feed it the wrong binary type, write attempts can fail even though basic serial linking still works. LibreTiny’s flashing guide also states that choosing the wrong family typically makes the process fail rather than magically succeed. (docs.libretiny.eu)
As of March 22, 2026, BK7231GUIFlashTool build 293 is the current published release on GitHub, and the project describes itself as the replacement for older tools such as bkWriter 1.60 and hid_download_py. The same project also explicitly says that changing the baud rate can help, and that sometimes a higher or lower baud works better depending on the setup. (github.com)
A second actively maintained option is ltchiptool, which supports BK7231 devices through both GUI and CLI. Its current documentation emphasizes:
-b,Tuya also provides an official UART download tool (tyutool). Its documentation shows a default baud of 115200 in the GUI flow, while CLI examples may use much higher rates for some chips. In practice, for a marginal WB2S setup, starting low is the safer engineering choice. (github.com)
Read and erase transactions are often more tolerant of:
Write is the first stage where all of these are stressed simultaneously:
For WB2S/BK7231T, the documented memory map places:
So your failure at 69632 decimal = 0x11000 is exactly where a normal application write begins. That strongly suggests the issue is transport/power related, not “sector 0x11000 is bad.” (docs.libretiny.eu)
A USB-UART bridge may enumerate and pass serial data perfectly while still being a poor power source. The 3.3 V pin on many adapters is meant for light loads and often has weak transient performance. For flashing Beken/Tuya modules, the documentation recommends a good stable 3.3 V source, specifically noting that the adapter regulator is usually insufficient. (docs.libretiny.eu)
At UART flash rates, long Dupont leads act as:
A second ground lead reduces loop impedance and improves return current paths. Short twisted pairs or at least short direct wiring reduce susceptibility to edge distortion. The exact-error Q&A for your symptom specifically recommends short leads and even a second ground wire. (elektroda.com)
If this WB2S is inside a mains-powered switch, plug, or relay product, reflashing can affect:
Also, if you erase vendor firmware before verifying your custom image and recovery path, you can make the product unusable. LibreTiny recommends dumping stock firmware first, which is good engineering practice for traceability and rollback. (docs.libretiny.eu)
Use external 3.3 V power
Add local decoupling
Reduce baud
Verify wiring
Keep wires short
Check tool and image
Try a newer tool
If the module is still in-circuit
That sequence separates:
A practical approach is to use Write flash, choose the firmware file, and let the tool auto-detect file type and offset. The docs state this avoids manual offset mistakes and reduces the chance of overwriting the wrong region. (docs.libretiny.eu)
If this still fails after the checklist above, the next useful steps are:
.bin, .rbl, .uf2, or .crc files. (docs.libretiny.eu)Your error is most consistent with a write-time loss of bootloader communication, not a mysterious bad block at 0x11000. On WB2S/BK7231T, 0x11000 is the normal app start, and the chip is known to be sensitive to weak 3.3 V power, marginal UART wiring, and download-mode dropouts during flashing. The highest-probability fix is:
If you want, send me:
and I can give you a much more targeted, tool-specific recovery procedure.