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.

Registers are not updated in c5515 in ccs4.2

I am trying to write simple code to transfer data from one memory location to another through DMA. But DMA register values are not getting updated to SRC & DST address which I give. My code is as below,

#include "USBSTK5515.h"
#include "register_dma.h"
#include "register_system.h"

#define N 128 // Transfer data elements
#define M 16 // Transfer data frames


unsigned short src[N*M];
unsigned short dst[N*M];
int i;
unsigned long srcAddr,dstAddr;


void main(void)
{
Uint16 register_value;
// Initialize source and destination memory for testing
for (i = 0; i < (N*M); i++)
{
dst[i] = 0;
src[i] = i + 1;
}


// Convert word address to byte address, DMA uses byte address
srcAddr = (unsigned long)src;
dstAddr = (unsigned long)dst;
// srcAddr <<= 1;
// dstAddr <<= 1;

PER_RESET = PER_RESET & 0xFFEF;
IDLE_PCGCR = IDLE_PCGCR & 0xFFF7;



DMA0_CH0_SRC_LSW = (short)(srcAddr & 0x0000FFFF); // here registers are not updating to source and destination address
DMA0_CH0_SRC_MSW = (short)(srcAddr >> 16);

DMA0_CH0_DST_LSW = (short)(dstAddr & 0x0000FFFF);
DMA0_CH0_DST_MSW = (short)(dstAddr >> 16);

DMA0_CH0_TC_MSW = 0x2000;
DMA0_CH0_TC_LSW = 0x0004;

DMA_IFR = 0xFFFF;
DMA_MSK = 0xFFFF;

DMA0_CH0_TC_MSW = DMA0_CH0_TC_MSW | 0x8000;

}

I am updating registers according to DMA manual for c5515.

please help.

Thanks

  • Does 'IDLE_PCGCR' resolve to:

    *((volatile ioport unsigned*) 0x1c02)

    This is PCGCR1, which controls gating for DMA0.

    Regards,

    Bill

  • yes i have used register_system.h file , there it is defined as

    #define IDLE_PCGCR        *(ioport volatile unsigned *)0x1C02    // Peripheral Clock Gating Control Register LSW

  • Hi,

      Can you refer to CSL example and follow the programming sequence when you implement your code.

      Below is the download link from where you could download and install CSL example.

      SPRC133

    Also, If the below mentioned two steps are taken care you should have no issue with DMA Registers programming. Have you checked and confirmed on the below steps through CCS Register view?

    1. Ensure the DMA controller is out of reset by setting the DMA_RST bit to 0 in the peripheral reset control register (PRCR). PRCR is a chip configuration register, it is not part of the DMA controller.
    2. Enable the DMA controller input clock by setting the corresponding DMAnCG bit to 0 in the peripheral clock gating configuration registers (PCGCR1 and PCGCR2). PCGCR1 and PCGCR2 are chip configuration registers, they are not part of the DMA controller.

    Hope the above information helps.

    Regards

     Vasanth

  • Hello Vasanth ,

           Thanks for the help, I was doing wrong address conversion. Now code is working fine. Will it be easy to code using CSL?

             Also, I have one more question, can I get somewhere help to modify .cmd file so that I can store large chunk of data in particular memory location.

    Thanks,

    Rishikesh

  • Hi,

    On your question on Cmd file. There exist a command file in each of CSL example, you could refer to these command file and modify/update data section (.data) based on your requirements.

    Regards

     Vasanth

  • Hi,

    What is use of upper 7 bits in XARn register, where are these 7 bits important. When we should consider them during address calculation?

    Thanks

  • One example is described in this errata - sprz373

    2.1.11 HWAFFT Data and Scratch Pointers Copied as 16-Bit Instead of 23-Bit

    Basically the upper bits become important when copying addresses greater than 0x10000.

    Hope this helps,
    Mark