2016-12-14 01:27 AM
Hello,
did anyone ever manage to get PB3 working as an I/O port on an STM32F103?
I am having a hard time with the F103VB where I need PB3 as input - no matter what I try, PB3 simply is returning a 0 value.
AFIO->MAPR is set to SWD debug only, JTAG off (and AFIO clock is on, of course).
I also explicitly set DBGMCU_CR to turn TRACE off, although that should be default after reset.
The other two related port pins (PB4 and PA15) work perfectly fine as GPIO. Only PB3 simply appears dead.
The errata sheet also doesn't mention any problems with PB3 as GPIO.
Did I find a new bug?
Any help is greatly appreciated.
Thanks, Tilmann
2019-02-08 10:38 AM
2019-02-08 10:44 AM
2019-07-12 01:48 AM
Hi. I had the same problem. The solution was simple. Just added a delay between remapping and configuration PB3 as GPIO.
Code by using SPL:
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
for(int u; u < 0x11A; u++);
/* Initialization reading pins */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOB, &GPIO_InitStructure);