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.

Msp430f5438a: adc12 problem



I am trying to test a adc12 example code from texas. The code is correct, but when I try to connect a voltage signal at configured adc port the following message appears:

msp430 trouble halting target cpu internal error.

This message appeara when the program is running and i connect the voltage to the pin.

I have revised the erra sheet and schematic to verify that there are not any short.

Can someone help me please? Thanks in advance

  • >This message appeara when the program is running and i connect the voltage to the pin.
    Please specify voltage and impedance of the source.
  • In a first moment, I connected an arduino pin to the adc port directly without impedance.
    After, a variable source 0-3.3 volts from a pointer of 10 k potentiometer.
  • Hi Miguel!

    I'm not 100% sure about the following because I never used an Arduino, but doesn't the Arduino work with 5V? If you connected 5V to the MSP430 without having any resistance in between, then maybe you already killed the pin by overvoltage and the resulting excessive current through the protection diode?

    Dennis
  • This error can occur if you connect the voltage accidently to the wrong port pin which is configured as GPIO port output. Which ADC input you are using? Is it configured as ADC input? Can you please measure supply voltage before and after you connected your voltage to the pin…

    Tobias
  • First of all, Thanks for the help.

    I don't know the reason, but now it works correctly with the same performance. 

    Other quick question, do you know why the ADCMEM0 register is different to 0 if there is not any voltage at this pin in the beginning?

    My code is the following:

    #include <msp430.h>
    int temp=0;
    int main(void)
    {
    WDTCTL = WDTPW + WDTHOLD; // Stop WDT
    ADC12CTL0 = ADC12SHT02 + ADC12ON; // Sampling time, ADC12 on
    ADC12CTL1 = ADC12SHP; // Use sampling timer
    ADC12IE = 0x01; // Enable interrupt
    ADC12MCTL0 |= ADC12INCH_7;
    ADC12CTL0 |= ADC12ENC;

    P6SEL |= 0x80; // P7.4 ADC option select
    P1DIR |= BIT0; // P1.0 output

    __delay_cycles(10000);

    while (1)
    {
    ADC12CTL0 |= ADC12SC; // Start sampling/conversion

    __bis_SR_register(LPM0_bits + GIE); // LPM0, ADC12_ISR will force exit
    __no_operation(); // For debugger
    }
    }

    #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
    #pragma vector = ADC12_VECTOR
    __interrupt void ADC12_ISR(void)
    #elif defined(__GNUC__)
    void __attribute__ ((interrupt(ADC12_VECTOR))) ADC12_ISR (void)
    #else
    #error Compiler not supported!
    #endif
    {
    switch(__even_in_range(ADC12IV,34))
    {
    case 0: break; // Vector 0: No interrupt
    case 2: break; // Vector 2: ADC overflow
    case 4: break; // Vector 4: ADC timing overflow
    case 6: // Vector 6: ADC12IFG0
    temp = ADC12MEM0;
    if (ADC12MEM0 >= 0x7ff) // ADC12MEM = A0 > 0.5AVcc?
    P1OUT |= BIT0; // P1.0 = 1
    else
    P1OUT &= ~BIT0; // P1.0 = 0

    __bic_SR_register_on_exit(LPM0_bits); // Exit active CPU

    break;
    case 8: break; // Vector 8: ADC12IFG1
    case 10: break; // Vector 10: ADC12IFG2
    case 12: break; // Vector 12: ADC12IFG3
    case 14: break; // Vector 14: ADC12IFG4
    case 16: break; // Vector 16: ADC12IFG5
    case 18: break; // Vector 18: ADC12IFG6
    case 20: // Vector 20: ADC12IFG7
    break;
    case 22: break; // Vector 22: ADC12IFG8
    case 24: break; // Vector 24: ADC12IFG9
    case 26: break; // Vector 26: ADC12IFG10
    case 28: break; // Vector 28: ADC12IFG11
    case 30: break; // Vector 30: ADC12IFG12
    case 32: break; // Vector 32: ADC12IFG13
    case 34: break; // Vector 34: ADC12IFG14
    default: break;
    }
    }

    It is an example from texas.

    Thanks

  • A floating (unconnected) pin will never give you 0 because charge couples from the surrounding to it. Remember that the pin has very high impedance and some capacitance. An input always needs a defined potential, otherwise you get random results.

**Attention** This is a public forum