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/PROCESSOR-SDK-DRA8X-TDA4X: How to configure the ADC in TDA4VM?

Part Number: PROCESSOR-SDK-DRA8X-TDA4X


Tool/software: TI C/C++ Compiler

Hello,

I am using ADC0/1 in MCU domain. I have confiured the ADC to continuous mode.

My FIFO threshold is configured to 64:

configStatus = ADCSetCPUFIFOThresholdLevel(adc[i].baseAddress,
                                                   ADC_FIFO_NUM_0, 64U);

I read the data in 1s period:

for (i = 0; i < NUM_OF_ADC; i++)
    {
        intrStatus = ADCGetIntrStatus(adc[i].baseAddress);

        while(!(ADC_INTR_SRC_END_OF_SEQUENCE == (intrStatus & ADC_INTR_SRC_END_OF_SEQUENCE)))
        {
            intrStatus = ADCGetIntrStatus(adc[i].baseAddress);
        }

        fifoWordCnt = ADCGetFIFOWordCount(adc[i].baseAddress, ADC_FIFO_NUM_0);

        for (index = 0; index < fifoWordCnt; index++)
        {
            fifoData_x = ADCGetFIFOData(adc[i].baseAddress, ADC_FIFO_NUM_0);
            stepID   = ((fifoData_x & ADC_FIFODATA_ADCCHNLID_MASK) >>
                                ADC_FIFODATA_ADCCHNLID_SHIFT);
            fifoData_x = ((fifoData_x & ADC_FIFODATA_ADCDATA_MASK) >>
                        ADC_FIFODATA_ADCDATA_SHIFT);
            voltageLvl  = fifoData_x * (uint32_t) ADC_REF_VOLTAGE;
            voltageLvl /= (uint32_t) ADC_MAX_RANGE;

            fifoData[i][stepID] = fifoData_x;

            appLogPrintf("\ni is %d:Channel %d: Voltage Level is %dmV", i, stepID, voltageLvl);
        }
    }

Currently, the print log showed several times and then ended. I want to know if the FIFO will overflow if configured to continuous mode? Should I clean the buffer after each read?

Please show us how, thank you!

  • Hi, :

    If certain steps are configured to continuous mode, it has the chance for the FIFO to overflow if the data haven't been retrieved in time.

    in this case, the exception must be handled for the ADC to operate properly again.

    example code can be found at: Adc_hwFifoErrRecovery (path: mcusw/mcal_drv/Adc/src/Adc_Priv.c)

  • Hi, :

    Here is an example which I tested with.

    /*
     *   Copyright (c) Texas Instruments Incorporated 2015-2020
     *
     *  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.
     *
     */
    
    /**
     *  \file     adc_app_semicpu.c
     *
     *  \brief    This file contains ADC test code.
     *
     *  \details  ADC operational mode is set to Single shot.
     *            Following steps are enabled.
     *            Step ID       Input from Channel
     *            2             1
     *            3             3
     *            4             4
     *            5             5
     *            6             6
     *            Program uses SYNTIMER32k for timing calculations.
     *
     **/
    
    /* ========================================================================== */
    /*                             Include Files                                  */
    /* ========================================================================== */
    #ifdef CPU_mcu1_0
    
    #include <stdint.h>
    #include <stdio.h>
    #include <ti/csl/csl_types.h>
    #include <ti/csl/soc.h>
    #include <ti/csl/hw_types.h>
    #include <ti/csl/arch/csl_arch.h>
    #include <ti/board/board.h>
    #include <ti/osal/osal.h>
    #include <ti/drv/sciclient/sciclient.h>
    
    #include <ti/csl/csl_adc.h>
    
    #include <ti/csl/src/ip/adc/V0/V0_1/hw_adc.h>
    #include <ti/csl/src/ip/adc/V0/adc.h>
    #include <utils/console_io/include/app_log.h>
    #include <ti/csl/soc/j721e/src/cslr_soc_baseaddress.h>
    #include <ti/csl/soc/j721e/src/cslr_intr_mcu_r5fss0_core0.h>
    #include <ti/drv/sciclient/soc/sysfw/include/j721e/tisci_devices.h>
    #include <ti/board/src/j721e_evm/include/pinmux.h>
    #include <ti/board/src/j721e_evm/J721E_pinmux.h>
    #include <ti/board/src/j721e_evm/include/board_pinmux.h>
    #include <ti/board/src/j721e_evm/include/board_cfg.h>
    
    /* ========================================================================== */
    /*                                Macros                                      */
    /* ========================================================================== */
    
    #define APP_ADC_MODULE          (CSL_MCU_ADC0_BASE)
    
    #define APP_ADC_DIV             (1U)
    /* Reference voltage for ADC - should be given in mV*/
    #define APP_ADC_REF_VOLTAGE     (1800U)
    
    #define APP_ADC_RANGE_MAX       (4096U)
    
    /* ========================================================================== */
    /*                            Global Variables                                */
    /* ========================================================================== */
    
    volatile uint32_t isrFlag = 0U;
    static SemaphoreP_Handle semHandle;
    #define ADC_TEST_SAMPLE_COUNT 1000
    
    static uint32_t adcSampleData[ADC_TEST_SAMPLE_COUNT];
    static uint32_t adcIntStatus[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    
    /* ========================================================================== */
    /*                 Internal Function Declarations                             */
    /* ========================================================================== */
    /**
     * \brief   This is Interrupt Service Routine for ADC interrupt.
     *
     * \param   none.
     *
     * \retval  none.
     */
    static void AppADCIntrISR(void *handle);
    
    /**
     * \brief   This function waits for 62.50us.
     *
     * \param   none.
     *
     * \retval  none.
     *
     * \note    Wait for 4 us before starting a conversion,after powering on
     *          ADC module.
     */
    static void AppADCWait(void);
    
    /**
     * \brief   This function initializes ADC module.
     *
     * \param   none.
     *
     * \retval  status          Initialization status.
     */
    static int32_t AppADCInit(void);
    
    /**
     * \brief   This function will start ADC conversion.
     *
     * \param   none.
     *
     * \retval  none.
     */
    static void AppADCStart(void);
    
    /**
     * \brief   This function will stop ADC conversion
     *
     * \param   none.
     *
     * \retval  none.
     */
    static void AppADCStop(void);
    
    static void AppADCTestInit(void);
    static void AppADCConfigureInterrupt(void);
    static void AppADCModuleEnable(void);
    static void AppADCModuleDisable(void);
    static void AppADCPrintSamples(void);
    
    /* ========================================================================== */
    /*                          Function Definitions                              */
    /* ========================================================================== */
    static void StartupEmulatorWaitPFxn (void)
    {
        volatile uint32_t enableDebug = 1;
        do
        {
        }while (enableDebug);
    }
    
    void test_csl_adc_singleshot_test_app(void)
    {
        /* @description:Test app for ADC tests
    
           @requirements: PRSDK-7040
    
           @cores: mcu1_0 */
    
        int32_t         configStatus, testErrCount = 0;
        uint32_t        loopcnt, fifoData, fifoWordCnt;
        uint32_t        sampleCount = 0;
        uint32_t        exitLoop = 0;
    
        adcStepConfig_t adcConfig;
    
        StartupEmulatorWaitPFxn();
    
        /* Initialize Instance */
        AppADCTestInit();
    
        AppADCConfigureInterrupt();
    
        /* Enable ADC module */
        AppADCModuleEnable();
    
        /* Initialize ADC module */
        configStatus = AppADCInit();
        if (STW_SOK != configStatus)
        {
            appLogPrintf("Error in ADC divider configuration.\n");
            testErrCount++;
        }
        /* Initialize ADC configuration params */
        adcConfig.mode             = ADC_OPERATION_MODE_SINGLE_SHOT;
        adcConfig.channel          = ADC_CHANNEL_1;
        adcConfig.openDelay        = 0x1ffffU;
        adcConfig.sampleDelay      = 0x7fU;
        adcConfig.rangeCheckEnable = 0U;
        adcConfig.averaging        = ADC_AVERAGING_16_SAMPLES;
        adcConfig.fifoNum          = ADC_FIFO_NUM_0;
        
        /* Enable interrupts */
        ADCEnableIntr(APP_ADC_MODULE, (ADC_INTR_SRC_END_OF_SEQUENCE |
                                       ADC_INTR_SRC_FIFO0_THRESHOLD |
                                       ADC_INTR_SRC_FIFO0_OVERRUN |
                                       ADC_INTR_SRC_FIFO0_UNDERFLOW |
                                       ADC_INTR_SRC_FIFO1_THRESHOLD |
                                       ADC_INTR_SRC_FIFO1_OVERRUN |
                                       ADC_INTR_SRC_FIFO1_UNDERFLOW |
                                       ADC_INTR_SRC_OUT_OF_RANGE));
        /* Configure ADC */
        /* step 2 configuration */
        configStatus = ADCSetStepParams(APP_ADC_MODULE, ADC_STEP_2, &adcConfig);
        if (STW_SOK != configStatus)
        {
            appLogPrintf("Error in ADC step configuration.\n");
            testErrCount++;
        }
        /* step 3 configuration */
        adcConfig.mode    = ADC_OPERATION_MODE_CONTINUOUS;
        adcConfig.channel = ADC_CHANNEL_3;
        configStatus      = ADCSetStepParams(APP_ADC_MODULE, ADC_STEP_3,
                                             &adcConfig);
        if (STW_SOK != configStatus)
        {
            appLogPrintf("Error in ADC step configuration.\n");
            testErrCount++;
        }
        /* step 4 configuration */
        adcConfig.mode    = ADC_OPERATION_MODE_SINGLE_SHOT;
        adcConfig.channel = ADC_CHANNEL_4;
        configStatus      = ADCSetStepParams(APP_ADC_MODULE, ADC_STEP_4,
                                             &adcConfig);
        if (STW_SOK != configStatus)
        {
            appLogPrintf("Error in ADC step configuration.\n");
            testErrCount++;
        }
        /* step 5 configuration */
        adcConfig.mode    = ADC_OPERATION_MODE_CONTINUOUS;
        adcConfig.channel = ADC_CHANNEL_5;
        configStatus      = ADCSetStepParams(APP_ADC_MODULE, ADC_STEP_5,
                                             &adcConfig);
        if (STW_SOK != configStatus)
        {
            appLogPrintf("Error in ADC step configuration.\n");
        }
        /* step 6 configuration */
        adcConfig.mode    = ADC_OPERATION_MODE_SINGLE_SHOT;
        adcConfig.channel = ADC_CHANNEL_6;
        configStatus      = ADCSetStepParams(APP_ADC_MODULE, ADC_STEP_6,
                                             &adcConfig);
        if (STW_SOK != configStatus)
        {
            appLogPrintf("Error in ADC step configuration.\n");
            testErrCount++;
        }
        ADCStepIdTagEnable(APP_ADC_MODULE, TRUE);
        configStatus =
            ADCSetCPUFIFOThresholdLevel(APP_ADC_MODULE, ADC_FIFO_NUM_0,
                                        40U);
        if (STW_SOK != configStatus)
        {
            appLogPrintf("Error in ADC CPU threshold configuration.\n");
            testErrCount++;
        }
        /* step enable */
        ADCStepEnable(APP_ADC_MODULE, ADC_STEP_2, TRUE);
        ADCStepEnable(APP_ADC_MODULE, ADC_STEP_3, TRUE);
        ADCStepEnable(APP_ADC_MODULE, ADC_STEP_4, TRUE);
        ADCStepEnable(APP_ADC_MODULE, ADC_STEP_5, TRUE);
        ADCStepEnable(APP_ADC_MODULE, ADC_STEP_6, TRUE);
        AppADCStart();
    
        while (exitLoop == 0)
        {
            SemaphoreP_pend(semHandle, SemaphoreP_WAIT_FOREVER);
            //appLogPrintf("ISR status:0x%x\n", isrFlag);
    
            /*Get FIFO data */
            fifoWordCnt = ADCGetFIFOWordCount(APP_ADC_MODULE, ADC_FIFO_NUM_0);
            //appLogPrintf("Number of samples in FIFO: %d", fifoWordCnt);
            //appLogPrintf("FIFO Data:");
            for (loopcnt = 0U; loopcnt < fifoWordCnt; loopcnt++)
            {
                fifoData = ADCGetFIFOData(APP_ADC_MODULE, ADC_FIFO_NUM_0);
                #if 1
                adcSampleData[sampleCount] = fifoData;
                if (sampleCount < (ADC_TEST_SAMPLE_COUNT - 1))
                    sampleCount++;
                else
                {
                    exitLoop = 1;
                    break;
                }
                
                #else
                stepID   = ((fifoData & ADC_FIFODATA_ADCCHNLID_MASK) >>
                            ADC_FIFODATA_ADCCHNLID_SHIFT);
                fifoData = ((fifoData & ADC_FIFODATA_ADCDATA_MASK) >>
                            ADC_FIFODATA_ADCDATA_SHIFT);
                voltageLvl  = fifoData * (uint32_t) APP_ADC_REF_VOLTAGE;
                voltageLvl /= (uint32_t) APP_ADC_RANGE_MAX;
                appLogPrintf("Step ID: %d, Voltage Level: %d mV", stepID + 1, voltageLvl);
                #endif
            }
        }
    
        AppADCStop();
        /* Power down ADC */
        ADCPowerUp(APP_ADC_MODULE, FALSE);
        /* Disable ADC module */
        AppADCModuleDisable();
    
        AppADCPrintSamples();
    
    }
    
    /* ========================================================================== */
    /*                 Internal Function Definitions                              */
    /* ========================================================================== */
    
    void AppADCIntrISR(void *handle)
    {
        uint32_t status;
    
        status = ADCGetIntrStatus(APP_ADC_MODULE);
        ADCClearIntrStatus(APP_ADC_MODULE, status);
    
        if (ADC_INTR_SRC_END_OF_SEQUENCE == (status & ADC_INTR_SRC_END_OF_SEQUENCE))
        {
            adcIntStatus[0]++;
            SemaphoreP_post(semHandle);
        }
        if (ADC_INTR_SRC_FIFO0_THRESHOLD == (status & ADC_INTR_SRC_FIFO0_THRESHOLD))
        {
            adcIntStatus[1]++;
        }
        if (ADC_INTR_SRC_FIFO0_OVERRUN == (status & ADC_INTR_SRC_FIFO0_OVERRUN))
        {
            adcIntStatus[2]++;
        }
        if (ADC_INTR_SRC_FIFO0_UNDERFLOW == (status & ADC_INTR_SRC_FIFO0_UNDERFLOW))
        {
            adcIntStatus[3]++;
        }
        if (ADC_INTR_SRC_FIFO1_THRESHOLD == (status & ADC_INTR_SRC_FIFO1_THRESHOLD))
        {
            adcIntStatus[4]++;
        }
        if (ADC_INTR_SRC_FIFO1_OVERRUN == (status & ADC_INTR_SRC_FIFO1_OVERRUN))
        {
            adcIntStatus[5]++;
        }
        if (ADC_INTR_SRC_FIFO1_UNDERFLOW == (status & ADC_INTR_SRC_FIFO1_UNDERFLOW))
        {
            adcIntStatus[6]++;
        }
        if (ADC_INTR_SRC_OUT_OF_RANGE == (status & ADC_INTR_SRC_OUT_OF_RANGE))
        {
            adcIntStatus[7]++;
        }
    
        ADCWriteEOI(APP_ADC_MODULE);
    }
    
    static int32_t AppADCInit(void)
    {
        adcRevisionId_t revId;
        int32_t         configStatus = STW_EFAIL;
    
        /* Get ADC information */
        ADCGetRevisionId(APP_ADC_MODULE, &revId);
    
        /* Clear All interrupt status */
        ADCClearIntrStatus(APP_ADC_MODULE, ADC_INTR_STATUS_ALL);
        /* Power up AFE */
        ADCPowerUp(APP_ADC_MODULE, TRUE);
        /* Wait for 4us at least */
        AppADCWait();
        /* Do the internal calibration */
        ADCInit(APP_ADC_MODULE, FALSE, 0U, 0U);
        /* Configure ADC divider*/
        configStatus = ADCSetClkDivider(APP_ADC_MODULE, APP_ADC_DIV);
    
        return configStatus;
    }
    
    static void AppADCStart(void)
    {
        adcSequencerStatus_t status;
    
        /* Check if FSM is idle */
        ADCGetSequencerStatus(APP_ADC_MODULE, &status);
        while ((ADC_ADCSTAT_FSM_BUSY_IDLE != status.fsmBusy) &&
               ADC_ADCSTAT_STEP_ID_IDLE != status.stepId)
        {
            ADCGetSequencerStatus(APP_ADC_MODULE, &status);
        }
        /* Start ADC conversion */
        ADCStart(APP_ADC_MODULE, TRUE);
    }
    
    static void AppADCStop(void)
    {
        adcSequencerStatus_t status;
    
        /* Disable all/enabled steps */
        ADCStepEnable(APP_ADC_MODULE, ADC_STEP_2, FALSE);
        ADCStepEnable(APP_ADC_MODULE, ADC_STEP_3, FALSE);
        ADCStepEnable(APP_ADC_MODULE, ADC_STEP_4, FALSE);
        ADCStepEnable(APP_ADC_MODULE, ADC_STEP_5, FALSE);
        ADCStepEnable(APP_ADC_MODULE, ADC_STEP_6, FALSE);
        /* Wait for FSM to go IDLE */
        ADCGetSequencerStatus(APP_ADC_MODULE, &status);
        while ((ADC_ADCSTAT_FSM_BUSY_IDLE != status.fsmBusy) &&
               ADC_ADCSTAT_STEP_ID_IDLE != status.stepId)
        {
            ADCGetSequencerStatus(APP_ADC_MODULE, &status);
        }
        /* Stop ADC */
        ADCStart(APP_ADC_MODULE, FALSE);
        /* Wait for FSM to go IDLE */
        ADCGetSequencerStatus(APP_ADC_MODULE, &status);
        while ((ADC_ADCSTAT_FSM_BUSY_IDLE != status.fsmBusy) &&
               ADC_ADCSTAT_STEP_ID_IDLE != status.stepId)
        {
            ADCGetSequencerStatus(APP_ADC_MODULE, &status);
        }
    }
    
    static void AppADCWait(void)
    {
        Osal_delay(10U);
    }
    
    static void AppADCConfigureInterrupt(void)
    {
        OsalRegisterIntrParams_t intrPrms;
        OsalInterruptRetCode_e osalRetVal;
        HwiP_Handle hwiHandle;
    
        Osal_RegisterInterrupt_initParams(&intrPrms);
        intrPrms.corepacConfig.arg          = (uintptr_t)0;
        intrPrms.corepacConfig.priority     = 0x20U;
        intrPrms.corepacConfig.corepacEventNum = 0U; /* NOT USED ? */
        intrPrms.corepacConfig.intVecNum = CSLR_MCU_R5FSS0_CORE0_INTR_MCU_ADC0_GEN_LEVEL_0;
        intrPrms.corepacConfig.isrRoutine   = (void (*)(uintptr_t)) (&AppADCIntrISR) ;
        osalRetVal = Osal_RegisterInterrupt(&intrPrms, &hwiHandle);
        if(OSAL_INT_SUCCESS != osalRetVal)
        {
            appLogPrintf("Error Could not register ISR !!!\n");
        }
    }
    
    static void AppADCModuleEnable(void)
    {
        /* Enable ADC module */
        Sciclient_pmSetModuleState(TISCI_DEV_MCU_ADC0,
            TISCI_MSG_VALUE_DEVICE_SW_STATE_ON,
            TISCI_MSG_FLAG_AOP |
            TISCI_MSG_FLAG_DEVICE_EXCLUSIVE |
            TISCI_MSG_FLAG_DEVICE_RESET_ISO,
            SCICLIENT_SERVICE_WAIT_FOREVER);
    
    }
    
    static void AppADCModuleDisable(void)
    {
        /* Disable ADC module */
        Sciclient_pmSetModuleState(TISCI_DEV_MCU_ADC0,
            TISCI_MSG_VALUE_DEVICE_SW_STATE_AUTO_OFF,
            TISCI_MSG_FLAG_AOP |
            TISCI_MSG_FLAG_DEVICE_EXCLUSIVE |
            TISCI_MSG_FLAG_DEVICE_RESET_ISO,
            SCICLIENT_SERVICE_WAIT_FOREVER);
    
    }
    
    static pinmuxPerCfg_t gMcu_adc0PinCfg[] =
    {
        /* MyMCU_ADC0 -> MCU_ADC0_AIN0 -> K25 */
        {
            PIN_MCU_ADC0_AIN0, PIN_MODE(0) | \
            ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION))
        },
        /* MyMCU_ADC0 -> MCU_ADC0_AIN1 -> K26 */
        {
            PIN_MCU_ADC0_AIN1, PIN_MODE(0) | \
            ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION))
        },
        /* MyMCU_ADC0 -> MCU_ADC0_AIN2 -> K28 */
        {
            PIN_MCU_ADC0_AIN2, PIN_MODE(0) | \
            ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION))
        },
        /* MyMCU_ADC0 -> MCU_ADC0_AIN3 -> L28 */
        {
            PIN_MCU_ADC0_AIN3, PIN_MODE(0) | \
            ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION))
        },
        /* MyMCU_ADC0 -> MCU_ADC0_AIN4 -> K24 */
        {
            PIN_MCU_ADC0_AIN4, PIN_MODE(0) | \
            ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION))
        },
        /* MyMCU_ADC0 -> MCU_ADC0_AIN5 -> K27 */
        {
            PIN_MCU_ADC0_AIN5, PIN_MODE(0) | \
            ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION))
        },
        /* MyMCU_ADC0 -> MCU_ADC0_AIN6 -> K29 */
        {
            PIN_MCU_ADC0_AIN6, PIN_MODE(0) | \
            ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION))
        },
        /* MyMCU_ADC0 -> MCU_ADC0_AIN7 -> L29 */
        {
            PIN_MCU_ADC0_AIN7, PIN_MODE(0) | \
            ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION))
        },
        {PINMUX_END}
    };
    
    static pinmuxModuleCfg_t gMcu_adcPinCfg[] =
    {
        {0, TRUE, gMcu_adc0PinCfg},
        {PINMUX_END}
    };
    
    pinmuxBoardCfg_t gJ721E_ADCPinmuxData[] =
    {
        {0, gMcu_adcPinCfg},
        {PINMUX_END}
    };
    
    static void AppADCTestInit(void)
    {
        /*Create Semaphore*/
        SemaphoreP_Params semaphoreParams;
        SemaphoreP_Params_init(&semaphoreParams);
        semaphoreParams.mode = SemaphoreP_Mode_BINARY;
    
        semHandle = SemaphoreP_create(0, &semaphoreParams);
        if (NULL == semHandle)
        {
            /*Failed to create Semaphore*/
            appLogPrintf("TimerTest: Failed to create Semaphore\n");
        }
    
        Board_pinmuxUpdate(gJ721E_ADCPinmuxData,
                           BOARD_SOC_DOMAIN_WKUP);
    }
    
    static void AppADCPrintSamples(void)
    {
        uint32_t        loopcnt, stepID, voltageLvl, fifoData;
    
        for (loopcnt = 0; loopcnt < ADC_TEST_SAMPLE_COUNT; loopcnt++)
        {
            fifoData = adcSampleData[loopcnt];
            stepID   = ((fifoData & ADC_FIFODATA_ADCCHNLID_MASK) >>
                        ADC_FIFODATA_ADCCHNLID_SHIFT);
            fifoData = ((fifoData & ADC_FIFODATA_ADCDATA_MASK) >>
                        ADC_FIFODATA_ADCDATA_SHIFT);
            voltageLvl  = fifoData * (uint32_t) APP_ADC_REF_VOLTAGE;
            voltageLvl /= (uint32_t) APP_ADC_RANGE_MAX;
            appLogPrintf("SP[%d]: Step ID =[%d], Voltage Level=[%d mV]", loopcnt, stepID + 1, voltageLvl);
        }
    
        for (loopcnt = 0; loopcnt < 8; loopcnt++)
        {
            appLogPrintf("adcIntStatus[%d]=%d", loopcnt, adcIntStatus[loopcnt]);
        }
    
    }
    #endif
    /********************************* End of file ******************************/