Cannot Configure JTDI pin (PA15) as GPIO

Thread Starter

devjeetmandal

Joined May 7, 2017
48
I am using STM32F103RCT6 to blink a LED which is connected to PA15 - JTDI in PU.

My GPIO Configuration is like this

C:
GPIOA->CRH |= GPIO_CRH_MODE15; //Output mode, max speed 50 MHz.
GPIOA->CRH &= ~GPIO_CRH_CNF15; //General purpose output push-pull\
And I am trying to Blink Like this

C:
#define LED_HIGH() (GPIOA->BSRR |= GPIO_BSRR_BR15) //LED High
#define LED_LOW() (GPIOA->BSRR |= GPIO_BSRR_BS15) //LED LOW
In datasheet it says
Capture.PNG

To free the Pin for GPIO we need to configure SWJ_CFG[2:0] either with 010 or 100. So for that i am configuring
C:
AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_1; //((uint32_t)0x02000000) as 010
Datasheet also says we need to do something with ODR/IDR registers but i am not getting correcty how to configure PA15 (or any JTAG pins) as GPIO.

The SWJ_CFG in AFIO_MAPR is given as
new.PNG

I have a LED on PA15 and i cannot blink it.
Any suggestion will be helpful.

Thank You in advance
 
Top