Part Number: TMS320F280049C
Other Parts Discussed in Thread: LAUNCHXL-F280049C, C2000WARE
Tool/software: Code Composer Studio
hello team
we are using LAUNCHXL-F280049C, we try to blink led using cputimer0, i use the example code for timer which is presented in C2000 ware, i do some changes in code for toggle the led. When i flash the code led is not blink,i attached my code below.
/ Included Files
//
#include "F28x_Project.h"
//
// Function Prototypes
//
__interrupt void cpuTimer0ISR(void);
#define DEVICE_GPIO_PIN_LED1 23
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
InitSysCtrl();
//
// Initialize GPIO
//
InitGpio();
GPIO_SetupPinMux(DEVICE_GPIO_PIN_LED1, GPIO_MUX_CPU1, 0);
GPIO_SetupPinOptions(DEVICE_GPIO_PIN_LED1, GPIO_OUTPUT, GPIO_PUSHPULL);
//
// Disable CPU interrupts
//
DINT;
//
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
//
InitPieCtrl();
//
// Disable CPU interrupts and clear all CPU interrupt flags
//
IER = 0x0000;
IFR = 0x0000;
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR)
//
InitPieVectTable();
//
// Map ISR functions
//
EALLOW;
PieVectTable.TIMER0_INT = &cpuTimer0ISR;
EDIS;
//
// Initialize the Device Peripheral. For this example, only initialize the
// Cpu Timers.
//
InitCpuTimers();
//
// Configure CPU-Timer 0, 1, and 2 to interrupt every second:
// 100MHz CPU Freq, 1 second Period (in uSeconds)
//
ConfigCpuTimer(&CpuTimer0, 100, 1000000);
//
// To ensure precise timing, use write-only instructions to write to the
// entire register. Therefore, if any of the configuration bits are changed
// in ConfigCpuTimer and InitCpuTimers, the below settings must also be
// be updated.
//
CpuTimer0Regs.TCR.all = 0x4000;
//
// Enable CPU int1 which is connected to CPU-Timer 0, CPU int13
// which is connected to CPU-Timer 1, and CPU int 14, which is connected
// to CPU-Timer 2
//
IER |= M_INT1;
//
// Enable TINT0 in the PIE: Group 1 interrupt 7
//
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
//
// Enable global Interrupts and higher priority real-time debug events
//
EINT;
ERTM;
//
// IDLE loop. Just sit and loop forever (optional).
//
while(1)
{
}
}
//
// cpuTimer0ISR - CPU Timer0 ISR with interrupt counter
//
__interrupt void cpuTimer0ISR(void)
{
//led toggl
if(CpuTimer0.InterruptCount==0)
{
GPIO_WritePin(DEVICE_GPIO_PIN_LED1, 1);
CpuTimer0Regs.TCR.bit.TSS=1;
}
CpuTimer0.InterruptCount++;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
//
// Acknowledge this interrupt to receive more interrupts from group 1
//
}
is there any other changes in code?
thank you