cancel
Showing results for 
Search instead for 
Did you mean: 

USART Receiver problem

madhu13
Associate II
Posted on September 03, 2010 at 14:38

USART Receiver problem

4 REPLIES 4
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 Venmo Up vote any posts that you find helpful, it shows what's working..
madhu13
Associate II
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.

t1
Associate II
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.

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 Venmo Up vote any posts that you find helpful, it shows what's working..