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: Problem with breakpoints in debug session (TMS320C6748)

Other Parts Discussed in Thread: TMS320C6748, OMAP-L138

Tool/software: Code Composer Studio

Hello,
I have a problem with breakpoints in debug session using CCS version 5.1 and DSP processor TMS320C6748 (OMAP L-138 EVM). The program stops on the breakpoint only once (even if it is set in a while loop). I am not getting any error messages from program compilation/ dsp initialization (I am using built-in emulator TI XDS 100v1 USB). Please see the example code (the audio samples are transmitted and received correctly):

L138_initialise_poll(FS_48000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB);
  while(1) 
  {
    sample = input_sample();  // <- breakpoint
    output_sample(sample);
  }

Could you please point me, what could be the reason of that?

  • Hello,
    It is hard to say without a reproducible test case. Did you confirm that it is indeed executing the lines, but the breakpoint is simply ignored? Can you step though the loop as expected? Do you have optimization enabled?

    The best thing to do is to provide a test case. That would be source files and an *.out file that I can run on my local target

    Also note that CCSv5.1 is pretty old. I would strongly recommended upgrading to a later version if possible

    Thanks
    ki
  • Hi Ki,
    thanks for your answer. It seems like the problem was in the program I used (example C program from OMAP-L138 Experimenter book), maybe it does not support C6748 dsp. I tried McASP example from Starterware and it works fine.

    Thanks,
    Kamila
  • Thanks for the update.

    So to confirm, the code was not actually running as expected hence the line with the breakpoint was not being reached after that initial time?

    Thanks
    ki
  • Yes, the program always stops at the following line:

    while (!CHKBIT(MCASP->SRCTL11, XRDY));

    I tried to modify the StarterWare example to interrupt mode (without DMA) but it doesn't work. I am geting no signal on the output.

    Could you please take a look on the file I attached? 

    #include "interrupt.h"
    #include "soc_OMAPL138.h"
    #include "hw_syscfg0_OMAPL138.h"
    #include "evmOMAPL138.h"
    #include "codecif.h"
    #include "mcasp.h"
    #include "aic31.h"
    #include "psc.h"
    
    #include <string.h>
    
    /******************************************************************************
    **                      INTERNAL MACRO DEFINITIONS
    ******************************************************************************/
    /* Slot size to send/receive data */
    #define SLOT_SIZE                             (16u)
    
    /* Word size to send/receive data. Word size <= Slot size */
    #define WORD_SIZE                             (16u)
    
    /* Sampling Rate which will be used by both transmit and receive sections */
    #define SAMPLING_RATE                         (48000u)
    
    /* Number of channels, L & R */
    #define NUM_I2S_CHANNELS                      (2u) 
    
    /* AIC3106 codec address */
    #define I2C_SLAVE_CODEC_AIC31                 (0x18u) 
    
    /* Interrupt channels to map in AINTC */
    #define INT_CHANNEL_I2C                       (2u)
    #define INT_CHANNEL_MCASP                     (2u)
    
    /* McASP Serializer for Receive */
    #define MCASP_XSER_RX                         (12u)
    
    /* McASP Serializer for Transmit */
    #define MCASP_XSER_TX                         (11u)
    
    /*
    ** Below Macros are calculated based on the above inputs
    */
    
    #define I2S_SLOTS                             ((1 << NUM_I2S_CHANNELS) - 1)
    
    
    /*
    ** Definitions which are not configurable 
    */
    
    
    /******************************************************************************
    **                      INTERNAL FUNCTION PROTOTYPES
    ******************************************************************************/
    static void McASPRxIsr(void);
    static void McASPIntSetup(void);
    static void AIC31I2SConfigure(void);
    static void McASPI2SConfigure(void);
    static void I2SDataTxRxActivate(void);
    
    /******************************************************************************
    **                      INTERNAL VARIABLE DEFINITIONS
    ******************************************************************************/
    static volatile unsigned int sample;
    volatile int i=0;
    
    /******************************************************************************
    **                          FUNCTION DEFINITIONS
    ******************************************************************************/
    /*
    ** Function to configure the codec for I2S mode
    */
    static void AIC31I2SConfigure(void)
    {
        volatile unsigned int delay = 0xFFF;
    
        AIC31Reset(SOC_I2C_0_REGS);
        while(delay--);
    
        /* Configure the data format and sampling rate */
        AIC31DataConfig(SOC_I2C_0_REGS, AIC31_DATATYPE_I2S, SLOT_SIZE, 0);
        AIC31SampleRateConfig(SOC_I2C_0_REGS, AIC31_MODE_BOTH, SAMPLING_RATE);
    
        /* Initialize both ADC and DAC */
        AIC31ADCInit(SOC_I2C_0_REGS);
        AIC31DACInit(SOC_I2C_0_REGS);
    }
    
    /*
    ** Configures the McASP Transmit Section in I2S mode.
    */
    static void McASPI2SConfigure(void)
    {
        McASPRxReset(SOC_MCASP_0_CTRL_REGS);
        McASPTxReset(SOC_MCASP_0_CTRL_REGS);
    
        /* Set I2S format in the transmitter/receiver format units */
        McASPRxFmtI2SSet(SOC_MCASP_0_CTRL_REGS, WORD_SIZE, SLOT_SIZE,
                         MCASP_RX_MODE_NON_DMA);
        McASPTxFmtI2SSet(SOC_MCASP_0_CTRL_REGS, WORD_SIZE, SLOT_SIZE,
                         MCASP_TX_MODE_NON_DMA);
    
        /* Configure the frame sync. I2S shall work in TDM format with 2 slots */
        McASPRxFrameSyncCfg(SOC_MCASP_0_CTRL_REGS, 2, MCASP_RX_FS_WIDTH_WORD, 
                            MCASP_RX_FS_EXT_BEGIN_ON_FALL_EDGE);
        McASPTxFrameSyncCfg(SOC_MCASP_0_CTRL_REGS, 2, MCASP_TX_FS_WIDTH_WORD, 
                            MCASP_TX_FS_EXT_BEGIN_ON_RIS_EDGE);
    
        /* configure the clock for receiver */
        McASPRxClkCfg(SOC_MCASP_0_CTRL_REGS, MCASP_RX_CLK_EXTERNAL, 0, 0);
        McASPRxClkPolaritySet(SOC_MCASP_0_CTRL_REGS, MCASP_RX_CLK_POL_RIS_EDGE); 
        McASPRxClkCheckConfig(SOC_MCASP_0_CTRL_REGS, MCASP_RX_CLKCHCK_DIV32,
                              0x00, 0xFF);
    
        /* configure the clock for transmitter */
        McASPTxClkCfg(SOC_MCASP_0_CTRL_REGS, MCASP_TX_CLK_EXTERNAL, 0, 0);
        McASPTxClkPolaritySet(SOC_MCASP_0_CTRL_REGS, MCASP_TX_CLK_POL_FALL_EDGE); 
        McASPTxClkCheckConfig(SOC_MCASP_0_CTRL_REGS, MCASP_TX_CLKCHCK_DIV32,
                              0x00, 0xFF);
     
        /* Enable synchronization of RX and TX sections  */  
        McASPTxRxClkSyncEnable(SOC_MCASP_0_CTRL_REGS);
    
        /* Enable the transmitter/receiver slots. I2S uses 2 slots */
        McASPRxTimeSlotSet(SOC_MCASP_0_CTRL_REGS, I2S_SLOTS);
        McASPTxTimeSlotSet(SOC_MCASP_0_CTRL_REGS, I2S_SLOTS);
    
        /*
        ** Set the serializers, Currently only one serializer is set as
        ** transmitter and one serializer as receiver.
        */
        McASPSerializerRxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_RX);
        McASPSerializerTxSet(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_TX);
    
        /*
        ** Configure the McASP pins 
        ** Input - Frame Sync, Clock and Serializer Rx
        ** Output - Serializer Tx is connected to the input of the codec 
        */
        McASPPinMcASPSet(SOC_MCASP_0_CTRL_REGS, 0xFFFFFFFF);
        McASPPinDirOutputSet(SOC_MCASP_0_CTRL_REGS, MCASP_PIN_AXR(MCASP_XSER_TX));
        McASPPinDirInputSet(SOC_MCASP_0_CTRL_REGS, MCASP_PIN_AFSX 
                                                   | MCASP_PIN_ACLKX
                                                   | MCASP_PIN_AFSR
                                                   | MCASP_PIN_ACLKR
                                                   | MCASP_PIN_AXR(MCASP_XSER_RX));
    
        /* Enable error interrupts for McASP */
    //    McASPTxIntEnable(SOC_MCASP_0_CTRL_REGS, MCASP_TX_DMAERROR
    //                                            | MCASP_TX_CLKFAIL
    //                                            | MCASP_TX_SYNCERROR
    //                                            | MCASP_TX_UNDERRUN);
    
        McASPRxIntEnable(SOC_MCASP_0_CTRL_REGS, MCASP_RX_DATAREADY);
    }
    
    /*
    ** Sets up the error interrupts for McASP in AINTC
    */
    static void McASPIntSetup(void)
    {
    #ifdef _TMS320C6X
        IntRegister(C674X_MASK_INT5, McASPRxIsr);
        IntEventMap(C674X_MASK_INT5, SYS_INT_MCASP0_INT);
        IntEnable(C674X_MASK_INT5);
    #else
        /* Register the error ISR for McASP */
        IntRegister(SYS_INT_MCASPINT, McASPRxIsr);
    
        IntChannelSet(SYS_INT_MCASPINT, INT_CHANNEL_MCASP);
        IntSystemEnable(SYS_INT_MCASPINT);
    #endif
    }
    
    /*
    ** Activates the data transmission/reception
    ** The DMA parameters shall be ready before calling this function.
    */
    static void I2SDataTxRxActivate(void)
    {
        /* Start the clocks */
        McASPRxClkStart(SOC_MCASP_0_CTRL_REGS, MCASP_RX_CLK_EXTERNAL);
        McASPTxClkStart(SOC_MCASP_0_CTRL_REGS, MCASP_TX_CLK_EXTERNAL);
    
        /* Activate the  serializers */
        McASPRxSerActivate(SOC_MCASP_0_CTRL_REGS);
        McASPTxSerActivate(SOC_MCASP_0_CTRL_REGS);
    
    //    /* make sure that the XDATA bit is cleared to zero */
    //    while(McASPTxStatusGet(SOC_MCASP_0_CTRL_REGS) & MCASP_TX_STAT_DATAREADY);
    
        /* Activate the state machines */
        McASPRxEnable(SOC_MCASP_0_CTRL_REGS);
        McASPTxEnable(SOC_MCASP_0_CTRL_REGS);
    }
    
    /*
    ** The main function. Application starts here.
    */
    int main(void)
    {
    
        /* Set up pin mux for I2C module 0 */
        I2CPinMuxSetup(0);
        McASPPinMuxSetup();
    
        /* Power up the McASP module */
        PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_MCASP0, PSC_POWERDOMAIN_ALWAYS_ON,
                 PSC_MDCTL_NEXT_ENABLE);
    
    #ifdef _TMS320C6X
        // Initialize the DSP interrupt controller
        IntDSPINTCInit();
    #else
        /* Initialize the ARM Interrupt Controller.*/
        IntAINTCInit();
    #endif
    
        /* Initialize the I2C 0 interface for the codec AIC31 */
        I2CCodecIfInit(SOC_I2C_0_REGS, INT_CHANNEL_I2C, I2C_SLAVE_CODEC_AIC31);
    
        McASPIntSetup();
    
    #ifdef _TMS320C6X
        IntGlobalEnable();
    #else
        /* Enable the interrupts generation at global level */
        IntMasterIRQEnable();
        IntGlobalEnable();
        IntIRQEnable();
    #endif
    
        /* Configure the Codec for I2S mode */
        AIC31I2SConfigure();
    
        /* Configure the McASP for I2S */
        McASPI2SConfigure();
    
        /* Activate the audio transmission and reception */
        I2SDataTxRxActivate();
    
        while(1){
        };
    }  
    
    /*
    ** Rx ISR for McASP
    */
    static void McASPRxIsr(void)
    {
        sample = McASPRxBufRead(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_RX);
        i++;
        McASPTxBufWrite(SOC_MCASP_0_CTRL_REGS, MCASP_XSER_TX, sample);
    }
    

  • I suggest you post in the related device forum as starterware does not come from the tools group but it comes from the device group. The experts there can help you best