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

[upload] Error 3221225477 #51

Closed
LovelyA72 opened this issue Feb 24, 2024 · 7 comments
Closed

[upload] Error 3221225477 #51

LovelyA72 opened this issue Feb 24, 2024 · 7 comments

Comments

@LovelyA72
Copy link

LovelyA72 commented Feb 24, 2024

I am not able to upload a fresh project to my CH32V307VCT6 board

Context: 3221225477 in Windows is 0xC0000005 error which is an access violation error. Which means that the uploader hard crashed during the upload process.

my config:

[env:uno]
platform = https://github.com/Community-PIO-CH32V/platform-ch32v.git
board = genericCH32V307VCT6 
framework = arduino

upload log (partial):

Configuring upload protocol...
AVAILABLE: isp, minichlink, wch-link
CURRENT: upload_protocol = wch-link
Uploading .pio\build\uno\firmware.elf
Open On-Chip Debugger 0.11.0+dev-02415-gfad123a16-dirty (2023-09-22-10:36)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

Warn : Transport "sdi" was already selected
Ready for Remote Connections
*** [upload] Error 3221225477
@maxgerhardt
Copy link
Member

I have seen OpenOCD crash when an WCH-Link was used that was not in RISC-V mode, or had the latest firmware installed on it via the MounRiver IDE.

Can you show a screenshot of the device manager with "View -> Device By Container" of your WCH-Link? In the "details" view, what PID and VID does it have?

E.g.,
grafik
grafik

@LovelyA72
Copy link
Author

After installing the driver it stopped hard crashing. But it still can not upload.

Uploading .pio\build\uno\firmware.elf
Open On-Chip Debugger 0.11.0+dev-02415-gfad123a16-dirty (2023-09-22-10:36)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

Warn : Transport "sdi" was already selected
Ready for Remote Connections
[wch_riscv.cpu.0] Target successfully examined.
** Programming Started **
Error: error writing to flash at address 0x00000000 at offset 0x00000000
embedded:startup.tcl:1162: Error: ** Programming Failed **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 1227
at file "embedded:startup.tcl", line 1162
*** [upload] Error 1

@maxgerhardt
Copy link
Member

@LovelyA72
Copy link
Author

Thank you so much! It now works properly. It will still be nice to be able to exit gracefully with error message when there's a driver issue instead of hard crashing.

@maxgerhardt
Copy link
Member

Graceful exit would indeed be nice, however that's something WCH / MounRiver must fix, since those are their binaries. They also don't upstream their OpenOCD changes yet (although it violates the GPL), and source code releases appear only very sparingly.

@LovelyA72
Copy link
Author

LovelyA72 commented Feb 26, 2024

I think it will be nice to offer the user choice between official closed source openocd fork or the open source minichlink from ch32v003fun. Because using the closed source fork might be some people's deal breaker.

@maxgerhardt
Copy link
Member

maxgerhardt commented Feb 26, 2024

This already works using upload_protocol = minichlink in the platformio.ini, I tested this with a WCH-LinkE (loaded WinUSB drivers via Zadig on Windows) and a CH32V003. That tool might however not support all chips, and its GDB is still not properly usable from within PlatformIO (#28, cnlohr/ch32fun#201).

CURRENT: upload_protocol = minichlink
minichlink -w .pio\build\ch32v003f4p6_evt_r0\firmware.bin 0x08000000 -b
Interface Setup
Image written.
Found WCH Link
WCH Programmer is LinkE version 2.11
Chip Type: 003
Setup success
Flash Storage: 16 kB
Part UUID    : ab-c8-ab-cd-13-de-bc-49
PFlags       : ff-ff-ff-ff
Part Type (B): 07-13-bb-91
Read protection: disabled
====== [SUCCESS] Took 6.73 seconds ======

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants