cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F100VCT6 and PB3

Rick Hamilton
Associate II
Posted on August 11, 2017 at 10:18

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.

3 REPLIES 3
Posted on August 11, 2017 at 13:37

Hello

the default state of PB3  after reset is as JTDO.

0690X00000607p5QAA.png

So you need to remap it to PB3

Read the

http://www.st.com/content/ccc/resource/technical/document/datasheet/38/66/c2/1c/d3/d5/40/85/CD00212417.pdf/files/CD00212417.pdf/jcr:content/translations/en.CD00212417.pdf

 
Posted on August 11, 2017 at 14:45

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on August 13, 2017 at 10:25

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