Skip to main content
madhu13
Associate III
September 3, 2010
Question

USART Receiver problem

  • September 3, 2010
  • 4 replies
  • 878 views
Posted on September 03, 2010 at 14:38

USART Receiver problem

    This topic has been closed for replies.

    4 replies

    madhu13
    madhu13Author
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 14:05

    thank you now my code is working fine with USART-CR2=0x0000, but in Synchronous mode we have to enable the CLKEN bit right then why it is not working. and in the manual it is written also as follows

    USART Synchronous mode is selected by by writing CLKEN bit in USART_CR2 register.

    Tesla DeLorean
    Guru
    May 17, 2011
    Posted on May 17, 2011 at 14:05

    Works fine if you don't enable SCLK

     USART1->BRR = 0x0341; // 9600

     USART1->CR1 = 0x200C; // Enable USART, TX, RX

     USART1->CR2 = 0x0000; // Not Synchronous

    Your TX code would also work more effectively if you monitored TXE rather than TC, and your RX code will foul up if there is any kind of receive error state pending.

    Still it might be instructive if you evaluate how the library code is setting up the hardware so you can also debug your own code.
    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    Tesla DeLorean
    Guru
    May 17, 2011
    Posted on May 17, 2011 at 14:05

    >>thank you now my code is working fine with USART-CR2=0x0000, but in Synchronous mode we have to enable the CLKEN bit right then why it is not working.

    You're doing synchronous serial with Rx, RxClk, Tx, TxClk? That would be useful information to provide in your question. Most synchronous applications these days use SPI, and classic UART applications are typically asynchronous (ie without a clock).
    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    t1_it
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 14:05

    In synchronous mode, the are no start or stop bits.  So Hyperterminal will not be compatible with it.