At reset, the STM32 will have PB4 and PB3 mapped to JTAG function by default.
To use these pins as normal I/O, you must disable JTAG:
// disable JTAG
AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_JTAGDISABLE;
I discovered this when I realized PB4 and PB3 were changing when I was changing PB10
I hope some will find this piece of information useful.
Barry
Using STM32 PB PORTB GPIOB Pin Pad Port
Moderators: RoccoMarco, lbednarz, tfAteba
Re: Using STM32 PB PORTB GPIOB Pin Pad Port
Also, add this too....
AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_DISABLE;
AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_DISABLE;