Closed Tonymac32 closed 2 years ago
Great PR! This allowed be to create a blinky firmware and flash it on the device using https://github.com/LoveMHz/vnproch55x. (for me, ch55xtool.py
has a bug (https://github.com/MarsTechHAN/ch552tool/issues/16) and can't find my device at all, while other tools can find it).
There is also a forked Arduino core based on SDuino (for STM8 devices) available at https://github.com/DeqingSun/ch55xduino, and it works greatly! They also use the vnproch55x
flasher per above.
The nice thing with the core is is that once any ch55xduino firmware has been flashed, it exposes a USB serial port that supports the standard reset-to-bootloader mechanism via opening it at 1200 baud. That way one doesn't even have to manually reboot the device by holding a button and switching power on and off.
I'll see if I can get the Arduino core implementation to work and the other uploader based on your work! 👍
am not clear on how to have platformIO grab the necessary python upload tool automagically
The tool has to uploaded into the PIO package repository via pio package publish
, then you can reference the package in the platform.json
and use a bit of code to tell PIO that you need the pacakge, then use functions like platform.get_package_dir()
to get the path to the installed package.
Edit: I've just published the framework-arduinoch55x
package and the Win, Linux and Mac versions of tool-vnproch55x
and hope they'll be approved soon for usage.
@maxgerhardt nice! The upload tool did not fare so well against some of the newer bootloader revisions on the CH55x devices, I wound up making this PR because I designed a Pi 0 form factor dev board and was hopeful to provide some decent support. After a very extended silence I'd all but forgotten about it. 👀
I'll take a look at the arduino platform, it has been a while since I tried it out.
@Tonymac32 could make a board file name in uppercase? We keep TARGET DEVICES in their original form (typically upper case).
@maxgerhardt what do we need to merge this PR?
I can take another run at this starting next week, I'm unfortunately in the middle of moving and don't have access to my build system until I set it back up. Thanks for the review!
The PR has been merged, the latest version of tool-vnproch55x has been published to the registry. Please re-test with the latest dev-platform:
pio upgrade --dev
platformio.ini
=> platform = https://github.com/platformio/platform-intel_mcs51.git
pio pkg update
.Does it work now?
Ah but the upload tool used in this PR is https://github.com/MarsTechHAN/ch552tool, not https://github.com/LoveMHz/vnproch55x (which I was using on the command line), which package you've uploaded.
Also a note on the original issue with ch552tool, this was related to the libusb backend file missing or being a buggy version (I think v1.0.25). Maybe it was fixed with the fresh new release put out a few hours ago, but it was buggy for a really long time. For the Python tool to use libusb devices one needs to have the libusb-1.0.dll
in the Python interpreter folder or the program folder. Or use WinUSB drivers with Zadig, I have not tested that.
I have the chip and can test later in the evening.
I used these tools (they were recently updated) https://github.com/DeqingSun/ch55xduino/tree/ch55xduino/ch55xduino/tools
Checked on mac OS, and it works. Are they broken?
Yes ch55xduino uses vnproch55x.exe but this PR calls into ch55xtool.py. I think the binary releases of vnproch55.exe worked fine for me and this is where I had the binaries from.
Sorry, I removed your package to avoid duplicates. Let's summarize - should we make any changes regarding this PR?
I found some time for the OSS dev-platforms, I'm not sure that I can back to this repo in the next months. I would be great to merge all PRs and re-test them. Thanks!
I think we
ch55xtool.py
and reference it as uploader in platform.json
, keep uploader code the sameor slightly rewrite the upload code to use tool-vnproch55x
, i.e. call into vnproch55x.exe
Or have both upload methods available. I can take a look at this today, but right now it should be non-working.
Ah, I see you have already done the second point in https://github.com/platformio/platform-intel_mcs51/commit/6402cc747528692b663cd64535e1493209618b5e, so it should actually be working.
Great PR! This allowed be to create a blinky firmware and flash it on the device using LoveMHz/vnproch55x. (for me,
ch55xtool.py
has a bug (MarsTechHAN/ch552tool#16) and can't find my device at all, while other tools can find it).There is also a forked Arduino core based on SDuino (for STM8 devices) available at DeqingSun/ch55xduino, and it works greatly! They also use the
vnproch55x
flasher per above.The nice thing with the core is is that once any ch55xduino firmware has been flashed, it exposes a USB serial port that supports the standard reset-to-bootloader mechanism via opening it at 1200 baud. That way one doesn't even have to manually reboot the device by holding a button and switching power on and off.
I'll see if I can get the Arduino core implementation to work and the other uploader based on your work! +1
am not clear on how to have platformIO grab the necessary python upload tool automagically
The tool has to uploaded into the PIO package repository via
pio package publish
, then you can reference the package in theplatform.json
and use a bit of code to tell PIO that you need the pacakge, then use functions likeplatform.get_package_dir()
to get the path to the installed package.Edit: I've just published the
framework-arduinoch55x
package and the Win, Linux and Mac versions oftool-vnproch55x
and hope they'll be approved soon for usage.
Did this every go through? Sorry to bump an old thread but I'm trying to get PIO working with the CH552! If ch55xduino got in there i should be good to target that slightly different board?
ch55xduino is "not there" This is how I got my board working just recently: https://github.com/danielkucera/ch552-hid/
ch55xduino is "not there" This is how I got my board working just recently: danielkucera/ch552-hid
Wow.. i am amazed at how exactly similar my current project looks to that.. i even have the commented out link_medium.py
Thank you haha! if i learn anything more ill lyk
What version of SDCC are you using?
The CH559 is a USB microcontroller based on the MCS-51 architecture.
This chip requires a custom upload protocol, I have placed the framework for that in main.py, I am not clear on how to have platformIO grab the necessary python upload tool automagically from here: https://github.com/MarsTechHAN/ch552tool
This tool depends on libusb as well.
Once these details are figured out/solved I can follow with board definitions for the remainder of the CH55x family.