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.
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..
>>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..