-
Notifications
You must be signed in to change notification settings - Fork 24
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
Enhance all the things! :) #22
Conversation
It tries to check the payload size before it has a payload. Move it after. Fixes: 2bd501c Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Not entirely useful perhaps, but a useful cleanup if you are going to do more in this project. Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Use namedtuples to make it a bit easier than raw hand maintained dicts. Signed-off-by: Karl Palsson <karlp@tweak.net.au>
This is sufficient to detect and report bootloader version. Flashing as yet untested. Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Sufficient to report part number and bootloader version. Have not tested flashing, as I don't (yet) want to risk my only wch-link. On the ch32v307-r1-1v0 board, (the black eval board) you can short the J1 pads on the wch-link section to enter bootloader mode. Signed-off-by: Karl Palsson <karlp@tweak.net.au>
appears to have introduced a new send key command, and the checksum calculation is based off 8 bytes of the read config response (instead of the previous 4 bytes).
…d file, provided the `CH55X_IC_REF` entry for the device has a key: `erase_required_pages` with the value of True Tested-by: Karl Palsson <karlp@tweak.net.au> Reviewed-by: Karl Palsson <karlp@tweak.net.au> I've (karlp) actually pretty heavily modified this, to be basically equivalent to what was already introduced in 2bd501c via MarsTechHAN#17
My CH32V103 with bootloader 2.60 needs an empty WRITE_CMD_V2 command after the payload has been uploaded: Without this the verify will fail immediately. My CH579 device with bootloader 2.7 will fail with this empty write. I'm not sure if this write is needed for bootloader 2.60 only, or if its needed for all CH32V103 devices. Err'ing on the latter for now.
Bootloader version 2.60, appears to need the same dummy write. Still not enough to say anything conclusive, perhaps it's actually a "riscv" vs "arm" vs "8051"? Existing code implies that ARM CH579 _didn't_ want this, but RISCV CH32v103 and CH32v307 both do. 8051 cores never needed this either. See also comments on: cddc995 Signed-off-by: Karl Palsson <karlp@tweak.net.au>
I like some of the refactoring that was done in #21, but it does allll of it in a single big commit, so it's hard to pull in pieces of it. I've tried to make less structural changes up front while expanding functionality, though some structural overhauls do feel in order to grow this moving forward. Thanks so much for having this base line functionality "just working" though! |
For what its worth, for my changes that were incorporated into this, I had successfully tested them on the following devices:
|
hrm, I failed to get ch582m btver 2.40 toprogram in my fork today, either with or without the dummy extra write. I'll have to try your original code, see if that works for me and if I've got somethign wrong. |
@karlp Is it failing on the first write, or does everything appear successful but the firmware doesn't execute? If its failing after the first write, it may be because the "Enable sumilat interface" was enabled via WCH ISP Tool. |
@karlp I think 2.4 needs the 8 byte checksum instead of 4 byte. Changing that has made it able to flash my CH549F on BTVER 02.40. |
USB traffic from a patched WCH ISP Tool programming a CH549F with BTVER 02.40:
|
Will do. I'm also going to recheck with the ch32v307 board, but I ran out of time last night. It's failing immediately, not in the verify stage, but I really ran out of time. I managed to flash it using the wch-link and the binary openocd in the MounRiver toolkit. |
@pablomarx and @karlp please give a try for #21 |
Hi, thanks for all the work! I was bringing up my CH32V307 board and was very happy to find this PR here. I managed to get the PR to work with my board, but had to make two changes: In case it's relevant, the bootloader version on my chip is also V2.60 |
@arturo182 it's nice to hear and could you do small favor:
|
Thanks, I will check it out later today and let you know. BTW I'm a part of an unofficial WCH Discord server that also has a WCH employee there, in case you want to ask questions. Here's the server: https://discord.gg/2prGQmA3ez And here's a note from him regarding this issue: (UUID is the chk_sum) |
@arturo182 I got stuff working here, but @Pe3ucTop 's branch has more and goes further, it's more likely to be the "future" code at least |
I see, I thought this one was more relevant because it was newer. But I'll check out that one then :) |
It's only newer by a couple of days iirc, and the other person seems to be more motivated in adding all the rest of it, I was just poking this enough to try and get things running :) I needed some other parts that their branch didn't address, but it's now been updated as the superset of all. |
A series of commits, pulled from both @pablomarx as well as my own code, that does...
I've tried to split these commits as well as possible, but I do realize this is a wide ranging commit. The commits from @pablomarx I've taken at face value, but without them, my ch32v307 with bootloader v2.60 didn't work.
Unfortunately I have not explicitly tested this with any of the more "traditional" parts (yet) I simply don't have enough test devices for that.