AnsweredAssumed Answered

STM32F373 USART2 Problem

Question asked by Shaam on May 11, 2015
Latest reply on Jun 22, 2015 by Clive One
Hello, I have some problem with USART2 (stm32f373). USART1 is working with same code but, Usart2 does not work.  here is the code.

void Uart_Int(void)
{
  GPIO_InitTypeDef GPIO_InitStructure;
  USART_InitTypeDef USART_InitStructure;
  USART_ClockInitTypeDef USART_ClockInitStructure;
 
  USART_ClockStructInit(&USART_ClockInitStructure);
  USART_ClockInit(USART2, &USART_ClockInitStructure);
 
 
  RCC_APB2PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
 
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA , ENABLE);
 
  GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_7);
  GPIO_PinAFConfig(GPIOA, GPIO_PinSource3, GPIO_AF_7);
 
 
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//---------
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
  GPIO_Init(GPIOA, &GPIO_InitStructure);
 
 
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//---------
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;
  GPIO_Init(GPIOA, &GPIO_InitStructure);
 
  USART_InitStructure.USART_BaudRate =9600;
  USART_InitStructure.USART_WordLength = USART_WordLength_8b;
  USART_InitStructure.USART_StopBits = USART_StopBits_1;
  USART_InitStructure.USART_Parity = USART_Parity_No;
  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
  USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
  USART_Init(USART2, &USART_InitStructure);
  USART_Cmd(USART2, ENABLE); /**/
  }



int main(void)
{
   unsigned char data=0;
    Uart_Int();
 
     //
    while(1)
    {
         
     while (USART_GetFlagStatus(USART2, USART_FLAG_TXE) == RESET);
  USART_SendData( USART2, 'a');
     
  }


 }

what kind of problem it has.....?

Outcomes