cancel
Showing results for 
Search instead for 
Did you mean: 

PC Drivers & Software

draguilera
Journeyman III

AXI DMA Simple Transfer not working

Good morning,

I've followed the steps for this DMA simple transfer example: https://www.youtube.com/watch?v=tQpt2N7__NQ&t=336s.

For this examplem I'm using an Eclypse-Z7 board with the following hardware description:

draguilera_0-1710172017422.png

I exported the hardware description project, created the platform and copied the code in the helloworld.c file:

#include <unistd.h>
#include <stdio.h>
#include <xstatus.h>
#include "platform.h"
#include "xil_printf.h"
#include "xil_types.h"
#include "xil_printf.h"
#include "xil_cache.h"
#include "xparameters.h"
#include "xaxidma.h"

#define DMA_DEVICE_ID XPAR_AXI_DMA_0_BASEADDR
#define DMA_TRANSFER_SIZE 16

static XAxiDma dma_ctl;
static XAxiDma_Config *dma_cfg;

int main()
{
init_platform();

s32 status;
u32 data_dma_to_device[DMA_TRANSFER_SIZE];
u32 data_device_to_dma[DMA_TRANSFER_SIZE];

Xil_DCacheDisable();

dma_cfg = XAxiDma_LookupConfig(DMA_DEVICE_ID);
if (NULL == dma_cfg)
{
print("DMA Config failed\n\r");
return XST_FAILURE;
}
print("DMA config success\n\r");

status = XAxiDma_CfgInitialize(&dma_ctl, dma_cfg);
if (status != XST_SUCCESS)
{
return XST_FAILURE;
print("DMA initialize failed\n\r");
}
print("DMA initialize success\n\r");
xil_printf("%u\n", status);

for (u32 i=0; i < DMA_TRANSFER_SIZE; i++)
{
data_dma_to_device[i] = i;
}

u32 x = 6;

status = XAxiDma_SimpleTransfer(&dma_ctl, (data_dma_to_device, DMA_TRANSFER_SIZE * 4, XAXIDMA_DMA_TO_DEVICE);
if (status != XST_SUCCESS)
{
print("DMA to device transfer fail\n\r");
xil_printf("%u\n", status);
return XST_FAILURE;
}
print("DMA to device transfer success\n\r");

usleep(1);

if (XAxiDma_Busy(&dma_ctl, XAXIDMA_DMA_TO_DEVICE))
{
print("DMA to device transfer incomplete\n\r");
return XST_FAILURE;
}
print("DMA to device transfer complete\n\r");

status = XAxiDma_SimpleTransfer(&dma_ctl, data_device_to_dma, DMA_TRANSFER_SIZE*4, XAXIDMA_DEVICE_TO_DMA);
if (status != XST_SUCCESS)
{
print("Device to DMA transfer fail\n\r");
return XST_FAILURE;
}
print("Device to DMA transfer success\n\r");

usleep(1);

if (XAxiDma_Busy(&dma_ctl, XAXIDMA_DEVICE_TO_DMA))
{
print("Device to DMA transfer incomplete\n\r");
return XST_FAILURE;
}
print("Device to DMA transfer complete\n\r");

xil_printf("Received data after complete round - trip DMA loop.\n");
for (u32 i=0; i < DMA_TRANSFER_SIZE; i++)
{
xil_printf("%u ", data_device_to_dma[i]);
}

cleanup_platform();

return XST_SUCCESS;
}
 
However, when I execute it, the program fails in the first simpletransfer, returning the XST_INVALID_PARAMS status. I don't know what I am doing wrong. If anyone can help me, I'd really appreciate it.
 

draguilera_1-1710172088922.png

 

 

0 Likes
0 Replies