This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

UART implementation using TIMER

Other Parts Discussed in Thread: MSP430G2553

Hi,

   I am using MSP430G2553. For my application i need 2 UART port. So that i am planning to do software based uart implementation using timer. I have a quite confusion as "whether can we able to declare the timer pins as UART port pins, meanwhile  use the UART peripheral pins also uart port". My exact application is i want use GPS and GSM module same time so that i need to use the timer pins also for uart.

I had referred the sample code msp430g2xx3_ta_uart9600 given in TI, in that they declared 

P1SEL = UART_TXD + UART_RXD;

that's why i have the doubt.

can anyone clarify is it possible to use the uart peripheral mode and timer pin as also for uart  mode at a time.

Thanks in advance

  • There are no UART pins. There are UART signals and you can route the UART signals to some of the pins.

    Similarly, there are no Timer pins. There are Timer signals and you can route the Timer signals to some of the pins.

    In order to be able to use both the UART signals and the Timer signals, you need to route them to different pins to be connected to your GPS and GSM.

    The beauty (or ugliness) of the statement:

    P1SEL = UART_TXD + UART_RXD;

    is, it can mean totally different things all depend on how UART_TXT and UART_RXD are defined.

  • it can mean totally different things all depend on how UART_TXT and UART_RXD are defined?
    i couldn't get your point pls clarify it
  • There are many cross compilers that you can use to generate object code for MSP430. They all come with a set of header files that define various symbolic names.for various MSP430 chips. In the case of MSP430G2553 chip, usually there is a header file named msp430g2553.h

    P1SEL is usually defined as an unsigned char @0x0026. However, UART_TXD and UART_RXD are usually not defined. But you can include other none-standard header file that defines them. Or, you can define them yourself.

    Here are just 2 examples out of tens of thousands other possible ways they are defined.

    Example 1: UART_TXD is defined as 2, UART_RXD is defined as 4. In this case P1SEL = UART_TXD + UART_RXD; means put 6 into the unsigned char @0x0026 because 2 + 4 = 6.

    Example 2: UART_TXD is defined as 8, UART_RXD is defined as 1. In this case P1SEL = UART_TXD + UART_RXD; means put 9 into the unsigned char @0x0026 because 8 + 1 = 9.

  • >can anyone clarify is it possible to use the uart peripheral mode and timer pin as also for uart mode at a time.
    G2553 has one hardware uart, so P1.1 and P1.2 is taken for that job and if one uart could use a higher baudrate , use this one for that.

    Implementing a second software based uart from the msp430g2xx3_ta_uart2400.c or msp430g2xx3_ta_uart9600 examples.
    You do have some flexibility as CCRx is available at more than one pin, so adjust the demo's defines.
    But using up a timer(s) for it, may affect other parts of code that also need it

**Attention** This is a public forum