Part Number: TMS320F28374S
Other Parts Discussed in Thread: C2000WARE
Tool/software:
Hi Everybody
As you can see in the picture, I have two projects named as demo2 and demo3. I am currently using TMS320F28374S microcontroller for my project. As stated in the documentation i have developed two projects one from driverlib and other from the device support to do same task. When I build from the demo2 (driverlib) the toggling of GPIO26 takes place at every 6 u-Sec and when i build from the demo3 (device support) takes 40 u-Sec.
I want to know why running the same function on same hardware is taking so much different time. I want to know what is the mistake i am doing in configuring the demo3 project. I have followed every instruction in the document F2837xS_FRM_EX_UG to configure the project.

This is the code written for InitSysCtrl function in F2837xS_SysCtrl.c file.
void InitSysCtrl(void)
{
//
// Disable the watchdog
//
DisableDog();
#ifdef _FLASH
//
// Copy time critical code and Flash setup code to RAM. This includes the
// following functions: InitFlash()
//
// The RamfuncsLoadStart, RamfuncsLoadSize, and RamfuncsRunStart
// symbols are created by the linker. Refer to the device .cmd file.
//
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
//
// Call Flash Initialization to setup flash waitstates. This function must
// reside in RAM.
//
InitFlash_Bank0();
#endif
//
// *IMPORTANT*
//
// The Device_cal function, which copies the ADC & oscillator calibration
// values from TI reserved OTP into the appropriate trim registers, occurs
// automatically in the Boot ROM. If the boot ROM code is bypassed during
// the debug process, the following function MUST be called for the ADC and
// oscillators to function according to specification. The clocks to the
// ADC MUST be enabled before calling this function.
//
// See the device data manual and/or the ADC Reference Manual for more
// information.
//
EALLOW;
//
// Enable pull-ups on unbonded IOs as soon as possible to reduce power
// consumption.
//
GPIO_EnableUnbondedIOPullups();
CpuSysRegs.PCLKCR13.bit.ADC_A = 1;
CpuSysRegs.PCLKCR13.bit.ADC_B = 1;
CpuSysRegs.PCLKCR13.bit.ADC_C = 1;
CpuSysRegs.PCLKCR13.bit.ADC_D = 1;
//
// Check if device is trimmed
//
if(*((Uint16 *)0x5D1B6) == 0x0000){
//
// Device is not trimmed--apply static calibration values
//
AnalogSubsysRegs.ANAREFTRIMA.all = 31709;
AnalogSubsysRegs.ANAREFTRIMB.all = 31709;
AnalogSubsysRegs.ANAREFTRIMC.all = 31709;
AnalogSubsysRegs.ANAREFTRIMD.all = 31709;
}
CpuSysRegs.PCLKCR13.bit.ADC_A = 0;
CpuSysRegs.PCLKCR13.bit.ADC_B = 0;
CpuSysRegs.PCLKCR13.bit.ADC_C = 0;
CpuSysRegs.PCLKCR13.bit.ADC_D = 0;
EDIS;
//
// Initialize the PLL control: SYSPLLMULT and SYSCLKDIVSEL.
//
// Defined options to be passed as arguments to this function are defined
// in F2837xS_Examples.h.
//
// Note: The internal oscillator CANNOT be used as the PLL source if the
// PLLSYSCLK is configured to frequencies above 194 MHz.
//
// PLLSYSCLK = (XTAL_OSC) * (IMULT + FMULT) / (PLLSYSCLKDIV)
//
#ifdef _LAUNCHXL_F28377S
InitSysPll(XTAL_OSC,IMULT_40,FMULT_0,PLLCLK_BY_2);
#else
InitSysPll(XTAL_OSC,IMULT_20,FMULT_0,PLLCLK_BY_2);
#endif
//
// Turn on all peripherals
//
InitPeripheralClocks();
}
the code written in main.c of demo2 (driverlib) is as follow:
#include "main.h"
float T;
PLL_DATATYPE grid_volt;
int main(void)
{
Device_init();
Interrupt_initModule();
Interrupt_initVectorTable();
Interrupt_enableMaster();
InitializeGPIO();
EINT;
ERTM;
while(1)
{
GPIO_writePin(26, 1);
PLL(&grid_volt,T);
PLL(&grid_volt,T);
GPIO_writePin(26, 0);
}
}
The code written in main.c of demo3 (device support) is as follow:
#include <F28x_Project.h>
#include "main.h"
float T;
PLL_DATATYPE grid_volt;
int main(void )
{
InitSysCtrl(); // System Initialization
EALLOW;
GpioCtrlRegs.GPAMUX2.bit.GPIO26 = 0; // GPIO34 as GPIO
GpioCtrlRegs.GPAGMUX2.bit.GPIO26 = 0; // GPIO34 as GPIO
GpioCtrlRegs.GPADIR.bit.GPIO26 = 1; // Direct GPIO as output
EDIS;
while(1)
{
GpioDataRegs.GPATOGGLE.bit.GPIO26 = 1;
PLL(&grid_volt,T);
GpioDataRegs.GPATOGGLE.bit.GPIO26 = 1;
}
}
Thank you in advance.