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.

s/w breakpoint problem

Hi, I started to use my F2808 and I got problem. When I start my program DSP returns s/w breakpoint. I know that there are hardware and software breakpoints. I didn't put any soft. breakpoints so it must be hardware problem. Now here is my code: 

 

#include "PeripheralHeaderIncludes.h"

//#include "DSP280x_Gpio.h"

 

void Gpio_select(void);

void InitSystem(void);

//void delay_loop(long);

 

void main (void)

{

InitSystem();

Gpio_select();

/*GpioCtrlRegs.GPAMUX1.all=0x0000;

GpioCtrlRegs.GPAMUX2.all=0X0000;

GpioCtrlRegs.GPADIR.all=0XFFFF;

GpioDataRegs.GPASET.bit.GPIO0='1';*/

 

//GpioDataRegs.GPASET.bit.GPIO0=0;

GpioDataRegs.GPADAT.bit.GPIO0=0;

}

 

void Gpio_select(void)

{

EALLOW;

GpioCtrlRegs.GPAMUX1.bit.GPIO0=0x0;

// GpioCtrlRegs.GPAMUX2.all=0x0000;

// GpioCtrlRegs.GPBMUX1.all=0x0000;

// GpioCtrlRegs.GPBMUX2.all=0x0000;

GpioCtrlRegs.GPADIR.bit.GPIO0=1;

//    GpioCtrlRegs.GPBDIR.all=0xFFFF;

EDIS;

}

 

void InitSystem(void)

{

EALLOW;

   SysCtrlRegs.WDCR= 0x00E8; // Setup the watchdog 

 

   // Memory Protection Configuration   

    DevEmuRegs.PROTSTART = 0x0100;  // Write default value to protection start register   

   DevEmuRegs.PROTRANGE = 0x00FF;  // Write default value to protection range register   

 

   SysCtrlRegs.PLLCR.bit.DIV=10; // Setup the Clock PLL to multiply by 5

    //SysCtrlRegs.SCSR=0; // Watchdog(WDENINT)to generate a RESET

   SysCtrlRegs.HISPCP.all=0x1; // Setup Highspeed Clock Prescaler to divide by 2

   SysCtrlRegs.LOSPCP.all = 0x2; // Setup Lowspeed CLock Prescaler to divide by 4

      

   // Peripheral clock enables set for the selected peripherals.

    SysCtrlRegs.PCLKCR0.bit.ADCENCLK=0;

SysCtrlRegs.PCLKCR0.bit.ECANAENCLK=0;

SysCtrlRegs.PCLKCR0.bit.ECANBENCLK=0;

SysCtrlRegs.PCLKCR0.bit.SCIAENCLK=0;

SysCtrlRegs.PCLKCR0.bit.SCIBENCLK=0;

SysCtrlRegs.PCLKCR0.bit.SPICENCLK=0;

SysCtrlRegs.PCLKCR0.bit.ECANAENCLK=0;

SysCtrlRegs.PCLKCR0.bit.SPIAENCLK=0;

SysCtrlRegs.PCLKCR0.bit.SPIBENCLK=0;

SysCtrlRegs.PCLKCR0.bit.SPICENCLK=0;

EDIS;

}

 

//void delay_loop(long end)

//{

//long i;

// for (i = 0; i < end; i++);

//EALLOW;

//SysCtrlRegs.WDKEY = 0x55;

//SysCtrlRegs.WDKEY = 0xAA;

//EDIS;

//}

It simply sets/reset GPIO0 ( via GPADAT regiseter ). I desabled WDT and when I run my program it returns me s/w breakpoint. Is something wrong with code or with my memory organization?
Thank you.

  • I would suggest starting with examples in the C280x/2801x C/C++ Header Files and Peripheral Examples as they are configured to work correctly on a 2808 device.

    http://focus.ti.com/docs/toolsw/folders/print/sprc191.html

    Adnan Poljak said:
    Hi, I started to use my F2808 and I got problem. When I start my program DSP returns s/w breakpoint. I know that there are hardware and software breakpoints. I didn't put any soft. breakpoints so it must be hardware problem.

    Sorry, I'm not sure I understand.  When you say it returns a software breakpoint do you mean the PC stops on an ESTOP0 instruction?   If so can you tell me the address of the instruction?

    A couple of observations on the code - I doubt these are causing the particular issue, though

    Adnan Poljak said:
    GpioDataRegs.GPASET.bit.GPIO0='1';*/

    Remove the ' '  around the '1'. 

    Adnan Poljak said:

    GpioDataRegs.GPADAT.bit.GPIO0=0;

    I suggest using GPACLEAR registers instead of using DAT to clear the bit.

    Adnan Poljak said:

       // Memory Protection Configuration   

        DevEmuRegs.PROTSTART = 0x0100;  // Write default value to protection start register   

       DevEmuRegs.PROTRANGE = 0x00FF;  // Write default value to protection range register   

    I suggest not bothering with these registers.  Their default value is fine.

     

     

     

  •  

    This I get when I run my program. I did use GPASET and GPACLEAR but it won't work. Now when I run my DSP second time it runs and when I halt it I get this:

     

    000066 0000        ITRAP0     

    000067 0000        ITRAP0     

    000068 0A0B        INC        @11

    000069 0000        ITRAP0

     

    Bold area is where it stoped. I didnt use any Interrupt in my program. And here is my memory organization:

     

    -stack 400

     

    -heap 400

    MEMORY

    {

    // PAGE 0:    /* Program Memory */

      // PAGE 0 : PROG(RW)     : origin = 0x3E8000, length = 0x10000

      // PAGE 0 : BOOT(R)     : origin = 0x3FF000, length = 0xFC0   

       //PAGE 0 : RESET(RW)    : origin = 0x00A000, length = 0x2

       //PAGE 0 : VECTORS(R)  : origin = 0x00A002, length = 0x3E

     

     

       PAGE 1 : M0RAM(RW)   : origin = 0x000000, length = 0x400

       PAGE 1 : M1RAM(RW)   : origin = 0x000400, length = 0x400

       PAGE 1 : H0RAM(RW)   : origin = 0x3FA000, length = 0x2000

       PAGE 1 : L0L1RAM(RW) : origin = 0x008000, length = 0x2000

     

    }

     

     

    SECTIONS

    {

       PieVectTableFile : > M0RAM,   PAGE = 1

     

    /*** Peripheral Frame 0 Register Structures ***/

       DevEmuRegsFile    : > M0RAM,     PAGE = 1

       FlashRegsFile     : > M0RAM,  PAGE = 1

       CsmRegsFile       : > M0RAM,         PAGE = 1

       AdcMirrorFile     : > M0RAM,  PAGE = 1   

       CpuTimer0RegsFile : > M0RAM,  PAGE = 1

       CpuTimer1RegsFile : > M0RAM,  PAGE = 1

       CpuTimer2RegsFile : > M0RAM,  PAGE = 1  

       PieCtrlRegsFile   : > M0RAM,    PAGE = 1      

     

    /*** Peripheral Frame 1 Register Structures ***/

     

     

     

     

       EPwm1RegsFile     : > M1RAM        PAGE = 1   

       EPwm2RegsFile     : > M1RAM        PAGE = 1   

       EPwm3RegsFile     : > M1RAM        PAGE = 1   

       EPwm4RegsFile     : > M1RAM        PAGE = 1   

       EPwm5RegsFile     : > M1RAM        PAGE = 1   

       EPwm6RegsFile     : > M1RAM        PAGE = 1

     

       ECap1RegsFile     : > M1RAM        PAGE = 1   

       ECap2RegsFile     : > M1RAM        PAGE = 1   

       ECap3RegsFile     : > M1RAM        PAGE = 1   

       ECap4RegsFile     : > M1RAM        PAGE = 1

     

     

     

       GpioCtrlRegsFile  : > H0RAM     PAGE = 1

       GpioDataRegsFile  : > H0RAM      PAGE = 1

       GpioIntRegsFile   : > H0RAM      PAGE = 1

     

    /*** Peripheral Frame 2 Register Structures ***/

       SysCtrlRegsFile   : > H0RAM,      PAGE = 1

       SpiaRegsFile      : > H0RAM,        PAGE = 1

       SciaRegsFile      : > H0RAM,        PAGE = 1

       XIntruptRegsFile  : > H0RAM,    PAGE = 1

       AdcRegsFile       : > H0RAM,         PAGE = 1

       SpibRegsFile      : > H0RAM,        PAGE = 1

       ScibRegsFile      : > H0RAM,        PAGE = 1

       SpicRegsFile      : > H0RAM,        PAGE = 1

       SpidRegsFile      : > H0RAM,        PAGE = 1

       I2caRegsFile      : > H0RAM,        PAGE = 1 

     

    /*** Code Security Module Register Structures ***/

       CsmPwlFile        : > H0RAM,     PAGE = 1

     

          /* 22-bit program sections */

       .reset   : > L0L1RAM,   PAGE = 1

       .vectors : > L0L1RAM, PAGE = 1 

       .pinit   : > L0L1RAM,    PAGE = 1

       .cinit   : > L0L1RAM,    PAGE = 1

       .text    : > L0L1RAM,    PAGE = 1

     

       /* 16-Bit data sections */

       .const   : > H0RAM, PAGE = 1

       .bss     : > H0RAM, PAGE = 1

       .stack   : > M1RAM, PAGE = 1

       .sysmem  : > M0RAM, PAGE = 1

       .cio     : > M0RAM, PAGE = 1

     

       /* 32-bit data sections */

       .ebss    : > H0RAM, PAGE = 1

       .econst  : > H0RAM, PAGE = 1

       .esysmem : > H0RAM, PAGE = 1

    }

     

    I used only Page1 RAM memory and I didnt write my program on flash. So where I made mistake?

     

    Thank you.

  • The memory linker file you show has a lot of issues.  I strongly suggest  instead starting with examples in the C280x/2801x C/C++ Header Files and Peripheral Examples as they are configured to work correctly on a 2808 device. It will be  a better use of your time.

    http://focus.ti.com/docs/toolsw/folders/print/sprc191.html

    Regards

    Lori

     

     

  • I did pass some TI tutorials, but none of them doesn't say anything about *cmd files. It says put *cmd file and then I'm forced to program on my flash. What if I want to use RAM memory only. I red something about memory organization on F2808 documentation, can you tell where is the best place to save my program, (except flash) or if you have some link (document) where I can get extra information.

    Thank you.

  • Adnan Poljak said:
    I did pass some TI tutorials, but none of them doesn't say anything about *cmd files. It says put *cmd file and then I'm forced to program on my flash. What if I want to use RAM memory only. I red something about memory organization on F2808 documentation, can you tell where is the best place to save my program, (except flash) or if you have some link (document) where I can get extra information.

    Adnan,

    The main issue I see with the command file you posted is all of the register structures are mapped to RAM.  Writing to the registers won't do anything other than change the contents of the RAM.  If you check the example projects I mentioned there is a command file that maps all the register structures directly over the register.

    My suggestion is to start with the examples I mentioned as they have all been tested and will run on the RAM.   You can then copy and modify one to suit your particular application.

    Regards

    Lori