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/MSP430G2553: Debug Mode: Breakpoint prohibits the ADC to count up

Part Number: MSP430G2553


#include <msp430g2553.h>

void configWDT(void);
void configClocks(void);
void configADC(void);
void configTimerA(void);
void faultRoutine(void);
void startADC(void);

int ekgON = 0;
int systemIsSetUp = 0;
volatile int tempRaw = 0;
int test_ISR_counter = 0;
int dummy1 = 0;



int main(void)
{
    configWDT();
    configClocks();
    _BIS_SR(GIE);
    systemIsSetUp = 1;


      P1DIR = 0x41;                             // P1.0 & 6 output (red/green LEDs) - just for indication right now, not important for any function
      P1OUT = 0;


    ekgON = 1;                                  //manually set: ekgON
    //while(ekgON == 0){}                       

    configTimerA();                             
    configADC();
    startADC();                               

    
    while(ekgON == 1){
        dummy1++;
    }                                                   /


    return 0;
}


void configWDT(void)
 {
 WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer
 }


void configClocks(void){
    if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF){
      faultRoutine();                          // If calibration data is erased
                                               // run FaultRoutine()
    }else{}                                     //what should be in FalseRoutine????

     BCSCTL1 = CALBC1_1MHZ;                    // Set range
     DCOCTL = CALDCO_1MHZ;                     // Set DCO step + modulation
     BCSCTL3 |= LFXT1S_2;                      // LFXT1 = VLO
     IFG1 &= ~OFIFG;                           // Clear OSCFault flag
     BCSCTL2 = SELM_0 + DIVS0 + DIVS1;         // MCLK = DCO = 1MHz - SMLCK = MCLK/8
}



void configADC(void){
    ADC10CTL0 = 0;
    ADC10CTL0 = SREF_1 + ADC10SR + REFON + ADC10ON + ADC10IE;           //Sample and Hold Time: 8*CLK (!!) - reduce sampling rate to 50ksps - internal Reference at 1,5V - ADC10 on - ADC10 interrupt enabled
    ADC10CTL1 = INCH_10 + SHS1 + CONSEQ1;                               //Input Channel TempSensor - Source is Internal CLock - Trigger sourced from TimerA Output Unit 0 - Repeated single channel conversion
}


void configTimerA(void){
    TACTL = TASSEL1 + MC0;                      // SMCLK - Up Mode
    TACCTL0 = OUTMOD_4;                         //Output Mode 4 (toggle)
    TACCR0 = 0x271;                             //625
}



void faultRoutine(void)
 {
   P1OUT = 0x01;                            // red LED on
   while(1);                                // TRAP
 }

#pragma vector=ADC10_VECTOR
__interrupt void ADC10_ISR (void){
   tempRaw = ADC10MEM;
   test_ISR_counter++;
}

void startADC(){
    ADC10CTL0 |= ENC + ADC10SC;                       // first conversion is started, afterwards the timerA triggers the ADC

}

Tool/software: Code Composer Studio

Hello, I am currently working with an MSP430G2553, which performs conversions with the ADC10 triggered by TimerA.

I created two expression to check the functionality of my programm:

- tempRaw: here I store the value from the Temperatur Sensor and wan to check the value with the expression

- test_ISR_counter: I want to check how often the the ISR routine of the ADC10 has been started

When I start the programm in debug mode the expression can not be read:  tempRaw unknown Could not read 0x0204: execution state prevented access (picture)

When I click the suspend button in debug Mode I can see values for both expressions (seems to fit to my programm) (picture)

Since I want to have my expressions updated automatically, I added an Breakpoint (--> refresh all windows) in the while loop. However, when I start the programm both expressions are not cahnged at all. (picture)

Now I have two questions:

1. Why do I get the error message "execution state prevented access"? Do I have to change something in my programm?

2. Why are my expressions not changed at all when I add an Breakpoint which is supposed to just update the expressions?

Thanks!

Markus

  • #include <msp430g2553.h>
    
    void configWDT(void);
    void configClocks(void);
    void configADC(void);
    void configTimerA(void);
    void faultRoutine(void);
    void startADC(void);
    
    
    int systemIsSetUp = 0;
    volatile int tempRaw = 0;
    int test_ISR_counter = 0;
    int dummy1 = 0;
    
    
    /*
     * Programm funktioniert
     */
    int main(void)
    {
        configWDT();
        configClocks();
        _BIS_SR(GIE);
        systemIsSetUp = 1;
    
    
          P1DIR = 0x41;                             // P1.0 & 6 output (red/green LEDs) - just for indication right now, not important for any function
          P1OUT = 0;
                                     
        //while(ekgON == 0){}                       
    
        configTimerA();                             
        configADC();
        startADC();                                 //diese Funktion muss vermutlich über einen Interrupt aufgerufen werden
    
        //Delay function caused the MSP430 to jump into the ISR_Trap routine (after the second delay function has been executed)
        while(ekgON == 1){
            dummy1++;
        }                                                   //Hier wird die CPU festgehalten während die Conversion und Datenübertragung läuft - gerade Endlosschleife
                                                            //vielleicht muss die Bedingung auch wen und die CPU soll immer drin bleiben, alle weiteren Instructions werden mit Interrupts gemacht
    
    
    
        return 0;
    }
    
    
    void configWDT(void)
     {
     WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer
     }
    
    
    void configClocks(void){
        if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF){
          faultRoutine();                          // If calibration data is erased
                                                   // run FaultRoutine()
        }else{}                                     //what should be in FalseRoutine????
    
         BCSCTL1 = CALBC1_1MHZ;                    // Set range
         DCOCTL = CALDCO_1MHZ;                     // Set DCO step + modulation
         BCSCTL3 |= LFXT1S_2;                      // LFXT1 = VLO
         IFG1 &= ~OFIFG;                           // Clear OSCFault flag
         BCSCTL2 = SELM_0 + DIVS0 + DIVS1;         // MCLK = DCO = 1MHz - SMLCK = MCLK/8
    }
    
    
    
    void configADC(void){
        ADC10CTL0 = 0;
        ADC10CTL0 = SREF_1 + ADC10SR + REFON + ADC10ON + ADC10IE;           //Sample and Hold Time: 8*CLK (!!) - reduce sampling rate to 50ksps - internal Reference at 1,5V - ADC10 on - ADC10 interrupt enabled
        ADC10CTL1 = INCH_10 + SHS1 + CONSEQ1;                               //Input Channel TempSensor - Source is Internal CLock - Trigger sourced from TimerA Output Unit 0 - Repeated single channel conversion
    }
    
    
    void configTimerA(void){
        TACTL = TASSEL1 + MC0;                      // SMCLK - Up Mode
        TACCTL0 = OUTMOD_4;                         //Output Mode 4 (toggle)
        TACCR0 = 0x271;                             //625
    }
    
    
    
    void faultRoutine(void)
     {
       P1OUT = 0x01;                            // red LED on
       while(1);                                // TRAP
     }
    
    #pragma vector=ADC10_VECTOR
    __interrupt void ADC10_ISR (void){
       tempRaw = ADC10MEM;
       test_ISR_counter++;
    }
    
    void startADC(){
        ADC10CTL0 |= ENC + ADC10SC;                       // first conversion is started, afterwards the timerA triggers the ADC
    
    }
    

  • Hi,

    1. Why do I get the error message "execution state prevented access"? Do I have to change something in my programm?
    In an MSP430, the Debugger is unable to read variables when the processor is running, thus the message. You have to halt the processor to properly update this view.

    2. Why are my expressions not changed at all when I add an Breakpoint which is supposed to just update the expressions?
    The IDE can only update its screen fast enough - at 0.5s by default but, under several ideal scenarios, this could go as low as 0.1s. What you are experiencing, however, may be an artifact of both the compiler and the debugger
    - the compiler may have rendered the variable egkON as useless and removed it
    - with that, the source breakpoint would be hit only at the first interaction of the while loop

    In this case, two details should be expected:
    - The variable should have been declared as volatile;
    - The update rate will happen at a much lower rate than the ADC.

    Hope this helps,
    Rafael
  • Thank you for the explanations!