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.

Code Composer Build Errors: error#20 ADC identifiers are undefined

Hi,

I'm working on a MSP432 launchpad and trying to display an ADC value on a LCD. Now this same code (shown below) has compiled before without any problems but now, every time I try to build it or debug it, I get an error saying identifier "ADC14xxxxx" is undefined for every single instance. Eg, ADC14CTL0, ADC14CONSEQ_2, etc. Why is this happening? I didn't do anything special during the installation. All I did was make a workspace and a new project in it. There were some emulator updates but that's it. When I looked up the msp.h file in the ccsv6 folder, it says "#error "Failed to match a default include file""

Here's the code:

#include "msp.h"
#include <stdio.h>

void LCD_INIT();
void lcd_command(char cmd);
void lcd_char(char data);
void lcd_string(char data[]);
void newline();
void ADC_INIT();
int getADC();
void printADC();

int rawVolt; //unsigned long

void main(void)
{
    
    WDTCTL = WDTPW | WDTHOLD;           // Stop watchdog timer
    
    LCD_INIT();
    ADC_INIT();

    while(1)
    {
     }

}

void LCD_INIT()
{
    P2DIR = 0xFF;                    //Set all the pins on P2 as outputs
    P1DIR |= BIT7 + BIT6;// + BIT5;    //Set P1.7 = RS and P1.6 = E as outputs P1.5 = RW
    __delay_cycles(960);
    lcd_command(0x38);                //Two lines
    __delay_cycles(960);
    lcd_command(0x0F);                //Display on, cursor on, blink on
    __delay_cycles(960);
    lcd_command(0x01);                //clear screen, cursor home
    __delay_cycles(960);
}

void lcd_command(char cmd)
{
    __delay_cycles(960);
    P1OUT &= ~ (BIT7);         // RS is selecting command register, i.e. P1.7 = 0, and WRITING P1.5 = 0
    P1OUT |= BIT6;                    // P1.6 = E = 1

    __delay_cycles(960);
    P2OUT = cmd;
    P1OUT ^= BIT6;                    // E = 0
}

void lcd_char(char data)
{
    __delay_cycles(960);
    P1OUT |= BIT7 + BIT6;             // RS is selecting data register, i.e. P1.7 = 1 and E = 1
    __delay_cycles(960);
    P2OUT = data;
    P1OUT ^= BIT6;                     // E = 0
}

void lcd_string(char *data)
{
    volatile int i = 0;
    while(data[i] != 0)
    {
        lcd_char(data[i]);
        i++;
    }
}

void newline()
{
    __delay_cycles(960);
    lcd_command(0xC0);
}

void ADC_INIT()
{
    P1OUT &= ~BIT0;                     // Clear Red LED to start
    P1DIR |= BIT0;                      // Set P1.0/LED to output

    P6SEL1 &= ~BIT0;                        //Configure P6.0 for ADC
    P6SEL0 |= BIT0;

    ADC14CTL0 &= ~ADC14ENC;                    //Turn off Enable. With few exceptions, the ADC14 control bits can only be modified when ADC14ENC = 0.
    ADC14CTL0 |= ADC14CONSEQ_2 + ADC14SHT1_3 + ADC14ON;        //Select "Repeat single channel" mode, 16 clock ticks, ADC On
    ADC14MCTL0 |= ADC14INCH_15;         // A15 ADC input select; Vref=AVCC
    ADC14CTL1 |= ADC14SSEL_1 + ADC14RES_0;             //Set SYSCLK
    //ADC14CTL0 |= ADC14ENC | ADC14SC;     // Start sampling/conversion; Enable and start conversion.
                                                 //ADC14ENC must be set to 1 before any conversion can take place
}

int getADC()
{
    ADC14CTL0 |= ADC14ENC | ADC14SC;     // Start sampling/conversion; Enable and start conversion.
                                                //ADC14ENC must be set to 1 before any conversion can take place
    while(ADC14IFG0 == 0)                //Flag will be set when MEM0 is loaded with a conversion result
    {};
    rawVolt = ADC14MEM0;
    return rawVolt;
}

void printADC()
{
    int volt1 = getADC();
    int adc_Volt = (5 * volt1)/255;
    char voltage[64];
    sprintf(voltage,"%1f", adc_volt);
    lcd_string(voltage);
    lcd_char('V');                                        //Print the volts sign
    lcd_char(0x01);                                        //Clear screen and take cursor home
}






  • Hello,
    Can you provide your full build output? You can copy&paste to a test file and attach it to this thread.

    Also, are you using an MSPWare example? And if so, which one?

    Thanks
    ki
  • Bhoomi Patel said:
    Now this same code (shown below) has compiled before without any problems but now, every time I try to build it or debug it, I get an error saying identifier "ADC14xxxxx" is undefined for every single instance. Eg, ADC14CTL0, ADC14CONSEQ_2, etc. Why is this happening? I didn't do anything special during the installation. All I did was make a workspace and a new project in it. There were some emulator updates but that's it.

    I believe it is the MSP432 Emulators update that triggered the build error. The new package contains updates to the header definitions to conform to CMSIS, so the code needs to be converted to use the new CMSIS headers. Please see this app note (which includes a conversion tool) for more information. 

    I will also move this thread to the MSP forum so the folks there are aware of the issue, and can also provide additional comments as needed.

  • Please also take a look at this sticky post that contains much more detail about this change.

  • Aarti,

    I think you're right about that update causing this problem. I did follow your instructions and tried installing CodeConvert but I can't even launch the .exe file. Every time I try to run it, it crashes:

    I turned off my anti-virus while doing this and I'm running Windows 10. Is there any way to undo that MSP432 Emulator update?

    I also tried following the instructions on this page but it didn't help: http://processors.wiki.ti.com/index.php/MSP432_CMSIS_Update?DCMP=epd-mcu-msp-gen&HQS=MSP432CMSIS#Step_1:_Update_IDE_.26_software_packages

  • Bhoomi Patel said:
    I did follow your instructions and tried installing CodeConvert but I can't even launch the .exe file. Every time I try to run it, it crashes:

    Per the app note, run the conversion tool from a command prompt (see section 3) . Let us know if this still does not work.

  • I've run into the same problem after updating, where I get several errors pertaining to the ADC14 library having undefined identifiers.

    I also see errors in the MSP432P401R.c file, for instance:  identifier "INT_DMA_ERR" is undefined.

    Running the code conversion tool has no effect on the files in question, they are exactly the same.

  • That was my mistake. I should have looked at the usage instructions properly. However, going through command prompt did not help.
  • What I finally ended up doing was uninstall the latest version of CCS and install the previous version, Version: 6.1.1.00022, and not install the MSP430and MSP432 emulator updates. I don't know how long I can go without installing those updates, or if they're directly linked to my issues at all, but as of now everything builds and debugs perfectly.

  • Bhoomi and Max,

    The conversion tool can be used to convert your C source files to a format that works with the new CMSIS header definitions. However, the conversion may not always be 100% complete, meaning that, depending on your code you may need to make additional manual changes to get the code to build. You can refer to the header files in \ccsv6\ccs_base\arm\include to see the changes and update your source code accordingly.

    The recently released version of MSPWare 3.20.00.37 also uses these new definitions, so you can use the examples included there as a reference as well.

    Bhoomi, going back to a base installation of CCS 6.1.2 (without the Emulators update) is fine for the short term, however, since the entire MSP432 software ecosystem is being updated to be based on the CMSIS-Core, it might be advisable to start updating your software as well. 

  • Aarti,

    You are right, I'm already getting the following error which I believe is caused by the emulators not being updated :

    "CORTEX_M4_0: JTAG Communication Error: (Error -1170 @ 0x0) Unable to access the DAP. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 6.0.83.1)"

    I am using the msp432 for my senior design project and it's very time-sensitive. This uP is already proving to be more time-consuming and hassling than I had expected. I will probably be back on this thread when I start the code conversion process.
    Any help with the process will be appreciated!


    Thank you for the help so far!

**Attention** This is a public forum