Community-PIO-CH32V / ch32-pio-projects

W.CH CH32 RISC-V Projects using PlatformIO
48 stars 8 forks source link

blinky-none-os: PA1/PA2 used for crystal on CH32V003F4P6_EVT_R0 #2

Closed salfter closed 1 year ago

salfter commented 1 year ago

I ordered one of the inexpensive kits from an AliExpress vendor that includes a CH32V003F4P6_EVT_R0 eval board, a programmer, and other bits and pieces. What's the first thing most people try to bring up on a new eval board? A blinky program. I grabbed the one from here, wired the board to the programmer, ran a jumper from PA1 to LED1, and loaded the code onto the board...and got nothing for my trouble.

It turns out that PA1 and PA2 on these boards are wired to the onboard 24-MHz crystal, which is used as the clock source for the microcontroller. I tweaked the source to use PC1 instead, and once flashed, it behaved as expected.

To avoid this bit of frustration for other new users, you might be interested in the PR I'm about to submit.

maxgerhardt commented 1 year ago

The examples here are at least supposed to mirror https://github.com/Community-PIO-CH32V/platform-ch32v/blob/develop/examples/blinky-none-os/src/main.c but they got out of sync. Platform example uses PC1. Will sync the examples..

maxgerhardt commented 1 year ago

Fixed in https://github.com/Community-PIO-CH32V/ch32-pio-projects/commit/78f044b49b0cb201493ec6254408be459f47dcc5