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.

MSP430G2230 Loading Program error

Other Parts Discussed in Thread: MSP430G2230

I am using CCS (Code Composser Studio ) Version 6.0

MCU : MSP430G2230

Launch pad : MSP-TS430D8

I am going to execute example code for Turn ON LED if analog input is > 0.5 V on pin P1.5

Below is code :

#include <msp430.h>

int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop WDT

/* Initialization Code */
P1REN = 0x1B; // Terminate unavailable Port1 pins (P1.0/1/3/4) properly
// Config as Input with pull-down enabled
BCSCTL3 |= LFXT1S_2; // Select VLO as low freq clock
/* End Initialization Code */

ADC10CTL0 = SREF_1 | ADC10SHT_2 | REFON | ADC10ON | ADC10IE;
__enable_interrupt(); // Enable interrupts.
TA0CCR0 = 30; // Delay to allow Ref to settle
TA0CCTL0 |= CCIE; // Compare-mode interrupt.
TA0CTL = TASSEL_2 | MC_1; // TACLK = SMCLK, Up mode.
LPM0; // Wait for delay.
TA0CCTL0 &= ~CCIE; // Disable timer Interrupt
__disable_interrupt();
ADC10CTL1 = INCH_5; // input A5
ADC10AE0 |= BIT5; // PA.1 ADC option select
P1DIR |= BIT2; // Set P1.2 to output direction

for (;;)
{
ADC10CTL0 |= ENC | ADC10SC; // Sampling and conversion start
__bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exi
if (ADC10MEM < 0x156) // ADC10MEM = A5 > 0.5V?
P1OUT &= ~BIT2; // Clear P1.2 LED off
else
P1OUT |= BIT2; // Set P1.2 LED on
}
}

// ADC10 interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=ADC10_VECTOR
__interrupt void ADC10_ISR (void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(ADC10_VECTOR))) ADC10_ISR (void)
#else
#error Compiler not supported!
#endif
{
__bic_SR_register_on_exit(CPUOFF); // Clear CPUOFF bit from 0(SR)
}

#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMERA0_VECTOR
__interrupt void ta0_isr(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMERA0_VECTOR))) ta0_isr (void)
#else
#error Compiler not supported!
#endif
{
TA0CTL = 0;
LPM0_EXIT; // Exit LPM0 on return
}

After debugging it shows error as below :

MSP430: Trouble Writing Memory Block at 0xf800 on Page 0 of Length 0x112: Could not write device memory
MSP430: GEL: File: C:\Users\admin\Desktop\MSP430G2230 Project Files\msp430g2230_adc10_02\Debug\msp430g2230_adc10_02.out: Load failed.

Please help.

  • It doesn’t help posting your same problem in multiple threads.
    However, the problem is not related to the code you are uploading (unless the code was compiled for a different MSP and tries to install on locations where you current MSP has no FLASH at all, but this isn’t the case here).
    For some reason, the JTAG interface cannot upload the code or it shows a verify error after the write.
    Possible reasons are an unstable or insufficient power supply, maybe a shaky connection between FET and the MSP, sometimes just a bad USB cable.
    Also, it sometimes helps to just remove VCC from the MSP and put it back and then try again.

**Attention** This is a public forum