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.

CCS/MSP430FR2111: asynchronous data transmission

Part Number: MSP430FR2111
Other Parts Discussed in Thread: MSP430G2533,

Tool/software: Code Composer Studio

I have a circuit board with a current measuring point at a high voltage potential. The measurement data should be transmitted to the evaluation electronics related to earth potential
via an optical connection. I have to transfer the measured values ​​very quickly. I do not handshake between the sender and receiver.
After each measurement, I will only send packets with two 8-bit words that resulted from the current measurement. Errors in the transmission are
recognized by the plausibility of the data in the evaluation electronics. I have now tried to set up a simple data transfer with the MSP430FR2111. I use pin P1.3 for the transfer. I have scheduled the following program for broadcast.
However, no data appears on P1.3!

I have earlier selected to use the P1.3 in stad of the P1.7, so I have to remap the output (SYSCFG3 |= 0x01;   // Remaping Output von P1.7 to P1.3)

The calibration of the transfer rate is not made yet. I have to work with a higher Baudrate in the final solution. The actual configuration comes from an other test setup for testing the optical link. There I made the test with a MSP430G2533.

#include <msp430.h>
#include "msp430FR2111.h"

unsigned int daten, n;                                      // 8-Bit Datenwort

int main(void)
{
    WDTCTL = WDTPW | WDTHOLD;                               // stop watchdog timer

    PM5CTL0 &= ~LOCKLPM5;                                   // Disable the GPIO power-on high-impedance mode

//  Clock setzen für 1MHz
    CSCTL0 = 0x40;                                          //DOC = 2   MOD = 0
    CSCTL1 = 0xC7;                                          //Rsel = 7
    CSCTL2 = 0x00;                                          // MCLK = DCO / 1; SMCLK = DCO / 1

//  Port konfigurieren
    P1DIR = 0xFF;                                           // Alles ausgänge
    P1OUT &= ~0xFF;                                         // Alle Ports auf Null setzen

    UCA0CTLW0 |= UCSWRST;                                   // UART Reset
    UCA0CTLW0 |= 0x8880;                                    // 8Bit, ODD, UART,Asynchron, SMCLK, 2 Stop
    UCA0CTLW1 |= 0x0003;                                    // Deglitch time = 200ns
    UCA0BR0 = 8;                                            // 1MHz 115200
    UCA0BR1 = 0;                                            // 1MHz 115200
    UCA0MCTLW = UCBRS2 + UCBRS0;                            // Modulation UCBRSx = 5
    SYSCFG3 |= 0x01;                                        // Remaping Output von P1.7 to P1.3

    UCA0CTLW0 &= ~UCSWRST;                                  // Initialize eUSCI


    while (1)
    {
        daten = 74;                                         //delivered from the measurement procedure

        n = 2;                                              // to transmit two 8 Bit words

        while (n > 0)                                       // Loop for two Bytes
        {
            UCA0TXBUF = daten & 0x0F;                       // Placing the 8 Bit in the TX buffer

            while(!(UCA0IFG & UCTXIFG));                    // Waiting until the buffer is empty

            daten = daten >> 8;                             // upper 8 Bit to the lower 8 Bit

            n--;                                            // Going to the next  Byte for sending
        }
    }
}

This is a test program for testing data transmission. In the actual program, the assignment of a measured value takes the place of the assignment of the value 74.

Do you have an explanation where I make an error in the program? Do you have a verry simple solution for trasfering such simple data unidirectional only?

Thank you for helping me.

  • You need to connect P1.3 to the USCI (UCA0TXD) using P1SEL [Ref data sheet (SLASE78C) Table 6-34]:

    > P1SEL0 |= BIT3;  // P1.3 as UCA0TXD per data sheet Table 6-34

  • Hello Charles,

    in addition to Bruce's recommendation, which is correct, I would recommend you flipping the sequence of the GPIO instructions

    //  Port konfigurieren
        P1DIR = 0xFF;                                           // Alles ausgänge
        P1OUT &= ~0xFF;                                         // Alle Ports auf Null setzen

    Configuring PDIR first, might result in generating a glitch, which might generate issues on the RX side.

    Best regards

    Peter

  • Hello Charles,

    is there anything else on this topic, we can do for you?

    Best regards

    Peter

**Attention** This is a public forum