cancel
Showing results for 
Search instead for 
Did you mean: 

USART STM32 asynchonous mode

hexanpro2
Associate
Posted on February 19, 2010 at 17:23

USART STM32 asynchonous mode

5 REPLIES 5
Posted on May 17, 2011 at 13:40

The USART Data Register (DR) is 16-bits wide, to accommodates all 9 bits (

D0

..

D8

)

You should always write the DR as an ''unsigned short'' or ''u16'', if using DMA the 9-bit mode would require you send Half Words, not Bytes.

-Clive

/*******************************************************************************

* Function Name  : USART_SendData

* Description    : Transmits single data through the USARTx peripheral.

* Input          : - USARTx: Select the USART or the UART peripheral.

*                    This parameter can be one of the following values:

*                     - USART1, USART2, USART3, UART4 or UART5.

*                  - Data: the data to transmit.

* Output         : None

* Return         : None

*******************************************************************************/

void USART_SendData(USART_TypeDef* USARTx, u16 Data)

{

  /* Check the parameters */

  assert_param(IS_USART_ALL_PERIPH(USARTx));

  assert_param(IS_USART_DATA(Data));

  /* Transmit Data */

  USARTx->DR = (Data & (u16)0x01FF);

}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Andrew Neil
Evangelist III
Posted on May 17, 2011 at 13:40

It would be polite to acknowledge the help that you've already received on this:

http://raisonance-forum.xsalto.com/viewtopic.php?id=3179

hexanpro2
Associate
Posted on May 17, 2011 at 13:41

Thanks, for your anwser and your time...

I base my communications in this base, and this saves me a lots af time...

Thanks for your time, once more...

My complements...

Andrew Neil
Evangelist III
Posted on May 17, 2011 at 13:41

There is an example of using the USART in Multiprocessor Mode (ie, 9-bit mode) included in the Standard Peripheral Library:

Project\STM32F10x_StdPeriph_Examples\USART\MultiProcessor

Andrew Neil
Evangelist III
Posted on May 17, 2011 at 13:41

Have you read the description of the Multiprocessor Mode in the RM0008 Reference Manual?