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/MSP432P401M: Error in loading the program in MSP432P401M

Part Number: MSP432P401M

Tool/software: Code Composer Studio

Hi ,

I have XDS 100V2 JTAG connector and i am using my own board for MSP432P401M. 

I got this error during the debug process, error in loading the program:-

CORTEX_M4_0: Flash Programmer: Reading HW revision failed.
CORTEX_M4_0: Your XMS432P401R material is no longer supported. We recommend you moving to production-quality MSP432P401R/M silicon by ordering samples at www.ti.com/product/MSP432P401R.
CORTEX_M4_0: File Loader: Memory write failed: Unknown error
CORTEX_M4_0: GEL: File: C:\Users\Nikhil Bapat\workspace_v7\inclinometer1\Debug\inclinometer1.out: Load failed.

I already checked "MSP432 Launchpad Users Guide-Factory reset script" and its shows that my xds100v2 is successfully connected.

Please help me in solving this .

With regards

Sayali Pathak

  • Sayali and I working together on this project.

    Just to add something, the MSP432 board that we have designed used 48 MHz crystal. We started with example from the MSP ware and it was working. We were able to see the register values to reflect the voltage input at the ADC. When code for 48 MHz was added, this error started showing up. We tried it with two different computers and with different CCS versions but it is still the same.

  • Sayali,

    I am curious since it is stated that the errors started when adding code for 48 MHz, have you changed also the flash wait states and Vcore?  Please tell me if the information in this previous E2E post is of assistance: click here.

  • Hi Sayali, Nikhil,
    The XMS432P401 is pre-production silicon, whose support has been discontinued since we now have the
    production version MSP432P401R. See the link below for details on the differences.

    processors.wiki.ti.com/.../XMS432_Support

    If possible, I would recommend switching out the part on your custom board. (Yes, I know this can be
    a pain, but it should save you many hassles going forward).

    Regards,
    Bob Landers
  • Bob,

    The MCU that I have was ordered from TI directly and it says MSP432P401M Rev C.

    That is the most intriguing thing. We are using the M version, not R. The linker and other files in the code are also for M and it was working before.

    I am using CCSv 7. In Help->Installation Details, I can only see MSP432 tool-chain. I do not see MSP432 Emulators.
  • John,

    When I added the code for 48 MHz I only added these lines to the main code:

            // Configure DCO to 48MHz, ensure MCLK uses DCO as source

            CS->KEY = CS_KEY_VAL ;                  // Unlock CS module for register access

            CS->CTL0 = 0;                           // Reset tuning parameters

            CS->CTL0 = CS_CTL0_DCORSEL_5;           // Set DCO to 48MHz

            CS->CTL1 = (CS->CTL1 & ~(CS_CTL1_SELM_MASK | CS_CTL1_DIVM_MASK)) |  CS_CTL1_SELM_3;  // Select MCLK = DCO, no divider

            CS->KEY = 0;                            // Lock CS module from unintended accesses

    I am attaching the main.c file here for reference.

    //  MSP432P401M - ADC14, Sample A1, AVcc Ref and Timer32 Example, One-shot mode in free run
    //
    //  Description:A single sample is made on A1 with reference to AVcc.
    //              ADC14 internal oscillator times sample (16x) and conversion.
    //              Timer 32 (module 0) is set up in 32-bit, free-run, and periodic mode.
    //              Timer count is loaded with an initial value of 0xFFFFFF.
    //              After perform some function, the timer interrupt triggers
    //              and the ISR is executed. Within the ISR, timer counts down and reaches the 0.
    //              Software sets ADC14_CTL0_SC to start sample and
    //              conversion - ADC14_CTL0 automatically cleared at EOC.It just clears the interrupt flag
    //              and exits back to the main application and enters a while loop.
    
    
    //************************************************************************************************//
    //   SAYALI PATHAK
    //   3 Feb 2017 (Created)
    //   8 Feb 2017 (Changes)
    #include "MSP432P401M.h"
    #include <stdint.h>
    
    //Defining variables for inclinometer ADC conversions
    //Nikhil Bapat 8 Feb 2017
    
    unsigned int i;
    unsigned int j;
    unsigned int l=1;
    
    
    //Defining variables for inclinometer voltage to angel conversions
    //
    //
    
    //Counters for debugging
    unsigned int m=0;
    unsigned int n=0;
    
    //*************************************************************************************
    //Main code
    int main(void)
    {
          //Stop watchdog timer
          WDT_A->CTL = WDT_A_CTL_PW |  WDT_A_CTL_HOLD;
    
        // Configure GPIO
        //this port pins is used as a UART pin
         // P1->DIR |= BIT0;
         //P1->OUT &= ~BIT0;
    
             P5->SEL1 |= BIT4;                       // Configure P5.4 for ADC
             P5->SEL0 |= BIT4;
    
    
        // UNUSED pin setup
    
             P10->DIR &= ~(BIT0 + BIT1 + BIT2 + BIT3); // set P10 as input direction
             P10->REN |= BIT0 +  BIT1 + BIT2 + BIT3; //enable pull-up/pull-down resistors on P10
             P10->OUT &= ~(BIT0 +  BIT1 + BIT2 + BIT3); //Set P10 resistors to pull down
    
             P1->DIR &= ~(BIT1 + BIT4 + BIT5 + BIT6 + BIT7);
             P1->REN |= BIT1 + BIT4 + BIT5 + BIT6 + BIT7;
             P1->OUT &= ~(BIT1 + BIT4 + BIT5 + BIT6 + BIT7);
    
             P2->DIR &= ~(BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7);
             P2->REN |= BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7;
             P2->OUT &= ~(BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7);
    
             P8->DIR &= BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7;
             P8->REN |= BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7;
             P8->OUT &= ~(BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7);
    
             P9->DIR &= ~(BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5);
             P9->REN |= BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 ;
             P9->OUT &= ~(BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5);
    
             P6->DIR &= ~(BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7);
             P6->REN |= BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7;
             P6->OUT &= ~(BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7);
    
             P4->DIR &= ~(BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7);
             P4->REN |= BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7;
             P4->OUT &= ~(BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7);
    
             P5->DIR &= ~(BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7);
             P5->REN |= BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7;
             P5->OUT &= ~(BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7);
    
             P7->DIR &= ~(BIT0 + BIT1 + BIT2 + BIT3);
             P7->REN |= BIT0 + BIT1 + BIT2 + BIT3;
             P7->OUT &= ~(BIT0 + BIT1 + BIT2 + BIT3);
    
           /*  //SAYALI PATHAK 9 FEB 2017
             // Configure DCO to 48MHz, ensure MCLK uses DCO as source
             CS->KEY = CS_KEY_VAL ;                  // Unlock CS module for register access
             CS->CTL0 = 0;                           // Reset tuning parameters
             CS->CTL0 = CS_CTL0_DCORSEL_5;           // Set DCO to 48MHz
             CS->CTL1 = (CS->CTL1 & ~(CS_CTL1_SELM_MASK | CS_CTL1_DIVM_MASK)) |  CS_CTL1_SELM_3;  // Select MCLK = DCO, no divider
             CS->KEY = 0;                            // Lock CS module from unintended accesses */
    
            //ADC Setup
            ADC14->CTL0 = ADC14_CTL0_SHT0_2 | ADC14_CTL0_SHP | ADC14_CTL0_ON; // Sampling time, S&H=16, ADC14 on
           //ADC14->CTL1 = ADC14_CTL1_RES_2;         // Use sampling timer, 12-bit conversion results
            ADC14->CTL1 = ADC14_CTL1_RES_3;         // Use sampling timer, 14-bit conversion results
            ADC14->MCTL[0] |= ADC14_MCTLN_INCH_1;   // A1 ADC input select; Vref=AVCC
          // ADC14->IER0 |= ADC14_IER0_IE0;          // Enable ADC conv complete interrupt
    
    
    
      /*  // Timer32 set up in one-shot, free run, 32-bit, no pre-scale
        TIMER32_1->CONTROL = TIMER32_CONTROL_SIZE |
               TIMER32_CONTROL_ONESHOT;
    
       //  Load Timer32 Counter with initial value
       TIMER32_1->LOAD= 0xFFFFFF;
    
        // Enable the Timer32 interrupt in NVIC
        __enable_irq();
        NVIC->ISER[0] = 1 << ((T32_INT1_IRQn) & 31);
    
        // Start Timer32 and enable interrupt
        TIMER32_1->CONTROL |= TIMER32_CONTROL_ENABLE |
               TIMER32_CONTROL_IE;
    
        // Disable sleep on exit from ISR
        SCB->SCR &= ~SCB_SCR_SLEEPONEXIT_Msk;
    
        // Enter LPM0 and wait for the timer interrupt to wake-up
        __sleep();
        __no_operation();*/
    
    
    
       while (1)
       {
        if(l == 1)
       {
    
           // Timer32 set up in periodic ,free run, 32-bit, no pre-scale
           TIMER32_1->CONTROL = TIMER32_CONTROL_SIZE | TIMER32_CONTROL_ONESHOT;
    
           // Load Timer32 Counter with initial value
            TIMER32_1->LOAD= 0xFFFFFF;
          //  TIMER32_1->LOAD= 0xFFFF;
    
          // Enable the Timer32 interrupt in NVIC
           __enable_irq();
           NVIC->ISER[0] = 1 << ((T32_INT1_IRQn) & 31);
    
           // Disable sleep on exit from ISR
           SCB->SCR &= ~SCB_SCR_SLEEPONEXIT_Msk;
    
           // Start Timer32 and enable interrupt
           TIMER32_1->CONTROL |= TIMER32_CONTROL_ENABLE |  TIMER32_CONTROL_IE;
    
    
          // Enter LPM0 and wait for the timer interrupt to wake-up
          //  __sleep();
          // __no_operation();
    
    
           m++;
           if (m>50000)
           {
               m=0;
           }
    
           l=0;
    
       }
       }
     }
    void T32_INT1_IRQHandler(void)
    {
        // P1->OUT ^= BIT0;                    // Toggle P1.0 LED
    
        // Start sampling/conversion
           ADC14->CTL0 |= ADC14_CTL0_ENC | ADC14_CTL0_SC;
           n++;
           if (n==50000)
           {
               n=0;
           }
    
    
         TIMER32_1->INTCLR |= BIT0;  // Clear Timer32 interrupt flag
    
         // Disable the timer and interrupt
          TIMER32_1->CONTROL &= ~(TIMER32_CONTROL_ENABLE |TIMER32_CONTROL_IE);
         l= 1;
    
    }
    
    
    
    

  • Hi,


    looks like you have the same issue as described in this thread.

    It is important that the system is in VCORE1 and that the flash wait state is set to 1 in order for the device to work at 48Mhz.

    When code with bad configured clocks is running in the device the debuggers have problems reading out the device information, thus leading to the described error.

    Regards,


    Thorsten

  • Nikhil,

    It looks like you have not changed VCORE or Flash wait states.  Since now I see you are using register level programming, can you please reference the following Example Code for setting up 48MHz DCO.

    I think this should clear things up for you, but let me know if you have any further questions.

  • OK, that is a bit odd, but at least you're using production silicon, so you don't have to worry about those differences.
    From the rest of this thread, it looks like there are other issues as well. I think John is addressing the real issue at play here.
    Let us know if you see the debugger error again after fixing the Vcore settings.
  • John,
    I have imported the example code given by you.still it is showing same error while debugging. I am choosing a factory reset in msp432 setting and debug the code but error is same.I will have erase the code prepared by me. can you please tell me steps to erase the code??
  • I am following the below steps to factory reset the launchpad

    1. Connect the failing LaunchPad/unit to your PC.
    2. Open CCS, assume you already have at least one MSP432 project open.
    3. Go to View > Target Configuration.
    4. Within Target Configuration navigate to your MSP432 project > the .ccxml file.
    5. Right Click > Launch Configuration
    6. Under Debug window you should now see some tree structure starting with the .ccmxl file being the root > something_CORTEX_M4_something (unknown)
    7. Right Click > Show all hidden cores.
    8. Connect only to the Non-Debuggable Devices > DAP.
    9. Go to Script > Factory Reset.
    10. Power cycle and try to restart debug.

    My error is removed and now i successfully build and debug the " EXAMPLE CODE FOR SETTING UP 48MHz DCO".
  • Sayali,

    This sounds like good news!  Does this mean your issue is solved?  Or are you still having troubles?  Sounds like you got the example code to work.  Were you also able to implement this in your own code?

  • Yes my issue is solved.I just add the following steps in my code to enable operation at MCLK=48MHz

    1. Configure VCORE level to 1
    2. Configure flash wait-state to 1
    3. Configure DCO frequency to 48MHz

    My code is also working without any error.

    Thanks

**Attention** This is a public forum