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/MSP430FR6047: Getting simple UART to work

Part Number: MSP430FR6047
Other Parts Discussed in Thread: EVM430-FR6047

Tool/software: Code Composer Studio

I am attempting to get a simple serial out from my EVM430-FR6047 board. The long term goal is to use this code in conjunction with the ultrasonic measuring example code to transmit flow readings to another microcontroller for IoT transmission. Here is the code:

#include <msp430.h>


void main(void) {
    //Stuff for UART
    char wel[] ="HelloWord!!";
    volatile char i=0;

    //USCI setup code
      P4SEL1 |= 0x30;                       //P4.4,5 = USC_A1 TXD/RXD 0011 0000 
      UCA1CTL1 |= UCSWRST;                 //**Put state machine in reset**
      UCA1CTL1 |= UCSSEL_1;                 //Choose 32668Hz
      UCA1BR0 = 3;                          //Baud rate 9600 (refer users guide)
      UCA1BR1 = 0x00;                       //cHOOSE 32768hz
      UCA1MCTLW = 0x06;                      //Modulation UCBRSx=3, UCBRFx=0
      UCA1CTL0 = 0x00;                      //Not used
      UCA1CTL1 &= ~UCSWRST;                 // **Put USCI in operation mode**


      while(1)
      {i=0;
          while (wel[i] !='\0'){
              UCA1TXBUF = wel[i];
            while (UCA1STATW&UCBUSY);
            i++;
          }
          UCA1TXBUF = 0x0a;
        while(UCA1STATW&UCBUSY);
            UCA1TXBUF = 0x0d;
        while(UCA1STATW&UCBUSY);
      }

This code is inspired by a 2015 youtube video and modified it using the MSP430FR6xx User Guide. I feel like the answer is probably on page 767 where it talks about initializing and re-configuring the eUSCI_A module, but I am having trouble following it. I think the problem is in my configuration of the registers, but don't really know what to do next. Do the physical board jumpers need to be adjusted in any way? Everything compiles fine in Code Composer Studio onto by evaluation board, I just don't get any feedback into my serial connected terminal.

I feel like chip to chip communication should be easy and I am just doing something simple wrong. Any direction or help would be much appreciated

  • P4SEL1 |= 0x30;

    As shown in table 6-30 of the FR6047 datasheet, this configures both pins to output 0.

    To configure P4.3 and P4.4 for UCA0TXD and UCA0RXD, use:

    P4SEL0 |= 0x18;

    To configure P1.2 and P1.3 for UCA1TXD and UCA1RXD, use:

    P1SEL0 |= 0x0c;
  • Thank you so much for this. Apparently my understanding of embedded systems is way below what it needs to be. I cannot figure out how you arrived at
    P1SEL |= 0x18. That seems like a memory location, but how did you get that from the datasheet. I don't see 0x18 anywhere. I am looking at Table 6-30 on page 108 of the 187 page MSP340FR6047 data sheet.

    Sorry for being so dense,
  • The FR6047 has four UART modules.

    To use the first one (eUSCI_A0), you would have to configure the appropriate pins (P2.0/P2.1 or P4.3/P4.4) for UCA0TXD/UCA0RXD.
    To use the second one (eUSCI_A1), you would have to configure the appropriate pins (P1.2/P1.3) for UCA1TXD/UCA1RXD.
    To use the third one (eUSCI_A2), you would have to configure the appropriate pins (P5.0/P5.1 or P7.0/P7.1) for UCA2TXD/UCA2RXD.
    To use the fourth one (eUSCI_A3), you would have to configure the appropriate pins (P8.3/P8.2) for UCA3TXD/UCA3RXD.

    The pin diagrams in section 4.1 and the tables in section 4.2 show which signals are available at which pins; the tables in section 6.14 show how exactly to configure the pins.

    Assuming you want to use eUSCI_A0, table 6-30 shows that you have to set the bits P4SEL0.3 and P4SEL0.4, and to clear the bits P4SEL1.3 and P4SEL1.4 (these bits are cleared by default anyway).
    The statement "P4SEL0 |= 0x18" sets bits 3 and 4 in the P4SEL0 register.

    And when you're using the eUSCI_A0 module, you have to use the UCA0xxx registers

**Attention** This is a public forum