Project

General

Profile

DSP EDMA IRAM DATA TRANSFER

Added by Rafał Krawczyk over 10 years ago

Hello,
I am currently programming the DSP of MitydspL138 Industrial IO Board using the DSP/BIOS. I am trying to transfer a block of data in IRAM, which I understand is a part of L2 cache of OMAPL138 processor. I am trying to use EDMA fo the transfer. I tried to implement function in the commented example in DspQDMA.cpp. So far I did the following in my DSP/BIOS task:

1. Declaring source and destination addresses. As a test I want to transfer 8 bytes from address 0x11800000 to 0x11800100, the addresses within an IRAM address space:
unsigned int* src = (unsigned int*)(0x11800000);
unsigned int* dst = (unsigned int*)(0x11800100);
unsigned int numbytes = 0x8;
SEM_Handle myHandle = SEM_create(0,NULL);

unsigned int ii = numbytes>>2;
if (numbytes&3)
ii++;
2. Invoking block transfer function with waiting for the end of transfer
tcDspQDMA::GetInstance()->BlockTransfer(&myHandle, src, dst, ii,
EDMA_OPT_ESIZE_32BIT,
EDMA_OPT_PRI_HIGH);
SEM_pend(myHandle,SYS_FOREVER);

The implementation doesn't work. In debug perspective in "Memory Browser" view in CCSv5.4 the block of bytes in 0x11800100 is not overwritten by bytes located in 0x11800000. I have seen that Cache requires some extra configuration presented in the following lines of code:
// earlier using the CACHE_setL2Mode() API.
if (msL2Mode != CACHE_64KSRAM) {
CACHE_wbInvL2(dst,numwords*4,CACHE_WAIT);
CACHE_wbInvL2(src,ii*4,CACHE_WAIT);
}
else {
CACHE_wbInvL1d(dst,ii*4,CACHE_WAIT);
CACHE_wbInvL1d(src,ii*4,CACHE_WAIT);
}

However, in the MDK I did not find neither CACHE_wbInvL2  CACHE_wbInvL1d functions nor CACHE_WAIT CACHE_64KSRAM variables. If you have any suggestions how to solve this problem, any help is welcome.
Thanks in advance
Rafal Krawczyk

Replies (8)

RE: DSP EDMA IRAM DATA TRANSFER - Added by Michael Williamson over 10 years ago

Hi,

You need to make sure that you call tcDspQDMA::Initialize() with a free hardware level (try 7). Did you make that call?

-Mike

RE: DSP EDMA IRAM DATA TRANSFER - Added by Rafał Krawczyk over 10 years ago

Hello,
In fact I did not and it was the cause. When I invoked the method, EDMA started to transfer data properly ! Thank you . Below is my corrected version, just in case someone would deal with similar problem:

tcDspQDMA * dma= tcDspQDMA::GetInstance();
dma->Initialize(7);
dma->BlockTransfer(&myHandle, src, dst, ii,
EDMA_OPT_ESIZE_32BIT,
EDMA_OPT_PRI_HIGH);
Best regards,
Rafal Krawczyk

RE: DSP EDMA IRAM DATA TRANSFER - Added by Michael Williamson over 10 years ago

Heads up. Make sure that you configure the Event Mapper for the quick DMA transfer complete status to the DSP properly.

We found that we needed this patch to ensure the Event Mapper was routing the proper TCC interrupts from the EDMA controller to the requested interrupt level in the tcDspQDMA.cpp code.

You can also put this line of code in your main application if you don't want to patch/rebuild the core library. The event map level should be 8 (EDMA3_0_CC0_INT1, from Table 3-1 of the TRM).

--- C:/Users/mikew/AppData/Local/Temp/DspQDMA.cpp-revBASE.svn001.tmp.cpp    Thu May  9 12:18:19 2013
+++ C:/projects/mityomapl138/sw/DSP/lib/core/DspQDMA.cpp    Fri Aug  2 09:32:22 2013
@@ -203,6 +203,8 @@
     }

     hwi_attrs = HWI_ATTRS;
+    // map transfer complete interrupt to requested level
+    HWI_eventMap(anHWInterruptLevel, globalConfig[Edma3InstanceId].xferCompleteInt);
     HWI_dispatchPlug(anHWInterruptLevel, (Fxn)lisrEdma3ComplHandler0, -1, &hwi_attrs);
     C62_enableIER(1<<anHWInterruptLevel);

RE: DSP EDMA IRAM DATA TRANSFER - Added by Rafał Krawczyk over 10 years ago

Hello,
I added the line with HWI_eventMap(anHWInterruptLevel, globalConfig[Edma3InstanceId].xferCompleteInt) in DspQDMA.cpp and rebuilt the library linked to my project. The transmission is done correctly. Second parameter was equal to 8 just as you mentioned. Thank you very much for the information.
Best regards,
Rafal Krawczyk

RE: DSP EDMA IRAM DATA TRANSFER - Added by Rafał Krawczyk over 10 years ago

Hello again,
Is there any way to set a variable to be stored in specific address ? Using the EDMA I have transferred a block of 2048 bytes, which now I would like to use as an array [2048] of chars further on in my program. I tried to define a pointer:
static char *anArray=(char *)(0x11822000);
where 0x11822000 is the beginning address of data block is. This method doesn't work though. If you have any idea how to do that, any help is welcome.
Thank you in advance
Rafal Krawczyk

RE: DSP EDMA IRAM DATA TRANSFER - Added by Michael Williamson over 10 years ago

0x11822000 is not in DDR space, are you trying to access local SRAM or DDR?

-Mike

RE: DSP EDMA IRAM DATA TRANSFER - Added by Rafał Krawczyk over 10 years ago

Hello again,
Basically I am trying to access an address space defined in my .tcf file (identical with DSP-side HelloWorld DSP/BIOS project) as CACHE_L2, whose base address is 0x11820000 and whose length is 0x00020000. I am basically trying to perform an EDMA transfer of portion of data to an address space, which will not violate the system/application code section neither on DSP nor on ARM side(because I am using both cores, ARM with Linux with launched ARM-side application and the DSP with DSP/BIOS application.I am generally basing on a HelloWorld ARM-DSP project from CriticalLink). I assume CACHE_L2 is the data section, where no such code resides. The EDMA transfer works fine (that is, neither DSP nor ARM side application crashes and the data is transferred correctly, which could be sen in memory browser), however the troubles begin when I am trying to access the data from the address within the CACHE_L2 address space.
Just to precisely explain what is happeining in the application-I am debugging my DSP/BIOS application by adding the following lines in my code in my main function (that is, before it ends execution and DSP/BIOS takes over the control over an application, just like it was mentioned in the forum):

volatile Int i=1;
while(i);

This allows me to connect to previously loaded application in my DSP using Code Composer Studio v5.4. I load symbols without reloading the program in DSP core. I subsequently can change in the CCS-Debug perspective the value of "i" to zero and add breakpoints in my DSP/BIOS task (I have only one task so far). Without declaring the mentioned problematic pointers the DSP- side application works correctly- it communicates with ARM (via DSPLink) and it stops in breakpoints put in DSP/BIOS task. I can change the value of "i" to 0 to step out of loop and proceed with the application execution. I am using DSP/BIOS version 5.42.1.09.

When I initialize the pointers' values outside the task (i.e. before the main funtcion), the application executes to the infinite while(i) loop (when I connect to the DSP core via Code Composer, the instruction counter points to this line of code), which I put in my code to debug my application, but for unknown reason I cannot change the value of "i" in debug perspective- it happens before in my application any of data in address pointed by the pointers is changed in my application, so it is rather not the cause of violating application's code during the execution.

When I declare ant initialize the static pointers in my DSP/BIOS task, I can change the value of "i" in the debug perspective. However, despite having no modification of data pointed by my pointers (excluding violation of my code data by my own application), when I put the following code in my application, just to copy the data into an auxiliary buffer (I just picked the pointers to point to data in addresses within the CACHE_L2 address space):

///Declaration of breakpoints before looked like this:

static float sin21=(float)(0x11820000);
// //8192 bytes after s21
static float sin42=(float)(0x11822000);

////In the code below application crashes

float values1 [2048];
float values2 [2048];
for(int i=0;i!=2048;i++) {
values1[i]=sin21 [i];
values2[i]=sin42 [i];
}

my application ceases to respond. Not only it does not stop in selected breakpoints (where it should stop- I put breakpoints in always-executing part of code), but it also breaks my entire Linux system on ARM side so it does not respond either to my ssh commands. The shell to which I connect via serial RS232 cable on the other hand reports some errors when the above lines of code are executed on the DSP.

When I declare the arrays instead of pointers (i.e static float sin21 [2048] instead of static float sin21=(float)(0x11820000);), thereby making it unable to access data in given addresses, no such problem occurs.

Is there any other method to force an array to reside in a specific address space ?

If you have any suggestions, what might solve this problem, I am all ears.

Thank you in advance
Rafal Krawczyk

RE: DSP EDMA IRAM DATA TRANSFER - Added by Rafał Krawczyk over 10 years ago

Solved !
The problem was in the declaration of arrays to which I have copied the content of pointers. If you generally stick to these rules:

-Declare static pointers and initialize their values in the DSP/BIOS task

-Do not modify the data pointed by the pointers if they point directly to specific address in memory. In my application, when I modified values in data address space 0x11822000 the application on DSP side ceased to execute, the instruction following that line of code,that is, stepped into, but did not return from it.

-Declare any arrays to which you want to copy the data from the memory as static: in the listing from previous mail it should be:

static float values1 [2048];
static float values2 [2048];

The data in memory can be copied to static arrays, so I can now read the memory content from the DSP/BIOS application.

However, as I mentioned, I did not find out how to modify the value in the memory pointed by static the pointer and not to crash my application.
The modifications of memory like the following crashed the app:

static float sin42=(float)(0x11822000);
sin42[0]=1;

Nevertheless,changing the memory values in the same adresses by the EDMA worked correctly and did not crash the application.

Best regards
Rafal Krawczyk

    (1-8/8)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)