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.

RTOS/PROCESSOR-SDK-AM57X: Timer Suspend Control Options for DSP

Part Number: PROCESSOR-SDK-AM57X
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

We have generated CCS projects for PDK examples on C66x DSP according to

http://software-dl.ti.com/processor-sdk-rtos/esd/docs/05_03_00_07/rtos/index_overview.html?highlight=pdk%20example#pdk-example-and-test-project-creation

however when we run the executable on the C66xx_DSP1 core, we get  the following error message

[C66xx_DSP1] ti.sysbios.timers.dmtimer.Timer: line 1162: E_freqMismatch: Frequency mismatch: Expected 19200000 Hz, actual: 0 Hz.  You need to modify Timer.intFreq.lo to match the actual frequency.
xdc.runtime.Error.raise: terminating execution

We have tried to use the hint found at

processors.wiki.ti.com/.../Processor_SDK_RTOS_Setup_CCS

or

http://processors.wiki.ti.com/index.php/AM572x_GP_EVM_Hardware_Setup#Timer_Suspend_Control_Options_for_DSP

but were not able to solve the problem.

Could anybody help us ?

  • Hi,

    I don't know how exactly what test examples you created for C66x project and how the timer is used. You may look at the *.cfg file for your CCS project and add a line to specify the timer runs at 20MHz:

    Timer.intFreq.lo = 20000000;
    Timer.intFreq.hi = 0;

    Also see some discussion: e2e.ti.com/.../680756

    Regards, Eric
  • Hi Eric,

    Thank you very much for your answer.

    I tried two driver test examples, one for mcasp and one for gpio. The one for gpio was found in

    ti\pdk_am57xx_1_0_12\packages\ti\drv\gpio\test\led_blink\am572x\c66\bios

    I attach the main source file and the cfg file.

    I have not yet tried the code found in the discussion you gave me the link to. I will do it soon.

    Best regards,

    Gilbert

    /* ================ General configuration ================ */

    var Memory                     =   xdc.useModule('xdc.runtime.Memory');

    var HeapMem                     =   xdc.useModule('ti.sysbios.heaps.HeapMem');

    var HeapBuf                     =   xdc.useModule('ti.sysbios.heaps.HeapBuf');

    var Log                         =   xdc.useModule('xdc.runtime.Log');

    var Task                       =   xdc.useModule('ti.sysbios.knl.Task');

    var Semaphore                   =   xdc.useModule('ti.sysbios.knl.Semaphore');

    var Hwi                         =   xdc.useModule('ti.sysbios.family.c64p.Hwi');

    var ECM                         =   xdc.useModule('ti.sysbios.family.c64p.EventCombiner');

    var System                     =   xdc.useModule('xdc.runtime.System');

    SysStd                         =   xdc.useModule('xdc.runtime.SysStd');

     

    System.SupportProxy             =   SysStd;

     

    /* Create a default system heap using ti.bios.HeapMem. */

    var heapMemParams1             =   new HeapMem.Params;

    heapMemParams1.size             =   8192 * 25;

    heapMemParams1.sectionName     =   "systemHeap";

    Program.global.heap0           =   HeapMem.create(heapMemParams1);

     

    /* This is the default memory heap. */

    Memory.defaultHeapInstance     =   Program.global.heap0;

    Program.sectMap["systemHeap"]   =   Program.platform.stackMemory;

     

    /*

    * Enable Event Groups here and registering of ISR for specific GEM INTC is done

    * using EventCombiner_dispatchPlug() and Hwi_eventMap() APIs

    */

    var exception                                   =       xdc.useModule('ti.sysbios.family.c64p.Exception');

    exception.enablePrint = true;

     

    /* ================ BIOS configuration ================ */

    var BIOS                       =   xdc.useModule('ti.sysbios.BIOS');

     

    /* Enable BIOS Task Scheduler */

    BIOS.taskEnabled                =   true;

     

    /* ================ Task configuration ================ */

     

    /* No runtime stack checking is performed */

    Task.checkStackFlag = false;

     

     

    /* Reduce the number of task priorities */

    Task.numPriorities = 4;

     

    var task0Params = new Task.Params();

    task0Params.instance.name = "echo";

    task0Params.stackSize = 0x1000;

    Program.global.echo = Task.create("&gpio_test", task0Params);

     

     

    /* Define and add one Task Hook Set */

    Task.addHookSet({

           registerFxn: '&TaskRegisterId',

           switchFxn: '&mySwitch',

    });

     

    /* ================ Driver configuration ================ */

     

    /* Load the OSAL package */

    var osType = "tirtos"

    var Osal = xdc.useModule('ti.osal.Settings');

    Osal.osType = osType;

     

    /*use CSL package*/

    var socType           = "am572x";

    var Csl = xdc.loadPackage('ti.csl');

    Csl.Settings.deviceType = socType;

     

    /* Load Profiling package */

    var Utils = xdc.loadPackage('ti.utils.profiling');

     

    /* Load the gpio package */

    var Gpio = xdc.loadPackage('ti.drv.gpio');

    Gpio.Settings.enableProfiling = true;

     

    /* Load the GPIO package */

    var Gpio = xdc.loadPackage('ti.drv.uart');    

     

    /* Load the I2C package */

    var I2c = xdc.loadPackage('ti.drv.i2c');

    I2c.Settings.socType = socType;

     

    /* Load the SPI package */

    var Spi = xdc.loadPackage('ti.drv.spi');

     

    /* Load the Board package and set the board name */

    var Board = xdc.loadPackage('ti.board');

    Board.Settings.boardName = "evmAM572x";

     

    /* ================ Memory sections configuration ================ */

    Program.sectMap[".text"] = "EXT_RAM";

    Program.sectMap[".const"] = "EXT_RAM";

    Program.sectMap[".plt"] = "EXT_RAM";

    Program.sectMap["BOARD_IO_DELAY_DATA"] = "OCMC_RAM1";

    Program.sectMap["BOARD_IO_DELAY_CODE"] = "OCMC_RAM1";

     

    /**
     *  \file   main.c
     *
     *  \brief  Example application main file. This application will toggle the led.
     *          The led toggling will be done inside an callback function, which
     *          will be called by Interrupt Service Routine. Interrupts are
     *          triggered manually and no external source is used to trigger
     *          interrupts.
     *
     */
    
    /*
     * Copyright (C) 2014 - 2018 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.
     *
     */
    
    
    #ifdef USE_BIOS
    /* XDCtools Header files */
    #include <xdc/std.h>
    #include <xdc/runtime/System.h>
    #include <xdc/runtime/Error.h>
    
    /* BIOS Header files */
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    #if defined(SOC_AM65XX)
    #if defined (__aarch64__)
    #include <ti/sysbios/family/arm/v8a/Mmu.h>
    #endif
    #endif
    #endif /* #ifdef USE_BIOS */
    
    #include <stdio.h>
    
    /* TI-RTOS Header files */
    #include <ti/drv/gpio/GPIO.h>
    #include <ti/drv/gpio/soc/GPIO_soc.h>
    
    #include "GPIO_log.h"
    #include "GPIO_board.h"
    
    #include <ti/board/board.h>
    
    /**********************************************************************
     ************************** Macros ************************************
     **********************************************************************/
    #define DELAY_VALUE       (500U)   /* 500 msec */
    
    /**********************************************************************
     ************************** Internal functions ************************
     **********************************************************************/
    
    /* Delay function */
    void AppDelay(unsigned int delayVal);
    
    /* Callback function */
    void AppGpioCallbackFxn(void);
    
    #if defined(idkAM574x) || defined(idkAM572x) || defined(idkAM571x)
    /* GPIO clock and pinmux configurations */
    extern void AppGPIOInit(void);
    #endif
    
    #if defined(idkAM574x) || defined(idkAM572x)
    extern void GPIOApp_UpdateBoardInfo(void);
    extern void GPIOAppUpdateConfig(uint32_t *gpioBaseAddr, uint32_t *gpioPin);
    #endif
    
    #ifdef SOC_AM65XX
    /* Main domain GPIO interrupt events */
    #define MAIN_GPIO_INTRTR_GPIO0_BANK0_INT (0x000000C0) /* GPIO port 0 bank 0 interrupt event #, input to MAIN_GPIO_INTRTR */
    #define MAIN_GPIO_INTRTR_GPIO1_BANK0_INT (0x000000C8) /* GPIO port 1 bank 0 interrupt event #, input to MAIN_GPIO_INTRTR */
    
    /* Main domain GPIO interrupt events */
    #define WKUP_GPIO_INTRTR_GPIO0_BANK0_INT (0x0000003C) /* GPIO port 0 bank 0 interrupt event #, input to WKUP_GPIO_INTRTR */
    
    
    /* Main to MCU GPIO interrupt router mux output events */
    #define CSL_MAIN2MCU_INTRTR_PLS_GPIOMUX_INT0_DFLT_PLS  (0x00000000)
    #define CSL_MAIN2MCU_INTRTR_PLS_GPIOMUX_INT31_DFLT_PLS (0x0000001F)
    
    void GPIO_configIntRouter(uint32_t portNum, uint32_t pinNum, uint32_t gpioIntRtrOutIntNum, GPIO_v0_HwAttrs *cfg)
    {
        GPIO_IntCfg       *intCfg;
        CSL_IntrRouterCfg  intrRouterCfg;
        uint32_t           gpioIntRtrInIntNum;
        uint32_t           bankNum;
        uint32_t           i;
    
        intCfg = cfg->intCfg;
    
    #if defined (am65xx_evm) || defined (am65xx_idk)
        /* no main domain GPIO pins directly connected to LEDs on GP EVM, 
           use WKUP domain GPIO pins which connected to LEDs on base board */
        cfg->baseAddr = CSL_WKUP_GPIO0_BASE;
    
        /* Initialize WKUP GPIO Interrupt Router conifg structure */
        intrRouterCfg.pIntrRouterRegs = (CSL_intr_router_cfgRegs *)(uintptr_t)(CSL_WKUP_GPIOMUX_INTRTR0_CFG_BASE);
        intrRouterCfg.pIntdRegs       = (CSL_intr_router_intd_cfgRegs *)(uintptr_t)NULL;
        intrRouterCfg.numInputIntrs   = 64;
        intrRouterCfg.numOutputIntrs  = 16;
        for (i = 0; i < intrRouterCfg.numOutputIntrs; i++)
            CSL_intrRouterCfgMux(&intrRouterCfg, intrRouterCfg.numInputIntrs - 1, i);
    
        bankNum = pinNum/16; /* Each GPIO bank has 16 pins */
    
        /* WKUP GPIO int router input interrupt is the GPIO bank interrupt */
        gpioIntRtrInIntNum = WKUP_GPIO_INTRTR_GPIO0_BANK0_INT + bankNum;
    #if defined (__aarch64__)
        intCfg[pinNum].intNum = CSL_GIC0_INTR_WKUP_GPIOMUX_INTRTR0_BUS_OUTP_0 + bankNum;
    #else
        intCfg[pinNum].intNum = CSL_MCU0_INTR_GPIOMUX_INTR0_OUTP_0 + bankNum;
    #endif
        intCfg[pinNum].eventId = 0;
        intCfg[pinNum].intcMuxNum = INVALID_INTC_MUX_NUM;
        intCfg[pinNum].intcMuxInEvent = 0;
        intCfg[pinNum].intcMuxOutEvent = 0;
        
        /* Setup interrupt router configuration for gpio port/pin */
    #if defined (__aarch64__)
        gpioIntRtrOutIntNum = intCfg[pinNum].intNum - CSL_GIC0_INTR_WKUP_GPIOMUX_INTRTR0_BUS_OUTP_0;
    
        /* Route WKUP GPIO pin interrupt to main GIC */
        CSL_intrRouterCfgMux(&intrRouterCfg, gpioIntRtrInIntNum, gpioIntRtrOutIntNum);
    #else
        gpioIntRtrOutIntNum = intCfg[pinNum].intNum - CSL_MCU0_INTR_GPIOMUX_INTR0_OUTP_0;
    
        /* Route WKUP GPIO pin interrupt to mcu VIM */
        CSL_intrRouterCfgMux(&intrRouterCfg, gpioIntRtrInIntNum, gpioIntRtrOutIntNum);
    #endif
    
    #else /* defined (am65xx_evm) */
        /* Use main domain GPIO pins directly connected to IDK EVM */
    
        /* Initialize Main GPIO Interrupt Router conifg structure */
        intrRouterCfg.pIntrRouterRegs = (CSL_intr_router_cfgRegs *)(uintptr_t)(CSL_GPIOMUX_INTRTR0_INTR_ROUTER_CFG_BASE);
        intrRouterCfg.pIntdRegs       = (CSL_intr_router_intd_cfgRegs *)(uintptr_t)NULL;
        intrRouterCfg.numInputIntrs   = 208;
        intrRouterCfg.numOutputIntrs  = 32;
        for (i = 0; i < intrRouterCfg.numOutputIntrs; i++)
            CSL_intrRouterCfgMux(&intrRouterCfg, intrRouterCfg.numInputIntrs - 1, i);
            
        bankNum = pinNum/16; /* Each GPIO bank has 16 pins */
        if (portNum == 0)
        {
            /* MAIN GPIO int router input interrupt is the GPIO bank interrupt */
            gpioIntRtrInIntNum = MAIN_GPIO_INTRTR_GPIO0_BANK0_INT + bankNum;
    #if defined (__aarch64__)
            intCfg[pinNum].intNum = CSL_GIC0_INTR_MAIN_GPIOMUX_INTROUTER_MAIN_GPIOMUX_INTROUTER_MAIN_0_BUS_OUTP_0 + bankNum;
    #else
            intCfg[pinNum].intNum = CSL_MCU0_INTR_MAIN2MCU_PULSE_INTR0_OUTP_0 + bankNum;
    #endif
        }
        else
        {
            gpioIntRtrInIntNum = MAIN_GPIO_INTRTR_GPIO1_BANK0_INT + bankNum;
    #if defined (__aarch64__)
            intCfg[pinNum].intNum = CSL_GIC0_INTR_MAIN_GPIOMUX_INTROUTER_MAIN_GPIOMUX_INTROUTER_MAIN_0_BUS_OUTP_6 + bankNum;
    #else
            intCfg[pinNum].intNum = CSL_MCU0_INTR_MAIN2MCU_PULSE_INTR0_OUTP_6 + bankNum;
    #endif
        }
        intCfg[pinNum].eventId = 0;
        intCfg[pinNum].intcMuxNum = INVALID_INTC_MUX_NUM;
        intCfg[pinNum].intcMuxInEvent = 0;
        intCfg[pinNum].intcMuxOutEvent = 0;
        
        /* Setup interrupt router configuration for gpio port/pin */
    #if defined (__aarch64__)
        /* gpioIntRtrOutIntNum parameter (main gpio int router output int number) is not used in A53 code,
         * it is derived from the GIC500  interrupt number configured in HwAttr in GPIO_soc.c */
        gpioIntRtrOutIntNum = intCfg[pinNum].intNum - CSL_GIC0_INTR_MAIN_GPIOMUX_INTROUTER_MAIN_GPIOMUX_INTROUTER_MAIN_0_BUS_OUTP_0;
    
        /* Route GPIO pin interrupt to main GIC */
        CSL_intrRouterCfgMux(&intrRouterCfg, gpioIntRtrInIntNum, gpioIntRtrOutIntNum);
    #else
        /* Route GPIO pin interrupt to MAIN2MCU_INTRTR */
        CSL_intrRouterCfgMux(&intrRouterCfg, gpioIntRtrInIntNum, gpioIntRtrOutIntNum);
        
        /* Initialize Main to MCU Interrupt Router conifg structure */
        intrRouterCfg.pIntrRouterRegs = (CSL_intr_router_cfgRegs *)(uintptr_t)(CSL_MAIN2MCU_PLS_INTRTR0_CFG_BASE);
        intrRouterCfg.pIntdRegs       = (CSL_intr_router_intd_cfgRegs *)(uintptr_t)NULL;
        intrRouterCfg.numInputIntrs   = 32;
        intrRouterCfg.numOutputIntrs  = 48;
        for (i = 0; i < intrRouterCfg.numOutputIntrs; i++)
            CSL_intrRouterCfgMux(&intrRouterCfg, intrRouterCfg.numInputIntrs - 1, i);
    
        /* Route GPIO int router output to MAIN2MCU int router output, MAIN2MCU int router output int number
         * is derived from the MCU GIC interrupt number configured in HwAttr in GPIO_soc.*/
        gpioIntRtrInIntNum = gpioIntRtrOutIntNum;
        gpioIntRtrOutIntNum = intCfg[pinNum].intNum - CSL_MCU0_INTR_MAIN2MCU_PULSE_INTR0_OUTP_0;
        CSL_intrRouterCfgMux(&intrRouterCfg, gpioIntRtrInIntNum, gpioIntRtrOutIntNum);
    #endif
    #endif /* defined (am65xx_evm) */
    }
    
    #ifdef USE_BIOS
    #if defined (__aarch64__)
    Void InitMmu()
    {
        Mmu_MapAttrs attrs;
        Bool         retVal;
        uint32_t     mapIdx = 0;
    
        Mmu_initMapAttrs(&attrs);
    
        attrs.attrIndx = 0;
        retVal = Mmu_map(0x00100000, 0x00100000, 0x00900000, &attrs); /* Main MMR0 cfg  */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
    
        mapIdx++;
        retVal = Mmu_map(0x00400000, 0x00400000, 0x00001000, &attrs); /* PSC0          */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
    
        mapIdx++;
        retVal = Mmu_map(0x01800000, 0x01800000, 0x00100000, &attrs); /* gicv3          */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
    
        mapIdx++;
        retVal = Mmu_map(0x02400000, 0x02400000, 0x000c0000, &attrs); /* dmtimer        */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
        
        mapIdx++;
        retVal = Mmu_map(0x02800000, 0x02800000, 0x00040000, &attrs); /* uart           */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
    
        mapIdx++;
        retVal = Mmu_map(0x02000000, 0x02000000, 0x00100000, &attrs); /* main I2C       */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
    
        mapIdx++;
        retVal = Mmu_map(0x42120000, 0x42120000, 0x00001000, &attrs); /* Wkup I2C0       */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
    
        mapIdx++;
        retVal = Mmu_map(0x02100000, 0x02100000, 0x00080000, &attrs); /* McSPI          */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
    
        mapIdx++;
        retVal = Mmu_map(0x00600000, 0x00600000, 0x00002000, &attrs); /* GPIO           */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
         
        mapIdx++;
        retVal = Mmu_map(0x42110000, 0x42110000, 0x00001000, &attrs); /* WKUP GPIO      */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
         
        mapIdx++;
        retVal = Mmu_map(0x00a00000, 0x00a00000, 0x00040000, &attrs); /* MAIN INTR_ROUTERs */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
         
        mapIdx++;
        retVal = Mmu_map(0x42200000, 0x42200000, 0x00001000, &attrs); /* WKUP INTR_ROUTER */
        if (retVal == FALSE)
        {
             goto mmu_exit;
        }
        
        mapIdx++;
        retVal = Mmu_map(0x40f00000, 0x40f00000, 0x00020000, &attrs); /* MCU MMR0 CFG   */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
    
        mapIdx++;
        retVal = Mmu_map(0x40d00000, 0x40d00000, 0x00002000, &attrs); /* PLL0 CFG       */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
    
        mapIdx++;
        retVal = Mmu_map(0x43000000, 0x43000000, 0x00020000, &attrs); /* WKUP MMR0 cfg  */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
    
        mapIdx++;
        retVal = Mmu_map(0x02C40000, 0x02C40000, 0x00100000, &attrs); /* pinmux ctrl    */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
    
        mapIdx++;
        retVal = Mmu_map(0x2A430000, 0x2A430000, 0x00001000, &attrs); /* ctrcontrol0    */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
    
        mapIdx++;
        retVal = Mmu_map(0x42000000, 0x42000000, 0x00001000, &attrs); /* PSC WKUP */
        if (retVal == FALSE)
        {
             goto mmu_exit;
        }
    
        attrs.attrIndx = 7;
        mapIdx++;
        retVal = Mmu_map(0x80000000, 0x80000000, 0x03000000, &attrs); /* ddr            */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
    
        mapIdx++;
        retVal = Mmu_map(0x70000000, 0x70000000, 0x04000000, &attrs); /* msmc           */
        if(retVal == FALSE)
        {
            goto mmu_exit;
        }
    
    mmu_exit:
        if(retVal == FALSE)
        {
            System_printf("Mmu_map idx %d returned error %d", mapIdx, retVal);
            while(1);
        }
    
        return;
    }
    #endif /* #if defined (__aarch64__) */
    #endif /* #ifdef USE_BIOS */
    #endif /* #if defined(SOC_AM65XX) */
    
    /*
     *  ======== Board_initI2C ========
     */
    static void Board_initGPIO(void)
    {
        Board_initCfg boardCfg;
    
    #if defined(SOC_K2H) || defined(SOC_K2K) || defined(SOC_K2E) || defined(SOC_K2L) || defined(SOC_K2G) || defined(SOC_C6678) || defined(SOC_C6657) || defined(SOC_OMAPL137) || defined(SOC_OMAPL138) || defined(SOC_AM65XX)
        GPIO_v0_HwAttrs gpio_cfg;
    
        /* Get the default SPI init configurations */
        GPIO_socGetInitCfg(GPIO_LED0_PORT_NUM, &gpio_cfg);
    
        /* Modify the default GPIO configurations if necessary */
    #if defined (am65xx_evm) || defined (am65xx_idk)
        GPIO_configIntRouter(GPIO_LED0_PORT_NUM, GPIO_LED0_PIN_NUM, 0, &gpio_cfg);
    #endif
    
        /* Set the default GPIO init configurations */
        GPIO_socSetInitCfg(GPIO_LED0_PORT_NUM, &gpio_cfg);
    
    #if defined(SOC_K2G)
        /* Setup GPIO interrupt configurations */
        GPIO_socSetIntMux(GPIO_LED0_PORT_NUM, GPIO_LED0_PIN_NUM, NULL, GPIO_MUX_SEL);
    #endif
    #if defined(SOC_OMAPL137) || defined(SOC_OMAPL138)
        /* Setup GPIO interrupt configurations */
        GPIO_socSetBankInt(GPIO_LED0_PORT_NUM, GPIO_LED0_PIN_NUM, NULL);
    #endif
    #endif
    
    #if defined(evmK2E) || defined(evmC6678)
        boardCfg = BOARD_INIT_MODULE_CLOCK |
            BOARD_INIT_UART_STDIO;
    #else
        boardCfg = BOARD_INIT_PINMUX_CONFIG |
            BOARD_INIT_MODULE_CLOCK |
            BOARD_INIT_UART_STDIO;
    #endif
        Board_init(boardCfg);
    
    #if defined(idkAM572x) || defined(idkAM574x)
        GPIOApp_UpdateBoardInfo();
    #endif
    }
    
    /**********************************************************************
     ************************** Global Variables **************************
     **********************************************************************/
    volatile uint32_t gpio_intr_triggered = 0;
    uint32_t gpioBaseAddr;
    uint32_t gpioPin;
    
    /*
     *  ======== test function ========
     */
    #ifdef USE_BIOS
    void gpio_test(UArg arg0, UArg arg1)
    {
    #else
    int main()
    {
        Board_initGPIO();
    #endif
    #if defined(SOC_AM574x) || defined(SOC_AM572x) || defined(SOC_AM571x)|| defined(SOC_AM335x) || defined(SOC_AM437x) || \
        defined(SOC_K2H) || defined(SOC_K2K) || defined(SOC_K2E) || defined(SOC_K2G) || defined(SOC_OMAPL137) || defined(SOC_OMAPL138) || defined(SOC_AM65XX)
        uint32_t testOutput = 1;
    #endif
    
        /* GPIO initialization */
        GPIO_init();
    
        /* Set the callback function */
        GPIO_setCallback(USER_LED0, AppGpioCallbackFxn);
    
        /* Enable GPIO interrupt on the specific gpio pin */
        GPIO_enableInt(USER_LED0);
    
        /* Write high to gpio pin to control LED1 */
        GPIO_write((USER_LED1), GPIO_PIN_VAL_HIGH);
        AppDelay(DELAY_VALUE);
    
        GPIO_log("\n GPIO Led Blink Application \n");
    
    #if defined(SOC_K2L) || defined(SOC_C6678) || defined(SOC_C6657)
        /* No GPIO pin directly connected to user LED's on K2L/C6678/C6657/AM65xx EVM, just trigger interrupt once */
        GPIO_toggle(USER_LED0);
        while (!gpio_intr_triggered);
    
        UART_printStatus("\n All tests have passed \n");
    #ifdef USE_BIOS
        Task_exit();
    #endif
    
    #else
    
        while(1)
        {
    #if defined(SOC_AM574x) || defined(SOC_AM572x) || defined(SOC_AM571x)|| defined(SOC_AM335x) || defined(SOC_AM437x)
    
    #if defined (idkAM572x) || defined (idkAM574x)
            /* Update GPIO info based on the board */
            GPIOAppUpdateConfig(&gpioBaseAddr, &gpioPin);
    #else
            gpioBaseAddr = GPIO_BASE_ADDR;
            gpioPin      = GPIO_LED_PIN;
    #endif
            /* Trigger interrupt */
            GPIOTriggerPinInt(gpioBaseAddr, 0, gpioPin);
    #endif
    #if defined(SOC_K2H) || defined(SOC_K2K) || defined(SOC_K2E) || defined(SOC_K2G) || defined(SOC_OMAPL137) || defined(SOC_OMAPL138) || defined(SOC_AM65XX)
            GPIO_toggle(USER_LED0);
    #endif
            AppDelay(DELAY_VALUE);
            if (testOutput)
            {
                UART_printStatus("\n All tests have passed \n");
                testOutput = 0;
            }
        }
    #endif
    }
    
    #ifdef USE_BIOS
    /*
     *  ======== main ========
     */
    int main(void)
    {
        /* Call board init functions */
        Board_initGPIO();
    
    #if defined(idkAM574x) || defined(idkAM572x) || defined(idkAM571x)
        AppGPIOInit();
    #endif
    
        /* Start BIOS */
        BIOS_start();
        return (0);
    }
    #endif
    
    /*
     *  ======== AppDelay ========
     */
    void AppDelay(unsigned int delayVal)
    {
        Osal_delay(delayVal);
    }
    
    /*
     *  ======== Callback function ========
     */
    void AppGpioCallbackFxn(void)
    {
        /* Toggle LED1 */
        GPIO_toggle(USER_LED1);
        AppDelay(DELAY_VALUE);
        gpio_intr_triggered = 1;
    }
    
    
    

    /* ================ General configuration ================ */
    var Memory                      =   xdc.useModule('xdc.runtime.Memory');
    var HeapMem                     =   xdc.useModule('ti.sysbios.heaps.HeapMem');
    var HeapBuf                     =   xdc.useModule('ti.sysbios.heaps.HeapBuf');
    var Log                         =   xdc.useModule('xdc.runtime.Log');
    var Task                        =   xdc.useModule('ti.sysbios.knl.Task');
    var Semaphore                   =   xdc.useModule('ti.sysbios.knl.Semaphore');
    var Hwi                         =   xdc.useModule('ti.sysbios.family.c64p.Hwi');
    var ECM                         =   xdc.useModule('ti.sysbios.family.c64p.EventCombiner');
    var System                      =   xdc.useModule('xdc.runtime.System');
    SysStd                          =   xdc.useModule('xdc.runtime.SysStd');
     
    System.SupportProxy             =   SysStd;
     
    /* Create a default system heap using ti.bios.HeapMem. */
    var heapMemParams1              =   new HeapMem.Params;
    heapMemParams1.size             =   8192 * 25;
    heapMemParams1.sectionName      =   "systemHeap";
    Program.global.heap0            =   HeapMem.create(heapMemParams1);
     
    /* This is the default memory heap. */
    Memory.defaultHeapInstance      =   Program.global.heap0;
    Program.sectMap["systemHeap"]   =   Program.platform.stackMemory;
     
    /*
     * Enable Event Groups here and registering of ISR for specific GEM INTC is done
     * using EventCombiner_dispatchPlug() and Hwi_eventMap() APIs
     */
    var exception                                    =       xdc.useModule('ti.sysbios.family.c64p.Exception');
    exception.enablePrint = true;
     
    /* ================ BIOS configuration ================ */
    var BIOS                        =   xdc.useModule('ti.sysbios.BIOS');
     
    /* Enable BIOS Task Scheduler */
    BIOS.taskEnabled                =   true;
     
    /* ================ Task configuration ================ */
     
    /* No runtime stack checking is performed */
    Task.checkStackFlag = false;
     
     
    /* Reduce the number of task priorities */
    Task.numPriorities = 4;
     
    var task0Params = new Task.Params();
    task0Params.instance.name = "echo";
    task0Params.stackSize = 0x1000;
    Program.global.echo = Task.create("&gpio_test", task0Params);
     
     
    /* Define and add one Task Hook Set */
    Task.addHookSet({
           registerFxn: '&TaskRegisterId',
           switchFxn: '&mySwitch',
    });
     
    /* ================ Driver configuration ================ */
     
    /* Load the OSAL package */
    var osType = "tirtos"
    var Osal = xdc.useModule('ti.osal.Settings');
    Osal.osType = osType;
     
    /*use CSL package*/
    var socType           = "am572x";
    var Csl = xdc.loadPackage('ti.csl');
    Csl.Settings.deviceType = socType;
     
    /* Load Profiling package */
    var Utils = xdc.loadPackage('ti.utils.profiling');
     
    /* Load the gpio package */
    var Gpio = xdc.loadPackage('ti.drv.gpio');
    Gpio.Settings.enableProfiling = true; 
     
    /* Load the GPIO package */
    var Gpio = xdc.loadPackage('ti.drv.uart');    
     
    /* Load the I2C package */
    var I2c = xdc.loadPackage('ti.drv.i2c');
    I2c.Settings.socType = socType;
     
    /* Load the SPI package */
    var Spi = xdc.loadPackage('ti.drv.spi');
     
    /* Load the Board package and set the board name */
    var Board = xdc.loadPackage('ti.board');
    Board.Settings.boardName = "evmAM572x";
     
    /* ================ Memory sections configuration ================ */
    Program.sectMap[".text"] = "EXT_RAM";
    Program.sectMap[".const"] = "EXT_RAM";
    Program.sectMap[".plt"] = "EXT_RAM";
    Program.sectMap["BOARD_IO_DELAY_DATA"] = "OCMC_RAM1";
    Program.sectMap["BOARD_IO_DELAY_CODE"] = "OCMC_RAM1";
     
  • Hi,

    Attached is a standalone timer SYSBIOS project showing how to configure a timer running 20MHz clock, on C66x core of AM572x. There is no any compilation or run time error any kind. You can integrate into your own project.

    clock_IDK_AM572X_C66XX.zip

    Regards, Eric