AnsweredAssumed Answered

USART

Question asked by salazar.timothy on Jul 17, 2013
Latest reply on Jul 17, 2013 by salazar.timothy
I tried configuring. Im using the STM32F103RB 
/* Setup GPIO pin GPIO_USART1_TX. */
  GPIO_InitTypeDef GPIO_InitStructure; // GPIO structure
  USART_InitTypeDef USART_InitStructure; // USART Structure
  USART_ClockInitTypeDef USART_ClockInitStructure; // USART Clock Source
  USART_Cmd(USART1, ENABLE);
   
  //USART_ClearFlag(USART1,USART_FLAG_TXE);
 // RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 , ENABLE);
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
   
  //GPIO Configuration
  GPIO_PinRemapConfig(GPIO_Remap_USART1,ENABLE);
   
  // Enable Clock
  USART_ClockInitStructure.USART_Clock = USART_Clock_Enable;
  USART_ClockInitStructure.USART_CPHA = USART_CPHA_1Edge;
  USART_ClockInitStructure.USART_CPOL = USART_CPOL_Low;
  USART_ClockInitStructure.USART_LastBit = USART_LastBit_Enable;
  USART_ClockInit(USART1, &USART_ClockInitStructure);
   
  // USART Configure
  USART_InitStructure.USART_BaudRate = 9600;
  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
  USART_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;
  USART_InitStructure.USART_Parity = USART_WordLength_8b;
  USART_InitStructure.USART_StopBits = USART_StopBits_1;
  USART_InitStructure.USART_WordLength =  USART_Parity_No;
  USART_Init(USART1, &USART_InitStructure); // Stops here
 
   
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;  //PA9-UART.TX
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(GPIOB, &GPIO_InitStructure);
   
  /* Configure USART Rx as input floating */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
  GPIO_Init(GPIOB, &GPIO_InitStructure);
the USART but still fail to make it work any suggestions?

Outcomes