2022-08-07 03:41 AM
hi
I have a 1000uF capacitor and a blue pill STM32F103c8t6. I connected the positive end of cap to PB9 and the negative end to GND.
then I had the code below inside while(1) loop
///////////////////////////CHARGE//////////////////////////////////
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_9,GPIO_PIN_SET);
HAL_Delay(10000);//wait to fully charged
but when I measure voltage using a multimeter, I see 0.5v instead of 3.3v. why?
Edit. when I use 1uF cap or less, I see 3.3v... can someone explain that?
2022-08-07 08:17 AM
You'd need more code than that to enable the pin
2022-08-07 08:45 AM
There is a risk of damaging uCPU. Look into datasheet, max. GPIO current limits section. Usually it's just 3 mA. Than put appropriate resistor in series to limit current.
2022-08-07 08:53 AM
Until the capacitor charges, it is basically a short circuit... You have to limit the current with a 180 ohm or higher resistor or by some other means. And learn the basics of electronics.
2022-08-07 08:59 AM
For STM32 the absolute maximum is typically +/-25 mA.
2022-08-07 11:49 PM
yes, it is actually 25mA. I forgot to say that I've used a 1Mohm resistor in parallel with the cap
2022-08-07 11:49 PM
you're right. I forgot to say that I've used a 1Mohm resistor in parallel with the cap
2022-08-09 03:58 AM
To limit a current you have to put a resistor in series. That is the absolute basics of the electronics. While you do not understand such a things, you should not connect anything to any microcontroller or any integrated circuit at all - you will just damage it. Take a battery, LED, resistor, switch/button and learn the absolute basics. When you can calculate the correct resistor value, then you have understood the absolute minimum to go further.