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/TMS570LC4357: Creating a TMS570LC4357 DMA example

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

I am in the process of porting the http://www.ti.com/lit/an/spna121a/spna121a.pdf 

The code from the example project posted is quite different from the example provided with what looks like a different register structure and will not compile.

/* - Populate dma control packets structure */
g_dmaCTRLPKT.CHCTRL = 0;                                 /* channel control */
g_dmaCTRLPKT.ELCNT = 1;                                    /* element count */
g_dmaCTRLPKT.ELDOFFSET = 0;                           /* element destination offset */
g_dmaCTRLPKT.ELSOFFSET = 0;                          /* element source offset */
g_dmaCTRLPKT.FRDOFFSET = 0;                           /* frame destination offset */
g_dmaCTRLPKT.FRSOFFSET = 0;                           /* frame source offset */
g_dmaCTRLPKT.PORTASGN = 4;                             /* port b */
g_dmaCTRLPKT.RDSIZE = ACCESS_8_BIT;            /* read size */
g_dmaCTRLPKT.WRSIZE = ACCESS_8_BIT;           /* write size */
g_dmaCTRLPKT.TTYPE = FRAME_TRANSFER ;    /* transfer type */
g_dmaCTRLPKT.ADDMODERD = ADDR_INC1;      /* address mode read */
g_dmaCTRLPKT.ADDMODEWR = ADDR_FIXED;   /* address mode write */
g_dmaCTRLPKT.AUTOINIT = AUTOINIT_OFF;       /* autoinit */

The instructions in the provided example also state the following VIM configuration:

* - Enable GIO(optional), SCI2, drivers
*
* Vim Channel 0-31
* - Enable VIM channel 13 (LIN1 High) Interrupt (Optional)
*
* Vim Channel 32-63
* - Enable VIM channel 40 (DMA BTCA) Interrupt

I do not have background to understand what registers are intended to be used for the TMS570LC4357 platform.

Could you post the HL_sys_main.c that is intended to be used for the TMS570LC4357 DMA example?

Much thanks

  • More info:

    The TMS570LC4357 defines the following for 'dmaPort'

    PORTB_READ_PORTB_WRITE = 0x3U,
    PORTA_READ_PORTA_WRITE = 0x2U,
    PORTA_READ_PORTB_WRITE = 0x1U,
    PORTB_READ_PORTA_WRITE = 0x0U

    There is no "4".

    Which port configuration should be used?
  • any thoughts on this one?
  • Hello John,

    The code I gave you is for TMS570LC4357 and RM57 device. There are 2 ports for DMA read/write: Port A and Port B:

    The device you used is TMS570LC4357, so please use the example code I gave you.

    Other Hercules devices use PORT B for DMA data read and write. The PORT B is 0b1xx (0b100 is used in our example) in port assignment register.

  • The code provided is a snippet from a different example application.

    If one replaces posted the sample code with your code:

    g_dmaCTRLPKT.SADD                  =     (uint32)TXDATA;
    g_dmaCTRLPKT.DADD                 =     (uint32)&(mibspiRAM1->tx[0].data);
    g_dmaCTRLPKT.CHCTRL             =    0;                                                     /* channel control */
    g_dmaCTRLPKT.ELCNT               =     E_COUNT;                                       /* element count */
    g_dmaCTRLPKT.FRCNT                =    F_COUNT;                                      /* element count */
    g_dmaCTRLPKT.ELDOFFSET       =    4;                                                    /* element destination offset */
    g_dmaCTRLPKT.ELSOFFSET       =    0;                                                     /* element source offset */
    g_dmaCTRLPKT.FRDOFFSET      =    0;                                                    /* frame destination offset */
    g_dmaCTRLPKT.FRSOFFSET      =    0;                                                   /* frame source offset */
    g_dmaCTRLPKT.PORTASGN       =    PORTA_READ_PORTB_WRITE; /* port b */
    g_dmaCTRLPKT.RDSIZE              =     ACCESS_16_BIT;                        /* read size */
    g_dmaCTRLPKT.WRSIZE             =    ACCESS_16_BIT;                         /* write size */
    g_dmaCTRLPKT.TTYPE               =    FRAME_TRANSFER ;                  /* transfer type */
    g_dmaCTRLPKT.ADDMODERD   =     ADDR_INC1;                                 /* address mode read */
    g_dmaCTRLPKT.ADDMODEWR  =     ADDR_OFFSET;                           /* address mode write */
    g_dmaCTRLPKT.AUTOINIT          =     AUTOINIT_OFF;                           /* autoinit */

    You get :

    "../source/HL_sys_main.c", line 254: error #20: identifier "TXDATA" is undefined
    "../source/HL_sys_main.c", line 255: error #20: identifier "mibspiRAM1" is undefined
    "../source/HL_sys_main.c", line 257: error #20: identifier "E_COUNT" is undefined
    "../source/HL_sys_main.c", line 258: error #20: identifier "F_COUNT" is undefined

    What would be helpful is to post the entire example project for the TMS570LC43 platform so I can fill in the missing pieces. 

  • Hello,

    The HALCoGen has an example. HALCoGen-->Help-->Help Topics-->Examples-->example_mibspiDma.c

    The help windows shows the HALCoGen setup and source code.