Altera_Forum
Honored Contributor
13 years agoDMA Transfer problem
Hi,
I am trying to do a simple DMA mem to mem transfer as per the "Chap24: DMA controller core " example. I have been at this for almost a week now and it is still not working for me. Can you please help me. The dma transfer is getting stuck in the "while(!txrx_done)" loop. I am not getting any error messages. Here is the status of my registers just before it enters the "while loop". readaddress =800000, writeaddress =801000, length =80, status =2, control =fc Here are the details of my setup: I am using the DE2 board. First in Qsys: DMA Controller DMA Read Master -> SDRAM Controller slave DMA Write Master -> SDRAM Controller slave DMA Control-port Slave-> CPU Data Master niosii code: staticvolatileint txrx_done = 0; static void txrxdone(void * handle, void * data) { txrx_done = 1; } init code: alt_dma_txchan txchan; alt_dma_rxchan rxchan; alt_u32* tx_data = (alt_u32*)0x800000; alt_u32* rx_buffer = (alt_u32*)(0x801000); // Create the transmit channel if ((txchan = alt_dma_txchan_open("/dev/dma_0")) == NULL) { printf ("Failed to open transmit channel\n"); exit (1); } // Create the receive channel if ((rxchan = alt_dma_rxchan_open("/dev/dma_0")) == NULL) { printf ("Failed to open receive channel\n"); exit (1); } setting up transfer: printf("Setting up DMA\n"); // Post the transmit request if ((rc1 = alt_dma_txchan_send (txchan, tx_data, 128, NULL, NULL)) < 0) { printf ("Failed to post transmit request, reason = %i\n", rc1); exit (1); }   if ((rc1 = alt_dma_rxchan_prepare (rxchan, rx_buffer, 128, txrxDone, NULL)) < 0) { printf ("Failed to post read request, reason = %i\n", rc1); exit (1); } while (!txrx_done); printf ("Transfer successful!\n"); Please help!