Skip to main content
hexanpro2
Associate
Feb 19, 2010 4:23 PM UTC
Question

USART STM32 asynchonous mode

Posted on February 19, 2010 at 17:23

USART STM32 asynchonous mode

    This topic has been closed for replies.

    5 replies

    Andrew Neil
    Super User
    May 17, 2011 11:40 AM UTC
    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

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    Tesla DeLorean
    Guru
    May 17, 2011 11:40 AM UTC
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Andrew Neil
    Super User
    May 17, 2011 11:41 AM UTC
    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

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    hexanpro2
    hexanpro2Author
    Associate
    May 17, 2011 11:41 AM UTC
    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
    Super User
    May 17, 2011 11:41 AM UTC
    Posted on May 17, 2011 at 13:41

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

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.