cancel
Showing results for 
Search instead for 
Did you mean: 

DMA Performance

Cl.1
Associate II

Do some homework assigned by the lecture but have no direction so ask for some help.

I need to write a function DMASpeed() to demosntrate the speed improvement of DMA over a software loop for memory to memory transfers. I include polling DMA for my homework. I need to transfer as larger a block of data as possible, allocating memory using malloc() for the source and destination. Also to measure the timing, toggle a GPIO pin look at the timing on the oscilloscope or logic analyser.

static char src[]="*Hello*";

static volatile char dst[8]={0,0,0,0,0,0,0,0}; // Ensure NULL terminated

void

DMASpeed (void)

{

 // Initial value

 printf("BEFORE: dst = '%s'\n", dst);

 // Transfer

 printf("Initiate DMA Transfer...\n");

 HAL_DMA_Start (&hdma_memtomem_dma2_stream0, (uint32_t) src, (uint32_t) dst, 2);

 printf("DMA Transfer initiated.\n");

 // Poll for DMA completion

 printf("Poll for DMA completion.\n");

 HAL_DMA_PollForTransfer(&hdma_memtomem_dma2_stream0, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);

 printf("DMA complete.\n");

 // Print result

 printf("AFTER: dst = '%s'\n", dst);

}

Can anyone give a brief about the work and how i going to implement it.

0 REPLIES 0