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.

Compiler/MSP432P401R: I am facing problem in linking a code in code composer studio with MSP432P401R

Part Number: MSP432P401R

Tool/software: TI C/C++ Compiler

i have an error Encountered during linking in MSP432P401r . My code is shown below

#include "ti/devices/msp432p4xx/inc/msp.h"
#include <stdint.h>
#define Num_of_Results 1100
#define ADC_TIMER 1
#define ADC_TIMER_PERIOD 12000

volatile uint16_t A1results[Num_of_Results];
int main(void) {
volatile unsigned int i;
WDT_A->CTL = WDT_A_CTL_PW | // Stop WDT
WDT_A_CTL_HOLD;
P1->SEL0 |= BIT2 | BIT3; // set 2-UART pin as secondary function
// Configure UART
EUSCI_A0->CTLW0 |= EUSCI_A_CTLW0_SWRST; // Put eUSCI in reset
EUSCI_A0->CTLW0 = EUSCI_A_CTLW0_SWRST | // Remain eUSCI in reset

EUSCI_B_CTLW0_SSEL__SMCLK; // Configure eUSCI clock source for SMCLK
EUSCI_A0->BRW = 1; // 12000000/16/9600
EUSCI_A0->MCTLW = (10<< EUSCI_A_MCTLW_BRF_OFS) |
EUSCI_A_MCTLW_OS16;

EUSCI_A0->CTLW0 &= ~EUSCI_A_CTLW0_SWRST; // Initialize eUSCI

P5->SEL1 |= BIT4; // Configure P5.4 for ADC
P5->SEL0 |= BIT4;
ADC14->CTL0 = ADC14_CTL0_SHT0_6| ADC14_CTL0_ON | ADC14_CTL0_PDIV_2 | ADC14_CTL0_DIV_2 | ADC14_CTL0_SSEL_4 | ADC14_CTL0_MSC| ADC14_CTL0_SHP | ADC14_CTL0_CONSEQ_1;
ADC14->CTL1 = ADC14_CTL1_RES_0; // Use sampling timer, 12-bit conversion results


ADC14->CTL0= ADC14_CTL0_SHP+ADC14_CTL0_CONSEQ_1;

ADC14->MCTL[0] |= ADC14_MCTLN_INCH_1; // A1 ADC input select; Vref=AVCC
ADC14->IER0 = ADC14_IER0_IE3; // Enable ADC14IFG.3

TIMER_A1->CCTL[1]=OUTMOD_3;
TIMER_A1->CCR[0] = ((ADC_TIMER_PERIOD)/2)-1;
TIMER_A1->CCR[0] = ADC_TIMER_PERIOD-1;
ADC14->CTL0 = ADC14_CTL0_SHS_1;
ADC14->CTL0 = ADC14_CTL0_ENC;

TIMER_A1->CTL |= TIMER_A_CTL_TASSEL_2 | // mCLK
TIMER_A_CTL_MC_1; //UP mode

ADC14->CTL0 = ADC14_CTL0_SC;

__enable_irq();

// Enable ADC interrupt in NVIC module
NVIC->ISER[0] = 1 << ((ADC14_IRQn) & 31);
_no_operation();

ADC14->IER0 |= ADC14_IER0_IE0; // Enable ADC conv complete interrupt

SCB->SCR &= ~SCB_SCR_SLEEPONEXIT_Msk; // Wake up on exit from ISR

// Ensures SLEEPONEXIT takes effect immediately
__DSB();
}

void ADC14_IRQHandler(void)
{
volatile unsigned int data ;

data = ADC14->MEM[0];

while(!(EUSCI_A0->IFG & EUSCI_A_IFG_TXIFG));

// Echo the received character back
EUSCI_A0->TXBUF = data;
}

  • In CCS, please rebuild the entire project.  Right click on the project name and select Rebuild Project.  Then capture the entire contents of the Console view in a text file.  Use the icon named Copy Build Log.  Be sure to use the file extension .txt.  Then attach that text file to your next post.

    Thanks and regards,

    -George

  • **** Clean-only build of configuration Debug for project msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs ****
    
    "C:\\ti\\ccs910\\ccs\\utils\\bin\\gmake" -k -j 8 clean -O 
     
    DEL /F  "msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.hex"  "msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.out" 
    DEL /F "msp432p401x_adc14_01.obj" "system_msp432p401r.obj" "ccs\startup_msp432p401r_ccs.obj" 
    DEL /F "msp432p401x_adc14_01.d" "system_msp432p401r.d" "ccs\startup_msp432p401r_ccs.d" 
    Could Not Find E:\abhilasha\adc_14\timer\A1\msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs\Debug\msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.hex
    Finished clean
     
    
    **** Build Finished ****
    
    **** Build of configuration Debug for project msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs ****
    
    "C:\\ti\\ccs910\\ccs\\utils\\bin\\gmake" -k -j 8 all -O 
     
    Building file: "../ccs/startup_msp432p401r_ccs.c"
    Invoking: ARM Compiler
    "C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_19.6.0.STS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --include_path="E:/abhilasha/adc_14/timer/A1/msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs" --include_path="C:/ti/simplelink_msp432p4_sdk_3_20_00_06/source" --include_path="C:/ti/simplelink_msp432p4_sdk_3_20_00_06/source/third_party/CMSIS/Include" --include_path="C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_19.6.0.STS/include" --advice:power=none --define=__MSP432P401R__ --define=DeviceFamily_MSP432P401x -g --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on --preproc_with_compile --preproc_dependency="ccs/startup_msp432p401r_ccs.d_raw" --obj_directory="ccs"  "../ccs/startup_msp432p401r_ccs.c"
    Finished building: "../ccs/startup_msp432p401r_ccs.c"
     
    Building file: "../msp432p401x_adc14_01.c"
    Invoking: ARM Compiler
    "C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_19.6.0.STS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --include_path="E:/abhilasha/adc_14/timer/A1/msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs" --include_path="C:/ti/simplelink_msp432p4_sdk_3_20_00_06/source" --include_path="C:/ti/simplelink_msp432p4_sdk_3_20_00_06/source/third_party/CMSIS/Include" --include_path="C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_19.6.0.STS/include" --advice:power=none --define=__MSP432P401R__ --define=DeviceFamily_MSP432P401x -g --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on --preproc_with_compile --preproc_dependency="msp432p401x_adc14_01.d_raw"  "../msp432p401x_adc14_01.c"
    "../msp432p401x_adc14_01.c", line 123: warning #225-D: function "_no_operation" declared implicitly
    Finished building: "../msp432p401x_adc14_01.c"
     
    Building file: "../system_msp432p401r.c"
    Invoking: ARM Compiler
    "C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_19.6.0.STS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --include_path="E:/abhilasha/adc_14/timer/A1/msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs" --include_path="C:/ti/simplelink_msp432p4_sdk_3_20_00_06/source" --include_path="C:/ti/simplelink_msp432p4_sdk_3_20_00_06/source/third_party/CMSIS/Include" --include_path="C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_19.6.0.STS/include" --advice:power=none --define=__MSP432P401R__ --define=DeviceFamily_MSP432P401x -g --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on --preproc_with_compile --preproc_dependency="system_msp432p401r.d_raw"  "../system_msp432p401r.c"
    Finished building: "../system_msp432p401r.c"
     
    Building target: "msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.out"
    Invoking: ARM Linker
    "C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_19.6.0.STS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --advice:power=none --define=__MSP432P401R__ --define=DeviceFamily_MSP432P401x -g --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on -z -m"msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.map" --stack_size=512 -i"C:/ti/simplelink_msp432p4_sdk_3_20_00_06/source" -i"C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_19.6.0.STS/lib" --diag_wrap=off --display_error_number --warn_sections --xml_link_info="msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs_linkInfo.xml" --rom_model -o "msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.out" "./msp432p401x_adc14_01.obj" "./system_msp432p401r.obj" "./ccs/startup_msp432p401r_ccs.obj" "../msp432p401r.cmd"  -l"ti/display/lib/display.aem4f" -l"ti/grlib/lib/ccs/m4f/grlib.a" -l"third_party/spiffs/lib/ccs/m4f/spiffs.a" -l"ti/drivers/lib/drivers_msp432p401x.aem4f" -l"third_party/fatfs/lib/ccs/m4f/fatfs.a" -l"ti/devices/msp432p4xx/driverlib/ccs/msp432p4xx_driverlib.lib" -llibc.a 
    <Linking>
     
     undefined     first referenced          
      symbol           in file               
     ---------     ----------------          
     _no_operation ./msp432p401x_adc14_01.obj
     
    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.out" not built
     
    >> Compilation failure
    makefile:151: recipe for target 'msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.out' failed
    gmake[1]: *** [msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.out] Error 1
    makefile:147: recipe for target 'all' failed
    gmake: *** [all] Error 2
    
    **** Build Finished ****
    
    **** Clean-only build of configuration Debug for project msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs ****
    
    "C:\\ti\\ccs910\\ccs\\utils\\bin\\gmake" -k -j 8 clean -O 
     
    DEL /F  "msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.hex"  "msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.out" 
    DEL /F "msp432p401x_adc14_01.obj" "system_msp432p401r.obj" "ccs\startup_msp432p401r_ccs.obj" 
    DEL /F "msp432p401x_adc14_01.d" "system_msp432p401r.d" "ccs\startup_msp432p401r_ccs.d" 
    Could Not Find E:\abhilasha\adc_14\timer\A1\msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs\Debug\msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.hex
    Finished clean
     
    
    **** Build Finished ****
    
    **** Build of configuration Debug for project msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs ****
    
    "C:\\ti\\ccs910\\ccs\\utils\\bin\\gmake" -k -j 8 all -O 
     
    Building file: "../ccs/startup_msp432p401r_ccs.c"
    Invoking: ARM Compiler
    "C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_19.6.0.STS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --include_path="E:/abhilasha/adc_14/timer/A1/msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs" --include_path="C:/ti/simplelink_msp432p4_sdk_3_20_00_06/source" --include_path="C:/ti/simplelink_msp432p4_sdk_3_20_00_06/source/third_party/CMSIS/Include" --include_path="C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_19.6.0.STS/include" --advice:power=none --define=__MSP432P401R__ --define=DeviceFamily_MSP432P401x -g --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on --preproc_with_compile --preproc_dependency="ccs/startup_msp432p401r_ccs.d_raw" --obj_directory="ccs"  "../ccs/startup_msp432p401r_ccs.c"
    Finished building: "../ccs/startup_msp432p401r_ccs.c"
     
    Building file: "../msp432p401x_adc14_01.c"
    Invoking: ARM Compiler
    "C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_19.6.0.STS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --include_path="E:/abhilasha/adc_14/timer/A1/msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs" --include_path="C:/ti/simplelink_msp432p4_sdk_3_20_00_06/source" --include_path="C:/ti/simplelink_msp432p4_sdk_3_20_00_06/source/third_party/CMSIS/Include" --include_path="C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_19.6.0.STS/include" --advice:power=none --define=__MSP432P401R__ --define=DeviceFamily_MSP432P401x -g --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on --preproc_with_compile --preproc_dependency="msp432p401x_adc14_01.d_raw"  "../msp432p401x_adc14_01.c"
    "../msp432p401x_adc14_01.c", line 123: warning #225-D: function "_no_operation" declared implicitly
    Finished building: "../msp432p401x_adc14_01.c"
     
    Building file: "../system_msp432p401r.c"
    Invoking: ARM Compiler
    "C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_19.6.0.STS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --include_path="E:/abhilasha/adc_14/timer/A1/msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs" --include_path="C:/ti/simplelink_msp432p4_sdk_3_20_00_06/source" --include_path="C:/ti/simplelink_msp432p4_sdk_3_20_00_06/source/third_party/CMSIS/Include" --include_path="C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_19.6.0.STS/include" --advice:power=none --define=__MSP432P401R__ --define=DeviceFamily_MSP432P401x -g --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on --preproc_with_compile --preproc_dependency="system_msp432p401r.d_raw"  "../system_msp432p401r.c"
    Finished building: "../system_msp432p401r.c"
     
    Building target: "msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.out"
    Invoking: ARM Linker
    "C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_19.6.0.STS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --advice:power=none --define=__MSP432P401R__ --define=DeviceFamily_MSP432P401x -g --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on -z -m"msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.map" --stack_size=512 -i"C:/ti/simplelink_msp432p4_sdk_3_20_00_06/source" -i"C:/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_19.6.0.STS/lib" --diag_wrap=off --display_error_number --warn_sections --xml_link_info="msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs_linkInfo.xml" --rom_model -o "msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.out" "./msp432p401x_adc14_01.obj" "./system_msp432p401r.obj" "./ccs/startup_msp432p401r_ccs.obj" "../msp432p401r.cmd"  -l"ti/display/lib/display.aem4f" -l"ti/grlib/lib/ccs/m4f/grlib.a" -l"third_party/spiffs/lib/ccs/m4f/spiffs.a" -l"ti/drivers/lib/drivers_msp432p401x.aem4f" -l"third_party/fatfs/lib/ccs/m4f/fatfs.a" -l"ti/devices/msp432p4xx/driverlib/ccs/msp432p4xx_driverlib.lib" -llibc.a 
    <Linking>
     
     undefined     first referenced          
      symbol           in file               
     ---------     ----------------          
     _no_operation ./msp432p401x_adc14_01.obj
     
    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.out" not built
     
    >> Compilation failure
    makefile:151: recipe for target 'msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.out' failed
    gmake[1]: *** [msp432p401x_adc14_01_MSP_EXP432P401R_nortos_ccs.out] Error 1
    makefile:147: recipe for target 'all' failed
    gmake: *** [all] Error 2
    
    **** Build Finished ****
    

  • Thank you.  The key diagnostic from the linker is ...

     undefined     first referenced          
      symbol           in file               
     ---------     ----------------          
     _no_operation ./msp432p401x_adc14_01.obj
    

    This is almost certainly due to some error in configuring the project.  This thread is being turned over to some MSP432 experts who know how projects like yours should be configured.

    Thanks and regards,

    -George

  • > _no_operation ./msp432p401x_adc14_01.obj

    I think this function (intrinsic) name has two underbars at the beginning, i.e. "__no_operation()"

  • hello sir

    Thank you for previous answer i resolved my errors but i did not get any output nothing is shown after run the program whats problem in code now 

    Thank you 

  • This is really a new question (unrelated to CCS), but:

    1) In these lines:

    >ADC14->CTL0= ADC14_CTL0_SHP+ADC14_CTL0_CONSEQ_1;

    >ADC14->CTL0 = ADC14_CTL0_SHS_1;
    >ADC14->CTL0 = ADC14_CTL0_ENC;

    >ADC14->CTL0 = ADC14_CTL0_SC;

    By using "=", you're clearing all the other bits; in particular, you're setting CTL0_ON=0, turning off the ADC. Each of these should be "|=". (Also, the first and last are unneeded.)

    ---------------------

    You're using CONSEQ=1 but you're only using one channel (MCTL/MEM), and you're not setting the EOS bit in the final (only) MCTL. I suggest CONSEQ=0.

    ---------------------

    > EUSCI_A0->BRW = 1; // 12000000/16/9600

    This doesn't look right. Since you haven't changed SMCLK, it's running at 3MHz, and my calculator says 3000000/16/9600=20. If you're succeeding, though, that's fine.

    ---------------------

    The next thing you'll encounter: With CONSEQ=0 or =1 and a timer trigger (SHS != 0) you need to toggle ENC (off, then on) between triggers. [Ref TRM (SLAU356I) Figs 22-7 and 22-8]. The ISR is a pretty good place to do this. The symptom will be that you'll only get one conversion result (ISR call) and then nothing.

  • hello sir 

    I did all above you mention but still i dont get any output please see my below code what is problem now. I used baud rate 460800. System clock 12MHZ.

    #include "ti/devices/msp432p4xx/inc/msp.h"
    #include <stdint.h>
    #define Num_of_Results 1100
    #define ADC_TIMER 1
    #define ADC_TIMER_PERIOD 12000
    #define __SYSTEM_CLOCK 12000000

    volatile uint16_t A1results[Num_of_Results];
    int main(void) {
    volatile unsigned int i;
    WDT_A->CTL = WDT_A_CTL_PW | // Stop WDT
    WDT_A_CTL_HOLD;
    P1->SEL0 |= BIT2 | BIT3; // set 2-UART pin as secondary function
    // Configure UART
    EUSCI_A0->CTLW0 |= EUSCI_A_CTLW0_SWRST; // Put eUSCI in reset
    EUSCI_A0->CTLW0 = EUSCI_A_CTLW0_SWRST | // Remain eUSCI in reset

    EUSCI_B_CTLW0_SSEL__SMCLK; // Configure eUSCI clock source for SMCLK
    EUSCI_A0->BRW = 1; // 12000000/16/460800
    EUSCI_A0->MCTLW = (10<< EUSCI_A_MCTLW_BRF_OFS) |
    EUSCI_A_MCTLW_OS16;

    EUSCI_A0->CTLW0 &= ~EUSCI_A_CTLW0_SWRST; // Initialize eUSCI

    P5->SEL1 |= BIT4; // Configure P5.4 for ADC
    P5->SEL0 |= BIT4;
    ADC14->CTL0 |= ADC14_CTL0_SHT0_6 | ADC14_CTL0_ON | ADC14_CTL0_PDIV_2 | ADC14_CTL0_DIV_2 | ADC14_CTL0_SSEL_4 | ADC14_CTL0_MSC| ADC14_CTL0_SHP | ADC14_CTL0_CONSEQ_0 | ADC14_CTL0_SHP;
    ADC14->CTL1 |= ADC14_CTL1_RES_0; // Use sampling timer, 12-bit conversion results


    //ADC14->CTL0= ADC14_CTL0_SHP+ADC14_CTL0_CONSEQ_1;


    ADC14->MCTL[0] |= ADC14_MCTLN_INCH_1; // A1 ADC input select; Vref=AVCC
    ADC14->IER0 = ADC14_IER0_IE3; // Enable ADC14IFG.3

    TIMER_A1->CCTL[1] = OUTMOD_3;
    TIMER_A1->CCR[0] = ((ADC_TIMER_PERIOD)/2)-1;
    TIMER_A1->CCR[0] = ADC_TIMER_PERIOD-1;
    ADC14->CTL0 = ADC14_CTL0_SHS_1;
    ADC14->CTL0 = ADC14_CTL0_ENC;

    TIMER_A1->CTL |= TIMER_A_CTL_TASSEL_2 | // mCLK
    TIMER_A_CTL_MC_1; //UP mode


    ADC14->CTL0 |= ADC14_CTL0_SC;


    __enable_irq();

    // Enable ADC interrupt in NVIC module
    NVIC->ISER[0] = 1 << ((ADC14_IRQn) & 31);
    __no_operation();

    ADC14->IER0 |= ADC14_IER0_IE0; // Enable ADC conv complete interrupt

    SCB->SCR &= ~SCB_SCR_SLEEPONEXIT_Msk; // Wake up on exit from ISR

    // Ensures SLEEPONEXIT takes effect immediately
    __DSB();
    // ADC14->CTL0 |= ADC14_CTL0_EOS;

    }

    void ADC14_IRQHandler(void)
    {
    volatile unsigned int data ;

    data = ADC14->MEM[0];

    while(!(EUSCI_A0->IFG & EUSCI_A_IFG_TXIFG));

    // Echo the received character back
    EUSCI_A0->TXBUF = data;
    }

    Thanks 

  • What triggers the initial serial write?

    There does not seem to be any reason for the interrupt to fire.

  • You didn't make the changes I recommended.

    > ADC14->CTL0 = ADC14_CTL0_SHS_1;
    > ADC14->CTL0 = ADC14_CTL0_ENC;

    These (still) turn off the ADC. Use "|=".

    ---------------------

    > EUSCI_A0->BRW = 1; // 12000000/16/460800

    I (still) don't see any code that changes SMCLK from 3MHz to 12MHz.

    BRW=1 is (still) incorrect for UCOS=16 and either SMCLK=3MHz or 12MHz. It's not very good at 8MHz.

    ---------------------

    You're (still) not toggling ENC in the ISR.

    ---------------------

    You should probably compare your code with some of the Examples over at

    http://dev.ti.com/tirex/explore/node?node=AOqyDJonBtS4QACP3tJVEg__z-lQYNj__LATEST

  • Thanks sir for previous reply

    i changes in my code i run it baud rate 115200 i got 481 samples per sec problem is that after every second i got different number of samples .Either i use baud rate 115200 or 460800 i got same samples .As u said trigger ENC in ISR i trigger than nothing in result. what is now problem in code


    #include "ti/devices/msp432p4xx/inc/msp.h"
    #define __SYSTEM_CLOCK 12000000
    int main(void)
    {
    volatile unsigned int i, data;
    __enable_irq();

    WDT_A->CTL = WDT_A_CTL_PW | // Stop watchdog timer
    WDT_A_CTL_HOLD;
    // Enable ADC interrupt in NVIC module
    NVIC->ISER[0] = 1 << ((ADC14_IRQn) & 31);

    // Configure UART pins
    P1->SEL0 |= BIT2 | BIT3; // set 2-UART pin as secondary function

    P5->SEL1 |= BIT4; // Configure P5.4 for ADC
    P5->SEL0 |= BIT4;
    CS->KEY = CS_KEY_VAL ; // Unlock CS module for register access
    CS->CTL0 = 0; // Reset tuning parameters
    CS->CTL0 = CS_CTL0_DCORSEL_3; // Set DCO to 12MHz
    // Select MCLK = DCO, no divider
    // Select SMCLK = DCO
    CS->CTL1 = (CS->CTL1 & ~(CS_CTL1_SELM_MASK |
    CS_CTL1_SELS_MASK )) |
    CS_CTL1_SELM_3 |
    CS_CTL1_SELS_3;

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


    // Enable eUSCIA0 interrupt in NVIC module
    // NVIC->ISER[0] = 1 << ((EUSCIA0_IRQn) & 31);

    ADC14->CTL0 |= ADC14_CTL0_SHT0_6| ADC14_CTL0_SHP | ADC14_CTL0_ON | ADC14_CTL0_PDIV_2 | ADC14_CTL0_DIV_2 | ADC14_CTL0_CONSEQ_2 | ADC14_CTL0_SSEL_4 | ADC14_CTL0_MSC;
    ADC14->CTL1 |= ADC14_CTL1_RES_0; // Use sampling timer, 12-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

    SCB->SCR &= ~SCB_SCR_SLEEPONEXIT_Msk; // Wake up on exit from ISR

    // Configure UART
    EUSCI_A0->CTLW0 |= EUSCI_A_CTLW0_SWRST; // Put eUSCI in reset
    EUSCI_A0->CTLW0 = EUSCI_A_CTLW0_SWRST | // Remain eUSCI in reset

    EUSCI_B_CTLW0_SSEL__SMCLK; // Configure eUSCI clock source for SMCLK
    // Baud Rate calculation
    // 12000000/(16*115200) = 6.510
    // Fractional portion = 0.510
    // User's Guide Table 21-4: UCBRSx = 0x0
    // UCBRFx = int ( (6.510-6)*16) = 8
    EUSCI_A0->BRW = 6; // 12000000/16/115200
    EUSCI_A0->MCTLW = (8<< EUSCI_A_MCTLW_BRF_OFS) |
    EUSCI_A_MCTLW_OS16;

    EUSCI_A0->CTLW0 &= ~EUSCI_A_CTLW0_SWRST; // Initialize eUSCI
    // EUSCI_A0->IFG &= ~EUSCI_A_IFG_RXIFG; // Clear eUSCI RX interrupt flag
    // EUSCI_A0->IE |= EUSCI_A_IE_RXIE; // Enable USCI_A0 RX interrupt
    // Enable global interrupt
    // P1->IE |= 0x02;
    //NVIC->ISER[1]=1;


    // *Ensures SLEEPONEXIT takes effect immediately
    __DSB();

    // __delay_cycles(1500000);
    ADC14->CTL0 |= ADC14_CTL0_ENC;

    while (1)
    {
    //

    // Start sampling/conversion
    ADC14->CTL0 |= ADC14_CTL0_SC;
    while (!ADC14->IFGR0);
    //data = ADC14->MEM[0];
    // __sleep();
    //
    __no_operation(); // For debugger
    }
    }

    // UART interrupt service routine
    void ADC14_IRQHandler(void)
    {
    //ADC14->CTL0 |= ADC14_CTL0_ENC;
    volatile unsigned int data ;

    data = ADC14->MEM[0];

    while(!(EUSCI_A0->IFG & EUSCI_A_IFG_TXIFG));

    // Echo the received character back
    EUSCI_A0->TXBUF = data;
    }

    Thank you

  • Hello sir,

    Using the above code when i use system clock 24MHZ for 500 samples i am not getting constant samples per sec i got above than 500 or some time below 500 how this is .

    Thank you

  • How much of a difference (samples/sec) are you seeing?

    My calculator says you should be getting about 12MHz/32/3/(128+16+1)=862 samples(bytes)/sec. This should be easily accommodated at 115.2kbps (11520 bytes/sec).

    If doubling your ADC clock doesn't change things, it sounds like your limitation is elsewhere. What are you using to receive these samples?

  • Thanks for reply sir 

    Igot one time 456 on another sec i got 512samples/sec for the same clock and same baud rate 

    problem is that either i use 115200 baud rate or 460800 baud rate i got same no of samples in both cases. And i did not get constant samples per sec after each second it gives different  number of samples.

    I received these samples on notepad++ using python code .

    is there anything wrong in my code? and  in code both loop is right or wrong?

    Thank you sir

  • Given that (a) changing the UART bit-rate and (b) speeding up the ADC clock don't affect your symptom, I (still) suspect the problem is in the program that receives the data.

    Python does many things well, but "running really fast" is not typically among them. I usually use PuTTY with the "Session->Logging" option for these sorts of things. It won't keep up with multi-megabit rates, but it should do pretty well here.

  • Hello sir

    I send a picture of my output i am taking my output on realterm it shows what i send and what i received both are same but how can i calculate that it is  862 samples/sec. i think my code is running right.

    Thank you

  • I would start by capturing data in the log file for, say 30 seconds, counting the bytes in the log file, and dividing by 30. This is a bit clumsy, but it should give you  a first approximation fairly quickly. Right now you're looking for a 2x difference, which should be evident.

  • When I capture the output of this program in a PuTTY log file for 30 seconds, I get about 33000 bytes, so that's roughly 1ksps. I believe the MSP432 clock more than I believe my ("thousand-one") time-counting, but it's certainly closer to 862 sps than to 456.

    What did your Realterm experiment tell you?

**Attention** This is a public forum