Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CH554 programming error ... #2

Open
RandoSY opened this issue Feb 9, 2020 · 4 comments
Open

CH554 programming error ... #2

RandoSY opened this issue Feb 9, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@RandoSY
Copy link

RandoSY commented Feb 9, 2020

Howdy!

Just experiment with the ch552 this morning ...

lsusb returns

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 003: ID 7392:a812 Edimax Technology Co., Ltd
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 002: ID 04f2:1825 Chicony Electronics Co., Ltd
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 015: ID 04e8:3315 Samsung Electronics Co., Ltd ML-2540 Series Laser Printer
Bus 001 Device 034: ID 4348:55e0 WinChipHead
Bus 001 Device 026: ID 239a:8019
Bus 001 Device 004: ID 0bda:0181 Realtek Semiconductor Corp.
Bus 001 Device 002: ID 058f:6254 Alcor Micro Corp. USB Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

I can see WinChipHead ...

Got this error, when I attempted to flash ...

rasyoung@vic2016:~/code_test/8051/wch/ch554_sdcc/examples/blink$ sudo python ch55xtool.py --file blink.hex
Found CH554.
BTVER: V2.31.

Traceback (most recent call last):
File "ch55xtool.py", line 337, in
__main()
File "ch55xtool.py", line 314, in __main
ret = __write_flash_ch55x_v23(dev, chk_sum, payload)
File "ch55xtool.py", line 143, in __write_flash_ch55x_v23
payload = payload + [0] * ((math.ceil(len(payload) / 56) * 56) - len(payload)) # Payload needs to be padded, 56 is a good number
TypeError: can't multiply sequence by non-int of type 'float'

I notice in the hex file ... the first lines are "short"

:03000000020006F5
:03005F0002000399
:0300030002006296
:1000620012007C53930CAF92747F5FF5924393809E
:100072009000641200A4B29780F675A15575A1AAEA
:1000820074F855B94405F5B975A10022AE82AF8363

It reports the correct chip type and bootloader version. Wondered if you know what was the issue?

Thanks for posting this code!

Randy

@ishiyakazuo
Copy link
Contributor

Are you sure this can be used to program an Intel HEX file? It mentions bin in the readme...
(Actually, I'm also having a different problem with this tool, where it says it's programmed but the chip isn't happy afterwards. I've used this same code on chips with earlier bootloaders without a problem, so I'm inclined to think that it's this tool doing something, but I'm not sure what, yet... I found this while I was looking to see if it was expecting a .hex file)

@ishiyakazuo
Copy link
Contributor

Just a quick update -- I was able to get it to work with a binary file in my case, but not hex. (It could've been my hex file, but I think the answer is that flashing a bin file is the "safe" solution for now.)
I didn't have a CH554 on hand (nor CH552) with bootloader 2.3.1 -- I used CH551. It didn't work immediately with CH551, but I patched it to fix the issue I was running into. If you try a bin file and it still doesn't work, you might want to try my fork and see if that resolves it. I can't say for sure that my workaround doesn't break anything other than CH551 and CH552.

@MarsTechHAN
Copy link
Owner

This does not working with hex, I might gonna to add it (and check file name suffix)later

hmmm... I dont have older CH55x on my hand :( , so if @ishiyakazuo test it works, that will be nice.

@MarsTechHAN MarsTechHAN added the enhancement New feature or request label Mar 23, 2020
@ishiyakazuo
Copy link
Contributor

I have some CH55x with bootloader 2.3.1 still, if this is needed.

BBBSnowball added a commit to BBBSnowball/ch55xtool that referenced this issue May 14, 2021
Most flashing tools want hex files so this is an easy mistake to make. Conversion with objcopy is trivial so we don't have to add support for hex. However, we should at least warn the user. The README is quite clear about that but I had only looked at `--help`.

It seems that I'm not the only who made this mistake: MarsTechHAN#2
BBBSnowball added a commit to BBBSnowball/ch55xtool that referenced this issue May 14, 2021
Most flashing tools want hex files so this is an easy mistake to make. Conversion with objcopy is trivial so we don't have to add support for hex. However, we should at least warn the user. The README is quite clear about that but I had only looked at `--help`.

It seems that I'm not the only who made this mistake: MarsTechHAN#2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants