tuya-cloudcutter / bk7231tools

This is a collection of tools to interact with and analyze artifacts for BK7231 MCUs
MIT License
38 stars 6 forks source link

Problems with writing flash on Baleon #19

Closed mobrembski closed 1 year ago

mobrembski commented 1 year ago

Hi!

I had an old Baleon chip (BL2028N) which is compatible with Beken. However, when i try to flash firmware, it shows me this error:

bk7231tools write_flash -b 1500000 -d /dev/ttyUSB0 -s 0x11000 -S 0 ../libretiny-esphome/.esphome/build/socket-bkdebug/.pioenvs/socket-bkdebug/raw_firmware.bin
Connected! Chip info: 0x7231c / Flash ID: eb 60 15 / Protocol: FULL
Writing 826400 bytes to 0x11000
Trying to unprotect flash memory...
Traceback (most recent call last):
  File "/home/byku/.local/bin/bk7231tools", line 8, in <module>
    sys.exit(cli())
  File "/home/byku/.local/lib/python3.10/site-packages/bk7231tools/__main__.py", line 481, in cli
    args.handler(device, args)
  File "/home/byku/.local/lib/python3.10/site-packages/bk7231tools/__main__.py", line 356, in write_flash
    for _ in device.program_flash(
  File "/home/byku/.local/lib/python3.10/site-packages/bk7231tools/serial/__init__.py", line 89, in program_flash
    self.flash_unprotect()
  File "/home/byku/.local/lib/python3.10/site-packages/bk7231tools/serial/cmd_flash.py", line 203, in flash_unprotect
    self.flash_write_sr(sr, size=sr_size)
  File "/home/byku/.local/lib/python3.10/site-packages/bk7231tools/serial/cmd_flash.py", line 172, in flash_write_sr
    raise RuntimeError(
RuntimeError: Writing Status Register failed: wrote 0x0000, got 0x0001

As you might see, chip_info works OK, also read_flash. Just writing

kuba2k2 commented 1 year ago

Hi, I've just released v1.3.4 which should fix this issue. It will be available in a few moments, could you check if it works?

mobrembski commented 1 year ago

Hi, I've just released v1.3.4 which should fix this issue. It will be available in a few moments, could you check if it works?

Just checked, but it didnt fix the issue :(

kuba2k2 commented 1 year ago

GitHub Actions didn't work, it didn't publish. It should be on PyPI right now. Also, make sure that v1.3.4 is actually what you're running.

mobrembski commented 1 year ago

Yes, it's all good! Thanks! :+1: