I am currently testing a CH32V003F4P6 (20 pins) alone (without using a development board).
I’m trying to use pins PA1 and PA2 (designed for an external clock) as standard inputs/outputs.
I use the pinmode and digitalWrite functions without success. Is there a reconfiguration of these 2 pins to be carried out? If yes, do you have an idea for a resolution, an example script?
To free up PA1 and PA2 from being used for highspeed oscillator, change the clock source to be from HSI 48MHz (highspeed internal) instead of HSE 48MHz, by using
build_flags =
-DSYSCLK_FREQ_48MHZ_HSI=48000000
in the platformio.ini (in reference to this code). This specifically prevents this code from being executed
that executes the remap from GPIO to oscillator function.
If you want to fix that now, you would have to manually patch these core functions ( C:\Users\<user>\.platformio\packages\framework-arduino-openwch-ch32)