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.

AM4376: IDSK4376

Part Number: AM4376

Hello,

I am working on idk 4376.

I have ported starteware ADC volt measure project to rtos_template_app_am437x_a9.

project is getting build.

during execution i am facing problem at 

/* Wait till the ADC processes the analog lines. */
while(1U != gVoltMeasureAppCfg.appIntrCfg.endOfSeqIntr);

/* Read the sample data from the FIFO. */
gVoltMeasureAppSampleVal[0U] =
TSCADCFIFOADCDataRead(gVoltMeasureAppCfg.instAddr,
TSCADC_FIFO_SEL_0);

it show error as below

CortexA9: Unhandled ADP_Stopped exception 0x800C6998

kindly guide.

Regards,

Vrund

  • Hello Vrund,

    This kind of error is usually caused by a certain module not being enabled. Were you able to build and run the ADC voltage measurement example in the starterware, as recommended in this earlier thread

    Please also refer to this thread on enabling the ADC in board library.

    Regards,

    Jianzhong

  • hello,

    I have gone trhough your suggestion but that i have already taken care still problem persist.

    Below are the option that i have tried.

    1)

    a) importing starterware: volt measure added in rtos base project, 4 libraries are added(board, utils, soc, dal.) project compiled

    b) calling below in volt_measure_app_main.c

    /*ADC*/
    if(S_PASS == status)
    {
    status = PINMUXModuleConfig(CHIPDB_MOD_ID_ADC0, 0U, NULL);
    }

    and below in ADCAppInit function from adc_app.c.
    /* Clock Configuration. */
    status = PRCMModuleEnable(CHIPDB_MOD_ID_ADC0,0,0 /*pCfgAdc->instNum, FALSE*/ );

    Did not work. CortexA9: Unhandled ADP_Stopped exception 0x800C5108 during debugging.

    2) 

    a) importing starterware: volt measure added in rtos base project, 4 libraries are added(board, utils, soc, dal.) project compiled

    b) called Board_init(NULL); from main() under volt_measure_app_main.c

    c) added pdk board library from C:\ti\pdk_am437x_1_0_17\packages\ti\board\lib\idkAM437x\a9\release

    d) compilation error as below.


    **** Build of configuration Debug for project rtos_template_app_am437x_a9 ****

    "C:\\ti\\ccs1040\\ccs\\utils\\bin\\gmake" -k -j 12 all -O

    Building file: "../volt_measure_app_main.c"
    Invoking: GNU Compiler
    "C:/ti/ccs1040/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc-7.2.1.exe" -c -mcpu=cortex-a9 -march=armv7-a -mtune=cortex-a9 -marm -mfloat-abi=hard -Dam4372 -DSOC_AM437x -DEVM_AM437X -DevmAM437x -I"C:/ti/pdk_am437x_1_0_17/packages/ti/board/src/idkAM437x/include" -I"C:/ti/pdk_am437x_1_0_17/packages/ti/board/diag/adc/src" -I"C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/include/utils" -I"C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/include/am43xx" -I"C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/include/am43xx/am437x" -I"C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/include/hw" -I"C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/include" -I"C:/Users/20033229/workspace_v10/rtos_template_app_am437x_a9" -I"C:/ti/ccs1040/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi/include" -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF"volt_measure_app_main.d_raw" -MT"volt_measure_app_main.o" @"configPkg/compiler.opt" -o"volt_measure_app_main.o" "../volt_measure_app_main.c"
    ../volt_measure_app_main.c: In function 'main':
    ../volt_measure_app_main.c:144:14: warning: implicit declaration of function 'Board_init' [-Wimplicit-function-declaration]
    status = Board_init(NULL);// VR change BOARDInit(NULL);//Board_init(NULL);
    ^~~~~~~~~~
    ../volt_measure_app_main.c:139:21: warning: variable 'chan2' set but not used [-Wunused-but-set-variable]
    uint32_t chan1, chan2 = 0U;
    ^~~~~
    ../volt_measure_app_main.c:139:14: warning: variable 'chan1' set but not used [-Wunused-but-set-variable]
    uint32_t chan1, chan2 = 0U;
    ^~~~~
    Finished building: "../volt_measure_app_main.c"

    Building target: "rtos_template_app_am437x_a9.out"
    Invoking: GNU Linker
    "C:/ti/ccs1040/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc-7.2.1.exe" -mtune=cortex-a9 -marm -Dam4372 -DSOC_AM437x -DEVM_AM437X -DevmAM437x -Og -g -gdwarf-3 -gstrict-dwarf -Wall -mfloat-abi=hard -Wl,-Map,"rtos_template_app_am437x_a9.map" -nostartfiles -static -Wl,--gc-sections -L"C:/ti/pdk_am437x_1_0_17/packages/ti/board/lib/idkAM437x/a9/release" -L"C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/binary/examples/example_utils/lib/am43xx-evm/a9/debug/gcc" -L"C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/binary/device/lib/am43xx-evm/a9/debug/gcc" -L"C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/binary/utils/lib/am43xx-evm/a9/debug/gcc" -L"C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/binary/soc/lib/am43xx-evm/a9/debug/gcc" -L"C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/binary/dal/lib/am43xx-evm/a9/debug/gcc" -L"C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/binary/board/lib/am43xx-evm/a9/debug/gcc" -L"C:/ti/bios_6_76_03_01/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/hard" -Wl,--defsym,STACKSIZE=0x18000 -Wl,--defsym,HEAPSIZE=0x400 --specs=nano.specs -o"rtos_template_app_am437x_a9.out" "./adc_app.o" "./volt_measure_app_main.o" -Wl,-T"configPkg/linker.cmd" -Wl,--start-group "C:/ti/pdk_am437x_1_0_17/packages/ti/board/lib/idkAM437x/a9/release/ti.board.aa9fg" "C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/binary/examples/example_utils/lib/am43xx-evm/a9/debug/gcc/libexample_utils.a" "C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/binary/utils/lib/am43xx-evm/a9/debug/gcc/libutils.a" "C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/binary/soc/lib/am43xx-evm/a9/debug/gcc/libsoc.a" "C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/binary/dal/lib/am43xx-evm/a9/debug/gcc/libdal.a" "C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/binary/board/lib/am43xx-evm/a9/debug/gcc/libboard.a" -lgcc -lm -lrdimon -lc -Wl,--end-group
    makefile:152: recipe for target 'rtos_template_app_am437x_a9.out' failed
    C:/ti/pdk_am437x_1_0_17/packages/ti/board/lib/idkAM437x/a9/release/ti.board.aa9fg(idkAM437x_lld_init.oa9fg): In function `Board_uartStdioInit':
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_lld_init.c:39: undefined reference to `UART_stdioInit'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_lld_init.c:39: undefined reference to `UART_stdioInit'
    C:/ti/pdk_am437x_1_0_17/packages/ti/board/lib/idkAM437x/a9/release/ti.board.aa9fg(idkAM437x_ethernet_config.oa9fg): In function `Board_GPIOPinConfig':
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:135: undefined reference to `GPIODirModeSet'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:135: undefined reference to `GPIODirModeSet'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:138: undefined reference to `GPIODebounceFuncControl'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:138: undefined reference to `GPIODebounceFuncControl'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:152: undefined reference to `GPIOPinIntDisable'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:152: undefined reference to `GPIOPinIntDisable'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:177: undefined reference to `GPIOPinIntWakeUpEnable'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:177: undefined reference to `GPIOPinIntWakeUpEnable'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:160: undefined reference to `GPIOIntTypeSet'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:160: undefined reference to `GPIOIntTypeSet'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:163: undefined reference to `GPIOPinIntEnable'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:163: undefined reference to `GPIOPinIntEnable'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:169: undefined reference to `GPIOWakeupGlobalDisable'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:169: undefined reference to `GPIOWakeupGlobalDisable'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:172: undefined reference to `GPIOPinIntWakeUpDisable'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:172: undefined reference to `GPIOPinIntWakeUpDisable'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:146: undefined reference to `GPIODebounceTimeConfig'
    C:\ti\pdk_am437x_1_0_17\packages\ti\board/src/idkAM437x/idkAM437x_ethernet_config.c:146: undefined reference to `GPIODebounceTimeConfig'
    collect2.exe: error: ld returned 1 exit status
    gmake[1]: *** [rtos_template_app_am437x_a9.out] Error 1
    gmake: *** [all] Error 2
    makefile:148: recipe for target 'all' failed

    **** Build Finished ****

    regards,

    Vrund

  • Hello Vrund,

    Can you please first build and run the StarterWare example as mentioned in this earlier thread? This can server as your base reference.

    For those build errors, looks like you're missing the UART and GPIO LLD in your projects. Please follow this FAQ regarding how to add the LLDs of the PDK to your project.

    Regards,

    Jianzhong

  • Hello,

    Can you please first build and run the StarterWare example as mentioned in this earlier thread? This can server as your base reference.

    yes. I am able to build. but not able to run. 

    facing problem of CortexA9: Unhandled ADP_Stopped exception 0x800C5108 during debugging.

    then i tried to add adc module by below method.

    PFA of modified adc files.

    ADC module is getting enabled but it is not working.CortexA9: Unhandled ADP_Stopped exception 0x800C5108 during debugging.

    adc_app.c

    /**
     * \file   adc_app.c
     *
     * \brief  Source file containing the ADC IP related configuration functions.
     *         These functions will be called by example application.
     *
     */
    
    /**
     *  \copyright Copyright (C) 2013 Texas Instruments Incorporated -
     *             http://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.
    *
    */
    /* ========================================================================== */
    /*                             Include Files                                  */
    /* ========================================================================== */
    #include "types.h"
    #include "tsc_adc_ss.h"
    #include "adc_app.h"
    #include "error.h"
    #include "prcm.h"
    #include "pinmux.h"
    #include "console_utils.h"
    
    
    #include "types.h"
    #include "pinmux.h"
    #include "am43xx_pinmux.h"
    /* ========================================================================== */
    /*                                Macros                                      */
    /* ========================================================================== */
    
    /* ========================================================================== */
    /*                         Structures and Enums                               */
    /* ========================================================================== */
    
    
    /* ========================================================================== */
    /*                 Internal Function Declarations                             */
    /* ========================================================================== */
    
    /**
     * \brief   Configure the ADC interrupts to interrupt controller.
     *
     * \param   pCfgAdc        Pointer to the ADC configuration structure.
     *
     * \retval  S_PASS         Interrupt configuration successful.
     * \retVal  E_FAIL         Interrupt configuration failed.
     *
     */
    static int32_t AdcAppIntrConfig(adcAppCfgObj_t *pCfgAdc);
    
    /**
     * \brief   ADC Interrupt Service Routine. This function will read and clear the
     *          status of the Tx/Rx interrupts when generated. Will read the data
     *          from the ADC Fifo.
     *
     * \param   intrId         Interrupt ID.
     * \param   cpuId          CPU ID.
     * \param   pUserParam     User parameters.
     */
    static void AdcAppIsr(uint32_t intrId, uint32_t cpuId, void* pUserParam);
    
    /* ========================================================================== */
    /*                            Global Variables                                */
    /* ========================================================================== */
    static pinmuxPerCfg_t gAdc0PinCfg[] =
    {
        {
            /* My ADC 7 -> ext_hw_trigger -> AC25 */
            PIN_CAM1_FIELD, 0, \
            ( \
                PIN_MODE(2) | \
                ((PIN_PULL_UD_DIS | PIN_PULL_UP_EN | PIN_RX_ACTIVE | PIN_DS_VALUE_OVERRIDE_EN | PIN_DS_OP_DIS | PIN_DS_PULL_UP_EN) & \
                (~PIN_DS_OP_VAL_1 & ~PIN_DS_PULL_UD_EN & ~PIN_WAKE_UP_EN))
            ) \
        },
        {PINMUX_INVALID_PIN}
    };
    static pinmuxModuleCfg_t gAdcPinCfg[] =
    {
        {0, TRUE, gAdc0PinCfg},
        {CHIPDB_INVALID_INSTANCE_NUM}
    };
    pinmuxBoardCfg_t gIdkevmPinmuxData[] =
    {
        {CHIPDB_MOD_ID_ADC0, gAdcPinCfg},
        {CHIPDB_MOD_ID_INVALID}
    };
    int32_t PINMUXModuleConfig_1(chipdbModuleID_t moduleId, uint32_t instNum,
                                                                  void* pParam1);
    /* ========================================================================== */
    /*                          Function Definitions                              */
    /* ========================================================================== */
    
    int32_t ADCAppInit(adcAppCfgObj_t *pCfgAdc)
    {
        uint32_t fifoNum[2U];
        uint32_t index;
        int32_t status = S_PASS;
    
        tscAdcStepCfg_t adcStepCfg;
    
        /* Clock Configuration. */
        status = PRCMModuleEnable(CHIPDB_MOD_ID_ADC0,pCfgAdc->instNum, FALSE);
    
        /*ADC*/
        if(S_PASS == status)
        {
            status = PINMUXModuleConfig_1(CHIPDB_MOD_ID_ADC0, 0U, NULL);
        }
        if (S_PASS != status)
        {
            //CONSOLEUtilsPrintf("\n Clock Configuration failed !\n");
        }
        else
        {
            /* Configure the ADC AFE clock. */
            TSCADCClkDivConfig(pCfgAdc->instAddr,
                               pCfgAdc->modClk,
                               pCfgAdc->afeInClk);
    
            /* Enable the step ID tag. */
            TSCADCStepIdTagEnable(pCfgAdc->instAddr, TRUE);
    
            /* Disable the write protection for Step config registers. */
            TSCADCStepConfigProtectionEnable(pCfgAdc->instAddr, FALSE);
    
            /* Configure the ADC interrupts. */
            AdcAppIntrConfig(pCfgAdc);
    
            if (ADC_GP_MODE_ENABLE == pCfgAdc->appCtrl.adcMode)
            {
                adcStepCfg.adcNegativeInpRef = TSCADC_NEGATIVE_REF_VSSA;
                adcStepCfg.adcPositiveInpRef = TSCADC_POSITIVE_REF_VDDA;
                adcStepCfg.adcNegativeInpChan = TSCADC_INPUT_CHANNEL1;
                adcStepCfg.adcPositiveInpChan = TSCADC_INPUT_CHANNEL1;
                adcStepCfg.enableXppsw = TRUE;
                adcStepCfg.enableXnpsw = FALSE;
                adcStepCfg.enableYppsw = FALSE;
                adcStepCfg.enableXnnsw = TRUE;
                adcStepCfg.enableYpnsw = FALSE;
                adcStepCfg.enableYnnsw = FALSE;
                adcStepCfg.enableWpnsw = FALSE;
    
                /* Enable ADC for GP mode. */
                TSCADCTSModeConfig(pCfgAdc->instAddr,  TSCADC_MODE_FOUR_WIRE/*TSCADC_MODE_FOUR_WIRE*/);/*VR change TO TSCADC_MODE_GP_ADC*/
    
                fifoNum[0U] = TSCADC_FIFO_SEL_0;
                fifoNum[1U] = TSCADC_FIFO_SEL_1;
    
                for (index = 0U; index < 2U; index++)
                {
                    if (1U == index)
                    {
                        adcStepCfg.adcPositiveInpChan = TSCADC_INPUT_CHANNEL2;
                    }
    
                    /* Configure the ADC steps. */
                    TSCADCStepConfig(pCfgAdc->instAddr, (index + 1U),
                                     FALSE, &adcStepCfg);
    
                    /* Configure the ADC FIFO. */
                    TSCADCFIFOIRQThresholdLevelConfig(pCfgAdc->instAddr, (index + 1U),
                                         fifoNum[index], 2U, TRUE);
    
                    /* Configure the Step mode. */
                    TSCADCStepMode(pCfgAdc->instAddr, (index + 1U),
                                   TSCADC_STEP_MODE_SW_ENABLED_ONE_SHOT/*TSCADC_STEP_MODE_SW_ENABLED_ONE_SHOT*/);/*VR change TO TSCADC_STEP_MODE_SW_ENABLED_CONTINUOUS*/
    
                    /* Enable the ADC steps. */
                    TSCADCConfigureStepEnable(pCfgAdc->instAddr, (index + 1U), TRUE);
                }
    
                TSCADCIntrClear(pCfgAdc->instAddr,
                               (TSCADC_INTR_MASK_HW_PEN_EVENT_ASYNC |
                                TSCADC_INTR_MASK_END_OF_SEQUENCE |
                                TSCADC_INTR_MASK_FIFO0_THRESHOLD |
                                TSCADC_INTR_MASK_FIFO0_OVERRUN |
                                TSCADC_INTR_MASK_FIFO0_UNDERFLOW |
                                TSCADC_INTR_MASK_FIFO1_THRESHOLD |
                                TSCADC_INTR_MASK_FIFO1_OVERRUN |
                                TSCADC_INTR_MASK_FIFO1_UNDERFLOW |
                                TSCADC_INTR_MASK_OUT_OF_RANGE |
                                TSCADC_INTR_MASK_PEN_UP_EVENT |
                                TSCADC_INTR_MASK_HW_PEN_EVENT_SYNC));
    
                TSCADCEventInterruptEnable(pCfgAdc->instAddr, TSCADC_INTR_MASK_END_OF_SEQUENCE);
    
                TSCADCEnable(pCfgAdc->instAddr, TRUE);
            }
            else if (ADC_TS_MODE_ENABLE == pCfgAdc->appCtrl.adcMode)
            {
                /* Touchscreen configurations to be put here. */
                //CONSOLEUtilsPrintf("Touchscreen mode is not supported!!!\r\n");
            }
            else
            {
                //CONSOLEUtilsPrintf("Please select the proper value to select GP-ADC");
                //CONSOLEUtilsPrintf(" mode or Touchscreen mode.\r\n");
            }
        }
    
        return(status);
    }
    
    /* -------------------------------------------------------------------------- */
    /*                 Internal Function Definitions                              */
    /* -------------------------------------------------------------------------- */
    
    static int32_t AdcAppIntrConfig(adcAppCfgObj_t *pCfgAdc)
    {
        int32_t retVal = S_PASS;
        intcIntrParams_t gAdcIntrParams;
    
        INTCInit(FALSE);
    
        gAdcIntrParams.triggerType = pCfgAdc->appIntrCfg.trigType;
        gAdcIntrParams.priority = pCfgAdc->appIntrCfg.intrPriority;
        gAdcIntrParams.pFnIntrHandler = AdcAppIsr;
        gAdcIntrParams.pUserParam = pCfgAdc;
        gAdcIntrParams.isIntrSecure = pCfgAdc->appIntrCfg.isIntrSecure;
    
        if(S_PASS != INTCConfigIntr(pCfgAdc->appIntrCfg.intrLine,
                                    &gAdcIntrParams, FALSE))
        {
            //CONSOLEUtilsPrintf("FAILURE!!!.\r\n");
            //CONSOLEUtilsPrintf("Configuration failed for ADC interrupt.\r\n");
    
            retVal = E_FAIL;
        }
    
        return (retVal);
    }
    
    /* Reads the data from FIFO 0 and FIFO 1 */
    static void AdcAppIsr(uint32_t intrId, uint32_t cpuId, void* pUserParam)
    {
        uint32_t status;
        adcAppCfgObj_t *instObj = (adcAppCfgObj_t *) pUserParam;
    
        /* Read the interrupt status. */
        status = TSCADCIntStatus(instObj->instAddr);
    
        /* Check if End of sequence interrupt. */
        if(status & TSCADC_INTR_MASK_END_OF_SEQUENCE)
        {
            /* Clear the Interrupt status for end of sequence interrupt. */
            TSCADCIntrClear(instObj->instAddr,
                                        TSCADC_INTR_MASK_END_OF_SEQUENCE);
    
            /* Disable the end of sequence interrupt. */
            TSCADCEventInterruptDisable(instObj->instAddr, TSCADC_INTR_MASK_END_OF_SEQUENCE);
    
            /* Set the interrupt flag. */
            instObj->appIntrCfg.endOfSeqIntr = 1U;
        }
    }
    
    int32_t PINMUXModuleConfig_1(chipdbModuleID_t moduleId, uint32_t instNum,
                                                                  void* pParam1)
    {
        pinmuxModuleCfg_t* pModuleData = NULL;
        pinmuxPerCfg_t* pInstanceData = NULL;
        volatile const pinmuxBoardCfg_t* pPinmuxData  = NULL;
        uint32_t ctrlModBase = CHIPDBBaseAddress(CHIPDB_MOD_ID_CONTROL_MODULE, 0);
        int32_t status = E_FAIL;
        uint32_t index = 0;
    
        /* Get module Data */
        pPinmuxData = gIdkevmPinmuxData;
    
    
        status = E_INVALID_MODULE_ID;
        for(index = 0; ((S_PASS != status) &&
           (CHIPDB_MOD_ID_INVALID != pPinmuxData[index].moduleId)); index++)
        {
            if(pPinmuxData[index].moduleId == moduleId)
            {
                pModuleData = pPinmuxData[index].modulePinCfg;
    
                status = S_PASS;
            }
        }
    
        /* Get instance Data */
        if(S_PASS == status)
        {
            status = E_INST_NOT_SUPP;
            for(index = 0; ((S_PASS != status) &&
              (CHIPDB_INVALID_INSTANCE_NUM != pModuleData[index].modInstNum)); index++)
            {
                if(pModuleData[index].modInstNum == instNum)
                {
                    pInstanceData = pModuleData[index].instPins;
    
                    status = S_PASS;
                }
            }
        }
    
        /* Configure Pinmux */
        if(S_PASS == status)
        {
            for(index = 0; ((uint16_t)PINMUX_INVALID_PIN !=
                                          pInstanceData[index].pinOffset); index++)
            {
                if(NULL != pParam1)
                {
                    if(pInstanceData[index].optParam == *(uint16_t*)pParam1)
                    {
                        HW_WR_REG32((ctrlModBase + pInstanceData[index].pinOffset),
                                    pInstanceData[index].pinSettings);
                        status = S_PASS;
                        break;
                    }
                }
                else
                {
                    HW_WR_REG32((ctrlModBase + pInstanceData[index].pinOffset),
                                    pInstanceData[index].pinSettings);
                }
            }
            if((NULL != pParam1) && ((uint16_t)PINMUX_INVALID_PIN == pInstanceData[index].pinOffset))
            {
                status = E_FAIL;
            }
        }
    
        return status;
    }
    
    
    

    volt_measure_app_main.c

    /**
     * \file   volt_measure_app_main.c
     *
     * \brief  Example application main source file, which configures the ADC IP
     *         and executes the voltage measure use-case.
     */
    
    /**
     * \copyright Copyright (C) 2013 Texas Instruments Incorporated -
     *            http://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.
    *
    */
    
    /* ========================================================================== */
    /*                             Include Files                                  */
    /* ========================================================================== */
    #include "soc.h"
    #include "types.h"
    #include "error.h"
    #include "board.h"
    #include "device.h"
    #include "chipdb.h"
    #include "adc_app.h"
    #include "tsc_adc_ss.h"
    #include "console_utils.h"
    
    /* ========================================================================== */
    /*                                Macros                                      */
    /* ========================================================================== */
    
    /**
     * \name    Macros used by the application.
     */
    
    /** @{ */
    /* Macro representing the voltage resolution. */
    #define VOLTAGE_RESOLUTION       (439U)
    
    /* Macro representing the module clock of TSCADC. */
    #define TSCADC_MODULE_CLOCK      (24000000U)
    
    /* Macro representing the AFE clock of TSCADC. */
    #define TSCADC_AFE_CLOCK         (3000000U)
    /** @} */
    
    /* ========================================================================== */
    /*                         Structures and Enums                               */
    /* ========================================================================== */
    
    /* None */
    
    /* ========================================================================== */
    /*                 Internal Function Declarations                             */
    /* ========================================================================== */
    
    /**
     * \brief     Fetch the ADC instance address.
     *
     * \param     pObj       Pointer to the ADC application configuration
     *                       structure.
     *
     * \retval    #S_PASS - ADC instance is present.
     * \retVal    #E_FAIL - ADC instance is not present.
     */
    static int32_t AdcAppSocInfoGet(adcAppCfgObj_t *pObj);
    
    /* ========================================================================== */
    /*                            Global Variables                                */
    /* ========================================================================== */
    
    /** \brief Application default configuration */
    static const adcAppCfgObj_t ADCAPPVOLTMEASURE_DEFAULT =
    {
        0U,                           /* instNum */
        0U,                           /* instAddr */
        24000000U,                    /* modClk */
        3000000U,                     /* afeInClk */
        NULL,                         /* pSample */
        {
            FALSE,                    /* diffCtrl */
            0U                        /* fifoSel */
        },
        {
            INTC_TRIG_HIGH_LEVEL,     /* trigType */
            0U,                       /* intrLine */
            16U,                      /* intrPriority */
            FALSE,                    /* isIntrSecure */
            0U,                       /* endOfSeqIntr */
            NULL                      /* pFnIntrHandler */
        },
        {
            ADC_GP_MODE_ENABLE        /* adcMode. */
        }
    };
    
    /** \brief Global object for the ADC volt measure application. */
    static adcAppCfgObj_t gVoltMeasureAppCfg;
    
    /** \brief Variable to hold the sample values. */
    static uint32_t gVoltMeasureAppSampleVal[2U];
    
    /* ========================================================================== */
    /*                          Function Definitions                              */
    /* ========================================================================== */
    
    int main()
    {
        int32_t status = S_PASS;
        uint32_t chan1, chan2 = 0U;
    
        gVoltMeasureAppCfg = ADCAPPVOLTMEASURE_DEFAULT;
        gVoltMeasureAppCfg.pSample = gVoltMeasureAppSampleVal;
    
    
        status = BOARDInit(NULL);// VR change BOARDInit(NULL);//Board_init(NULL);
    
        /* Initialize the UART console */
        //CONSOLEUtilsInit();
    
        /* Select the console type based on compile time check */
        //CONSOLEUtilsSetType(CONSOLE_UTILS_TYPE_UART);
    
        //CONSOLEUtilsPrintf("\nStarterWare ADC voltage measure application!!\n");
        //CONSOLEUtilsPrintf("BOARDInit status [0x%x]\n", status);
    
        /* Print SoC & Board Information. */
        //SOCPrintInfo();
        //BOARDPrintInfo();
    
        status = AdcAppSocInfoGet(&gVoltMeasureAppCfg);
    
    
    
        if (S_PASS == status)
        {
            /* Initialize the ADC application. */
            status = ADCAppInit(&gVoltMeasureAppCfg);
    
            if (S_PASS == status)
            {
                /* Wait till the ADC processes the analog lines. */
                while(1U != gVoltMeasureAppCfg.appIntrCfg.endOfSeqIntr);
    
                /* Read the sample data from the FIFO. */
                gVoltMeasureAppSampleVal[0U] =
                       TSCADCFIFOADCDataRead(gVoltMeasureAppCfg.instAddr,
                           TSCADC_FIFO_SEL_0);
    
                gVoltMeasureAppSampleVal[1U] =
                       TSCADCFIFOADCDataRead(gVoltMeasureAppCfg.instAddr,
                           TSCADC_FIFO_SEL_1);
    
                chan1 = (gVoltMeasureAppSampleVal[0U] * VOLTAGE_RESOLUTION) / 1000U;
    
                chan2 = (gVoltMeasureAppSampleVal[1U] * VOLTAGE_RESOLUTION) / 1000U;
    
                //CONSOLEUtilsPrintf("Voltage sensed on the AN0 line :");
    
                //CONSOLEUtilsPrintf("%dmV\r\n", chan1);
    
                //CONSOLEUtilsPrintf("Voltage sensed on the AN1 line :");
    
                //CONSOLEUtilsPrintf("%dmV\r\n", chan2);
            }
            else
            {
                //CONSOLEUtilsPrintf("TSCADC initialization failed\n");
            }
        }
        else
        {
            //CONSOLEUtilsPrintf("Exiting from the application\n");
        }
    
        return (S_PASS);
    }
    
    /* -------------------------------------------------------------------------- */
    /*                 Internal Function Definitions                              */
    /* -------------------------------------------------------------------------- */
    
    static int32_t AdcAppSocInfoGet(adcAppCfgObj_t *pObj)
    {
        int32_t status = E_FAIL;
    
        pObj->instNum = 0U;
    
        if (TRUE == CHIPDBIsResourcePresent(CHIPDB_MOD_ID_ADC0, pObj->instNum))
        {
            /* Update the Interrupt Line number */
            if(SOC_FAMILY_ID_AM43XX == SOCGetSocFamilyId())
            {
                pObj->appIntrCfg.intrLine = 48U;
    
            }
            else if(SOC_FAMILY_ID_AM335X == SOCGetSocFamilyId())
            {
                pObj->appIntrCfg.intrLine = 16U;
            }
            else
            {
                //CONSOLEUtilsPrintf("ADC interrupts not supported on the SOC.\n");
            }
    
            /* TODO: Need to update the interrupt Numberdata base of ChipDB */
            /*
            pObj->appIntrCfg.intrLine = ChipDBInterruptNum(CHIPDB_MOD_ID_ADC0,
                                              0, 0);
            */
    
            /* Read the ADC instance number. */
            pObj->instAddr = CHIPDBBaseAddress(CHIPDB_MOD_ID_ADC0, 0U);
    
            status = S_PASS;
        }
        else
        {
            //CONSOLEUtilsPrintf("ADC instance is not present on the SOC.\n");
        }
    
        return(status);
    }
    

    Regards,

    Vrund

  • Hello Vrund,

    Sorry for my late response due to holidays. For the adc_app_volt_measure example, I was able to build it and run on the AM437x IDK. Below is my UART console output:

    StarterWare ADC voltage measure application!!
    BOARDInit status [0x0]
     SoC                   : [AM43XX]
     Core                  : [A9]
     Board Detected        : [IDKEVM]
     Base Board Revision   : [UNKNOWN]
     Daughter Card Revision: [UNKNOWN]
    Voltage sensed on the AN0 line :1795mV
    Voltage sensed on the AN1 line :8mV
    

    Regards,

    Jianzhong