Closed wanggaoteng closed 2 months ago
And opening this repository as a PlatformIO project did not work? There is a platformio.ini in there.
(Platform-CH32V maintainer here) This project should work out of the box without preinstalling anything. The platformio.ini
has platform = platform = https://github.com/Community-PIO-CH32V/platform-ch32v.git
set, so if you clone this repository and open it VSCode and have the PlatformIO extension installed, it should automatically download everything needed. You can then select an environment in the project environment switcher, such as blink
, and compile and upload it.
I think what you're trying to do, @wanggaoteng, is to create a new project that has ch32v003fun in it. But you mistakenly select framework = noneos-sdk
, which compiles in files from framework-wch-noneos-sdk
, which you are then forced to modify to make compilation work. It is wrong to modify any of the files inside there. ch32v003fun is a standalone framework, there must be no framework = ...
line in the platformio.ini
using it. Simply fork the ch32v003fun project and create a new environment in the platformio.ini
as documented, in which you can place all your new code. The description aboves creates some Frankenstein monster of a project, don't do that.
Example for a baremetal project is also in https://github.com/Community-PIO-CH32V/platform-ch32v/tree/develop/examples/baremetal-ch32v003.
I'm gonna take the lead on this issue here and make an addition to platform-ch32v
so that framework = ch32v003fun
becomes a selectable framework option in the "Create new project" dialog. It's gonna simplify things and prevents people creating projects in a very wrong way. I'll then PR in some better documentation for "How to create a project based on ch32v003fun", with both the "fork this repository and add a new environment" and "create a new framework = ch32v003fun
project" way.
@maxgerhardt I am excited for this. Thank you!
I successfully built a project that includes all the Ch32v003fun examples using Vscode with the Platformio extension,but I'm struggling to build only an example at a time .Is there a way to force Vscode to build only an example from the list of examples already in that folder?
I'm gonna take the lead on this issue here and make an addition to
platform-ch32v
so thatframework = ch32v003fun
becomes a selectable framework option in the "Create new project" dialog. It's gonna simplify things and prevents people creating projects in a very wrong way. I'll then PR in some better documentation for "How to create a project based on ch32v003fun", with both the "fork this repository and add a new environment" and "create a newframework = ch32v003fun
project" way.
Hi, @maxgerhardt
I'm very appreciate. Thank you very much.
Best regards.
Please see the projects
it uses the new framework = ch32v003fun
option in platform-ch32v. (You will need to update).
This is how user's ch32v003fun projects should look like when using PlatformIO. A 4 line platformio.ini. Standard folder layout. Only your code in src/. Github CI activated, giving you the green checkmark. No bullshit.
I've added documentation for this and all the other obstactles I've seen people trip over in #349.
Thanks for this!
While the build-in uart of the WCH-link works, it would be nice to use the
#define FUNCONF_USE_DEBUGPRINTF 1
option and use the 1wire interface not only for programming, but for debug output as well.
So i can use the v003's uart for other purposes.
Any pointers on how to set that up?
This already exists. If you have the latest platform-ch32v version, regardless of upload_protocol = wch-link/minichlink
etc. you should get a project task that says "Enable SDI Printf" and it uses "wlink sdi-print enable". After that, the regular COM port of the WCH-LinkE should spit out the decoded prints (regular "Monitor" task). There is also a "Minichlink Monitor SDI Printf" task to invoke minichlink -T
, if upload_protocol = minichlink
is set, if you prefer that path.
That's part of the documentation that I have to get better for https://pio-ch32v.readthedocs.io/. (But it's a new addition anyway)
Thank you for your great work @maxgerhardt
Testing upload_protocol= minichlink
Under Linux the "Minichlink Monitor SDI Printf" works, as long as glibc_2.34 is installed.
On ubuntu 20.04 you will be stuck on an older version, and will only work if you install it manually (i used https://packages.ubuntu.com/jammy/amd64/libc6/download) and then
sudo apt update
sudo apt install libc6
On Windows i used Zadig to replace the driver on the WCHlink (interface 0) to WinUSB. Then the monitoring Printf output also worked fine.
On the other hand i could not get 'Enable SDI Printf' to do anything. I can see it sends some data (for a second or so) over the SWIO pin on my oscilloscope when i enable the option, but after that second it becomes silent. (the minichlink option showed a constant data stream over the SWIO line)
I tried wlink and wch-link as upload protocol, both behave the same.
ubuntu-latest
(aka ubuntu22); you're right, this is not good for people using the older version. Maybe I'll build for Ubuntu 20 and the binaries will still work for Ubuntu22.wlink
sends to the WCH-LinkE, but I can imagine that it's very specific to the firmware version running on the WCH-LinkE. They do like to change the USB interface / command packets around as I've seen from @cnlohr on other occasions. Will retest with my WCH-LinkE and the latest firmware version for it (update via MounRiver)It does work if i compile the SDI_printf demo on MounRiver, and then use their WCH-LinkUtility to program the chip.
There was another update for the WCH-LinkE, i'm now on v2.12
Might be a misunderstanding on my part, but is SDI Printf supposed to work with the ch32v003fun
framework?
I think it might just be that the SDI printf in ch32v003fun chooses a different data or protocol format than SDI printf in official WCH SDK, so they are incompatible with each other. Will recheck on my side.
Yes exactly, that was my conclusion too. Then i think the ch32v003 framework should not show the SDI enable/disable options, only minichlink.
Do we know what their SDI protocol is? As long as it allows bidirectional communication and is as fast, I wouldn't mind swapping.
Ref the speed, i found this https://www.wch.cn/bbs/thread-107881-1.html Slightly faster then 115200 bps, so no where near the minichlink debug printf speed.
WCH's format is at
while ch32v003's is at
They do so seem very different and WCH's way doesn't even enable input.
Any chance we can just use mine? Theirs literally doesn't support input and is slower.
Also, Spirit on my Discord was having a hard time figuring out the right way to get debugprintf working with PIO.
Better docs for SWI Printf under PIO are on the way. With WCH SDK's SWI printf lacking, I would not advocate to use theirs. If anything, I would advicate for them to use ch32v003fun's way.
After many attempts, I want to share the steps to use ch32v003fun under vscode/platformio
Thanks to @cnlohr