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.

"no source available" in CCS Version 5.2

I am using CCS Version: 5.2.1.00018 with Windows 7 and the "Check for Updates" found none.

I have an assembler only project targeting the MSP4304152 on a custom board.

When I start the debugger I see the "No source available" message in the source pane.  The debug window shows the code and even the path to the .s43 file. but can't match this up to the assembler code.   I checked the various forums and this has been discussed in the past and the implication was that a fix was in the works.

I have debug turned on, and even tried the secret .asmfunc directive to no avail.

thanks,

 

James

  • James,

    This sounds very much like an issue that is fixed in the upcoming CCSv5.3.0 that has to do with asm source association when using elf.  Any chance we could get the executable and .s43 file to test the fix?

    John

  • Hi James,

    what version of compiler do you have?

    Best Regards,
    LIsa

  • Hi Lisa,

    The overall product is 5.2.1.00018 and the MSP430 Compiler Tools is 4.1.1.

    James

  • Hi James,

    would you be able to send the files (offline is fine via a friend/conversation request) requested?

    Best Regards,
    Lisa

  • Hi Lisa,

     

    I am going to have to come up with a sample for you to keep the front office folks happy.  How do I send you the zip file?

     

    James

  • Hi James,

    you can simply start a converstaion request  or friend request with me here on the forum.

    There is the ability to attach a file there.

    Best Regards,

    Lisa

  • Hi there,

    I am working with Code Composer Studio 5.4.0. I got the exact error. Can you please let me know how to solve my problem?

    Regards

  • Iman,

    If you are getting the exact same error then there is no problem to solve.  You have halted inside the runtime support library but don't have the source for it.  If you want you could step out to get back to your application code (unless you are already at the exit label).

    John

  • John,

    My code doesn't work. Actually I combined two codes (both are working) to have a single code, but the combined code doesn't work. I am working with ezdsPTMF28335 to a Ball and Beam Control system.

    Code1:(Working)

    #include "DSP2833x_Device.h"

    // external function prototypes
    extern void InitAdc(void);
    extern void InitSysCtrl(void);
    extern void InitPieCtrl(void);
    extern void InitPieVectTable(void);
    extern void InitCpuTimers(void);
    extern void ConfigCpuTimer(struct CPUTIMER_VARS *, float, float);
    extern void display_ADC(unsigned int);

    // Prototype statements for functions found within this file.
    void Gpio_select(void);
    interrupt void cpu_timer0_isr(void);
    interrupt void adc_isr(void); // ADC End of Sequence ISR
    // Global Variables
    unsigned int Voltage_VR1;
    unsigned int Voltage_VR2;
    float ballPosition;
    float alpha_Sensor = 0.02;
    float aveVoltageNew, aveVoltageOld = 4096;

    //###########################################################################
    // main code
    //###########################################################################
    void main(void)
    {
    InitSysCtrl(); // Basic Core Init from DSP2833x_SysCtrl.c

    EALLOW;
    SysCtrlRegs.WDCR= 0x00AF; // Re-enable the watchdog
    EDIS; // 0x00AF to NOT disable the Watchdog, Prescaler = 64

    DINT; // Disable all interrupts

    Gpio_select(); // GPIO9, GPIO11, GPIO34 and GPIO49 as output
    // to 4 LEDs at Peripheral Explorer)

    InitPieCtrl(); // basic setup of PIE table; from DSP2833x_PieCtrl.c

    InitPieVectTable(); // default ISR's in PIE

    InitAdc(); // Basic ADC setup, incl. calibration

    AdcRegs.ADCTRL1.all = 0;
    AdcRegs.ADCTRL1.bit.ACQ_PS = 7; // 7 = 8 x ADCCLK
    AdcRegs.ADCTRL1.bit.SEQ_CASC =1; // 1=cascaded sequencer
    AdcRegs.ADCTRL1.bit.CPS = 0; // divide by 1
    AdcRegs.ADCTRL1.bit.CONT_RUN = 0; // single run mode

    AdcRegs.ADCTRL2.all = 0;
    AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 1; // 1=enable SEQ1 interrupt
    AdcRegs.ADCTRL2.bit.EPWM_SOCA_SEQ1 =1; // 1=SEQ1 start from ePWM_SOCA trigger
    AdcRegs.ADCTRL2.bit.INT_MOD_SEQ1 = 0; // 0= interrupt after every end of sequence

    AdcRegs.ADCTRL3.bit.ADCCLKPS = 3; // ADC clock: FCLK = HSPCLK / 2 * ADCCLKPS
    // HSPCLK = 75MHz (see DSP2833x_SysCtrl.c)
    // FCLK = 12.5 MHz

    AdcRegs.ADCMAXCONV.all = 0x0001; // 2 conversions from Sequencer 1

    AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0; // Setup ADCINA0 as 1st SEQ1 conv.
    AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 1; // Setup ADCINA1 as 2nd SEQ1 conv.

    EPwm2Regs.TBCTL.all = 0xC030; // Configure timer control register
    /*
    bit 15-14 11: FREE/SOFT, 11 = ignore emulation suspend
    bit 13 0: PHSDIR, 0 = count down after sync event
    bit 12-10 000: CLKDIV, 000 => TBCLK = HSPCLK/1
    bit 9-7 000: HSPCLKDIV, 000 => HSPCLK = SYSCLKOUT/1
    bit 6 0: SWFSYNC, 0 = no software sync produced
    bit 5-4 11: SYNCOSEL, 11 = sync-out disabled
    bit 3 0: PRDLD, 0 = reload PRD on counter=0
    bit 2 0: PHSEN, 0 = phase control disabled
    bit 1-0 00: CTRMODE, 00 = count up mode
    */

    EPwm2Regs.TBPRD = 2999; // TPPRD +1 = TPWM / (HSPCLKDIV * CLKDIV * TSYSCLK)
    // = 20 µs / 6.667 ns

    EPwm2Regs.ETPS.all = 0x0100; // Configure ADC start by ePWM2
    /*
    bit 15-14 00: EPWMxSOCB, read-only
    bit 13-12 00: SOCBPRD, don't care
    bit 11-10 00: EPWMxSOCA, read-only
    bit 9-8 01: SOCAPRD, 01 = generate SOCA on first event
    bit 7-4 0000: reserved
    bit 3-2 00: INTCNT, don't care
    bit 1-0 00: INTPRD, don't care
    */

    EPwm2Regs.ETSEL.all = 0x0A00; // Enable SOCA to ADC
    /*
    bit 15 0: SOCBEN, 0 = disable SOCB
    bit 14-12 000: SOCBSEL, don't care
    bit 11 1: SOCAEN, 1 = enable SOCA
    bit 10-8 010: SOCASEL, 010 = SOCA on PRD event
    bit 7-4 0000: reserved
    bit 3 0: INTEN, 0 = disable interrupt
    bit 2-0 000: INTSEL, don't care
    */

    EALLOW;
    PieVectTable.TINT0 = &cpu_timer0_isr;
    PieVectTable.ADCINT = &adc_isr;
    EDIS;

    InitCpuTimers(); // basic setup CPU Timer0, 1 and 2

    ConfigCpuTimer(&CpuTimer0,150,100000);

    PieCtrlRegs.PIEIER1.bit.INTx7 = 1; // CPU Timer 0
    PieCtrlRegs.PIEIER1.bit.INTx6 = 1; // ADC

    IER |=1;

    EINT;
    ERTM;

    CpuTimer0Regs.TCR.bit.TSS = 0; // start timer0

    while(1)
    {
    while(CpuTimer0.InterruptCount <5)
    {
    // wait for 500 ms
    EALLOW;
    SysCtrlRegs.WDKEY = 0x55; // Service watchdog #1
    EDIS;
    }
    // Display VR1 voltage
    display_ADC(Voltage_VR1);

    while(CpuTimer0.InterruptCount <10) // wait for 1000 ms
    {
    EALLOW;
    SysCtrlRegs.WDKEY = 0x55; // Service watchdog #1
    EDIS;
    }
    // Display VR2 voltage
    display_ADC(Voltage_VR2);

    CpuTimer0.InterruptCount = 0;
    }
    }

    void Gpio_select(void)
    {
    EALLOW;
    GpioCtrlRegs.GPAMUX1.all = 0; // GPIO15 ... GPIO0 = General Puropse I/O
    GpioCtrlRegs.GPAMUX2.all = 0; // GPIO31 ... GPIO16 = General Purpose I/O
    GpioCtrlRegs.GPBMUX1.all = 0; // GPIO47 ... GPIO32 = General Purpose I/O
    GpioCtrlRegs.GPBMUX2.all = 0; // GPIO63 ... GPIO48 = General Purpose I/O
    GpioCtrlRegs.GPCMUX1.all = 0; // GPIO79 ... GPIO64 = General Purpose I/O
    GpioCtrlRegs.GPCMUX2.all = 0; // GPIO87 ... GPIO80 = General Purpose I/O

    GpioCtrlRegs.GPADIR.all = 0;
    GpioCtrlRegs.GPADIR.bit.GPIO9 = 1; // peripheral explorer: LED LD1 at GPIO9
    GpioCtrlRegs.GPADIR.bit.GPIO11 = 1; // peripheral explorer: LED LD2 at GPIO11

    GpioCtrlRegs.GPBDIR.all = 0; // GPIO63-32 as inputs
    GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1; // peripheral explorer: LED LD3 at GPIO34
    GpioCtrlRegs.GPBDIR.bit.GPIO49 = 1; // peripheral explorer: LED LD4 at GPIO49

    GpioCtrlRegs.GPCDIR.all = 0; // GPIO87-64 as inputs
    EDIS;
    }

    interrupt void cpu_timer0_isr(void)
    {
    CpuTimer0.InterruptCount++;
    EALLOW;
    SysCtrlRegs.WDKEY = 0xAA; // service WD #2
    EDIS;
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
    }

    interrupt void adc_isr(void)
    {
    Voltage_VR1 = AdcMirror.ADCRESULT0; // store results global
    aveVoltageNew = alpha_Sensor*Voltage_VR1 + (1-alpha_Sensor) * aveVoltageOld; // Computing Exponential Moving Average
    aveVoltageOld = aveVoltageNew;
    ballPosition = 2*(aveVoltageNew/169 - 2210/169);
    //Voltage_VR2 = AdcMirror.ADCRESULT1;
    // Reinitialize for next ADC sequence
    AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1; // Reset SEQ1
    AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1; // Clear INT SEQ1 bit
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE
    }

    //===========================================================================
    // End of SourceCode1
    //===========================================================================

    Code 2 (Working)

    #include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
    #include "DSP2833x_Examples.h" // DSP2833x Examples Include File
    #include "invpeninit.h" //#include "Example_posspeed.h" // Example specific Include file////////embedded

    #include<stdio.h>
    #include<math.h>


    #define AD7245 *((uint16 *)0x4001)
    #define DELAY2 1000000L
    #define PI 3.141593

    POSSPEED qep_posspeed=POSSPEED_DEFAULTS;//////////////////////embedded
    // Prototype statements for functions found within this file.
    interrupt void cpu_timer0_isr(void);
    interrupt void adc_isr(void); // Interrupt Function for ADC

    void initADGPIO();
    //void InitXintf16GpioDA();
    void initAD();
    void ADconvert();

    void testIOport();


    //////////////////////////////////////////
    float adtmp=0;
    ///////////////////////////////////////////Our Embedded Code
    //Position set point in meters

    int i;

    /////////////////////////////////////////////////////////////My Definitions
    volatile float motorAngle= -5*PI/18;
    float Kp = 8;
    float Ki = 2;
    float Kd = 0.0603;
    float alpha_II[2] = {0,0.001}, beta_II = -1;
    float alpha_ID[2] = {50,-50}, beta_ID = -0.9512;

    float InnerLoopController(float motorAngle);
    float InnerIntegrator(float alpha[2], float beta, float Input);
    float InnerDerivative(float alpha[2], float beta, float Input);

    /* Outer Loop for the Ball and Beam System
    */
    float L = 16.75; // Length of the beam in inches
    float r = 1; // Radius of servo coupled joint in inches
    float setPoint = 0; // Desired ball position (in cm)
    float Kp_bb = 0.012577; // Proportional coefficient for outer loop controller in rad/cm
    float Kv_bb = -0.006; // Derivative coefficient for outer loop controller in rad/cm/s

    float alpha_OD[2] = {20,-20}, beta_OD = -0.9802;

    float OuterLoopController(float ballPosition, float Kp_bb,float Kv_bb);
    float OuterDerivative(float alpha[2], float beta, float Input);


    //************************************************
    // MAIN
    //************************************************
    void main(void)
    {

    // Step 1. Initialize System Control:
    // PLL, WatchDog, enable Peripheral Clocks
    // This example function is found in the DSP2833x_SysCtrl.c file.
    InitSysCtrl();

    // Step 2. Initalize GPIO:
    // This example function is found in the DSP2833x_Gpio.c file and
    // illustrates how to set the GPIO to it's default state.
    // InitGpio(); // Skipped for this example


    // Step 3. Clear all interrupts and initialize PIE vector table:
    // 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.
    // This function is found in the DSP2833x_PieCtrl.c file.
    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).
    // This will populate the entire table, even if the interrupt
    // is not used in this example. This is useful for debug purposes.
    // The shell ISR routines are found in DSP2833x_DefaultIsr.c.
    // This function is found in DSP2833x_PieVect.c.
    InitPieVectTable();

    // Interrupts that are used in this example are re-mapped to
    // ISR functions found within this file.
    EALLOW; // This is needed to write to EALLOW protected registers
    PieVectTable.TINT0 = &cpu_timer0_isr;
    EDIS; // This is needed to disable write to EALLOW protected registers

    // Step 4. Initialize the Device Peripheral. This function can be
    // found in DSP2833x_CpuTimers.c
    InitCpuTimers(); // For this example, only initialize the Cpu Timers
    #if (CPU_FRQ_150MHZ)
    // Configure CPU-Timer 0 to interrupt every 500 milliseconds:
    // 150MHz CPU Freq, 50 millisecond Period (in uSeconds)
    ConfigCpuTimer(&CpuTimer0, 150, 1000); //setup sampling time for controllor
    #endif
    #if (CPU_FRQ_100MHZ)
    // Configure CPU-Timer 0 to interrupt every 500 milliseconds:
    // 100MHz CPU Freq, 50 millisecond Period (in uSeconds)
    ConfigCpuTimer(&CpuTimer0, 100, 1000);
    #endif

    // 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 (in DSP2833x_CpuTimers.h), the
    // below settings must also be updated.

    CpuTimer0Regs.TCR.all = 0x4001; // Use write-only instruction to set TSS bit = 0

    // Step 5. User specific code, enable interrupts:

    // Configure GPIO32 as a GPIO output pin
    EALLOW;
    GpioCtrlRegs.GPBMUX1.bit.GPIO32 = 0;
    GpioCtrlRegs.GPBDIR.bit.GPIO32 = 1;
    EDIS;

    // Enable CPU INT1 which is connected to CPU-Timer 0:
    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; // Enable Global interrupt INTM
    ERTM; // Enable Global realtime interrupt DBGM

    // Step 6. IDLE loop. Just sit and loop forever (optional):


    ////////////////////////////////////////////////////////////////////////////////embedded code for Eqep
    InitEQep1Gpio();
    InitEQep2Gpio();
    qep_posspeed.init(&qep_posspeed);
    EALLOW;
    EQep1Regs.QPOSCNT=0x0000;
    EQep2Regs.QPOSCNT=0x7fff;
    EDIS;

    ///////////////////////////////////////////////////////////////////////////////end of embedded code
    ////////////////////////////////////////////initialization of
    initADGPIO();//initialize GPIO for DAGPIO
    initAD();//set the output voltage as 0.
    //testIOport();
    ADconvert(0.0);//set output voltage as 0V manually
    ///////// My Settings

    ////////////////////////////////////////////////////////////////////////////////end of embedded code
    for(;;)
    ;
    }

    void testIOport() ///this is for testing if the port still works, no use for our program.
    {
    EALLOW;
    GpioCtrlRegs.GPBMUX1.bit.GPIO38 = 0;

    GpioCtrlRegs.GPBDIR.bit.GPIO38=1;
    GpioCtrlRegs.GPBPUD.bit.GPIO38=0;

    GpioCtrlRegs.GPCMUX1.bit.GPIO73 = 0;
    GpioCtrlRegs.GPCDIR.bit.GPIO73=1;
    GpioCtrlRegs.GPCPUD.bit.GPIO73=0;

    EDIS;
    }


    //********************************************************************************************
    //interrupt function for pendulum control *
    //********************************************************************************************
    interrupt void cpu_timer0_isr(void)
    {
    float Lr = L/r; // alpha to theta conversion ratio(L/r)
    CpuTimer0.InterruptCount++;
    GpioDataRegs.GPBTOGGLE.bit.GPIO32 = 1; // Toggle GPIO32 once per 500 milliseconds
    /////////////////////////////////////Eqep code
    motorAngle=qep_posspeed.calc(&qep_posspeed); //get motor angle
    // ballPosition=ball_pos.pos(&ball_pos); //get ball position
    float ballPosition = 0;
    ///////////////////////////////////////Controllers Function
    float ThetaD = OuterLoopController(-ballPosition+setPoint,Kp_bb*Lr,Kv_bb*Lr);
    ThetaD = -10*PI/180;
    float motorVoltage = InnerLoopController(-ThetaD + motorAngle);

    //////////////////////////////////////////start work if pendulum angle is 0
    adtmp+=1; //test
    if(adtmp<=3000000) //30000
    ADconvert(motorVoltage);
    else
    ADconvert(0.0);
    /////////////////////////////////////////////////////////////////////////////////////////
    // Acknowledge this interrupt to receive more interrupts from group 1
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
    }

    ////////////////////////////////////////////////////////////////////////////////////////////////////
    // Outer PD Controller Package
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    float OuterLoopController(float Measurement, float Kp_bb, float Kv_bb)
    {
    float theta = 0;
    float thetaDer = OuterDerivative(alpha_OD, beta_OD, Measurement);
    theta = Kp_bb * Measurement + Kv_bb * thetaDer;
    return theta;
    }
    // Outer Loop Derivative
    float OuterDerivative(float alpha[2], float beta,float input)
    {
    static float mOD[2] = {0,0}, outputOD = 0;
    mOD[0] = input - beta * mOD[1];
    outputOD = alpha[1] * mOD[0] + alpha[0] * mOD[1];
    mOD[1] = mOD[0];
    return outputOD;
    }

    ////////////////////////////////////////////////////////////////////////////////////////////////////
    // Inner PID Controller Package
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    float InnerLoopController(float Measurement)
    {
    float V = 0;
    float VI = InnerIntegrator(alpha_II, beta_II, Measurement);
    float VD = InnerDerivative(alpha_ID, beta_ID, Measurement);

    V = Kp * Measurement + Ki * VI + Kd * VD;
    return V;
    }
    // Inner Integrator
    float InnerIntegrator(float alpha[2], float beta,float input)
    {
    static float mII[2] = {0,0}, outputII = 0;
    mII[0] = input - beta * mII[1];
    outputII = alpha[1] * mII[0] + alpha[0] * mII[1];
    mII[1] = mII[0];
    return outputII;
    }
    // Inner Derivative
    float InnerDerivative(float alpha[2], float beta,float input)
    {
    static float mID[2] = {0,0}, outputID = 0;
    mID[0] = input - beta * mID[1];
    outputID = alpha[1] * mID[0] + alpha[0] * mID[1];
    mID[1] = mID[0];
    return outputID;
    }

    Code 3 (Code 1 + Code 2 (Not Working)):


    #include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
    #include "DSP2833x_Examples.h" // DSP2833x Examples Include File
    #include "invpeninit.h" //#include "Example_posspeed.h" // Example specific Include file////////embedded

    #include<stdio.h>
    #include<math.h>


    #define AD7245 *((uint16 *)0x4001)
    #define DELAY2 1000000L
    #define PI 3.141593

    // external function prototypes
    extern void InitAdc(void);
    extern void InitSysCtrl(void);
    extern void InitPieCtrl(void);
    extern void InitPieVectTable(void);
    extern void InitCpuTimers(void);
    extern void ConfigCpuTimer(struct CPUTIMER_VARS *, float, float);
    extern void display_ADC(unsigned int);
    POSSPEED qep_posspeed=POSSPEED_DEFAULTS;//////////////////////embedded
    // Prototype statements for functions found within this file.
    interrupt void cpu_timer0_isr(void);
    interrupt void adc_isr(void); // Interrupt Function for ADC

    void initADGPIO();
    //void InitXintf16GpioDA();
    void initAD();
    void ADconvert();

    void testIOport();

    static float aveVoltageNew, aveVoltageOld;
    //////////////////////////////////////////
    float adtmp=0;
    ///////////////////////////////////////////Our Embedded Code

    unsigned int Voltage_VR1; // Raw Digital Data from Potentiometer
    unsigned int Voltage_VR2; // Raw Digital Data from Potentiometer
    float alpha_Sensor = 0.02;
    float motorVoltage = 0; //Voltage to DC Motor
    float ballPosition = 21; // Position of Ball(cm)

    int i;

    /////////////////////////////////////////////////////////////My Definitions
    volatile float motorAngle= -5*PI/18;
    float ThetaD;
    float Kp = 8;
    float Ki = 2;
    float Kd = 0.0603;
    float alpha_II[2] = {0,0.001}, beta_II = -1;
    float alpha_ID[2] = {50,-50}, beta_ID = -0.9512;

    float InnerLoopController(float motorAngle);
    float InnerIntegrator(float alpha[2], float beta, float Input);
    float InnerDerivative(float alpha[2], float beta, float Input);

    /* Outer Loop for the Ball and Beam System
    */
    float L = 16.75; // Length of the beam in inches
    float r = 1; // Radius of servo coupled joint in inches

    float setPoint = 0; // Desired ball position (in cm)
    float Kp_bb = 0.012577; // Proportional coefficient for outer loop controller in rad/cm
    float Kv_bb = -0.006; // Derivative coefficient for outer loop controller in rad/cm/s

    float alpha_OD[2] = {20,-20}, beta_OD = -0.9802;

    float OuterLoopController(float ballPosition, float Kp_bb,float Kv_bb);
    float OuterDerivative(float alpha[2], float beta, float Input);


    //************************************************
    // MAIN
    //************************************************
    void main(void)
    {

    // Step 1. Initialize System Control:
    // PLL, WatchDog, enable Peripheral Clocks
    // This example function is found in the DSP2833x_SysCtrl.c file.
    InitSysCtrl();
    EALLOW;
    SysCtrlRegs.WDCR= 0x00AF; // Re-enable the watchdog
    EDIS; // 0x00AF to NOT disable the Watchdog, Prescaler = 64


    // Step 2. Initalize GPIO:
    // This example function is found in the DSP2833x_Gpio.c file and
    // illustrates how to set the GPIO to it's default state.
    // InitGpio(); // Skipped for this example


    // Step 3. Clear all interrupts and initialize PIE vector table:
    // 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.
    // This function is found in the DSP2833x_PieCtrl.c file.
    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).
    // This will populate the entire table, even if the interrupt
    // is not used in this example. This is useful for debug purposes.
    // The shell ISR routines are found in DSP2833x_DefaultIsr.c.
    // This function is found in DSP2833x_PieVect.c.
    InitPieVectTable();
    InitAdc(); // Initialize ADC
    // Interrupts that are used in this example are re-mapped to
    // ISR functions found within this file.


    AdcRegs.ADCTRL1.all = 0;
    AdcRegs.ADCTRL1.bit.ACQ_PS = 7; // 7 = 8 x ADCCLK
    AdcRegs.ADCTRL1.bit.SEQ_CASC =1; // 1=cascaded sequencer
    AdcRegs.ADCTRL1.bit.CPS = 0; // divide by 1
    AdcRegs.ADCTRL1.bit.CONT_RUN = 0; // single run mode

    AdcRegs.ADCTRL2.all = 0;
    AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 1; // 1=enable SEQ1 interrupt
    AdcRegs.ADCTRL2.bit.EPWM_SOCA_SEQ1 =1; // 1=SEQ1 start from ePWM_SOCA trigger
    AdcRegs.ADCTRL2.bit.INT_MOD_SEQ1 = 0; // 0= interrupt after every end of sequence

    AdcRegs.ADCTRL3.bit.ADCCLKPS = 3; // ADC clock: FCLK = HSPCLK / 2 * ADCCLKPS
    // HSPCLK = 75MHz (see DSP2833x_SysCtrl.c)
    // FCLK = 12.5 MHz

    AdcRegs.ADCMAXCONV.all = 0x0001; // 2 conversions from Sequencer 1

    AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0; // Setup ADCINA0 as 1st SEQ1 conv.
    AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 1; // Setup ADCINA1 as 2nd SEQ1 conv.

    EPwm2Regs.TBCTL.all = 0xC030; // Configure timer control register
    /*
    bit 15-14 11: FREE/SOFT, 11 = ignore emulation suspend
    bit 13 0: PHSDIR, 0 = count down after sync event
    bit 12-10 000: CLKDIV, 000 => TBCLK = HSPCLK/1
    bit 9-7 000: HSPCLKDIV, 000 => HSPCLK = SYSCLKOUT/1
    bit 6 0: SWFSYNC, 0 = no software sync produced
    bit 5-4 11: SYNCOSEL, 11 = sync-out disabled
    bit 3 0: PRDLD, 0 = reload PRD on counter=0
    bit 2 0: PHSEN, 0 = phase control disabled
    bit 1-0 00: CTRMODE, 00 = count up mode
    */

    EPwm2Regs.TBPRD = 2999; // TPPRD +1 = TPWM / (HSPCLKDIV * CLKDIV * TSYSCLK)
    // = 20 µs / 6.667 ns

    EPwm2Regs.ETPS.all = 0x0100; // Configure ADC start by ePWM2
    /*
    bit 15-14 00: EPWMxSOCB, read-only
    bit 13-12 00: SOCBPRD, don't care
    bit 11-10 00: EPWMxSOCA, read-only
    bit 9-8 01: SOCAPRD, 01 = generate SOCA on first event
    bit 7-4 0000: reserved
    bit 3-2 00: INTCNT, don't care
    bit 1-0 00: INTPRD, don't care
    */

    EPwm2Regs.ETSEL.all = 0x0A00; // Enable SOCA to ADC
    /*
    bit 15 0: SOCBEN, 0 = disable SOCB
    bit 14-12 000: SOCBSEL, don't care
    bit 11 1: SOCAEN, 1 = enable SOCA
    bit 10-8 010: SOCASEL, 010 = SOCA on PRD event
    bit 7-4 0000: reserved
    bit 3 0: INTEN, 0 = disable interrupt
    bit 2-0 000: INTSEL, don't care
    */

    EALLOW;
    PieVectTable.TINT0 = &cpu_timer0_isr;
    PieVectTable.ADCINT = &adc_isr;
    EDIS;

    // Step 4. Initialize the Device Peripheral. This function can be
    // found in DSP2833x_CpuTimers.c
    InitCpuTimers(); // For this example, only initialize the Cpu Timers

    // Configure CPU-Timer 0 to interrupt every 500 milliseconds:
    // 150MHz CPU Freq, 50 millisecond Period (in uSeconds)
    ConfigCpuTimer(&CpuTimer0, 150, 1000); //setup sampling time for controllor


    // 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 (in DSP2833x_CpuTimers.h), the
    // below settings must also be updated.

    CpuTimer0Regs.TCR.all = 0x4001; // Use write-only instruction to set TSS bit = 0

    // Step 5. User specific code, enable interrupts:

    // Configure GPIO32 as a GPIO output pin
    EALLOW;
    GpioCtrlRegs.GPBMUX1.bit.GPIO32 = 0;
    GpioCtrlRegs.GPBDIR.bit.GPIO32 = 1;
    EDIS;

    // Enable CPU INT1 which is connected to CPU-Timer 0:
    IER |= M_INT1;

    // Enable TINT0 in the PIE: Group 1 interrupt 7
    PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
    PieCtrlRegs.PIEIER1.bit.INTx6 = 1;
    // Enable global Interrupts and higher priority real-time debug events:
    EINT; // Enable Global interrupt INTM
    ERTM; // Enable Global realtime interrupt DBGM

    // Step 6. IDLE loop. Just sit and loop forever (optional):


    ////////////////////////////////////////////////////////////////////////////////embedded code for Eqep
    InitEQep1Gpio();
    InitEQep2Gpio();
    qep_posspeed.init(&qep_posspeed);
    EALLOW;
    EQep1Regs.QPOSCNT=0x0000;
    EQep2Regs.QPOSCNT=0x7fff;
    EDIS;

    ///////////////////////////////////////////////////////////////////////////////end of embedded code
    ////////////////////////////////////////////initialization of
    initADGPIO();//initialize GPIO for DAGPIO
    initAD();//set the output voltage as 0.
    //testIOport();
    ADconvert(0.0);//set output voltage as 0V manually
    ///////// My Settings

    ////////////////////////////////////////////////////////////////////////////////end of embedded code

    /* while(1)
    {
    while(CpuTimer0.InterruptCount <5)
    {
    // wait for 500 ms
    EALLOW;
    SysCtrlRegs.WDKEY = 0x55; // Service watchdog #1
    EDIS;
    }
    // Display VR1 voltage
    display_ADC(Voltage_VR1);

    while(CpuTimer0.InterruptCount <10) // wait for 1000 ms
    {
    EALLOW;
    SysCtrlRegs.WDKEY = 0x55; // Service watchdog #1
    EDIS;
    }
    // Display VR2 voltage
    display_ADC(Voltage_VR2);

    CpuTimer0.InterruptCount = 0;
    }*/
    }

    void testIOport() ///this is for testing if the port still works, no use for our program.
    {
    EALLOW;
    GpioCtrlRegs.GPBMUX1.bit.GPIO38 = 0;

    GpioCtrlRegs.GPBDIR.bit.GPIO38=1;
    GpioCtrlRegs.GPBPUD.bit.GPIO38=0;

    GpioCtrlRegs.GPCMUX1.bit.GPIO73 = 0;
    GpioCtrlRegs.GPCDIR.bit.GPIO73=1;
    GpioCtrlRegs.GPCPUD.bit.GPIO73=0;

    EDIS;
    }


    //********************************************************************************************
    //interrupt function for pendulum control *
    //********************************************************************************************
    interrupt void cpu_timer0_isr(void)
    {
    // alpha to theta conversion ratio(L/r)
    CpuTimer0.InterruptCount++;
    EALLOW;
    SysCtrlRegs.WDKEY = 0xAA; // service WD #2
    EDIS;
    GpioDataRegs.GPBTOGGLE.bit.GPIO32 = 1; // Toggle GPIO32 once per 500 milliseconds
    /////////////////////////////////////Eqep code
    motorAngle=qep_posspeed.calc(&qep_posspeed); //get motor angle
    ballPosition = (aveVoltageNew/85 - 25.8824); // Ball Sensor Result
    ///////////////////////////////////////Controllers
    ThetaD = OuterLoopController(ballPosition-setPoint,Kp_bb*L,Kv_bb*L);
    motorVoltage = InnerLoopController(-ThetaD + motorAngle);
    /// Voltage Limiter (Nonlinearity)
    if(motorVoltage>5)
    motorVoltage = 5;
    else if (motorVoltage<-5)
    motorVoltage = -5;
    //////////////////////////////////////////start work if pendulum angle is 0
    adtmp+=1; //test
    if(adtmp<=30000000) //30000
    ADconvert(motorVoltage);
    else
    ADconvert(0.0);
    /////////////////////////////////////////////////////////////////////////////////////////
    // Acknowledge this interrupt to receive more interrupts from group 1
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
    }

    //// ADC Interrupt Function (Reading Data from Position Sensor)
    interrupt void adc_isr(void)
    {
    int start = 0;
    Voltage_VR1 = AdcMirror.ADCRESULT0; // store results global

    if (start)
    aveVoltageNew = alpha_Sensor * Voltage_VR1 + (1-alpha_Sensor) * aveVoltageOld; // Computing Exponential Moving Average
    else
    {
    aveVoltageNew = Voltage_VR1;
    start = 1;
    }

    aveVoltageOld = aveVoltageNew;
    // ballPosition = (aveVoltageNew/85 - 2200/85); // Ball Sensor Result
    //Voltage_VR2 = AdcMirror.ADCRESULT1;
    // Reinitialize for next ADC sequence
    AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1; // Reset SEQ1
    AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1; // Clear INT SEQ1 bit
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE
    }
    //

    ////////////////////////////////////////////////////////////////////////////////////////////////////
    // Outer PD Controller Package
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    float OuterLoopController(float Measurement, float Kp_bb, float Kv_bb)
    {
    float theta = 0;
    float thetaDer = OuterDerivative(alpha_OD, beta_OD, Measurement);
    theta = Kp_bb * Measurement + Kv_bb * thetaDer;
    return theta;
    }
    // Outer Loop Derivative
    float OuterDerivative(float alpha[2], float beta,float input)
    {
    static float mOD[2] = {0,0}, outputOD = 0;
    mOD[0] = input - beta * mOD[1];
    outputOD = alpha[1] * mOD[0] + alpha[0] * mOD[1];
    mOD[1] = mOD[0];
    return outputOD;
    }

    ////////////////////////////////////////////////////////////////////////////////////////////////////
    // Inner PID Controller Package
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    float InnerLoopController(float Measurement)
    {
    float V = 0;
    float VI = InnerIntegrator(alpha_II, beta_II, Measurement);
    float VD = InnerDerivative(alpha_ID, beta_ID, Measurement);

    V = Kp * Measurement + Ki * VI + Kd * VD;
    return V;
    }
    // Inner Integrator
    float InnerIntegrator(float alpha[2], float beta,float input)
    {
    static float mII[2] = {0,0}, outputII = 0;
    mII[0] = input - beta * mII[1];
    outputII = alpha[1] * mII[0] + alpha[0] * mII[1];
    mII[1] = mII[0];
    return outputII;
    }
    // Inner Derivative
    float InnerDerivative(float alpha[2], float beta,float input)
    {
    static float mID[2] = {0,0}, outputID = 0;
    mID[0] = input - beta * mID[1];
    outputID = alpha[1] * mID[0] + alpha[0] * mID[1];
    mID[1] = mID[0];
    return outputID;
    }

    ////////////////////////////////////////////////////////////////////////////////////////////////////

    I don't know what is the problem! :(

  • Hi Iman or James,  Did you fixed this problem? I am having same problem with AM335x.

    It is looks like Linker is not converting the object file into proper address, if you find a solution, please send me .

  • Hi Terrance,

    Sorry to report but the short answer is no.

    The problem was that the debugger would not 'connect' to assembly language files.  One could see the disassembled code but the link to the actual source (and of course the comments and variable / label names) was broken.  I worked around this by keeping the source open in an external editor and manually matching up the source with the disassembly.  Not the best but I was able to get the assembly code working and then coded the remainder of the application in c.  I never had the problem debugging c language files.

    There was a comment from JohnS of TI back in August of 2012 that this was a known problem and would be corrected in the V5.3.0 release. I seem to recall sending in a project for them to test.  I see that the MSP430 of CCS is at v6, so I would hope that it was fixed by now.

    James

  • Hi All,

    I can confirm I  see this behavior. No step debugging through the assembly source.

    Are we sure this is a bug, amazing that it wouldn't be fixed by now?


    Randy