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/MSP430FR5962: MSP430FR5962 will not update info memory

Part Number: MSP430FR5962

Tool/software: Code Composer Studio

I have code composer v7.4, and v8.0, and v9.01 and my code all run properly in v7.4. However, in v9, the same code will not update info memory. Ram memory works fine. Is there any difference between the two versions while writing to info A,B,C,D memory? It will read the memory correctly, but will not write to it. I tried various mclk and smclk settings, dco settings and to no avail.

Code composer v7 used to be able to break at breakpoint settings. Starting from the latest updates, it will not break any more. V8 gives me some weired break points.

  • David,

    David Cheung said:
    However, in v9, the same code will not update info memory. Ram memory works fine.

    Do you mean that your application code writes to INFO memory but that is not working OR that Code Composer Studio is not writing to INFO memory?

    Do you have a project that you could share that shows this problem.  I don't have a FR5962 but I should be able to find a FR5969 to try it on.

    Regards,

    John

  • The following is a simple test code that I reduced to a few lines in the main. It will attempt to increment scaleln[usr] variable every 0.5 seconds. If you set a break point there and step it through, you will see that iscaleln does increment because it is in ram. Scaleln[usr] with usr set to any number between 0 and 4 will not update if compiled with the latest code composer studio V9. However, everything works fine when compiled with code composer studio V7.


    #include <msp430.h>
    #define VTest   true
    #include <stdint.h>
    #include <stdbool.h>
    #include "math.h"
    #include    "msp430FR5962.h"
    int main(void);
    void timeout(void);
    void delay0(int xdelay);
    void delay1(int xdelay);                                                // for motor
    void delay2(int xdelay);                                                // for LCD
    void sdelay(int xdelay);

    int         TSEC;
    int         mySEC;
    int         myOldSEC;
    int         myMIN;
    int         myOldMIN;
    int         UserMinutes;
    bool        enablemySEC;
    bool        powerup;                                                    // indicate port interrupt is from timeout
    int         dlycnt0;
    int         dlycnt1;
    int         dlycnt2;
    int         dlycnt3;
    int         clockcnt;
    bool        callclock;
    bool        scanning;
    int         displaytimer;
    unsigned int         usr;
    int         iusr;
    int         iscaleln;
    int         lastaction;

    #define     nusr        5                                               // number of users
    #define     maxscale    42                                              // max scale 42mm
    #define     minscale    25                                              // min scale 25mm
    int         scaleln[nusr];                                              // length of scale

    #if VTest
    int         testmin;
    #endif

    int __attribute__((section(".infoB"))) scaleln[5], lastaction, testnum;
    unsigned int __attribute__((section(".infoA"))) usr;

    void delay0(int xdelay)                                                 // delay for xdelay ms
    {
        dlycnt0 = xdelay;                                                   // use timer interrupt
        while(dlycnt0>0);
    }
    void delay1(int xdelay)                                                 // delay for xdelay ms
    {
        dlycnt1 = xdelay;                                                   // use timer interrupt
        while(dlycnt1>0);
    }
    void delay2(int xdelay)                                                 // delay for xdelay ms
    {
        dlycnt2 = xdelay;                                                   // use timer interrupt
        while(dlycnt2>0);
    }
    void sdelay(int xdelay)                                                 // delay for xdelay nops 0.6133uS
    {
        int intii;
        for(intii=xdelay;intii>0;intii--)                                   // use nops 0.6133us
        {
            __no_operation();
        }
    }

    #pragma vector=TIMER0_A0_VECTOR
    __interrupt void TIMER0_A0_ISR(void)                                    // 1024 interrupts per sec
    {
        if(dlycnt0>0)                                                       // 0.492ms per int
        {
            dlycnt0-=1;
        }
        if(dlycnt1>0)                                                       // for xdelay1()
        {
            dlycnt1-=1;
        }
        if(dlycnt2>0)                                                       // for xdelay2()
        {
            dlycnt2-=1;
        }
        //lledport ^= lled;                                                 // toggle LLED for timer test
        if(scanning == false)
        {
            clockcnt-=1;
            if(clockcnt<1)
            {
                callclock=true;
                clockcnt=512;
                //lledport ^= lled;                                         // toggle LLED for timer test
                TSEC+=1;
                if(TSEC>1)
                {
    #if VTest
                        testmin+=1;
    #endif
                    TSEC=0;
                }
            }
        }
    }

    int Init(void)
    {
        PJSEL0 = (BIT4);                                                    // For XT1
        PJSEL1 = 0;
        PJDIR = (BIT6 + BIT7);                                              // PJ ALL I/O EXCEPT XIN, XOUT
        PJOUT = 0;
                                                                            // ACLK = LFTCLK
        // Clock System Setup
        CSCTL0_H = CSKEY >> 8;                                              // Unlock CS registers
        //CSCTL1 = DCOFSEL_6;                                               // Set DCO to 8MHz
        //CSCTL1 = DCOFSEL_6 + DCORSEL;                                     // Set DCO to 24MHz
        CSCTL1 = DCOFSEL_4 + DCORSEL;                                       // Set DCO to 16MHz
        CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK;               // Set SMCLK = MCLK = DCO
        //CSCTL3 = DIVA_1 | DIVS_1 | DIVM_1;                                // Set all dividers to 1
        //CSCTL3 = DIVA_0 | DIVS_0 | DIVM_2;                                // set mclk to 6mHz
        CSCTL3 = DIVA_0 | DIVS_0 | DIVM_1;                                  // set mclk to 8mHz
        // configure waitstates
        //FRCTL0 = (FRCTLPW + AUTO_1);                                      // + NWAITS_3_L);                                                     // AUTO wait state
        FRCTL0 = (FRCTLPW + NWAITS_0);                                      // + NWAITS_0);                                                     // AUTO wait state
        CSCTL4 &= ~LFXTOFF;                                                 // Enable LFXT1
        CSCTL5 &= ~LFXTOFFG;                                                // Clear XT1 fault flag
        SFRIFG1 &= ~OFIFG;
        while (SFRIFG1 & OFIFG)
        {
          CSCTL5 &= ~LFXTOFFG;                                              // Clear XT1 fault flag
          SFRIFG1 &= ~OFIFG;
        }                                                                   // Test oscillator fault flag
        CSCTL0_H = 0;                                                       // Lock CS registers
        TA0CCTL0 = CCIE;                                                    // TACCR0 interrupt enabled
        TA0CCR0 = 31;                                                       // count from 0 to 35 (36 cnts)
        TA0CTL = TASSEL_1 + ID_0 + MC_1 +  TACLR;                           // ACLK, up mode, clear TAR
        // Configure reference
        PMMCTL0_H = PMMPW_H;                                                // Unlock the PMM registers
        //PMMCTL2 |= INTREFEN;                                              // Enable internal reference
        sdelay(400);                                                        // Delay for reference settling
        PM5CTL0 &= ~LOCKLPM5;                                               // Disable the GPIO power-on default high-impedance mode
        CAPTIO0CTL = 0;
        // GPIO Setup
        PJSEL0 = (BIT4);                                                    // For XT1
        PJSEL1 = 0;
        PJDIR = (BIT6 + BIT7);                                              // PJ ALL I/O EXCEPT XIN, XOUT
        PJOUT = 0;
                                                                            // ACLK = LFTCLK
        P1SEL1 = (BIT0 + BIT1 + BIT2 + BIT3);                               // Configure P1.0,1,2,3 for ADC
        P1SEL0 = (BIT0 + BIT1 + BIT2 + BIT3);                               // Configure P1.0,1,2,3 for ADC
        P1DIR = (BIT4 + BIT5 + BIT6 + BIT7);                                // P1.4,5,6,7 output
        P1OUT = 0;
        P1IE = 0;
        P2SEL1 = 0;
        P2SEL0 = 0;
        P2DIR = 0x80;                                                       // PORT 2 bit 0-6 INPUTS FOR PUSH BUTTONS
        P2REN = 0x7F;
        P2OUT = 0x7F;
        P3SEL1 = 0;
        P3SEL0 = 0;
        P3DIR = (BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7);    // P3 ALL OUTPUTS FOR LCD I/O
        P3IE = 0;
        P3REN = 0xFF;
        P3OUT = 0;
        P4SEL1 = 0;
        P4SEL0 = 0;
        P4DIR = (BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7);    // P4 ALL OUTPUTS FOR LVR, RVR
        P4IE = 0;
        P4OUT = 0;
        P5SEL1 = 0;
        P5SEL0 = 0;
        P5DIR = (BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7);    // P5 ALL OUTPUTS FOR LCD CONTROLS
        P5IE = 0;
        P5REN = 0xFF;
        P6SEL1 = 0;
        P6SEL0 = 0;
        P6DIR = (BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7);    // P6 ALL OUTPUTS FOR LCD CONTROLS
        P6IE = 0;
        P6OUT = 0;
        P7SEL1 = (BIT5);
        P7SEL0 = (BIT5);
        P7DIR = (BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT6 + BIT7);           // P7 ALL OUTPUTS FOR LCD CONTROLS
        P7IE = 0;
        P7OUT = 0;
        P8SEL1 = 0;
        P8SEL0 = 0;
        P8DIR = (BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7);    // P8 ALL OUTPUTS FOR LCD CONTROLS
        P8IE = 0;
        P8OUT = 0;
        // By default, REFMSTR=1 => REFCTL is used to configure the internal reference
        while(REFCTL0 & REFGENBUSY);                                      // If ref generator busy, WAIT
        REFCTL0 |= (REFVSEL_0 + REFON + REFTCOFF);                        // Select internal ref = 1.2V, Temperature off
                                                                            // Internal Reference ON
        // Configure ADC12
        ADC12CTL0 = ADC12SHT0_3 | ADC12ON;
        ADC12CTL1 = (ADC12SHP + ADC12SSEL_3 + ADC12DIV_0);                  // ADCCLK = MODOSC; sampling timer
        ADC12CTL2 |= ADC12RES_2;                                            // 12-bit conversion results
        ADC12IER0 = (ADC12IE0 + ADC12IE1 + ADC12IE2);                       // Enable ADC conv complete interrupt
        while(!(REFCTL0 & REFGENRDY));                                    // Wait for reference generator
                                                                            // to settle
        TSEC=0;
        mySEC=0;
        myOldSEC=0;
        myMIN=0;
        myOldMIN=1;
        UserMinutes=0;
        enablemySEC=false;
        dlycnt0=0;
        dlycnt1=0;
        dlycnt2=0;
        clockcnt=512;
        callclock=false;
        scanning = false;
        iscaleln=scaleln[usr];
        return 0;
    }

    void timeout(void)
    {
        UserMinutes=0;
        myMIN=0;
        mySEC=0;
        enablemySEC=false;
        ADC12CTL0 &= ~ADC12ON;                                              // turn off ADC
        //beeper();
        powerup=true;                                                       // power off mode
        //PMMCTL0_H = 0x00a5;
        //PMMCTL0_L |= 0x0010;
        //PMMCTL0_L &= 0x0040;
        //PMMCTL0_L = 0;
        //__low_power_mode_4();
        __bis_SR_register(LPM4_bits+GIE);                                   // enter LPM3 mode
        while(1);
    }
    // screens are:
    // 1 Select User                                                        // set usr
    // 2 Treatment Mode                                                     // enter treatment mode
    // 3 Set Treatment Pt                                                   // set ltpoint[usr], rtpoint[usr]
    // 4 Set Hand Scale                                                     // set scaleln[usr]
    // 5 Recall Scan                                                        // redisplay last scan for [usr]
    // 6 Scan Mode                                                          // scan hand for [usr]
    // 7 Reset Treatment Pt                                                 // move treatment point to home position
    // 8 Adjust Screen Brightness or Power off                              // turn unit off
    // 9 Calibration Mode                                                   // set leftmin and rightmin calibration for machine
    int main(void)
    {
    //startup:
        WDTCTL = WDTPW | WDTHOLD;                                           // stop watchdog timer
        if(Init()>0)return 1;
        _enable_interrupt();
        testmin=0;
        scanning=false;
        callclock=true;
        UserMinutes=90;
        while(1)
        {
            if(callclock==true)
            {
                callclock=false;
                iscaleln = scaleln[usr];
                iscaleln +=1;
                if(iscaleln > maxscale)
                    iscaleln = minscale;
                scaleln[usr] = iscaleln;
            }
        }
    } //main
  • Mystery solved. I just need to turn off the MPU protect check box and compile it with out MPU.