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/TMDSEVM572X: How to change OPP

Part Number: TMDSEVM572X

Tool/software: TI-RTOS

Hi,

I an using GP AM572x SDK:pdk_am57xx_1_0_5

TIRTOS: processor_sdk_rtos_am57xx_3_02_00_05

I want to change operating frequency from OPP_NOM to OPP_HIGH. how can i do this?

I tried with following change in code but it doesn't happen.

boardCfg = BOARD_INIT_PINMUX_CONFIG |
BOARD_INIT_MODULE_CLOCK | BOARD_INIT_UART_STDIO | BOARD_INIT_PLL_OPP_HIGH;
Board_init(boardCfg);

This gave me run time error.

Thanks,

Anjana Pathak

  • The RTOS team have been notified. They will respond here.
  • Hi,

    The EVM is typically run at OPP_NOM. To run at OPP_HIGH, you need to raise the power supply via PMIC. Did you do this? If it is not, it is only recommended to run the OPP_HIGH for a short period of time to avoid damage to the card.

    What program you run on the EVM? Do you use GEL file? If you look at our driver examples, when calling BOARD_INIT, the argument doesn't using BOARD_INIT_PLL_OPP_xxxx because the GEL file did the OPP setting already.

    For your testing, you may change GEL file to run at OPP_HIGH for a short period of time.

    Regards, Eric
  • Anajana,

    Please indicate what runtime error did you see with BOARD_INIT_PLL_OPP_HIGH ?? OPP as Eric explained is a combination of higher clock and PMIC voltage so increasing to OPP_HIGH without increasing the voltage could result in runtime issues but you should have been able to do this for a short period of time. Note that the board library for GP EVM only sets up the clock for OPP_HIGH, the voltage will need to be changed using PM LLD.

    Regards,
    Rahul

    PS: Refer to pmrtos_measurement example where this has been demonstrated for AM335x and AM437x. We plan to extend this for AM57x but this is currently not available out of the box.

  • I ran a quick test by setting the Board Init to OPP_HIGH and I can see the clocks being set to higher clock even without re-configuring the PMIC voltage setting. Please indicate what runtime issue you ran into so that we can try and reproduce this issue.

    Regards,
    Rahul
  • Hi Rahul,

    Run time error is related to ADP error (CortexA15_0: Unhandled ADP_Stopped exception 0x20023) and it comes when i put a break point on board_init(boardcfg). else it dose not execute the function below boar_init() which is CSL_xbarMpuIrqConfigure(.....) and hang off. Please see into the file attached, this is the file in which i am modifying for HIGH_OPP. How can i see the clock being set at higher clock?

    /*
     * Copyright (C) 2015 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 <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <xdc/std.h>
    #include <xdc/cfg/global.h>//anjana
    #include <xdc/runtime/Error.h>
    #include <xdc/runtime/System.h>
    
    #include <xdc/runtime/Types.h>
    #include <xdc/runtime/Timestamp.h>
    
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    
    #include <ti/ndk/inc/stkmain.h>
    //tagged by anjana
    #include <ti/ndk/inc/netmain.h>
    #include <ti/sysbios/timers/dmtimer/Timer.h>
    
    #include <ti/drv/emac/emac_drv.h>
    #include <ti/drv/emac/src/v4/emac_drv_v4.h>
    
    #include <ti/csl/soc.h>
    #include <ti/csl/cslr_device.h>
    
    #include <ti/drv/gpio/GPIO.h>//anjana
    #include <ti/drv/gpio/soc/GPIO_soc.h>//anjana
    
    #include <ti/board/board.h>
    
    /* TI-RTOS Header files */
    #include <ti/drv/i2c/I2C.h>
    #include <ti/drv/i2c/soc/I2C_v1.h>
    /* UART Header files */
    #include <ti/drv/uart/UART.h>
    #include <ti/drv/uart/UART_stdio.h>
    #include <ti/csl/soc/am572x/src/csl_device_xbar.h>
    
    /*GPIO_board.h*/
    #include <ti/board/src/evmAM572x/include/board_cfg.h>
    #include <ti/csl/soc/am572x/src/cslr_soc_mpu_baseaddress.h>
    
    /* Enable the below macro to have prints on the IO Console */
    //#define IO_CONSOLE
    
    #ifndef IO_CONSOLE
    #define NIMU_log                UART_printf
    #else
    #define NIMU_log                printf
    #endif
    
    /* ========================================================================== */
    /*                             Macros                                  */
    /* ========================================================================== */
    /* LM Board PBx pins which are connected to GPIO pins. */
    typedef enum GPIO_PUSHButton {
        USER_PB1 = 0,
        USER_PB2,
    	USER_PB3
    }GPIO_PUSHButton;
    /**Phy address of  port 0 */
    #define EMAC_CPSW_PORT0_PHY_ADDR_EVM     1
    /**Phy address of port 1 */
    #define EMAC_CPSW_PORT1_PHY_ADDR_EVM     2
    #define MAX_TABLE_ENTRIES   3
    
    //tagged by anjana
    #define NMFACTOR 0.08099
    #define DEGFACTOR 0.00015
    #define PRT 1274 //for 784 prf
    #define PI 3.14159265
    #define RADIAN 0.0174 //PI/180
    #define PIXEL_SCALE 37.5//75//450/6Nm,37.5//450/12Nm,150//450/3Nm //18.75 as 450/24Nm //4.4118 as 450/102NM
    
    
    /* ========================================================================== */
    /*                            Global Variables                                */
    /* ========================================================================== */
    
    /**Task handle for EIP*/
    Task_Handle main_task;
    static int nimu_device_index = 0U;
    NIMU_DEVICE_TABLE_ENTRY NIMUDeviceTable[MAX_TABLE_ENTRIES];
    
    void TaskFxn(UArg a0, UArg a1);
    
    extern int CpswEmacInit (STKEVENT_Handle hEvent);
    //tagged by anjana
    void Init_variables(void);
    void TimerInitialization();
    void myIsr(UArg arg);
    void app_delay(uint32_t delayValue);
    void MicroSecDelay( UInt32 uSDelay );
    void SendDataToPC();
    void PixelCalc();
    void CopyfirstPRT();
    void Cmp_Copy_FivePRT();
    /* Callback function */
    void AppGpioCallbackFxn(void);
    void AppGpioCallbackFxn_1(void);
    void AppGpioCallbackFxn_2(void);
    struct sockaddr_in sin1;
    //---------------------------------------------------------------------------
    // Configuration
    //
    //char *HostName1    = "tidsp";
    volatile uint32_t gpio_intr_triggered = 0,gpio_intr_triggered_1=0;
    Timer_Handle timerHandle;
    char *LocalIPAddr1 = "192.168.1.2";
    char *IPAddr = "192.168.1.144";
    unsigned int CountPRT,CountSecond,TCP_TXBuffer,BearingCount;
    float Bearingangle;
    
    Bool Start_Count,NextData,NextTheta;
    UInt16 NoOfSwipe,NoOfPRT,PrvRow,row,clmn,NoofdataSend,test=2200;
    UInt16 THIndex,THIndx_prv,t,t1,t2,target_end,target_start;
    Bool Start_PRT,Trigger,target_Flag,targetEnd_Flag,targetStart_Flag,BufferFillFlg,FalledgeFlag,RiseedgeFlag, NextPRTFlg,ThetaFlg,NextTrgtFlg_start,NextTrgtFlg_end;
    
    UInt16 XY_buffer_1[5][1100];
    UInt16 XY_buffer_2[1100];
    UInt16 XY_OneSwipe_buff[6][13];
    
    float SinTheta[360]={0,0.02,0.03,0.05,0.07,0.09,0.10,0.12,0.14,0.16,0.17,0.19,0.21,0.22,0.24,0.26,0.28,0.29,0.31,0.33,0.34,0.36,0.37,0.39,0.41,
    					0.42,0.44,0.45,0.47,0.48,0.50,0.52,0.53,0.54,0.56,0.57,0.59,0.60,0.62,0.63,0.64,0.66,0.67,0.68,0.69,0.71,0.72,0.73,0.74,0.75,
    					0.77,0.78,0.79,0.80,0.81,0.82,0.83,0.84,0.85,0.86,0.87,0.87,0.88,0.89,0.90,0.91,0.91,0.92,0.93,0.93,0.94,0.95,0.95,0.96,0.96,
    					0.97,0.97,0.97,0.98,0.98,0.98,0.99,0.99,0.99,0.99,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,0.99,0.99,0.99,0.99,
    					0.98,0.98,0.98,0.97,0.97,0.97,0.96,0.96,0.95,0.95,0.94,0.93,0.93,0.92,0.91,0.91,0.90,0.89,0.88,0.87,0.87,0.86,0.85,0.84,0.83,
    					0.82,0.81,0.80,0.79,0.78,0.77,0.75,0.74,0.73,0.72,0.71,0.69,0.68,0.67,0.66,0.64,0.63,0.62,0.60,0.59,0.57,0.56,0.54,0.53,0.52,
    					0.50,0.48,0.47,0.45,0.44,0.42,0.41,0.39,0.37,0.36,0.34,0.33,0.31,0.29,0.28,0.26,0.24,0.22,0.21,0.19,0.17,0.16,0.14,0.12,0.10,
    					0.09,0.07,0.05,0.03,0.02,0.00,-0.02,-0.03,-0.05,-0.07,-0.09,-0.10,-0.12,-0.14,-0.16,-0.17,-0.19,-0.21,-0.22,-0.24,-0.26,-0.28,
    					-0.29,-0.31,-0.33,-0.34,-0.36,-0.37,-0.39,-0.41,-0.42,-0.44,-0.45,-0.47,-0.48,-0.50,-0.52,-0.53,-0.54,-0.56,-0.57,-0.59,-0.60,
    					-0.62,-0.63,-0.64,-0.66,-0.67,-0.68,-0.69,-0.71,-0.72,-0.73,-0.74,-0.75,-0.77,-0.78,-0.79,-0.80,-0.81,-0.82,-0.83,-0.84,-0.85,
    					-0.86,-0.87,-0.87,-0.88,-0.89,-0.90,-0.91,-0.91,-0.92,-0.93,-0.93,-0.94,-0.95,-0.95,-0.96,-0.96,-0.97,-0.97,-0.97,-0.98,-0.98,
    					-0.98,-0.99,-0.99,-0.99,-0.99,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-0.99,-0.99,-0.99,-0.99,-0.98,
    					-0.98,-0.98,-0.97,-0.97,-0.97,-0.96,-0.96,-0.95,-0.95,-0.94,-0.93,-0.93,-0.92,-0.91,-0.91,-0.90,-0.89,-0.88,-0.87,-0.87,-0.86,
    					-0.85,-0.84,-0.83,-0.82,-0.81,-0.80,-0.79,-0.78,-0.77,-0.75,-0.74,-0.73,-0.72,-0.71,-0.69,-0.68,-0.67,-0.66,-0.64,-0.63,-0.62,
    					-0.60,-0.59,-0.57,-0.56,-0.54,-0.53,-0.52,-0.50,-0.48,-0.47,-0.45,-0.44,-0.42,-0.41,-0.39,-0.37,-0.36,-0.34,-0.33,-0.31,-0.29,
    					-0.28,-0.26,-0.24,-0.22,-0.21,-0.19,-0.17,-0.16,-0.14,-0.12,-0.10,-0.09,-0.07,-0.05,-0.03,-0.02};
    float CosTheta[360]={1.00,1.00,1.00,1.00,1.00,1.00,0.99,0.99,0.99,0.99,0.98,0.98,0.98,0.97,0.97,0.97,0.96,0.96,0.95,0.95,0.94,0.93,0.93,0.92,0.91,
    					0.91,0.90,0.89,0.88,0.87,0.87,0.86,0.85,0.84,0.83,0.82,0.81,0.80,0.79,0.78,0.77,0.75,0.74,0.73,0.72,0.71,0.69,0.68,0.67,0.66,
    					0.64,0.63,0.62,0.60,0.59,0.57,0.56,0.54,0.53,0.52,0.50,0.48,0.47,0.45,0.44,0.42,0.41,0.39,0.37,0.36,0.34,0.33,0.31,0.29,0.28,
    					0.26,0.24,0.22,0.21,0.19,0.17,0.16,0.14,0.12,0.10,0.09,0.07,0.05,0.03,0.02,0.00,-0.02,-0.03,-0.05,-0.07,-0.09,-0.10,-0.12,-0.14,
    					-0.16,-0.17,-0.19,-0.21,-0.22,-0.24,-0.26,-0.28,-0.29,-0.31,-0.33,-0.34,-0.36,-0.37,-0.39,-0.41,-0.42,-0.44,-0.45,-0.47,-0.48,
    					-0.50,-0.52,-0.53,-0.54,-0.56,-0.57,-0.59,-0.60,-0.62,-0.63,-0.64,-0.66,-0.67,-0.68,-0.69,-0.71,-0.72,-0.73,-0.74,-0.75,-0.77,
    					-0.78,-0.79,-0.80,-0.81,-0.82,-0.83,-0.84,-0.85,-0.86,-0.87,-0.87,-0.88,-0.89,-0.90,-0.91,-0.91,-0.92,-0.93,-0.93,-0.94,-0.95,
    					-0.95,-0.96,-0.96,-0.97,-0.97,-0.97,-0.98,-0.98,-0.98,-0.99,-0.99,-0.99,-0.99,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,-1.00,
    					-1.00,-1.00,-1.00,-0.99,-0.99,-0.99,-0.99,-0.98,-0.98,-0.98,-0.97,-0.97,-0.97,-0.96,-0.96,-0.95,-0.95,-0.94,-0.93,-0.93,-0.92,
    					-0.91,-0.91,-0.90,-0.89,-0.88,-0.87,-0.87,-0.86,-0.85,-0.84,-0.83,-0.82,-0.81,-0.80,-0.79,-0.78,-0.77,-0.75,-0.74,-0.73,-0.72,
    					-0.71,-0.69,-0.68,-0.67,-0.66,-0.64,-0.63,-0.62,-0.60,-0.59,-0.57,-0.56,-0.54,-0.53,-0.52,-0.50,-0.48,-0.47,-0.45,-0.44,-0.42,
    					-0.41,-0.39,-0.37,-0.36,-0.34,-0.33,-0.31,-0.29,-0.28,-0.26,-0.24,-0.22,-0.21,-0.19,-0.17,-0.16,-0.14,-0.12,-0.10,-0.09,-0.07,
    					-0.05,-0.03,-0.02,0.00,0.02,0.03,0.05,0.07,0.09,0.10,0.12,0.14,0.16,0.17,0.19,0.21,0.22,0.24,0.26,0.28,0.29,0.31,0.33,0.34,0.36,
    					0.37,0.39,0.41,0.42,0.44,0.45,0.47,0.48,0.50,0.52,0.53,0.54,0.56,0.57,0.59,0.60,0.62,0.63,0.64,0.66,0.67,0.68,0.69,0.71,0.72,0.73,
    					0.74,0.75,0.77,0.78,0.79,0.80,0.81,0.82,0.83,0.84,0.85,0.86,0.87,0.87,0.88,0.89,0.90,0.91,0.91,0.92,0.93,0.93,0.94,0.95,0.95,0.96,
    					0.96,0.97,0.97,0.97,0.98,0.98,0.98,0.99,0.99,0.99,0.99,1.00,1.00,1.00,1.00,1.00};
    
    
    /* ========================================================================== */
    /*                          Function Definitions                              */
    /* ========================================================================== */
    
    /**
     *  \name main
     *  \brief Main Function
     *  \param none
     *  \return none
     *
     */
    int main()
    {
        /* Call board init functions */
        Board_initCfg boardCfg;
        Task_Params taskParams;
        EMAC_HwAttrs_V4 cfg;
        boardCfg =  BOARD_INIT_PINMUX_CONFIG |
        BOARD_INIT_MODULE_CLOCK | BOARD_INIT_UART_STDIO | BOARD_INIT_PLL_OPP_HIGH;
        Board_init(boardCfg);
    
        CSL_xbarMpuIrqConfigure(CSL_XBAR_INST_MPU_IRQ_92, CSL_XBAR_GMAC_SW_IRQ_RX_PULSE);
        CSL_xbarMpuIrqConfigure(CSL_XBAR_INST_MPU_IRQ_93, CSL_XBAR_GMAC_SW_IRQ_TX_PULSE);
    
        /* Select RGMII 2 ports GMIIx_SEL = 2 for RGMII*/
       CSL_FINS (((CSL_control_coreRegs *) CSL_MPU_CTRL_MODULE_CORE_CORE_REGISTERS_REGS)->CONTROL_IO_1,
              CONTROL_CORE_CONTROL_IO_1_GMII1_SEL, 2U);
        CSL_FINS (((CSL_control_coreRegs *) CSL_MPU_CTRL_MODULE_CORE_CORE_REGISTERS_REGS)->CONTROL_IO_1,
              CONTROL_CORE_CONTROL_IO_1_GMII2_SEL, 2U);
    
        /*GMAC RESET ISOLATION Enable*/
        CSL_FINS (((CSL_control_coreRegs *) CSL_MPU_CTRL_MODULE_CORE_CORE_REGISTERS_REGS)->CONTROL_IO_2,
              CONTROL_CORE_CONTROL_IO_2_GMAC_RESET_ISOLATION_ENABLE, 0U);
        CSL_FINS (((CSL_control_coreRegs *) CSL_MPU_CTRL_MODULE_CORE_CORE_REGISTERS_REGS)->CONTROL_IO_2,
              CONTROL_CORE_CONTROL_IO_2_GMAC_RESET_ISOLATION_ENABLE, 1U);
    
    
        EMAC_socGetInitCfg(0, &cfg);
        cfg.port[0].phy_addr = EMAC_CPSW_PORT0_PHY_ADDR_EVM;
        cfg.port[1].phy_addr = EMAC_CPSW_PORT1_PHY_ADDR_EVM;
        EMAC_socSetInitCfg(0, &cfg);
    
        Init_variables();
    
        /*Task_Params_init(&taskParams);
        taskParams.priority = 2;
        taskParams.stackSize = 0x1400;
        main_task = Task_create (TaskFxn, &taskParams, NULL);*/
    
        //Tagged by anjana
        /*Task_Params_init(&taskParams);
        taskParams.priority = 5;
        taskParams.stackSize = 0x1400;
        main_task = Task_create (PixelCalc, &taskParams, NULL);*/
    
        Task_Params_init(&taskParams);
        taskParams.priority = 1;//4;
        taskParams.stackSize = 0x1400;
        main_task = Task_create (SendDataToPC, &taskParams, NULL);
    
        NIMUDeviceTable[nimu_device_index++].init =  &CpswEmacInit ;
        NIMUDeviceTable[nimu_device_index].init =  NULL ;
        TimerInitialization();
        /***********************/
          	GPIO_init();
    
                /* Set the callback function */
                GPIO_setCallback(USER_PB1, AppGpioCallbackFxn);
                GPIO_setCallback(USER_PB2, AppGpioCallbackFxn_1);
                GPIO_setCallback(USER_PB3, AppGpioCallbackFxn_2);
    
         /******************************/
        BIOS_start();
    
        return -1;
    }
    
    void Init_variables(void)
    {
       //TCP_TXBuffer=0,
    	THIndex =0;
       THIndx_prv=0;
       NextData=0;
       NextTheta=0;
       Start_Count=0;
       CountPRT=0;
       CountSecond=0;
       BearingCount=0;
       Bearingangle=0;
    
       row=0;
       PrvRow=0;
       NoofdataSend=0;
       clmn =0;
       NoOfPRT=0;
       NoOfSwipe=0;
       BufferFillFlg =0;
       NextPRTFlg=0;
       ThetaFlg=0;
       NextTrgtFlg_start=0;
       target_Flag=0;
       targetEnd_Flag=0;
       targetStart_Flag=0;
       target_start=0;
       target_end=0;
       Trigger=0;
       Start_PRT=0;
       FalledgeFlag=0;
       RiseedgeFlag=0;
    
    }
    /*initialization for 1 microsecond timer*/
    void TimerInitialization()
    {
    	Timer_Params timerParams;
    	Timer_Handle myTimer;
    	Error_Block eb;
    	Error_init(&eb);
    	Timer_Params_init(&timerParams);
    	timerParams.period = 1;
    	timerParams.periodType = Timer_PeriodType_MICROSECS;
    	timerParams.arg = 1;
    	timerParams.startMode = Timer_StartMode_AUTO;
    	myTimer = Timer_create(Timer_ANY, myIsr, &timerParams, &eb);
    	if (myTimer == NULL) {
    	System_abort("Timer create failed");
    	}
    
    }
    void myIsr(UArg arg)
    {
    
    	if(Start_Count)
    	{
    
    			CountPRT++;
    			BearingCount++;
    		if(BearingCount==517)		{
    			Bearingangle=Bearingangle+1;
    			if(Bearingangle>=4096)
    			{
    				Bearingangle=0;
    				NoOfPRT=0;
    				//NoOfSwipe++;
    			}
    
    			BearingCount=0;
    		}
    		//if(CountSecond<2342857)
    		{
    		CountSecond++;
    		}
    		/*else
    		{CountSecond=0;}*/
    
    	}
    	//System_exit(0);
    }
    /**
     *  \name TaskFxn
     *  \brief Task which do EIP initialization
     *  \param a0
     *  \param a1
     *  \return none
     *
     */
    /*void TaskFxn(UArg a0, UArg a1)
    {
    	NIMU_log("\n\rSYS/BIOS Ethernet/IP (CPSW) Sample application\n\r");
    //    SendDataToPC();
    }*/
    void PixelCalc()
    {
    	Int16 Pixel_X,Pixel_Y;
    	float RangeInNM,Theta;
        if(NoOfPRT<1726)
    	 {
    
        	/*if((target_Flag)||(targetEnd_Flag))
        	{
    
        		 if(NextData)
        		   {
        			   NextData=0;
        			   clmn++;
        			   //row=0;
        			   if(clmn==1)
        			   {
        				   NoofdataSend=row;
        				   //CopyfirstPRT();
        				   //Cmp_Copy_FivePRT();
        				   //target_Flag=0;
        				   BufferFillFlg =1;
        				   clmn=0;
        			   }
        			   row=0;
        		   }
        		   else{}
    
        		   if(target_Flag)
        		   {   t=target_start;
    
    
        		   }
        		   else if(targetEnd_Flag)
        			   t=target_end;
    
        		   RangeInNM = t * NMFACTOR;				//r (NM)
       			   //Theta = (PRT*NoOfPRT+t)*DEGFACTOR;//? (deg)
       			   //Theta = Theta + 0.05;
        		   Theta = Bearingangle/11.4;
       			   THIndex=(Int16)Theta;
       			   Pixel_X = (int)((RangeInNM*SinTheta[THIndex])*PIXEL_SCALE);		//x (NM)
       			   Pixel_Y = (int)((RangeInNM*CosTheta[THIndex])*PIXEL_SCALE);		//y (NM)				//S
       			   if(ThetaFlg==0)
       			   {
       				ThetaFlg=1;
       				XY_buffer_1[clmn][row]=THIndex;
       				THIndx_prv=THIndex;
       			    row++;
       			   }
       			   else{}
       			   XY_buffer_1[clmn][row]= Pixel_X+450;
       			   row++;
       			   XY_buffer_1[clmn][row]= 450-Pixel_Y;
       			   row++;
    
        		  if(target_Flag==1)
        		   {
        		   target_Flag=0;
        		   XY_buffer_1[clmn][row]=  1;
        		   RiseedgeFlag=1;
        		   }
        		  else if(targetEnd_Flag==1)
    			   {targetEnd_Flag=0;
    			   RiseedgeFlag=0;
    			   XY_buffer_1[clmn][row]=  0;
    			   FalledgeFlag=1;
    			   PrvRow=row;
    			   }
    
        		   row++;
        		}*/
    
        	/*else if((RiseedgeFlag==1)&&(CountPRT>60))
        	{
        		t=60;
        		RiseedgeFlag=0;
        		RangeInNM = t * NMFACTOR;				//r (NM)
    			   //Theta = (PRT*NoOfPRT+t)*DEGFACTOR;//? (deg)
    			   //Theta = Theta + 0.05;
    			   Theta = Bearingangle/11.4;
    			   THIndex=(Int16)Theta;
    			   Pixel_X = (int)((RangeInNM*SinTheta[THIndex])*PIXEL_SCALE);		//x (NM)
    			   Pixel_Y = (int)((RangeInNM*CosTheta[THIndex])*PIXEL_SCALE);		//y (NM)				//S
    			  /* if(ThetaFlg==0)
    			   {
    				ThetaFlg=1;
    				XY_buffer_1[clmn][row]=THIndex;
    				THIndx_prv=THIndex;
    				row++;
    			   }
    			   else{}*/
    			/*   XY_buffer_1[clmn][row]= Pixel_X+450;
    			   row++;
    			   XY_buffer_1[clmn][row]= 450-Pixel_Y;
    			   row++;
    			   XY_buffer_1[clmn][row]=  0;
    			   row++;
    
        	}*/
    
    
            	if(target_Flag)
            	{
            		target_Flag=0;
            		 if(NextData)
            		   {
            			   NextData=0;
            			   clmn++;
            			   //row=0;
            			   if(clmn==5)
            			   {
            				   NoofdataSend=row;
            				   CopyfirstPRT();
            				   //Cmp_Copy_FivePRT();
            				   //target_Flag=0;
            				   BufferFillFlg =1;
            				   clmn=0;
    
            			   }
            			   row=0;
            		   }
            		   else{}
    
         				   if(ThetaFlg==0)
        				   {
        						ThetaFlg=1;
        						row=0;
        						Theta = Bearingangle/11.4;
        						THIndex=(Int16)Theta;
        						XY_buffer_1[clmn][row]=THIndex;
        						//THIndx_prv=THIndex;
        						row++;
        						PrvRow=row;
        				   }
        				   else{}
    
         				   /*if(RiseedgeFlag==1)
         				   {
         					  row = PrvRow;
         				   }*/
         				   RiseedgeFlag=1;
         				   FalledgeFlag=0;
         				   t1=target_start;
        				   RangeInNM = t1 * NMFACTOR;				//r (NM)
        				   Pixel_X = (int)((RangeInNM*SinTheta[THIndex])*PIXEL_SCALE);		//x (NM)
        				   Pixel_Y = (int)((RangeInNM*CosTheta[THIndex])*PIXEL_SCALE);		//y (NM)				//S
        				   XY_buffer_1[clmn][row]= Pixel_X+450;
        				   row++;
        				   XY_buffer_1[clmn][row]= 450-Pixel_Y;
           				   row++;
        				   XY_buffer_1[clmn][row]= 1;
        				   row++;
        				   XY_buffer_1[clmn][row]= Pixel_X+450;
        				   				   row++;
        				   				   XY_buffer_1[clmn][row]= 450-Pixel_Y;
        				   				   row++;
        				   				   XY_buffer_1[clmn][row]= 0;
        				   				   row++;
    
        				   //Theta = (PRT*NoOfPRT+t)*DEGFACTOR;//? (deg)
        				   //Theta = Theta + 0.05;
            	}
    
    
            	else if((targetEnd_Flag)&&(RiseedgeFlag))
            	{
            		   targetEnd_Flag=0;
        			   RiseedgeFlag=0;
        			   FalledgeFlag=1;
        			   t2=target_end;
        			   for(t=t1+1;t<=t2;t++)
        			   {
        			   RangeInNM = t * NMFACTOR;				//r (NM)
        			   Pixel_X = (int)((RangeInNM*SinTheta[THIndex])*PIXEL_SCALE);		//x (NM)
        			   Pixel_Y = (int)((RangeInNM*CosTheta[THIndex])*PIXEL_SCALE);		//y (NM)				//S
        			   XY_buffer_1[clmn][row]= Pixel_X+450;
        			   row++;
        			   XY_buffer_1[clmn][row]= 450-Pixel_Y;
        			   row++;
        			   XY_buffer_1[clmn][row]= 1;
        		    		row++;
        		    		XY_buffer_1[clmn][row]= Pixel_X+450;
        		    		row++;
        		    		XY_buffer_1[clmn][row]= 450-Pixel_Y;
        		 		    		row++;
    
        		 		    		XY_buffer_1[clmn][row]= 0;
        		 		    		    		row++;
        			   }
        			  // PrvRow=row;
            	}
            	/*else if((RiseedgeFlag)&&(FalledgeFlag==0))
            	        	{
            	        		if(t<CountPRT)
            	        		{
            	        		t=CountPRT;
            	        		RangeInNM = t * NMFACTOR;				//r (NM)
            	        		Pixel_X = (int)((RangeInNM*SinTheta[THIndex])*PIXEL_SCALE);		//x (NM)
            	        		Pixel_Y = (int)((RangeInNM*CosTheta[THIndex])*PIXEL_SCALE);		//y (NM)				//S
            	        		XY_buffer_1[clmn][row]= Pixel_X+450;
            	        		row++;
            	        		XY_buffer_1[clmn][row]= 450-Pixel_Y;
            	         		row++;
            	        		/*XY_buffer_1[clmn][row]= 1;
            	        		row++;
            	        		XY_buffer_1[clmn][row]= Pixel_X+450;
            	        		row++;
            	        		XY_buffer_1[clmn][row]= 450-Pixel_Y;
            	     		    		row++;
    
            	     		    		XY_buffer_1[clmn][row]= 0;
            	     		    		    		row++;
            	        		}
            	        	}*/
    
    	 }
    }
    
    
    /*void Cmp_Copy_FivePRT()
    {
    int R,C;
    	for(R=0;R<4;R++)
    	{
    		for(C=0;C<7;C++)
    		 {
    		 	if(XY_buffer_1[R][C]!= XY_buffer_1[R+1][C])
    		 		{XY_buffer_2[C]=XY_buffer_1[R][C];}
    
    		 }
    	}
    }*/
    void Cmp_Copy_FivePRT()
    {
    int R,C,count,index=0;
    XY_buffer_2[index]=XY_buffer_1[1][0];
    index++;
    for(C=1;C<NoofdataSend;C++)
    {
    	for(R=0;R<3;R++)
    	{
    		if(XY_buffer_1[R][C]== XY_buffer_1[R+1][C])
    			{count++;}
    		else
    		{count--;}
    	}
    	if(count>2)
    	{
    		XY_buffer_2[index]=XY_buffer_1[4][C];
    	index++;
    	}
    	count=0;
    }
    NoofdataSend=index;
    }
    void CopyfirstPRT()
    {
    	int C;
    	for(C=0;C<NoofdataSend;C++)
    	 {
    
    	 	XY_buffer_2[C]=XY_buffer_1[4][C];
    	 }
    /*	C=NoofdataSend-1;
    	if(XY_buffer_2[C]==1)
    	{NoofdataSend=NoofdataSend-3;}*/
    }
    
    void SendDataToPC()
    {
    	SOCKET s = INVALID_SOCKET;
    	struct sockaddr_in sin1;
    	int K,I,respose,NoOfBytes;
    	UInt16 *pBuf = 0;
    	struct timeval timeout;
    	//app_delay(1000000);
    	//Task_sleep(10);
    	// Allocate the file descriptor environment for this Task
    
    	fdOpenSession( (HANDLE)Task_self() );
    	NIMU_log("\n== Start TCP Client Test ==\n");
    
    	// Create test socket
    //	s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    	s = socket(AF_INET, SOCK_STREAM, 0);
    	if( s == INVALID_SOCKET )
    	{
    		NIMU_log("failed socket create (%d)\n",fdError());
    	goto leave;
    	}
    
    	// Prepare address for connect
    	bzero( &sin1, sizeof(struct sockaddr_in) );
    	sin1.sin_family = AF_INET;
    	sin1.sin_addr.s_addr =  inet_addr(IPAddr);//inet_addr(SERVER_IP);//htonl(-1);
    	sin1.sin_port = htons(5060);//htons(9000);
    	// Configure our Tx and Rx timeout to be 5 seconds For TCPIP
    	timeout.tv_sec = 5;
    	timeout.tv_usec = 0;
    
    	if(setsockopt( s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof( timeout ) ) < 0 )
    			{
    				NIMU_log("failed Socket opt(%d)\n",fdError());
    			goto leave;
    			}
    	else
    	{NIMU_log("Socket opt succesful\n");}
    
    	//setsockopt( s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof( timeout ) );
    	// Connect socket
    	if( connect( s, (PSA) &sin1, sizeof(sin1) ) < 0 )
    	{
    		NIMU_log("failed connect (%d)\n",fdError());
    	goto leave;
    	}
    
    	// Allocate a working buffer
        if( !(pBuf = malloc( test )) )
        	{
        		NIMU_log("failed temp buffer allocation\n");
        	goto leave;
        	}
        //Task_sleep(50);
       	// Fill buffer with a test pattern
    
        K=0;
        NIMU_log("Start Send\n");
        Start_PRT=1;
        GPIO_enableInt(USER_PB1);
        GPIO_enableInt(USER_PB2);
        GPIO_enableInt(USER_PB3);
    
        while(1)//(NoOfSwipe<=1)//(1)
        {
        	if(Start_Count==1)
        	{
    				if(NoOfPRT<1726)
    				{
    					PixelCalc ();
    					if(BufferFillFlg==1)
    					{
    					BufferFillFlg=0;
    					K++;
    						for(I=0; I<NoofdataSend; I++)
    							{
    							// *(pBuf+I)=XY_buffer_1[0][I];
    
    							*(pBuf+I)	=XY_buffer_2[I];//XY_buffer_1[0][I];
    							//XY_OneSwipe_buff[NoOfSwipe][I]=XY_buffer_2[I];
    							}
    						NoOfBytes = NoofdataSend*2;
    						/*I=50;
    						*(pBuf+I)='\n';*/
    						respose=send( s, pBuf, NoOfBytes, 0 );
    						/*for(I=0; I<NoOfBytes; I++)
    										{
    										NIMU_log("%d,",*(pBuf+I));
    										}
    										NIMU_log("row:%d,",NoofdataSend);
    										NIMU_log("\n");*/
    						//				row=0;
    						//				clmn=0;
    						//NIMU_log("%d\n",respose);
    						if(respose<0)
    						{
    						NIMU_log("send failed (%d)\n",fdError());
    						}
    						//NIMU_log("PRT (%d)\n",NoOfPRT);
    					}
    				}
    				else
    				{
    					//NoOfPRT=0;
    					//NoOfSwipe++;
    				}
        	}
        }
        NIMU_log("Second1:%d\n",CountSecond);
        NIMU_log("Total PRT= %d\n",K);
    
    	leave:
    	if( pBuf )
    	free( pBuf );
    	if( s != INVALID_SOCKET )
    	fdClose( s );
    	NIMU_log("Second2:%d\n",CountSecond);
    	NIMU_log("== End TCP Client Test ==\n\n");
    
    	// Free the file descriptor environment for this Task
    	fdCloseSession( (HANDLE)Task_self() );
    	Task_exit();
    	}
    
    /*
     *  ======== Callback function ========
     */
    void AppGpioCallbackFxn(void)
    {
    	//gpio_intr_triggered = 1;
    
    	if((CountPRT<70)&&(Trigger==1))
    	{
    
    			target_Flag=1;
    			targetStart_Flag=1;
    			target_start=CountPRT;
    
    	}
    
    	else{Trigger=0;
    	targetStart_Flag=0;}
    }
    void AppGpioCallbackFxn_1(void)
    {
    
    	if(targetStart_Flag==1)
    		{
    			targetStart_Flag=0;
    			targetEnd_Flag=1;
    			target_end=CountPRT;
    		}
    
    }
    void AppGpioCallbackFxn_2(void)
    {
    	if(Start_PRT==1)
    	{
    		Start_Count=1;
    		Start_PRT=0;
    	}
    	Trigger=1;
    	//BufferFillFlg =0;
    	NextData=1;
    	CountPRT=0;
    	NoOfPRT++;
    	ThetaFlg=0;
    }
    
    /******************************/
    
    void app_delay(uint32_t delayValue)
    {
        volatile uint32_t delay = delayValue*10;
        while (delay--);
    }
    

    and as Eric said "change GEL file to run at OPP_HIGH for a short period of time". This means this high clock speed cannot be use throughout or for long period? and which and where in gel file need to modify?

    Thanks,

    Anjana Pathak

  • Hi,

    In ccsv7\ccs_base\emulation\boards\am572x\gel\AM572x_startup_common.gel, AM57xx_EVM_Initialization() function, replace AM572x_PRCM_Clock_Config_OPPNOM() with AM572x_PRCM_Clock_Config_OPPHIGH() for a quick try.

    Regards, Eric

  • there are multiple ways of testing OPP_HIGH.

    Option 1: In the GEL, there is option implemented to set the clocks to OPP_HIGH:

    Option 2: The secondary bootloader (SBL) also has this option. If you build SBL using

    make all BOARD=idkAM572x SOC=AM572x BOOTMODE=mmcsd OPPMODE=opp_high

    There are two pins on the AM572x that can be used to route the MPU Clock out. Refer to diagram on Page 522 in TRM to see how the clock can be observed.