2017-08-11 01:18 AM
Hi All.
On my latest project I am using STM32F100VCT6 and PB3. I am using this Pin as a quadrature encoder input for Timer 2 combined with PA15. I can not get the encoder to work. I tried setting PB3 up as an interrupt and it does not work, but PA15 does, I then tried setting PB3 as a GPIO and it does not work and PA15 does????? I thought the CPU was faulty so swapped it and still noting from PB3. The input signal is 5V peak to peak, but the datasheet states that pin is 5 Volt tolerant .I have produced more than 20 designs using various STM32 processors never had this problem before.
2017-08-11 04:37 AM
Hello
the default state of PB3 after reset is as JTDO.
So you need to remap it to PB3
Read the
2017-08-11 05:45 AM
Enable the AFIO clock, and then free up the debugger pins
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE);
or
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
https://community.st.com/0D70X000006SyA1SAK
The HAL has something similar
__HAL_AFIO_REMAP_SWJ_NOJTAG
2017-08-13 03:25 AM
Hi All,
Huge thanks for the responses, very helpful.
I used the Cube to configure the 'PINS'. SYS is set to 'NO DEBUG' so I assumed it would handle things like setting the functions to alternatives and disabling the JTAG.
I think this should be included in the cube or a commented warning that it needs to be handled inserted in the USER SysInit section. It would have saved me an others a few days scratching our heads.
In the end I disabled SW and JTAG (*WARNING*) only do this if you have reset brought out to your programming header.
SET_BIT(AFIO->MAPR, AFIO_MAPR_SWJ_CFG_DISABLE);
Now PB3 is now working thank you very much....
Cheers
Rick