MSP430FR2433: UART example 01 on Resource explorer

Part Number: MSP430FR2433
Other Parts Discussed in Thread: MSP430G2553

Tool/software:

Tool: CCS 12.7.1

Hi all!

Someone experienced this error while running this resource explorer UART example?

In addtion, soma weird characters appears, without typing.

Any help is appreciated!

  • Hi Italo,

    I have never seen this error.  Are you running this code on the MSP430FR2433 LaunchPad?

    Were you able to successfully program with error before this and now you see the error?

  • This symptom can appear if a program has a .data/.bss which is "too big", and the Watchdog goes off during C initialization. A TI Example seems an improbable candidate for this, since they're all pretty small.

    There was an artifact with the FR2433 Launchpad (and another one, I think): It is delivered with a program which uses the RTC, in particular RTCIE. The first time you program it, the debugger reset doesn't reset the RTC, and the interrupt goes off in the new code, which goes to the Fault ISR. I (vaguely) recall a different visible symptom, but this was also back in CCSv8, and maybe something has changed in the meantime. Power-cycling the Launchpad (after loading the new code) should clear this particular condition.

  • Hi Italo,

    Are you still seeing this issue?

  • Hi!

    Seems like the issue was resolved somehow. Maybe some initialization bug.

  • Well, I tried again and now this error occurred: 

    MSP430: Trouble Reading Memory Block at 0xc51a on Page 0 of Length 0x12: Could not read device memory

    Additionally, CCS lags and weird characters still appearing. Tried power-cycling, but no results.

  • Hi Italo,

    Are you having this issue with the MSP430FR2433 Launch Pad, or is this your custom PCB?  If custom PCB, what programmer are you using?

    In either case, check the VDD is +3.3V and stable on the MCU.

  • Hi!

    I'm using the LaunchPad, and the strange thing is that before I coded without interrupt, and it "worked". The characters appeared correctly on debugging mode, but when executing, they appeared weirdly.

  • Hi Italo,

    I tried the example code without any modifications to the code and it works on my Launch Pad.  Note: when running in debug mode, there will be a 3-4 sec delay in response due to the low bandwidth of the debugger.  If you reset the device and operate in normal run mode, you should see whatever you type on a terminal application get echoed back to the terminal.

  • Hello!

    I tried another snippet using on-board LED to check communication completeness between TX and RX. I suppose I'm misusing the console to see the echoes; even the simplest codes do not return anything in terminal.

  • Well, I tried another approach, replicating What successfully worked on msp430g2553, but didn't on it

    #include <msp430.h>
    
    void Software_Trim();                       // Software Trim to get the best DCOFTRIM value
    void ser_output(unsigned char*);
    #define MCLK_FREQ_MHZ 1                     // MCLK = 1MHz
    
    unsigned char TXData[] = "Test\n\r";
    
    int main(void)
    {
        WDTCTL = WDTPW | WDTHOLD;                 // Stop watchdog timer
    
        __bis_SR_register(SCG0);                // Disable FLL
        CSCTL3 = SELREF__REFOCLK;               // Set REFO as FLL reference source
        CSCTL1 = DCOFTRIMEN | DCOFTRIM0 | DCOFTRIM1 | DCORSEL_0;// DCOFTRIM=3, DCO Range = 1MHz
        CSCTL2 = FLLD_0 + 30;                   // DCODIV = 1MHz
        __delay_cycles(3);
        __bic_SR_register(SCG0);                // Enable FLL
        Software_Trim();                        // Software Trim to get the best DCOFTRIM value
        CSCTL4 = SELMS__DCOCLKDIV | SELA__REFOCLK; // set default REFO(~32768Hz) as ACLK source, ACLK = 32768Hz
                                                   // default DCODIV as MCLK and SMCLK source
    
        PM5CTL0 &= ~LOCKLPM5;                     // Disable the GPIO power-on default high-impedance mode
                                                  // to activate previously configured port settings
        P1DIR |= BIT0;
        P1OUT &= ~(BIT0);                           // P1.0 out low
    
        // Configure UART pins
        P1SEL0 |= BIT4 | BIT5;                    // set 2-UART pin as second function
    
        // Configure UART
        UCA0CTLW0 |= UCSWRST;                     // Put eUSCI in reset
        UCA0CTLW0 |= UCSSEL__SMCLK;
    
        // Baud Rate calculation
        UCA0BR0 = 104;                              // 1000000/9600 = 104.16
        UCA0BR1 = 0;
        UCA0MCTLW = 0x2000 | UCOS16 | UCBRF_2;      // 1000000/9600 - INT(1000000/9600)=0.16
                                                    // UCBRFx = int (0.16*16) = 2; 16 bcz of UCOS16
                                                    // UCBRSx value = 0x20 (See UG table 22-5)
        UCA0CTLW0 &= ~UCSWRST;                    // Initialize eUSCI
    
        while (1)
        {
            P1OUT ^= BIT0;
            ser_output(TXData);
            __delay_cycles(1000000);
        }
    }
    
    void ser_output(unsigned char* str)
    {
        while(*str)
        {
            while(!(UCA0IFG&UCTXIFG));
            UCA0TXBUF = *str++;
        }
    }
    
    void Software_Trim()
    {
        unsigned int oldDcoTap = 0xffff;
        unsigned int newDcoTap = 0xffff;
        unsigned int newDcoDelta = 0xffff;
        unsigned int bestDcoDelta = 0xffff;
        unsigned int csCtl0Copy = 0;
        unsigned int csCtl1Copy = 0;
        unsigned int csCtl0Read = 0;
        unsigned int csCtl1Read = 0;
        unsigned int dcoFreqTrim = 3;
        unsigned char endLoop = 0;
    
        do
        {
            CSCTL0 = 0x100;                         // DCO Tap = 256
            do
            {
                CSCTL7 &= ~DCOFFG;                  // Clear DCO fault flag
            }while (CSCTL7 & DCOFFG);               // Test DCO fault flag
    
            __delay_cycles((unsigned int)3000 * MCLK_FREQ_MHZ);// Wait FLL lock status (FLLUNLOCK) to be stable
                                                               // Suggest to wait 24 cycles of divided FLL reference clock
            while((CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1)) && ((CSCTL7 & DCOFFG) == 0));
    
            csCtl0Read = CSCTL0;                   // Read CSCTL0
            csCtl1Read = CSCTL1;                   // Read CSCTL1
    
            oldDcoTap = newDcoTap;                 // Record DCOTAP value of last time
            newDcoTap = csCtl0Read & 0x01ff;       // Get DCOTAP value of this time
            dcoFreqTrim = (csCtl1Read & 0x0070)>>4;// Get DCOFTRIM value
    
            if(newDcoTap < 256)                    // DCOTAP < 256
            {
                newDcoDelta = 256 - newDcoTap;     // Delta value between DCPTAP and 256
                if((oldDcoTap != 0xffff) && (oldDcoTap >= 256)) // DCOTAP cross 256
                    endLoop = 1;                   // Stop while loop
                else
                {
                    dcoFreqTrim--;
                    CSCTL1 = (csCtl1Read & (~DCOFTRIM0)) | (dcoFreqTrim<<4);
                }
            }
            else                                   // DCOTAP >= 256
            {
                newDcoDelta = newDcoTap - 256;     // Delta value between DCPTAP and 256
                if(oldDcoTap < 256)                // DCOTAP cross 256
                    endLoop = 1;                   // Stop while loop
                else
                {
                    dcoFreqTrim++;
                    CSCTL1 = (csCtl1Read & (~DCOFTRIM0)) | (dcoFreqTrim<<4);
                }
            }
    
            if(newDcoDelta < bestDcoDelta)         // Record DCOTAP closest to 256
            {
                csCtl0Copy = csCtl0Read;
                csCtl1Copy = csCtl1Read;
                bestDcoDelta = newDcoDelta;
            }
    
        }while(endLoop == 0);                      // Poll until endLoop == 1
    
        CSCTL0 = csCtl0Copy;                       // Reload locked DCOTAP
        CSCTL1 = csCtl1Copy;                       // Reload locked DCOFTRIM
        while(CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1)); // Poll until FLL is locked
    }
    // End of file
    

  • Interesting.

    Do you have an oscilloscope or logic probe that you can check the TX line and confirm the baud rate is 9600?

  • Hello!

    Configured my logic analyzer to async serial with 9600 baud rate and this was displayed:

    The upper line is the TX. The hexadecimal data depicted correctly corresponds to the ASCII of each character. So I suppose that It's working.

  • Hi Italo,

    Yes, looks like the device is echoing the data properly.  So given that, where are you still having issues?

  • Nothing is printed in my computer terminal.

    Now that I can see the transmission is occuring, and it is correct, I wonder what's wrong with the cable or any other configuration...

  • If you are running this on the FR2433 launchpad, you need to open your device manager on your PC and determine which COM PORT is assigned to "MSP430 application UART".  Be sure to specify this to your terminal application and it is also set to work at 9600 baud.

    Take a look at section 5 FAQ in the launchpad user guide.

**Attention** This is a public forum