Skip to content

Update Ch32V10x variants #211

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Update Ch32V10x variants #211

wants to merge 4 commits into from

Conversation

KenRouKoro
Copy link

Fix #210
Fully updated the pin definitions of CH32V103R8T6 according to the manual.
image

@maxint-rd
Copy link
Contributor

Excellent work!
(Unfortunately I don't have any V10x to give it a test, but perhaps someone else can..)

@KenRouKoro
Copy link
Author

@maxint-rd
I designed a board for the CH32V103C8T6, and it has passed all tests completely.
(Actually, it's because I designed and manufactured this board today and was preparing to write its firmware, but then I got really stuck by this problem QAQ)
image
image
image

@maxint-rd
Copy link
Contributor

Very nice board. Well done!

@KenRouKoro
Copy link
Author

image
WTF

@maxint-rd
Copy link
Contributor

maxint-rd commented Jul 9, 2025

WTF

I've made a fix for using interrupt driven serial. See PR #201.
I tested with V003 and X033, others with other processors. If you test it and it works, please let me know.

@KenRouKoro - I strongly advise you to review all PRs that have not been merged into the V1.0.4 and the current master branch. They contain some very valuable improvements (including yours). Please be aware that WCH hasn't dedicated much time to support this core. My impression is that it's a labor of love provided in limited spare time of WCH employees and some (increasingly less) active community members

@KenRouKoro
Copy link
Author

WTF

I've made a fix for using interrupt driven serial. See PR #201. I tested with V003 and X033, others with other processors. If you test it and it works, please let me know.

@KenRouKoro - I strongly advise you to review all PRs that have not been merged into the V1.0.4 and the current master branch. They contain some very valuable improvements (including yours). Please be aware that WCH hasn't dedicated much time to support this core. My impression is that it's a labor of love provided in limited spare time of WCH employees and some (increasingly less) active community members

I tried the content of the PR you submitted. The main serial port (USART1) works well on the ch32v103, but I am unable to configure the second serial port, as it gets merged into the main serial port in a very strange way. I am currently investigating the cause of this issue.

@maxint-rd
Copy link
Contributor

I've worked on dual serial port support for the X033 and got it working.
The WCH implementation only allowed for selection of the second port to use instead of the first. It involved setting some defines in a header file.

For dual (simultaneous) support I used the WCH method as basis, so it also requires setting certain defines in that header file. Next to dual support it also supports single port selection, so having the proper defines really matters. In the comment on top of PR #201 you can read all details.

So far I've only had the X033 to develop dual UART support. In this commit of PR #171 you can see the changes I made to support dual port usage on the X033. It involved selecting alternate pin functions. Other board definitions probably require similar chip specific changes.

Recently I obtained some V006 chips, which also have two UART modules. I've not yet had the time to implement and test dual support for the V006. Once I do, I'll add any changes to PR #200.

@KenRouKoro
Copy link
Author

@maxint-rd Today I conducted further testing. I used the native operation method (refer to the example project for Ch32V103) and confirmed that operating USART3 is feasible. However, it will take me a few more days to understand the current implementation of USART1 and port it accordingly. Additionally, I need to report an issue with the EEPROM library. For the Ch32V103, the current EEPROM library can only operate on the first two bytes. Writing to and reading from the other 24 bytes does not generate errors, but the values cannot be modified (they remain permanently at 255).

@maxint-rd
Copy link
Contributor

maxint-rd commented Jul 11, 2025

Additionally, I need to report an issue with the EEPROM library. For the Ch32V103, the current EEPROM library can only operate on the first two bytes. Writing to and reading from the other 24 bytes does not generate errors, but the values cannot be modified (they remain permanently at 255).

Okay. Please submit another issue to address the EEPROM library.

That library was contributed by me, based on code from the CH32fun project and EVT example code, when I only had the V003 available. (It states so in the readme). Improving it will likely be a community effort.

If you submit this as a new issue, I can see how I can make further contributions. At the moment I also have V002, V006, X033 and V203 for further testing/development. Support for the V10x probably requires help from you or other community members.

@maxint-rd
Copy link
Contributor

maxint-rd commented Jul 11, 2025

However, it will take me a few more days to understand the current implementation of USART1 and port it accordingly.

Please also have a look at the X033 code I added in PR #171 to support UART2 and of course the UART2 code in #201 . At the moment that PR only supports UART1 and UART2, but with a bit of effort I may be able to extend it to support UART3 and 4.

Edit: just added support for USART2 on CH32V006F8 (TSSOP20). Went about the same as for the X033, but had to specify using pin remapping function in PeripheralPins.c.
For the V103 I suggest you to first get UART2 working (on pins {PA2 and PA3). Once that works, it would be a bit easier to extend it to support UART3 (on pins PB10 and PB11). From what I see these pins don't need remapping (you can use AFIO_NONE).

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

Successfully merging this pull request may close these issues.

CH32V10x Pin Definition Issue
2 participants