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/TMS320C6748: TMS320c6748 LCDK Cache and EDMA Problems

Part Number: TMS320C6748
Other Parts Discussed in Thread: OMAPL138

Tool/software: Code Composer Studio

Greetings,

I've been working with the EDMA for sometime now with some success.  Implementing the EDMA with the Cache has become a significant problem however particularly on the RX buffers of the EDMA.

Currently I've been using the CSLR Cache library which has worked well for significantly speeding up many routines when receiving data through the EDMA and have experienced no problem when receiving data via the EDMA and initializing the cache prior. When transitioning to the transmit routine, it seems as though despite my output buffers being correct, the EDMA is dropping sometimes hundreds of samples, and sometimes cutting data off at the end of the routine.  It seems to be caused by the Cache routine and works fine when the cache is not enabled.  However, the cache is necessary and I'd rather not write my own code that moves my necessary code back and fourth out of L2 and L1 memory and would rather use and already developed cache routine.

I've read through the cache user manual on the TMS320C674x processors about coherence with the EDMA.  Although, more easily I feel as though it would be more ideal to place the output TX Buffers for the EDMA in a noncacheable portion of memory (Which I've tried by using Pragma statements but couldn't figure out how to change what level of SDRAM is Cachable)

Here is the code I use to initialize the Cache:

void disable_cache (void)
{
    // Set DDR2 (MAR 192 - 223) as not cacheable
    for(counter = 192; counter < 224; counter++)
        CSL_FINST(cacheRegs->MAR[counter], CACHE_MAR_PC, NOT_CACHEABLE);

    // Disable L1P
    CSL_FINST(cacheRegs->L1PCFG, CACHE_L1PCFG_MODE, DISABLE);
    stall = cacheRegs->L1PCFG;

    // Disable L1D
    CSL_FINST(cacheRegs->L1DCFG, CACHE_L1DCFG_MODE, DISABLE);
    stall = cacheRegs->L1DCFG;

    // Disable L2
    CSL_FINST(cacheRegs->L2CFG, CACHE_L2CFG_MODE, DISABLE);
    stall = cacheRegs->L2CFG;
}/* disable_cache */

void setup_DDR2_cache (void)
{
    // Set SDRAM (MAR 192 - 223) as cacheable
    for(counter = 192; counter < 224; counter++)
        CSL_FINST(cacheRegs->MAR[counter], CACHE_MAR_PC, CACHEABLE);
}/* setup_SDRAM_cache */



void enable_L1 (void)
{
    // Set L1P size to 32K
    CSL_FINST(cacheRegs->L1PCFG, CACHE_L1PCFG_MODE, 32K);
    stall = cacheRegs->L1PCFG;

    // Set L1D size to 32K
    CSL_FINST(cacheRegs->L1DCFG, CACHE_L1DCFG_MODE, 32K);
    stall = cacheRegs->L1DCFG;
}/* enable_L1 */

void enable_L2 (void)
{
    // Set L2 size to 256K
    CSL_FINST(cacheRegs->L2CFG, CACHE_L2CFG_MODE, 128K);
    stall = cacheRegs->L2CFG;
}/* enable_L2 */

Can someone tell me what is wrong with this cache routine or point me to one that is effective from some kind of TI software?

  • Hello,

    Can you let me know which software package you are currently using? Processor SDK? StarterWare? And is this a bare-metal or TI-RTOS application?

    Based on your response I'll look for an example that you can reference.

    Regards,
    Sahin
  • Sahin,

    For the EDMA-MCASP I'm using the StarterWare. I found the CSLR code somewhere, but that code along with a CSLR.h and CSLR_CACHE.h code was also supplied to make my code run more efficiently. This is a bare-metal application.  The example on the starterware only seems to address cache utilization with the EDMA for the UART.  I may just start working on trying to adapt that code to suite for now.  I've attached the two cache ".h" files.

    #ifndef _CSLR_H_
    #define _CSLR_H_
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    //Macro Concatentation:
    //	The ## operator concatenates two tokens into a macro invocation
    
    //Notes on Macro Concatentation Rules
    //[1] The ## operator cannot be the very first or very last item in the replacement list
    //[2] Concatenation takes place before any macros in arguments are expanded
    //    In otherwords, if you have two seperate portions of a string -> and
    //    together them make a complete string, -> the string will be expanded
    //    out to give C something to process
    //[3] If the result of the concatenation is a valid macro name, it is available for
    //    further replacement even if it appears in a context in which it would
    //    not be availabe (highlighting #2)
    //    If more than one ## operator appears in the replacement list, the order
    //    of evaluation is not defined.
    
    /* the "expression" macros */
    /* the Field MaKe macro */
    #define CSL_FMK(PER_REG_FIELD, val)                                         \
        (((val) << CSL_##PER_REG_FIELD##_SHIFT) & CSL_##PER_REG_FIELD##_MASK)
    
    //This macro takes in a string (PER_REG_FIELD) and a value
    // shifts is is the specified shift & AND's it with it's mask.
    //This prepares the value to be used in another macro by sit or clearing (1 or 0)
    //a particular bit in a register, and clearing all the rest of the bits.
    
    
    /* the Field EXTract macro */
    #define CSL_FEXT(reg, PER_REG_FIELD)                                        \
        (((reg) & CSL_##PER_REG_FIELD##_MASK) >> CSL_##PER_REG_FIELD##_SHIFT)
    // This macro takes in a register ANDs it with it's mask, and shifts it by shift
    //This macro extracts a bit to 1 or 0 by by specifying.
    
    
    
    /* the Field INSert macro */
    //Register, Register Field, Value
    #define CSL_FINS(reg, PER_REG_FIELD, val)                                   \
       ((reg) = ((reg) & ~CSL_##PER_REG_FIELD##_MASK)|CSL_FMK(PER_REG_FIELD, val))
    //This macro takes in a register, string, and value.
    //This macro inserts a bit (set or cleared) into it's corresponding FIELD in the register, 
    //and leaves all the other bits untouched.
    
    
    
    
    
    
    /* the "token" macros */
    
    /* the Field MaKe (Token) macro */
    #define CSL_FMKT(PER_REG_FIELD, TOKEN)                                      \
        CSL_FMK(PER_REG_FIELD, CSL_##PER_REG_FIELD##_##TOKEN)
    //this makco does the same thing as the CSL_FMK, except that it takes
    //a tken instead of a value. In other words, the token is expanded and replaced with a value, before
    //the CSL_FMK is called with the value.
    
    
    
    /* the Field INSert (Token) macro */
    #define CSL_FINST(reg, PER_REG_FIELD, TOKEN)                                \
        CSL_FINS((reg), PER_REG_FIELD, CSL_##PER_REG_FIELD##_##TOKEN)
    
    //This macro does the same thing as the CSL_FINS macro execpt witha token, instead of
    //a value.
    
    
    
    
    
    
    
    
    
    
    /* the "raw" macros */
    
    /* the Field MaKe (Raw) macro */
    #define CSL_FMKR(msb, lsb, val)                                             \
        (((val) & ((1 << ((msb) - (lsb) + 1)) - 1)) << (lsb))
    
    /* the Field EXTract (Raw) macro */
    #define CSL_FEXTR(reg, msb, lsb)                                            \
        (((reg) >> (lsb)) & ((1 << ((msb) - (lsb) + 1)) - 1))
    
    /* the Field INSert (Raw) macro */
    #define CSL_FINSR(reg, msb, lsb, val)                                       \
        ((reg) = ((reg) &~ (((1 << ((msb) - (lsb) + 1)) - 1) << (lsb)))         \
        | CSL_FMKR(msb, lsb, val))
    
        
    #ifdef __cplusplus
    }
    #endif
    
    #endif /* _CSLR_H_ */
    
    
    /** ============================================================================
     *   @file  cslr_cache.h
     *
     *   @path  $(CSLPATH)\inc
     *
     *   @desc  This file contains the Register Descriptions for CACHE
     *
     *  ============================================================================
     */
    #ifndef _CSLR_CACHE_H_
    #define _CSLR_CACHE_H_
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    #include <cslr.h>
    #include <tistdtypes.h>
    
    
    /* Minimum unit = 1 byte */
    
    /**************************************************************************\
    * Register Overlay Structure
    \**************************************************************************/
    typedef struct  {
        volatile Uint32 L2CFG;
        volatile Uint8 RSVD0[28];
        volatile Uint32 L1PCFG;
        volatile Uint32 L1PCC;
        volatile Uint8 RSVD1[24];
        volatile Uint32 L1DCFG;
        volatile Uint32 L1DCC;
        volatile Uint8 RSVD2[16312];
        volatile Uint32 L2WBAR;
        volatile Uint32 L2WWC;
        volatile Uint8 RSVD3[8];
        volatile Uint32 L2WIBAR;
        volatile Uint32 L2WIWC;
        volatile Uint32 L2IBAR;
        volatile Uint32 L2IWC;
        volatile Uint32 L1PIBAR;
        volatile Uint32 L1PIWC;
        volatile Uint8 RSVD4[8];
        volatile Uint32 L1DWIBAR;
        volatile Uint32 L1DWIWC;
        volatile Uint8 RSVD5[8];
        volatile Uint32 L1DWBAR;
        volatile Uint32 L1DWWC;
        volatile Uint32 L1DIBAR;
        volatile Uint32 L1DIWC;
        volatile Uint8 RSVD6[4016];
        volatile Uint32 L2WB;
        volatile Uint32 L2WBINV;
        volatile Uint32 L2INV;
        volatile Uint8 RSVD7[28];
        volatile Uint32 L1PINV;
        volatile Uint8 RSVD8[20];
        volatile Uint32 L1DWB;
        volatile Uint32 L1DWBINV;
        volatile Uint32 L1DINV;
        volatile Uint8 RSVD9[12212];
        volatile Uint32 MAR[256];
    } CSL_CacheRegs;
    
    /**************************************************************************\
    * Overlay structure typedef definition
    \**************************************************************************/
    typedef volatile CSL_CacheRegs         *CSL_CacheRegsOvly;
    
    /**************************************************************************\
    * Field Definition Macros
    \**************************************************************************/
    
    /* L2CFG */
    
    
    #define CSL_CACHE_L2CFG_NUM_MM_MASK (0x0F000000u)
    #define CSL_CACHE_L2CFG_NUM_MM_SHIFT (0x00000018u)
    #define CSL_CACHE_L2CFG_NUM_MM_RESETVAL (0x00000000u)
    
    
    #define CSL_CACHE_L2CFG_MMID_MASK (0x000F0000u)
    #define CSL_CACHE_L2CFG_MMID_SHIFT (0x00000010u)
    #define CSL_CACHE_L2CFG_MMID_RESETVAL (0x00000000u)
    
    
    #define CSL_CACHE_L2CFG_IP_MASK (0x00000200u)
    #define CSL_CACHE_L2CFG_IP_SHIFT (0x00000009u)
    #define CSL_CACHE_L2CFG_IP_RESETVAL (0x00000000u)
    /*----IP Tokens----*/
    #define CSL_CACHE_L2CFG_IP_NORMAL (0x00000000u)
    #define CSL_CACHE_L2CFG_IP_INVALIDATE (0x00000001u)
    
    #define CSL_CACHE_L2CFG_ID_MASK (0x00000100u)
    #define CSL_CACHE_L2CFG_ID_SHIFT (0x00000008u)
    #define CSL_CACHE_L2CFG_ID_RESETVAL (0x00000000u)
    /*----ID Tokens----*/
    #define CSL_CACHE_L2CFG_ID_NORMAL (0x00000000u)
    #define CSL_CACHE_L2CFG_ID_INVALIDATE (0x00000001u)
    
    
    #define CSL_CACHE_L2CFG_L2CC_MASK (0x00000008u)
    #define CSL_CACHE_L2CFG_L2CC_SHIFT (0x00000003u)
    #define CSL_CACHE_L2CFG_L2CC_RESETVAL (0x00000000u)
    /*----L2CC Tokens----*/
    #define CSL_CACHE_L2CFG_L2CC_NORMAL (0x00000000u)
    #define CSL_CACHE_L2CFG_L2CC_FREEZE (0x00000001u)
    
    #define CSL_CACHE_L2CFG_MODE_MASK (0x00000007u)
    #define CSL_CACHE_L2CFG_MODE_SHIFT (0x00000000u)
    #define CSL_CACHE_L2CFG_MODE_RESETVAL (0x00000000u)
    /*----MODE Tokens----*/
    #define CSL_CACHE_L2CFG_MODE_DISABLE (0x00000000u)
    #define CSL_CACHE_L2CFG_MODE_0K (0x00000000u)
    #define CSL_CACHE_L2CFG_MODE_32K (0x00000001u)
    #define CSL_CACHE_L2CFG_MODE_64K (0x00000002u)
    #define CSL_CACHE_L2CFG_MODE_128K (0x00000003u)
    #define CSL_CACHE_L2CFG_MODE_256K (0x00000004u)
    #define CSL_CACHE_L2CFG_MODE_MAX (0x00000005u)
    
    #define CSL_CACHE_L2CFG_RESETVAL (0x00000000u)
    
    /* L1PCFG */
    
    
    #define CSL_CACHE_L1PCFG_MODE_MASK (0x00000007u)
    #define CSL_CACHE_L1PCFG_MODE_SHIFT (0x00000000u)
    #define CSL_CACHE_L1PCFG_MODE_RESETVAL (0x00000000u)
    /*----MODE Tokens----*/
    #define CSL_CACHE_L1PCFG_MODE_DISABLE (0x00000000u)
    #define CSL_CACHE_L1PCFG_MODE_0K (0x00000000u)
    #define CSL_CACHE_L1PCFG_MODE_4K (0x00000001u)
    #define CSL_CACHE_L1PCFG_MODE_8K (0x00000002u)
    #define CSL_CACHE_L1PCFG_MODE_16K (0x00000003u)
    #define CSL_CACHE_L1PCFG_MODE_32K (0x00000004u)
    #define CSL_CACHE_L1PCFG_MODE_MAX (0x00000005u)
    
    #define CSL_CACHE_L1PCFG_RESETVAL (0x00000000u)
    
    /* L1PCC */
    
    
    #define CSL_CACHE_L1PCC_POPER_MASK (0x00010000u)
    #define CSL_CACHE_L1PCC_POPER_SHIFT (0x00000010u)
    #define CSL_CACHE_L1PCC_POPER_RESETVAL (0x00000000u)
    /*----POPER Tokens----*/
    #define CSL_CACHE_L1PCC_POPER_NORM (0x00000000u)
    #define CSL_CACHE_L1PCC_POPER_FREEZE (0x00000001u)
    
    
    #define CSL_CACHE_L1PCC_OPER_MASK (0x00000001u)
    #define CSL_CACHE_L1PCC_OPER_SHIFT (0x00000000u)
    #define CSL_CACHE_L1PCC_OPER_RESETVAL (0x00000000u)
    /*----OPER Tokens----*/
    #define CSL_CACHE_L1PCC_OPER_NORM (0x00000000u)
    #define CSL_CACHE_L1PCC_OPER_FREEZE (0x00000001u)
    
    #define CSL_CACHE_L1PCC_RESETVAL (0x00000000u)
    
    /* L1DCFG */
    
    
    #define CSL_CACHE_L1DCFG_MODE_MASK (0x00000007u)
    #define CSL_CACHE_L1DCFG_MODE_SHIFT (0x00000000u)
    #define CSL_CACHE_L1DCFG_MODE_RESETVAL (0x00000000u)
    /*----MODE Tokens----*/
    #define CSL_CACHE_L1DCFG_MODE_DISABLE (0x00000000u)
    #define CSL_CACHE_L1DCFG_MODE_0K (0x00000000u)
    #define CSL_CACHE_L1DCFG_MODE_4K (0x00000001u)
    #define CSL_CACHE_L1DCFG_MODE_8K (0x00000002u)
    #define CSL_CACHE_L1DCFG_MODE_16K (0x00000003u)
    #define CSL_CACHE_L1DCFG_MODE_32K (0x00000004u)
    #define CSL_CACHE_L1DCFG_MODE_MAX (0x00000005u)
    
    #define CSL_CACHE_L1DCFG_RESETVAL (0x00000000u)
    
    /* L1DCC */
    
    
    #define CSL_CACHE_L1DCC_POPER_MASK (0x00010000u)
    #define CSL_CACHE_L1DCC_POPER_SHIFT (0x00000010u)
    #define CSL_CACHE_L1DCC_POPER_RESETVAL (0x00000000u)
    /*----POPER Tokens----*/
    #define CSL_CACHE_L1DCC_POPER_NORMAL (0x00000000u)
    #define CSL_CACHE_L1DCC_POPER_FREEZE (0x00000001u)
    
    
    #define CSL_CACHE_L1DCC_OPER_MASK (0x00000001u)
    #define CSL_CACHE_L1DCC_OPER_SHIFT (0x00000000u)
    #define CSL_CACHE_L1DCC_OPER_RESETVAL (0x00000000u)
    /*----OPER Tokens----*/
    #define CSL_CACHE_L1DCC_OPER_NORM (0x00000000u)
    #define CSL_CACHE_L1DCC_OPER_FREEZE (0x00000001u)
    
    #define CSL_CACHE_L1DCC_RESETVAL (0x00000000u)
    
    /* L2WBAR */
    
    #define CSL_CACHE_L2WBAR_ADDR_MASK (0xFFFFFFFFu)
    #define CSL_CACHE_L2WBAR_ADDR_SHIFT (0x00000000u)
    #define CSL_CACHE_L2WBAR_ADDR_RESETVAL (0x00000000u)
    
    #define CSL_CACHE_L2WBAR_RESETVAL (0x00000000u)
    
    /* L2WWC */
    
    
    #define CSL_CACHE_L2WWC_CNT_MASK (0x0000FFFFu)
    #define CSL_CACHE_L2WWC_CNT_SHIFT (0x00000000u)
    #define CSL_CACHE_L2WWC_CNT_RESETVAL (0x00000000u)
    
    #define CSL_CACHE_L2WWC_RESETVAL (0x00000000u)
    
    /* L2WIBAR */
    
    #define CSL_CACHE_L2WIBAR_ADDR_MASK (0xFFFFFFFFu)
    #define CSL_CACHE_L2WIBAR_ADDR_SHIFT (0x00000000u)
    #define CSL_CACHE_L2WIBAR_ADDR_RESETVAL (0x00000000u)
    
    #define CSL_CACHE_L2WIBAR_RESETVAL (0x00000000u)
    
    /* L2WIWC */
    
    
    #define CSL_CACHE_L2WIWC_CNT_MASK (0x0000FFFFu)
    #define CSL_CACHE_L2WIWC_CNT_SHIFT (0x00000000u)
    #define CSL_CACHE_L2WIWC_CNT_RESETVAL (0x00000000u)
    
    #define CSL_CACHE_L2WIWC_RESETVAL (0x00000000u)
    
    /* L2IBAR */
    
    #define CSL_CACHE_L2IBAR_ADDR_MASK (0xFFFFFFFFu)
    #define CSL_CACHE_L2IBAR_ADDR_SHIFT (0x00000000u)
    #define CSL_CACHE_L2IBAR_ADDR_RESETVAL (0x00000000u)
    
    #define CSL_CACHE_L2IBAR_RESETVAL (0x00000000u)
    
    /* L2IWC */
    
    
    #define CSL_CACHE_L2IWC_CNT_MASK (0x0000FFFFu)
    #define CSL_CACHE_L2IWC_CNT_SHIFT (0x00000000u)
    #define CSL_CACHE_L2IWC_CNT_RESETVAL (0x00000000u)
    
    #define CSL_CACHE_L2IWC_RESETVAL (0x00000000u)
    
    /* L1PIBAR */
    
    #define CSL_CACHE_L1PIBAR_ADDR_MASK (0xFFFFFFFFu)
    #define CSL_CACHE_L1PIBAR_ADDR_SHIFT (0x00000000u)
    #define CSL_CACHE_L1PIBAR_ADDR_RESETVAL (0x00000000u)
    
    #define CSL_CACHE_L1PIBAR_RESETVAL (0x00000000u)
    
    /* L1PIWC */
    
    
    #define CSL_CACHE_L1PIWC_CNT_MASK (0x0000FFFFu)
    #define CSL_CACHE_L1PIWC_CNT_SHIFT (0x00000000u)
    #define CSL_CACHE_L1PIWC_CNT_RESETVAL (0x00000000u)
    
    #define CSL_CACHE_L1PIWC_RESETVAL (0x00000000u)
    
    /* L1DWIBAR */
    
    #define CSL_CACHE_L1DWIBAR_ADDR_MASK (0xFFFFFFFFu)
    #define CSL_CACHE_L1DWIBAR_ADDR_SHIFT (0x00000000u)
    #define CSL_CACHE_L1DWIBAR_ADDR_RESETVAL (0x00000000u)
    
    #define CSL_CACHE_L1DWIBAR_RESETVAL (0x00000000u)
    
    /* L1DWIWC */
    
    
    #define CSL_CACHE_L1DWIWC_CNT_MASK (0x0000FFFFu)
    #define CSL_CACHE_L1DWIWC_CNT_SHIFT (0x00000000u)
    #define CSL_CACHE_L1DWIWC_CNT_RESETVAL (0x00000000u)
    
    #define CSL_CACHE_L1DWIWC_RESETVAL (0x00000000u)
    
    /* L1DWBAR */
    
    #define CSL_CACHE_L1DWBAR_ADDR_MASK (0xFFFFFFFFu)
    #define CSL_CACHE_L1DWBAR_ADDR_SHIFT (0x00000000u)
    #define CSL_CACHE_L1DWBAR_ADDR_RESETVAL (0x00000000u)
    
    #define CSL_CACHE_L1DWBAR_RESETVAL (0x00000000u)
    
    /* L1DWWC */
    
    
    #define CSL_CACHE_L1DWWC_CNT_MASK (0x0000FFFFu)
    #define CSL_CACHE_L1DWWC_CNT_SHIFT (0x00000000u)
    #define CSL_CACHE_L1DWWC_CNT_RESETVAL (0x00000000u)
    
    #define CSL_CACHE_L1DWWC_RESETVAL (0x00000000u)
    
    /* L1DIBAR */
    
    #define CSL_CACHE_L1DIBAR_ADDR_MASK (0xFFFFFFFFu)
    #define CSL_CACHE_L1DIBAR_ADDR_SHIFT (0x00000000u)
    #define CSL_CACHE_L1DIBAR_ADDR_RESETVAL (0x00000000u)
    
    #define CSL_CACHE_L1DIBAR_RESETVAL (0x00000000u)
    
    /* L1DIWC */
    
    
    #define CSL_CACHE_L1DIWC_CNT_MASK (0x0000FFFFu)
    #define CSL_CACHE_L1DIWC_CNT_SHIFT (0x00000000u)
    #define CSL_CACHE_L1DIWC_CNT_RESETVAL (0x00000000u)
    
    #define CSL_CACHE_L1DIWC_RESETVAL (0x00000000u)
    
    /* L2WB */
    
    
    #define CSL_CACHE_L2WB_CMDANDSTAT_MASK (0x00000001u)
    #define CSL_CACHE_L2WB_CMDANDSTAT_SHIFT (0x00000000u)
    #define CSL_CACHE_L2WB_CMDANDSTAT_RESETVAL (0x00000000u)
    /*----CMDANDSTAT Tokens----*/
    #define CSL_CACHE_L2WB_CMDANDSTAT_WB (0x00000001u)
    #define CSL_CACHE_L2WB_CMDANDSTAT_NORMAL (0x00000000u)
    
    #define CSL_CACHE_L2WB_RESETVAL (0x00000000u)
    
    /* L2WBINV */
    
    
    #define CSL_CACHE_L2WBINV_CMDANDSTAT_MASK (0x00000001u)
    #define CSL_CACHE_L2WBINV_CMDANDSTAT_SHIFT (0x00000000u)
    #define CSL_CACHE_L2WBINV_CMDANDSTAT_RESETVAL (0x00000000u)
    /*----CMDANDSTAT Tokens----*/
    #define CSL_CACHE_L2WBINV_CMDANDSTAT_WBINV (0x00000001u)
    #define CSL_CACHE_L2WBINV_CMDANDSTAT_NORMAL (0x00000000u)
    
    #define CSL_CACHE_L2WBINV_RESETVAL (0x00000000u)
    
    /* L2INV */
    
    
    #define CSL_CACHE_L2INV_CMDANDSTAT_MASK (0x00000001u)
    #define CSL_CACHE_L2INV_CMDANDSTAT_SHIFT (0x00000000u)
    #define CSL_CACHE_L2INV_CMDANDSTAT_RESETVAL (0x00000000u)
    /*----CMDANDSTAT Tokens----*/
    #define CSL_CACHE_L2INV_CMDANDSTAT_INV (0x00000001u)
    #define CSL_CACHE_L2INV_CMDANDSTAT_NORMAL (0x00000000u)
    
    #define CSL_CACHE_L2INV_RESETVAL (0x00000000u)
    
    /* L1PINV */
    
    
    #define CSL_CACHE_L1PINV_CMDANDSTAT_MASK (0x00000001u)
    #define CSL_CACHE_L1PINV_CMDANDSTAT_SHIFT (0x00000000u)
    #define CSL_CACHE_L1PINV_CMDANDSTAT_RESETVAL (0x00000000u)
    /*----CMDANDSTAT Tokens----*/
    #define CSL_CACHE_L1PINV_CMDANDSTAT_INV (0x00000001u)
    #define CSL_CACHE_L1PINV_CMDANDSTAT_NORMAL (0x00000000u)
    
    #define CSL_CACHE_L1PINV_RESETVAL (0x00000000u)
    
    /* L1DWB */
    
    
    #define CSL_CACHE_L1DWB_CMDANDSTAT_MASK (0x00000001u)
    #define CSL_CACHE_L1DWB_CMDANDSTAT_SHIFT (0x00000000u)
    #define CSL_CACHE_L1DWB_CMDANDSTAT_RESETVAL (0x00000000u)
    /*----CMDANDSTAT Tokens----*/
    #define CSL_CACHE_L1DWB_CMDANDSTAT_WB (0x00000001u)
    #define CSL_CACHE_L1DWB_CMDANDSTAT_NORMAL (0x00000000u)
    
    #define CSL_CACHE_L1DWB_RESETVAL (0x00000000u)
    
    /* L1DWBINV */
    
    
    #define CSL_CACHE_L1DWBINV_CMDANDSTAT_MASK (0x00000001u)
    #define CSL_CACHE_L1DWBINV_CMDANDSTAT_SHIFT (0x00000000u)
    #define CSL_CACHE_L1DWBINV_CMDANDSTAT_RESETVAL (0x00000000u)
    /*----CMDANDSTAT Tokens----*/
    #define CSL_CACHE_L1DWBINV_CMDANDSTAT_WBINV (0x00000001u)
    #define CSL_CACHE_L1DWBINV_CMDANDSTAT_NORMAL (0x00000000u)
    
    #define CSL_CACHE_L1DWBINV_RESETVAL (0x00000000u)
    
    /* L1DINV */
    
    
    #define CSL_CACHE_L1DINV_CMDANDSTAT_MASK (0x00000001u)
    #define CSL_CACHE_L1DINV_CMDANDSTAT_SHIFT (0x00000000u)
    #define CSL_CACHE_L1DINV_CMDANDSTAT_RESETVAL (0x00000000u)
    /*----CMDANDSTAT Tokens----*/
    #define CSL_CACHE_L1DINV_CMDANDSTAT_INV (0x00000001u)
    #define CSL_CACHE_L1DINV_CMDANDSTAT_NORMAL (0x00000000u)
    
    #define CSL_CACHE_L1DINV_RESETVAL (0x00000000u)
    
    /* MAR */
    
    
    #define CSL_CACHE_MAR_PC_MASK (0x00000001u)
    #define CSL_CACHE_MAR_PC_SHIFT (0x00000000u)
    #define CSL_CACHE_MAR_PC_RESETVAL (0x00000000u)
    /*----PC Tokens----*/
    #define CSL_CACHE_MAR_PC_NOT_CACHEABLE (0x00000000u)
    #define CSL_CACHE_MAR_PC_CACHEABLE (0x00000001u)
    
    #define CSL_CACHE_MAR_RESETVAL (0x00000000u)
    
    #ifdef __cplusplus
    }
    #endif
    
    #endif
    
    

  • Hi Tyler,

    Thanks for the info. Are you performing cache operations on the source and destination buffers? You will want to perform a write back before the transfer and then an invalidate after to maintain cache coherence. This is a common issue when working with the EDMA.

    You can use the following API found in StarterWare, you will just need to #include the dspcache.h header file. 

    CacheWB((unsigned int)TXbuffer, TX_BUFFER_SIZE);
    CacheWB((unsigned int)RXbuffer, RX_BUFFER_SIZE);
    
    CacheInv((unsigned int)TXbuffer, TX_BUFFER_SIZE);
    CacheInv((unsigned int)RXbuffer, RX_BUFFER_SIZE);
    
    

    Also, since you are already using StarterWare, you should be able to use the StarterWare cache API for enabling the cache instead of the CSL code. It can be found at ~\OMAPL138_StarterWare\system_config\c674x\cache.c.

    The uartEdma_Cache.c example is a good reference for enabling the cache:

     /* setup MAR bits to enable cache for transmit buffer */
        CacheEnableMAR((unsigned int)buffer, TX_BUFFER_SIZE);
     /* Enable Cache */
        CacheEnable(L1PCFG_L1PMODE_32K | L1DCFG_L1DMODE_32K | L2CFG_L2MODE_256K);

    By the way, StarterWare is no longer being maintained or supported by TI. For new development, TI recommends starting with Processor SDK.

    Hope this helps.

    Regards,
    Sahin

  • Thank you Sahin,


    What you have posted has been very helpful and I've gone about implementing the cache in this manner.  However, my problems still lingers.

    I've checked to ensure my UART interrupt isn't somehow becoming an issue.  Here is the output from my DSP that I am getting when transmitting a simple Sine Wave.  It should be one full buffer length but it is not.  The frame drops are sometimes repetitive but sometimes random.  All of my tx buffers still look good and I've implemented the EDMA using a triple buffer technique so there should be no issue there either.  Seems like there could be a setting issue somewhere but not sure what it could be as this has not been a problem in the past when implementing with an EDMA.

    I've even tried stopping the code to prevent anything from being written into the buffers while the EDMA is transferring to MCASP and I still experience this same error.

    Thanks,

    Tyler

  • Tyler,

    What is your source and destination address? And if you disable cache now, does the problem disappear?

    Regards,
    Sahin
  • Sahin,

    I ended up moving to a ping pong buffers and it seems to have resolved my problems that I've been having. But yes if I disabled the cache the problem would disappear. As of right now, I do not need triple buffers and don't think I will need them so I've moved away from that.

    Thank you for all of your help.

    Tyler