Closed fabiodl closed 2 years ago
Sorry I got so busy recently. I will take a look.
Thank you! let me know if you need other binaries that fail.
The problem is likely with the erase command. It only erases 8 KB. The length needs to be adjusted to the size of the firmware being flashed.
The 0x08 is the size. Change it to 0x10, and it should work. ERASE_CHIP_CMD_V2 = [0xa4, 0x01, 0x00, 0x08]
Thanks, that seems to fix the issue!
Latest original software pass sizes in 32 bits also. For my 192kb chip erase original soft send : [0xA4, 0x04, 0x00, 0xC0, 0x00, 0x00, 0x00] 0xA4 - erase 0x0004 - command payload size = 4 byte = 32 bit 0x000000c0 = 192 = so 192 1k pages to erase
Indeed. I've also used 4 bytes for that command, even on a CH551 with a 2.3.1 bootloader. I think the bootloader is too small to have extra checks.
The problem is likely with the erase command. It only erases 8 KB. The length needs to be adjusted to the size of the firmware being flashed.
The 0x08 is the size. Change it to 0x10, and it should work. ERASE_CHIP_CMD_V2 = [0xa4, 0x01, 0x00, 0x08]
See that... I should really fix it. Welcome PR for that :p
Sorry, your latest commit has wrong divisor for erase size calculation !
erase_size = math.ceil(binary_size/0x1000) & 0xff but should be : / 1024 or / 0x400 because it is in 1k pages
In several projects, the tool works flawlessly for small files. Once I reach a certain size, it stars giving this kind of error
`python3 -m ch55xtool -f build/fat32.bin -r
Found CH559.
BTVER: V2.40.
Failed to verify firmware of CH55x.`
I attach a CH559 binary file that fails. In all the cases, the official programmer works.
fat32.zip