Yes... You can... It's a proven feature. If you see pin structure in STM32 Reference manual, you can see that it has required components -- [![STM32 Pin structure][1]][1] If this satisfies your requirements, then, you can do away with external components. [1]: https://i.sstatic.net/a59S0.jpg