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.

TMS320F2802x Piccolo debugging without using "f2802x_common" headers or libraries

Other Parts Discussed in Thread: TMS320F28027

I am trying to write a program in C on the TMS320F28027 Piccolo without using the extra functions and libraries provided in "f2802x_common" to set, clear, enable, disable register values with enumerated types. The program does not execute unless I debug and step through each instruction. I have been able to write a program with the "f2802x_common" libraries and I am able to resume and suspend the CPU just fine during debugging. When I try to go without these extra libraries the program does not seem to flow as I have written it unless I suspend and step through each instruction (step into functions, not over). When I try to execute/resume the code while debugging and then suspend, I get a window showing up saying that there is no source file and the program counter is not in my infinite while loop as expected. I am also not able to call the (*Device_cal) function even when it is defined correctly.

It is mostly default setup for Code Composer Studio v5.3. Debugging in RAM. No library files included in the project. I am using XDS100v2 for debugging.

Am I not understanding something? What am I missing?

Here is program that is not running correctly for me.

#include "F2802x_Device.h"


#define Device_cal (void(*)(void))0x3D7C80


inline void cnfg_setup(void);
inline void gpio_setup(void);


interrupt void epwm1_timer_isr(void)
{
}


int main(void)
{
    cnfg_setup();
    gpio_setup();

    while(1);
}


inline void cnfg_setup(void)
{
    // disable Watchdog, interrupts
    EALLOW;
    SysCtrlRegs.WDCR |= 0x4;

    // device calibration
    SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1;
    (*Device_cal)();
    SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 0;

    // set PLL for 60MHz
    SysCtrlRegs.PLLSTS.bit.DIVSEL   = 0x3;
    SysCtrlRegs.PLLCR.bit.DIV       = 0xC;
    EDIS;

    // wait for pll to stabilize
    while( SysCtrlRegs.PLLSTS.bit.PLLLOCKS == 0 );

    EALLOW;
    SysCtrlRegs.PLLSTS.bit.DIVSEL   = 0x2;
    EDIS;
}

inline void gpio_setup(void)
{
    // set GPIO 6,4,2,0,1,16,17,34 to general purpose
    EALLOW;
    GpioCtrlRegs.GPAMUX1.all &= ~0x0000333F;
    GpioCtrlRegs.GPAMUX2.all &= ~0x00000003;
    GpioCtrlRegs.GPBMUX1.bit.GPIO34 = 0;

    // set pull-up
    GpioCtrlRegs.GPAPUD.all &= ~0x00030057;
    GpioCtrlRegs.GPBPUD.bit.GPIO34 = 0;

    // set ports high
    GpioDataRegs.GPACLEAR.all = 0x00030057;
    GpioDataRegs.GPBCLEAR.bit.GPIO34 = 1;

    // set port direction
    GpioCtrlRegs.GPADIR.all |= 0x00030057;
    GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1;
    EDIS;
}

Thanks,

Kelly