2025-10-15 12:45 PM
Guys, I need to put 5V on a pin. For this, I configured my pin as an open-drain output with a pull-up resistor (10k) between the pin and the 5V line. I checked the 5V-tolerant pins in the Blue Pill datasheet and tested many of them, but the conclusion is always the same: the output is 3.7V when the pin is in high impedance. I used Keil uVision to write my code in C (at startup, I only used CMSIS and DEVICE for pre-configuration). My code is below. I used PB10 as a reference.
2025-10-15 12:57 PM
Maybe the overwhelmingly likely counterfeit chip on the board doesn't have 5 V tolerant pins.
2025-10-15 2:43 PM
You have (at least) made two mistakes:
You are using a so-called Blue Pill that has only been used with counterfeits for years (and you are asking for a solution for the counterfeit in the forum of the original manufacturer).
Regards
/Peter
2025-10-15 2:44 PM
Thanks for your comment! I didn't think it was a clone, as the debugger with STM32CubeIDE worked perfectly fine. However, after checking some IDs, I found very strange values, so it's probably fake =(
2025-10-15 3:03 PM
Thanks for the clarification, Peter. I'm new to the world of microcontrollers, and I'm diving into bare metal to understand how things really work. Didn't know there were clones. I will probably move to a NUCLEO one in the future (to avoid spending many hours on these bugs).
"You are confusing 5V tolerance (of an input) with 5V capability of an output" --> Could you explain what you mean? I know the output voltage on a pin is normally 3.3V, but if I configure the output as open-drain (high impedance) and connect a pull-up resistor to it, I can get higher values of voltage, right?
2025-10-15 3:28 PM
This depends on:
Details on GPIO behaviour can be found for the original device in the data sheet and in the Reference Manual RM0008.
Hope that helps?
Regard
/Peter