-
Notifications
You must be signed in to change notification settings - Fork 193
CH57x bringup and blinky, debugprintfdemo #561
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
Conversation
To clarify, I want to make sure this is run through its paces before we merge. |
definitely, also everyone is invited to add to this pr since it will be a while before i receive a 570, customs here is difficult (or create a new one based on this, or not based on it at all, for now this is just a starting off point) |
WCH is now selling CH570 evaluation boards (promo code |
I did not notice the silkscreen.. We'll find out when the boards arrive, anyway either is fine to test this PR, BLE or RF is not touched yet. |
I've added ch573 too, since I have one to test this on. The bringup and blinky works, but minichlink has trouble with the debugprintf. In https://github.com/biemster/ch573_minimal the debug print works exactly the same as in biemster/ch592_minimal, so I highly suspect this to be an issue with minichlink and not the mcu code. EDIT: the new |
This needs rebasing, which would ideally be done after #582 goes in. |
Should this work with minichlink? This is what I get with a CH570D:
A note on the |
No minichlink support will have to be addressed in a different PR. All the ch5xx chips have issues with minichlink, you could try the same approach temporarily as in #574 to get terminal working, but flashing will not work for sure. Did you try blink and did it work?? That would be amazing! |
No, I haven't been able to flash it. From your earlier comments I thought you did manage that? I've also tried the openocd fork distributed by WCH, without success:
|
No sorry, I did not even receive my board yet! You could try https://github.com/ch32-rs/wchisp but I don't think they have a |
Some huge rebase / merge went on here, I need to test this from the start again |
I think I destroyed this PR, there are 63 changed files now. Maybe better to start afresh |
@cnlohr please stop reviewing this :D something went wrong rebasing the whole thing, git and I are not the best of friends |
I don't understand how it pulled in all these other commits, the branch on my forks looks alright? |
I think I revived the branch, it can be merged cleanly again. I'll just fix the examples (tomorrow) |
Marking all resolved for the time being. |
This is now ready for review and merge, I managed to recover from the rebase difficulties. It's fully tested and working on ch573 and ch570. |
@@ -17,17 +23,17 @@ int main() | |||
{ | |||
SystemInit(); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should still do a funGpioInitAll()
, and in ch32fun.h, make it #define funGpioInitAll()
I would like general consistency. Could also add a comment, "doesn't actually do anything on the ch5xx chips.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I'll add that. I hope I remember during the ch5xx consolidation, the ch58x and ch59x don't have this either.
ch32fun/ch57xhw.h
Outdated
@@ -225,9 +225,15 @@ typedef enum | |||
} SYS_CLKTypeDef; | |||
|
|||
// For debug writing to the debug interface. | |||
#if MCU_PACKAGE == 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment explaining what package 3 is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ch57(3), I thought it worked like that on the other mcu's as well, but thinking of it now that's not really possible ofc 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just add a comment, for people who are casually reading the source code.
@@ -3,7 +3,7 @@ | |||
|
|||
#define FUNCONF_USE_HSI 0 // CH57x does not have HSI | |||
#define FUNCONF_USE_HSE 1 | |||
#define CLK_SOURCE_CH57X CLK_SOURCE_PLL_60MHz // default so not really needed. CH570/2 can go up to 100MHz | |||
#define CLK_SOURCE_CH5XX CLK_SOURCE_PLL_60MHz // default so not really needed. CH570/2 can go up to 100MHz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful way to define it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this worked out quite nice!
Done! I don't know if you usually squash commits while merging, but considering the weird state this PR was in yesterday I'd suggest to definitely do that this time. |
Oh you didn't need to update the comment everywhere but I'll accept it! Squash and merge it is! |
This PR is of course still untested, but a preparation to hit the ground running when the boards are released.
It's a copy of the current work on CH59x in #534, with the correct registers and stuff for CH570/2 of course.