Monday, February 25, 2013

STM32F103에서 PB3를 GPIO로 사용

GPIO_InitTypeDef GPIO_InitStructure;

RCC_APB2PeriphClockCmd (RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO, ENABLE);


// Remap 기능을 사용하기 위해서는 RCC_APB3Periph_AFIO를 Enable시켜야 한다.
GPIO_PinRemapConfig (GPIO_Remap_SWJ_JTAGDisable, ENABLE);


GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3
GPIO_InitStructure.GPIO_Speed ​​= 알아서;
GPIO_InitStructure.GPIO_Mode = 알아서;
GPIO_Init (GPIOB, & GPIO_InitStructure);


만약 Jtag 관련 GPIO를 설정 한 후 JTAG 이나 SWD 기능이 동작하지 않게 되어 프로그램을 주입할 수가 없게되면

CPU의 리셋 스위치를 연타해가며 주입해보면 들어가짐.

If you cannot download a program to STM32F103 CPU cause wrong Port B  setting (all  jtag disabled ), try press reset button of target board  many times very fast while download.