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.

CCS/LAUNCHXL-F28379D: Delay time for the Program.

Part Number: LAUNCHXL-F28379D
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

#include "F28x_Project.h"


void delay ();
void Gpio_setup (void);
unsigned int i;
void main(void)
{
InitSysCtrl ();
InitGpio ();
Gpio_setup ();
while (1)
{
EALLOW;
GpioDataRegs.GPADAT.bit.GPIO14 = 0;
DELAY_US(1000);
GpioDataRegs.GPADAT.bit.GPIO14 = 1;
DELAY_US(1000);
EDIS;
}
}
void Gpio_setup (void)
{
EALLOW;
GpioCtrlRegs.GPAMUX1.bit.GPIO14 = 0;//GPIO
GpioCtrlRegs.GPADIR.bit.GPIO14 = 1; //output
EDIS;
}

I have gone through the files 

F2837xD_usDelay.asm

F2837xD_SysCtrl.c

F2837xD_Examples.h

but I am not able to relate the delay I get by calculating and the delay I am getting while debugging. While debugging for complete cycle it is 4ms while calculating i am getting only 40ms.

#define CPU_RATE   5.00L   // for a 200MHz CPU clock speed (SYSCLKOUT)

I am using the command above for CPU clock speed.

and calculating the delay by this method

#define DELAY_US(A) F28x_usDelay(((((long double) A * 1000.0L) / (long double)CPU_RATE) - 9.0L) / 5.0L)

where in place of A I have taken 1000.

Please correct me and suggest me how to get the right delay.

Bighnaraj Panda