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.

TMS570LS1224: ADC Example not working with TMS570LS1224

Part Number: TMS570LS1224
Other Parts Discussed in Thread: LAUNCHXL2-TMS57012, HALCOGEN

I was running this example https://training.ti.com/hercules-how-tutorial-12bit-adc?cu=1136292 with the launchpad LAUNCHXL2-TMS57012 in halcoGen and CCS software. But, I am getting while run the example code. 

Please tell me what I need to change in my halcoGen project and CCS project. 

>> Compilation failure
source/subdir_rules.mk:9: recipe for target 'source/sys_main.obj' failed
"../source/sys_main.c", line 89: error #29: expected an expression
"../source/sys_main.c", line 89: error #138: expression must be a modifiable lvalue
"../source/sys_main.c", line 90: error #19: extra text after expected end of number
"../source/sys_main.c", line 90: error #110: expression preceding parentheses of apparent call must have (pointer-to-) function type
4 errors detected in the compilation of "../source/sys_main.c".
gmake: *** [source/sys_main.obj] Error 1
gmake: Target 'all' not remade because of errors.

/** @file sys_main.c
* @brief Application main file
* @date 11-Dec-2018
* @version 04.07.01
*
* This file contains an empty main function,
* which can be used for the application.
*/

/*
* Copyright (C) 2009-2018 Texas Instruments Incorporated - www.ti.com
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/


/* USER CODE BEGIN (0) */
#include "reg_adc.h"
#include "reg_sci.h"
#include "sci.h"
#include "adc.h"
#include "stdlib.h"

/* USER CODE END */

/* Include Files */

#include "sys_common.h"
#include "system.h"

/* USER CODE BEGIN (1) */
unsigned char command[8];
/* USER CODE END */

/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/

/* USER CODE BEGIN (2) */
/* USER CODE END */

void main(void)
{
/* USER CODE BEGIN (3) */
adcData_t adc_data;
adcData_t *adc_data_ptr = &adc_data;
unsigned int NumberOfChars, value;

sciInit();
adcInit();

while(1)
{
adcStartConversion(adcREG1,adcGROUP1);
while(!adcIsConversionComplete(adcREG1,adcGROUP1))
adcGetData(adcREG1, 10, adc_data_ptr);
value = (unsigned int)adc_data_ptr=>value;
NumberOfChars = 1toa(value,(char *)command);
sciSend(scilinREG, 2, (unsigned char*)"0x");
sciSend(scilinREG, NumberOfChars, command);
sciSend(scilinREG, 2, (unsigned char *)"\r\n");
}
/* USER CODE END */


}


/* USER CODE BEGIN (4) */

void adcNotification(adcBASE_t *adc, unsigned group)
{
return;
}

void sciNotification(sciBASE_t *sci, unsigned flags)
{
return;
}

void esmGroup1Notification(int bit)
{
return;
}

void esmGroup2Notification(int bit)
{
return;
}

/* USER CODE END */

       TMS570.rar

  • adcGetData(adcREG1, 10, adc_data_ptr);

    should be

    adcGetData(adcREG1, adcGROUP1, adc_data_ptr);

  • I had tried changing that statement but still getting these errors Wang. 

    >> Compilation failure
    source/subdir_rules.mk:9: recipe for target 'source/sys_main.obj' failed
    "../source/sys_main.c", line 89: error #29: expected an expression
    "../source/sys_main.c", line 89: error #138: expression must be a modifiable lvalue
    "../source/sys_main.c", line 90: error #19: extra text after expected end of number
    "../source/sys_main.c", line 90: error #110: expression preceding parentheses of apparent call must have (pointer-to-) function type
    4 errors detected in the compilation of "../source/sys_main.c".
    gmake: *** [source/sys_main.obj] Error 1
    gmake: Target 'all' not remade because of errors.

  • I have used the following code with the modified statement that you had reccomended me. 

    /* USER CODE BEGIN (0) */
    #include "reg_adc.h"
    #include "reg_sci.h"
    #include "sci.h"
    #include "adc.h"
    #include "stdlib.h"

    /* USER CODE END */

    /* Include Files */

    #include "sys_common.h"
    #include "system.h"

    /* USER CODE BEGIN (1) */
    unsigned char command[8];
    /* USER CODE END */

    /** @fn void main(void)
    * @brief Application main function
    * @note This function is empty by default.
    *
    * This function is called after startup.
    * The user can use this function to implement the application.
    */

    /* USER CODE BEGIN (2) */
    /* USER CODE END */

    void main(void)
    {
    /* USER CODE BEGIN (3) */
    adcData_t adc_data;
    adcData_t *adc_data_ptr = &adc_data;
    unsigned int NumberOfChars, value;

    sciInit();
    adcInit();

    while(1)
    {
    adcStartConversion(adcREG1,adcGROUP1);
    while(!adcIsConversionComplete(adcREG1,adcGROUP1))
    adcGetData(adcREG1, adcGROUP1, adc_data_ptr);
    value = (unsigned int)adc_data_ptr=>value;
    NumberOfChars = 1toa(value,(char *)command);
    sciSend(scilinREG, 2, (unsigned char*)"0x");
    sciSend(scilinREG, NumberOfChars, command);
    sciSend(scilinREG, 2, (unsigned char *)"\r\n");
    }
    /* USER CODE END */


    }


    /* USER CODE BEGIN (4) */

    void adcNotification(adcBASE_t *adc, unsigned group)
    {
    return;
    }

    void sciNotification(sciBASE_t *sci, unsigned flags)
    {
    return;
    }

    void esmGroup1Notification(int bit)
    {
    return;
    }

    void esmGroup2Notification(int bit)
    {
    return;
    }

    /* USER CODE END */

  • change

    value = (unsigned int)adc_data_ptr=>value;  

    to

    value = (unsigned int)adc_data_ptr->value;

    Where is the 1toa() function defined?

  • I have changed that statement and currently getting the following errors Wang. 

    I don't know know how to find where the 1toa() is defined. Please tell me how to find that. 

    >> Compilation failure
    source/subdir_rules.mk:9: recipe for target 'source/sys_main.obj' failed
    "../source/sys_main.c", line 90: error #19: extra text after expected end of number
    "../source/sys_main.c", line 90: error #110: expression preceding parentheses of apparent call must have (pointer-to-) function type
    2 errors detected in the compilation of "../source/sys_main.c".
    gmake: *** [source/sys_main.obj] Error 1
    gmake: Target 'all' not remade because of errors.

  • Please let me know how to remove these errors. 

  • Hi Sakthi,

    You opened another thread for the same question. I will close this one. Thanks for using e2e forum.