Closed toyoshim closed 3 years ago
I'm quickly looking the source, and find that device_erase_size
is set to 0x1d for CH559.
Is this the block count to erase flash ROM before writing new firmware?
Block size is 1024, and 1024 * 0x1d = 29696.
So, it can explain why writing starts failing when file size gets over around 30kB.
OK, I can fix the issue by setting it to 60 for CH559. I can send a pull request.
I have put all the flash related definitions into a dictionary, will be much easier to make changes and add more supported MCUs. Tested the code with: CH551, bt. v1.1 CH552, bt. v2.4 CH552, bt. v2.3 CH559, bt. v2.3 All passed using various bin file lengths. Also added a script installing the udev rules on linux. Hope everything works fine. Closing the issue.
It worked really fine, but once the file size gets over around 30kB, it starts failing on verification step. I confirmed that the official tool can write the same binary without any error. Also, the verification error is real. When I see this error, the device doesn't run correctly.
Here is a log.