2010-12-19 07:30 PM
STM32F103 Usart problem
2011-05-17 05:18 AM
You need to ensure that the AFIO is clocked for remapping to work. If you are using a different crystal you'll need to ensure the system is clocking at the speed the library code expects it to.
Try cleaning up the GPIO configuration void GPIO1_Configuration(void) { GPIO_InitTypeDef GPIO_InitStructure; /* Enable AFIO clock */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); /* Enable the USART2 Pins Software Remapping */ GPIO_PinRemapConfig(GPIO_Remap_USART2, ENABLE); /* Configure USART2 Tx (PA.02) as alternate function push-pull */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOA, &GPIO_InitStructure); /* Configure USART2 Rx (PA.3) as input floating */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(GPIOA, &GPIO_InitStructure); }