Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12409 Discussions

Failed to post DMA transmit request

Altera_Forum
Honored Contributor II
827 Views

Hi, 

 

I tried to use the general Avalon-MM DMA controller in Qsys and use the following C code to implement the DMA transmit: 

# include <stdio.h># include "system.h"# include "io.h"# include "sys/alt_dma.h" # define CUSTOM_BASE_ADDR 0x00800000 int i = 0; alt_u32 data ; alt_dma_txchan tx; int main() { /*fill the array*/ for(i=0;i<10;i++) { data = i; } /*DMA*/ tx = alt_dma_txchan_open("/dev/dma_import"); if(tx != NULL) { printf("DMA TX channel open\n"); if(alt_dma_txchan_ioctl(tx, ALT_DMA_TX_ONLY_ON, CUSTOM_BASE_ADDR)<0) { printf("Error: Failed to configure the DMA\n"); } if(alt_dma_txchan_send(tx, data , 5, NULL, NULL)<0) { printf("Error: failed to post transmit request\n"); } else { printf("DMA done\n"); } alt_dma_txchan_close(tx); } else { printf("Error: Failed to open tx channel!\n"); } return 0; }  

Where the array is stored in an external memory while the CUSTOM_BASE_ADDR is a separate peripheral. The connection among NIOS, external memory and custom peripheral should be fine since I've tested with general reading/writing. 

Turned out "alt_dma_txchan_send(tx, data , 5, NULL, NULL)" always failed. 

Currently I'm not sure if the problem lies in the hardware part or the software. Please suggest if there's any problem in the above code.  

 

Thanks!
0 Kudos
0 Replies
Reply