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 communication between two msp430 controllers

Other Parts Discussed in Thread: MSP430F2274, MSP430F1612

Hi,

I am trying to do UART communication between MSP430F1612 and MSP430F2274.

First of all I tried to send data to MSP430F1612 through PC UART and it is working as expected. I checked it by putting in debug mode.

Then I transmitted data using MSP430F2274 to PC UART and it is also working fine.

Now I connecetd UART of these two controllers together and MSP430F2274 will send data and MSP430F1612 will receive data. I connected their Tx to Rx of other controller and gave common Vcc and ground, I also made baud rate same.

But now I am not able to receive anything.

Is there anything I am missing?

Please let me know.

Regards,

Ankita Kadam

  • Just from the hardware point of view you only need to connect
    GND <-> GND
    TxD <-> RxD
    RxD <-> TxD
    (if both MSPs have the same supply voltage)

    Are you using custom boards?

  • I have done hardware connections as you mentioned.

    I think there is software problem.

    Regards,
    Ankita kadam
  • But how shall we know? You did not post any code.

    Dennis
  • Hi,

    till now i checked, that my transmitter controller is transmitting data and data is there on Rx ;ine of receiving controller. But it is not generating interupt.

    This is receiver controller code:

    main code:
    #include <msp430.h>
    #include "Config.h"

    int random;

    int main(void)
    {

    Watchdog_Init(); //watchdog timer stopped
    Clock_Init(); //Clock source selection
    Port_IO(); //Port pins selected as input/output
    Port_Sel(); //Port pins selected as alternate peripheral function
    Port_Out(); //Port pin output is made high
    UART_Init(); //UART is configured
    __bis_SR_register(GIE); // Enter LPM0 w/ interrupt


    while(1)
    {
    if(random=='A')
    {
    do_some_work();
    }
    }

    return 0;
    }

    #pragma vector=USART0RX_VECTOR
    __interrupt void usart0_rx (void)
    {
    IE1 = UTXIE0;
    random= RXBUF0; //Motor_run to RXBUF0
    TXBUF0 = random; //TXBUF0 to Motor_run;
    }


    #pragma vector=USART0TX_VECTOR
    __interrupt void usart0_tx (void)
    {
    IE1 = URXIE0;
    }

    config.c
    #include <msp430.h>
    #include "Config.h"

    void Watchdog_Init(void)
    {
    WDTCTL = WDTPW + WDTHOLD; // Stop WDT
    }

    void Clock_Init(void)
    {
    DCOCTL= DCO0; // selecting minimum DCO frequency--100kHz
    BCSCTL1= XT2OFF | XTS | DIVA_0; //external oscillator in HF mode
    BCSCTL2= SELM_3 | DIVS_0; //SM clock is given from external oscillator 1 and is divided by 8(SMCLK=1MHz)
    }
    void Port_IO(void)
    {
    P3DIR |= BIT4 ; // P3.4,5 = USART0 TXD/RXD
    P4DIR |= BIT2 | BIT3 | BIT4 | BIT5 | BIT6 | BIT7; //making these port pins output
    P6DIR |= BIT6 | BIT7 | BIT5; //making these port pins output
    P5DIR |= BIT1 | BIT2 | BIT3 | BIT4;

    }
    void Port_Sel(void)
    {
    P3SEL |= BIT4 | BIT5; // P3.4,5 = USART0 TXD/RXD
    P4SEL |= BIT4 | BIT3 | BIT2 | BIT5; //making these port pins as alternate function
    P6SEL |= BIT6 | BIT7;
    }
    void Port_Out(void)
    {
    P4OUT = BIT6 | BIT7;
    }
    void UART_Init(void)
    {
    UCTL0 |= SWRST; // Initialize USART state machine
    UCTL0 = 0x11; // 8-bit character
    UTCTL0 |= SSEL1; // UCLK= SMCLK
    UBR00 = 0x41; // 8MHz 9600 modulation
    UBR10 = 0x03; // 8MHz 9600 modulation
    UMCTL0 = 0x04; // 8MHz 9600 modulation
    ME1 |= UTXE0 + URXE0; // Enable USART0 TXD/RXD
    UCTL0 &= ~SWRST; // Initialize USART state machine
    IE1 |= URXIE0; // Enable USART0 RX interrupt
    }

    void delay(void)
    {
    volatile unsigned long int i;
    i = 10000; // SW Delay
    do (i--);
    while(i != 0);
    }
  • Hi folks,

    Sorry to dig this thread up. I am having the same problem getting two MSP430 devices to communicate with each other via UART. Each MSP430 can communicate with a FT231x chip but not with each other.

    Mr. Kadam: Did you ever get around this problem or find a solution?

    Thanks.
  • Hi,

    Problem was solved, but it was long time back and I am sorry that I do not remember.

    I will check the code and If I remember something, I will let you know.

    Regards,

    Ankita Kadam

  • Thanks for the update. In my case, the problem is presumably clock source. I soldered another batch of boards, loaded the same code, and things started to work.

    If you find anything, please do post back.

    Cheers,

    Zhiyong

**Attention** This is a public forum