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/TMS320F280049: Timer0 interrupt/LED Example Projects - Issues

Part Number: TMS320F280049
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hi everyone,

I have a custom board for the TMS320F280049 microcontroller, the schematic is attached to this thread. I am using the example projects with the C200ware, which supports the new microcontroller. It looks like the header files are intended to be used with a development board or something. 

I have tried the interrupt project, LED project according to "F28004x_DEV_USER_GUIDE.pdf". The projects build and load, however, they debugger does not show anything. For example, the timers (counters) do not increment. Does anyone have a blank project or a PWM or timer project with all the general device header files. Any ideas?

//#############################################################################
//
// FILE: timer_ex1_cputimers.c
//
// TITLE: CPU Timers Example
//
//! \addtogroup bitfield_example_list
//! <h1> CPU Timers </h1>
//!
//! This example configures CPU Timer0, 1, and 2 and increments
//! a counter each time the timer asserts an interrupt.
//!
//! \b External \b Connections \n
//! - None
//!
//! \b Watch \b Variables \n
//! - CpuTimer0.InterruptCount
//! - CpuTimer1.InterruptCount
//! - CpuTimer2.InterruptCount
//!
//
//#############################################################################
// $TI Release: F28004x Support Library v1.03.00.00 $
// $Release Date: Thu Dec 7 18:46:47 CST 2017 $
// $Copyright:
// Copyright (C) 2017 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.
// $
//#############################################################################

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

//
// Function Prototypes
//
__interrupt void cpuTimer0ISR(void);
__interrupt void cpuTimer1ISR(void);
__interrupt void cpuTimer2ISR(void);

//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
InitSysCtrl();

//
// Initialize GPIO
//
InitGpio();
//GPIO_SetupPinMux(31U, GPIO_MUX_CPU1, 0);
//GPIO_SetupPinOptions(31U, 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;
PieVectTable.TIMER1_INT = &cpuTimer1ISR;
PieVectTable.TIMER2_INT = &cpuTimer2ISR;
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);
ConfigCpuTimer(&CpuTimer1, 100, 1000000);
ConfigCpuTimer(&CpuTimer2, 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;
CpuTimer1Regs.TCR.all = 0x4000;
CpuTimer2Regs.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;
IER |= M_INT13;
IER |= M_INT14;

//
// 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)
{
CpuTimer0.InterruptCount++;

//
// Acknowledge this interrupt to receive more interrupts from group 1
//
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}

//
// cpuTimer1ISR - CPU Timer1 ISR with interrupt counter
//
__interrupt void cpuTimer1ISR(void)
{
//
// The CPU acknowledges the interrupt
//
CpuTimer1.InterruptCount++;
}

//
// cpuTimer2ISR CPU Timer2 ISR with interrupt counter
//
__interrupt void cpuTimer2ISR(void)
{
//
// The CPU acknowledges the interrupt
//
CpuTimer2.InterruptCount++;
}

//
// End of file
//

  • Note: The code is stuck at "InitSysCtrl();"
  • Mohamed,

    The examples and some of the example headers are generally created to align with a specific development board. By default, may of the basic c2000ware examples are designed to run out of the box on the controlCard. This uses a 2 pin 20 MHz crystal on X1/X2 as the source for the PLL.

    InitSysPLL will expect that a crystal is connected, if not, I think it may hang, as no time-out is built in.

    It looks like your custom board does not have an external XTAL. So you might want to modify the InitSysCtl function to use the INTOSC as a source for the PLL.

    I have a few other comments on your schematic:
    1. You have not provided a voltage source for VDDA? This is a 3.3V rail on the device that powers the analog domain of the device. I don't see it connected to a 3.3 V source. If this is not powered the analog portion of the device will not operate.
    2. VREFLO is floating with respect to the analog domain. You should either be driving this pin with a reference or it should be tied to ground.

    Thanks,
    Mark
  • Hi Mark, 

    Thanks a lot for your patience. Your comment was completely helpful. I have managed to change the following line in "f28004x_sysctrl.c" file;

    //InitSysPll(XTAL_OSC,IMULT_10,FMULT_0,PLLCLK_BY_2);

    InitSysPll(INT_OSC1,IMULT_10,FMULT_0,PLLCLK_BY_2);

    The microcontroller does something now :)! However, it is not flashing the code as I expected (I will post another thread on that). 

    I updated the schematic for another revision as in the new attached picture. I highlighted the VDDA part, and I am not sure about the Ground for VREFLO. Please let me know if my resolution in the schematic resolves the problem.

    Thanks,

    Mohamed

  • Mohamed,

    Why have you put two resistors in between 3.3 V and VDDA? It Can be directly connected as your VDDIO is. If you are concerned with noise from the digital domain, you may consider placing a ferrite bead between your 3.3 V 'VDD' rail (which I recommend renaming to 'VDDIO' as 'VDD' on this device typically refers to 1.2 V VDD supply. VDDIO would refer to 3.3 V. This is just my preference to eliminate any confusion).

    Please check the values of your decoupling caps per power supply pin as well. you can find this information in the pin description tables in the datasheet.

    VREFLO can be directly connected to ground.

    You can refer to the F280049M ControlCard schematic for a reference of how the power supply pins and other device support pins should be connected.

    Thanks,
    Mark
  • You're awesome Mark!
    Thanks for replying again. They are only space holders (zero ohm resistors). It is a new design and by the time the schematic was done, there was not any available reference document.
    Is there any generic documentation or C2000Ware for this specific microcontroller? All the codes are made for the control card.
    Thanks again!
    Mohamed
  • Mohamed,

    I'm glad that I am able to help! Your best HW reference is the controlCard at this time.

    For any SW, C2000ware is the right place. These examples are meant to be able to run on the Controlcard for ease of use for those purchasing and using our tools. Generally, you should only need to modify the pinout and clock sources if there are any differences between your board design and the reference design. These examples are made to help you get off the ground, you will need to make the modifications to the SW if you are running on custom HW.

    Mark