Skip to main content
nickabrham
Associate II
April 21, 2012
Question

Dual UARTs Problem

  • April 21, 2012
  • 2 replies
  • 684 views
Posted on April 21, 2012 at 08:27

Hi Everyone,

I have developed a program on STM3210E-Eval, in which I have configured both USART1 and USART2 to send data on their respective interrupts. Unfortunately only USART2 is sending data. UART1 is not sending the data. Attached file contains the relevant files. Kindly help.

Bye,

Nick.

 
    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    April 21, 2012
    Posted on April 21, 2012 at 14:28

    You want to initialize USART1, not USART2

    ie USART_Init( USART2, &USART_InitStructure); // Configure the USART1 should be USART_Init( USART1, &USART_InitStructure); // Configure the USART1

    // Configure UART1
    void UART1_Configuration(void)
    {
    // USART1 configured as follow:
    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); // Configure the USART1
    //Enable the USART Transmit interrupt: this interrupt is generated when the
    //USART1 transmit data register is empty
    USART_ITConfig(USART1, USART_IT_TXE, ENABLE);
    //Enable the USART Receive interrupt: this interrupt is generated when the
    //USART1 receive data register is not empty
    USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
    //Enable USART1
    USART_Cmd(USART1, ENABLE);
    }

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    nickabrham
    Associate II
    April 21, 2012
    Posted on April 21, 2012 at 15:16

    Thanks Clive,