Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

Programming STM32F10x I/O port pins

Previously we learned how to compile STM32VL Discovery projects that were included in the package. But to understand how to write own programs we need to get to some basics. I think the best place to start is the input and output system (I/O). Before we begin to write some code lets go through whats inside STM32 ports. If you look into STM32 reference manual, you’ll find that I/O system is pretty flexible. Port pins can work in several modes: Input floating; Input pull-up; Input pull-down; Analog; Output open drain; Output push-pull; Alternate function push-pull; Alternate function open drain. Pins are organized as 16-bit ports that have their names like PORTA, PORTB, PORC, PORTD… Ports are 16-bit wide; they are controlled with 32-bit words. Individually each port pin can be… Continue reading