AnsweredAssumed Answered

two USART configuration failed (USART3 problem)

Question asked by mohamadi.parisa on Mar 1, 2017
Latest reply on Mar 1, 2017 by mohamadi.parisa

Hi,

Here is my code for configuring two different usart but my USART3 doesn't work properly and USART2 works fine.(I remap both of them). what is my mistake that I didn't pay attention?

 

Problem: I don't have any signal on USART3_TX pin when I send a char. however my USART1 works fine(send and receive)

 

    USART_InitTypeDef USARTConfiguration;
    GPIO_InitTypeDef GPIOS;
        RCC_APB2PeriphClockCmd(RCC_APB1Periph_USART2|RCC_APB1Periph_USART3|RCC_APB2Periph_GPIOD |RCC_APB2Periph_GPIOC |RCC_APB2Periph_AFIO,ENABLE);
 GPIO_PinRemapConfig(GPIO_Remap_USART2|GPIO_PartialRemap_USART3,ENABLE);
    
    GPIOS.GPIO_Mode=GPIO_Mode_AF_PP ;
    GPIOS.GPIO_Speed=GPIO_Speed_50MHz;
    GPIOS.GPIO_Pin=GPIO_Pin_5;
    GPIO_Init(GPIOD,&GPIOS);
    
    GPIOS.GPIO_Mode=GPIO_Mode_IN_FLOATING ;
    GPIOS.GPIO_Pin=GPIO_Pin_6;
    GPIO_Init(GPIOD,&GPIOS);
               
    USARTConfiguration.USART_BaudRate=9600;
    USARTConfiguration.USART_StopBits=USART_StopBits_1;
    USARTConfiguration.USART_WordLength=USART_WordLength_8b;
    USARTConfiguration.USART_Parity=USART_Parity_No ;
    USARTConfiguration.USART_HardwareFlowControl=USART_HardwareFlowControl_None;
    USARTConfiguration.USART_Mode=USART_Mode_Rx | USART_Mode_Tx;
    USART_Init(USART2,&USARTConfiguration);
    USART_ITConfig(USART2,USART_IT_RXNE,ENABLE);
    NVIC_EnableIRQ(USART2_IRQn);
    USART_Cmd(USART2,ENABLE);

    GPIOS.GPIO_Mode=GPIO_Mode_AF_PP ;
    GPIOS.GPIO_Speed=GPIO_Speed_50MHz;
    GPIOS.GPIO_Pin=GPIO_Pin_10;
    GPIO_Init(GPIOC,&GPIOS);

    GPIOS.GPIO_Mode=GPIO_Mode_IN_FLOATING ;
    GPIOS.GPIO_Pin=GPIO_Pin_11;
    GPIO_Init(GPIOC,&GPIOS);  
    
    USARTConfiguration.USART_BaudRate=9600;
    USARTConfiguration.USART_StopBits=USART_StopBits_1;
    USARTConfiguration.USART_WordLength=USART_WordLength_8b;
    USARTConfiguration.USART_Parity=USART_Parity_No ;
    USARTConfiguration.USART_HardwareFlowControl=USART_HardwareFlowControl_None;
    USARTConfiguration.USART_Mode=USART_Mode_Rx | USART_Mode_Tx;
    USART_Init(USART3,&USARTConfiguration);
    USART_Cmd(USART3,ENABLE);

Thanks in advance.

Outcomes