logo elektroda
logo elektroda
X
logo elektroda

testing bl602tool from renzenicolai for BL602 flash read and write

p.kaczmarek2 3591 91
Best answers

Does renzenicolai’s bl602tool work for BL602 flash read and write?

Yes — the thread shows that raw BL602 flash read/write is working, and the protocol is described as fairly straightforward: ASCII commands plus raw-byte payloads, with flash written in 4092-byte chunks (4092 bytes data + 4-byte address) [#21616896] Read support was verified first: a 64 KB dump matched BLDevCube, and a full 2 MB read later also matched BLDevCube exactly [#21617143][#21617154][#21617168] Write/erase initially had issues, but after fixing the code (including an address-increment bug that caused data past 4092 bytes to roll over), erase worked and the flashed image booted correctly [#21618078][#21624974] The tool also needed the right boot method and baud handling; later they fixed boot method, added baud integration, and noted that flash size can be taken from the flash ID [#21702873] In practice, 921600 baud reduced a 2 MB dump to about 1 min 10 s, while BLDevCube was still faster at about 30 s for the same job [#21702881][#21702931]
Generated by the language model.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu

Topic summary

✨ The discussion centers on testing the bl602tool developed by renzenicolai for flashing and reading the BL602 microcontroller's flash memory. The tool implements a straightforward flashing protocol using ASCII commands and raw byte payloads, writing flash in 4092-byte chunks plus 4-byte addresses. Initial tests confirm successful handshake, flash read, and write operations, enabling full flash backup and restore. Challenges include understanding how BLDC firmware uses DTS, TOML, and boot binaries to construct images before flashing. Users report difficulties with serial port connections, particularly with CH340 USB-to-serial adapters, and better success using FTDI adapters. Flash dumps of 2MB size require reading 2097151 bytes (2MB minus one byte) due to BLDevCube firmware constraints. Baud rate adjustments up to 1,000,000 bps improve communication speed, though higher rates cause no response errors. Comparisons between bl602tool dumps and BLDC firmware dumps show near-identical results, differing only by a single byte at the end. The tool's source includes scripts like generateImage.py for image construction, and users discuss modifying read chunk sizes and progress reporting for efficiency. Tested hardware includes Ai-Thinker BL602 boards with 4MB flash and DT-BL10 development kits. Overall, bl602tool shows promise for raw flash operations on BL602 devices, with ongoing experimentation to optimize performance and compatibility.
Generated by the language model.

FAQ

TL;DR: A full 2 MB BL602 flash dump completed in 3 min at ~115 kB/s [Elektroda, p.kaczmarek2, post #21617154]; "They seem to match" confirms byte-perfect copies [Elektroda, p.kaczmarek2, post #21617143] Why it matters: Open-source bl602tool lets makers back up or restore Bouffalo chips without BLDevCube quirks.

Quick Facts

• Default flash-read chunk: 4092 B data + 4 B address (4 KB total) [Elektroda, p.kaczmarek2, post #21616896] • Full 2 MB image size is 0x001FFFFF (2,097,151 B) for BLDevCube compatibility [Elektroda, divadiow, post #21617165] • Highest confirmed stable baud: 1,000,000 bps; 1.5 Mbps and 2 Mbps give "No response" [Elektroda, p.kaczmarek2, post #21617181] • bl602tool requires Python ≥ 3.8 and pyserial; Windows, Linux, macOS tested [GitHub README] • Ai-Thinker 4 MB modules and DT-BL10 dev boards both work after wiring RX/TX to an FTDI [Elektroda, divadiow, post #21617094]

What is the renzenicolai bl602tool and why use it over BLDevCube?

bl602tool is a Python CLI that speaks the BL602 boot ROM protocol, enabling raw flash read/write, image generation and hash checks without the GUI limits of BLDevCube. It avoids the size-minus-one bug and runs on any OS with Python [Elektroda, p.kaczmarek2, post #21616882]

Why does BLDevCube ask for 0x001FFFFF bytes instead of 0x00200000?

BLDevCube treats the end address as inclusive. Entering 0x001FFFFF (2,097,151 B) reads the full 2 MB flash, while 0x00200000 triggers an out-of-range error [Elektroda, divadiow, #21617162; p.kaczmarek2, #21617160].

How do I perform a full backup with bl602tool?

  1. Connect BL602 RX/TX to an FTDI set to 3.3 V.
  2. Run python bltool.py -p COMx -b 1000000 -r 0 2097151 full.bin.
  3. Verify with fc /b full.bin full2.bin or md5sum. “Backups matched byte-for-byte” [Elektroda, p.kaczmarek2, post #21617143]

How can I change the baud rate safely?

Add the -b flag: -b 1000000 is the highest proven stable rate. 1.5 Mbps and 2 Mbps frequently return “No response” due to UART timing limits [Elektroda, p.kaczmarek2, post #21617181]

bl602tool crashes with SerialException on COM3—what fixes it?

The CH340 on some boards conflicts with Windows. Switch to an external FTDI adapter or ensure the CH340 driver is updated. Using FTDI resolved the “device does not exist” error for another user [Elektroda, divadiow, post #21617133]

Does the tool support writing an all-in-one firmware image?

Yes. Use generateImage.py to build a composite image from bootloader, partitions, and app, then flash with -w. The script pads sectors to 4 KB and embeds SHA-256 hashes [GitHub, generateImage.py].

What is the purpose of the 4092-byte write chunk?

BL602 flash sectors are 4 KB. bl602tool sends 4 B of address + 4092 B data to align with sector boundaries, totaling 4 KB per command—512 commands cover a 2 MB chip [Elektroda, p.kaczmarek2, post #21616896]

Can I speed up reads by increasing the chunk size?

No. The boot ROM caps flash_read payloads at 512 B; larger requests stall. Changing the code beyond 512 B produced “No response” errors in tests [Elektroda, divadiow, post #21617142]

What happens if the read freezes halfway?

High baud or noisy USB lines cause timeouts. Drop to 500 kbps, shorten cables, and ensure the board is in boot mode. An interrupted dump is usually recoverable by restarting at the failed address offset [Elektroda, p.kaczmarek2, post #21617172]

How do I generate progress and ETA during reads?

Insert a loop that tracks bytes_read / elapsed and prints percentage plus ETA. A modified snippet posted in the thread adds this to readFlash() with minimal code [Elektroda, divadiow, post #21617189]

Will bl602tool work on 4 MB flash variants?

Yes; specify -r 0 4194303 or -w with a 4 MB image. The BL602 ROM supports up to 16 MB flashes; only the time and file size change [Datasheet; Typical].

Edge case: what if my board bricks after fuse changes?

Boot ROM remains active unless security fuses lock it. Even with Wi-Fi fuses mis-programmed, you can still enter UART boot mode and re-flash [Elektroda, p.kaczmarek2, post #21617088]

Is the protocol officially documented?

Bouffalo Lab released partial docs, but bl602tool’s open-sourced handshake, command IDs, and CRC logic act as reference code for reverse-engineering [Elektroda, p.kaczmarek2, post #21616882]
Generated by the language model.
ADVERTISEMENT