I made a simple code read a button on D2 PC0 and turn on a LED, for this simple code works perfect.
But if a change for pins D0 PA1 adn D1 PA2 not work ..... work once and get a lot issues.
I found that this pins is dedicated for external oscillator i tried to disable it on the system_ch32v00x.c
#include <ch32v00X.h>
/*
* Uncomment the line corresponding to the desired System clock (SYSCLK) frequency (after
* reset the HSI is used as SYSCLK source).
* If none of the define below is enabled, the HSI is used as System clock source.
*/
//#define SYSCLK_FREQ_8MHz_HSI 8000000
//#define SYSCLK_FREQ_24MHz_HSI HSI_VALUE
#define SYSCLK_FREQ_48MHz_HSI 48000000
//#define SYSCLK_FREQ_8MHz_HSE 8000000
//#define SYSCLK_FREQ_24MHz_HSE HSE_VALUE
//#define SYSCLK_FREQ_48MHz_HSE 48000000
Unlesh HSI ...... but not work ..... I need to use PA2 and PA1 as digital inputs
Someone now how to enable PA2 and PA1 as digital inputs ?
[Edit: hi @juliodv , I didn't read your name first, so parts of my answer below may be redundant, since I know you already use the 1.0.4. I keep it here for other readers. The other part may still apply...]
First thing you should do is use the latest release (1.0.4) and then update that with the most recent code of the master branch of the github repository. The latest core allows setting HSI from the menu.
What package is your V003? The TSSOP20 has most pins and is great for real time debugging using the 2.x IDE. The SOP8 model has overlapping function on its pins.
Are you using a board with external clock? (eg. the evaluation board). If you are you probably cannot use those pins. Most often I use a bare chip on breakout in breadboard.
HSI works fine. I use it in all my CH32 projects. I'm not sure which pins I've used for input in those projects. You may want to look at the open and closed issues on Github to see what others experienced.