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.

TMS320F280049C: Assistance Needed Configuration on F280049CPMS 64-PIN MCU INTERNAL OSCILLATOR

Part Number: TMS320F280049C
Other Parts Discussed in Thread: C2000WARE

Tool/software:

Hello, everyone,

I am working with the TI F280049CPZS 100-Pin MCU and have written a simple code for a timer and LED blinking, which is working well. However, when I build the same code for the F280049CPMS 64-Pin MCU, it is not working. I am using C2000Ware for developing the code, I'm using internal oscillator for clock frequency.

here is my code.

Please guide me if I am on the wrong path.

Thank you.

// Included Files
//
#include "F28x_Project.h"
#include "driverlib.h"
#include "device.h"

//
// Define to pass to SysCtl_setClock(). Will configure the clock as follows:
// PLLSYSCLK = 10MHz (INT_OSC1) * 20 (IMULT) * 1 (FMULT) / 2 (PLLCLK_BY_2)
//
#define DEVICE_SETCLOCK_INTOSC (SYSCTL_OSCSRC_OSC1 | SYSCTL_IMULT(20) | \
SYSCTL_FMULT_NONE | SYSCTL_SYSDIV(2) | \
SYSCTL_PLL_ENABLE)

#define LED1_GPIO 34 // Use GPIO number directly

#define DEVICE_SYSCLK_FREQ 100000000 // Define the system clock frequency (100 MHz in this example)

int count = 0;

void initCPUTimers(void);

void configCPUTimer(uint32_t cpuTimer, float freq, float period);

__interrupt void cpuTimer0ISR(void);

void gpio_init(void);

void main(void)
{
Device_init();
Device_initGPIO();

DINT;
Interrupt_initModule();
Interrupt_initVectorTable();

gpio_init();

Interrupt_register(INT_TIMER0, &cpuTimer0ISR);
initCPUTimers();

SysCtl_setClock(DEVICE_SETCLOCK_INTOSC);

configCPUTimer(CPUTIMER0_BASE, DEVICE_SYSCLK_FREQ, 500000);
Interrupt_enable(INT_TIMER0);

Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
EINT;
ERTM;

CPUTimer_startTimer(CPUTIMER0_BASE);

while (1)
{
GPIO_togglePin(LED1_GPIO);
DELAY_US(100000);
}
}

void initCPUTimers(void)
{
CPUTimer_setPeriod(CPUTIMER0_BASE, 0xFFFFFFFF);
CPUTimer_setPreScaler(CPUTIMER0_BASE, 0);
CPUTimer_stopTimer(CPUTIMER0_BASE);
CPUTimer_reloadTimerCounter(CPUTIMER0_BASE);
}

void configCPUTimer(uint32_t cpuTimer, float freq, float period)
{
uint32_t temp;
temp = (uint32_t)(freq / 1000000 * period);
CPUTimer_setPeriod(cpuTimer, temp);
CPUTimer_setPreScaler(cpuTimer, 0);
CPUTimer_stopTimer(cpuTimer);
CPUTimer_reloadTimerCounter(cpuTimer);
CPUTimer_setEmulationMode(cpuTimer, CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT);
CPUTimer_enableInterrupt(cpuTimer);
}

__interrupt void cpuTimer0ISR(void)
{
count++;
if (count >= 1000)
{
count = 0;
}
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}

void gpio_init(void)
{
EALLOW;
GPIO_setDirectionMode(LED1_GPIO, GPIO_DIR_MODE_OUT);
GPIO_setMasterCore(LED1_GPIO, GPIO_CORE_CPU1);
GPIO_setPinConfig(GPIO_34_GPIO34);
GPIO_setQualificationMode(LED1_GPIO, GPIO_QUAL_ASYNC);
EDIS;
}