FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
5915 Discussions

questions about DMA transmition

Altera_Forum
Honored Contributor II
1,025 Views

hi: 

I want to transmit data from FIFO to sdram by DMA in SOPC builder. 

in NIOSII eclipse, 

 

if((tx=alt_avalon_dma_send(txchan,(void*)tx_data,0x1000,NULL,NULL))<0) 

printf("failed to send data from fifo \n"); 

always printf: failed to send data from fifo 

I add "while(1)" to contain this code: 

while(1) 

//the number of translated data at one time 

for(j=0;j<=100;j++) 

if((tx=alt_avalon_dma_send(txchan,(void*)tx_data,0x1000,NULL,NULL))<0) 

printf("failed to send data from fifo \n"); 

// 

if( j==90) 

exit(1); 

 

but it always failed ... 

 

is there somebody can give me any hints? thanks~
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
311 Views

hi,gurus  

I have try lots of times ,but always failed,so I hope someone can give me help~ 

the self-made SOPC component is connected to read master port of DMA, SDRAM is connected to write master port of DMA. 

the setl-made component is connected to avalon bus as a slave interface.when I use "IORD"to read the component,it is right,but when I connect is to DMA,DMA transmits failed~ 

 

if((rx= alt_avalon_dma_prepare(rxchan,rx_buffer,1024,done_t,NULL))<0) 

printf("rxchan receive failed.reason: %d",rx); 

exit(1); 

dma_prepare always failed, if the self-made component has some problems (the component consist of a FIFO which connected to avalon through slave port )?? 

 

 

 

The NiosII software code is attached 

the pogrammme is very urge,and there is nobody around me can give me advise,so I hope you gurus can give me some hints~ 

thanks very much~~
0 Kudos
Altera_Forum
Honored Contributor II
311 Views

/* begin receive data*/ 

if((rx= alt_avalon_dma_prepare(rxchan,rx_buffer,1024,done_t,NULL))<0) 

printf("rxchan receive failed.reason: %d",rx); 

exit(1); 

after running,niosII console: 

rx=-28; 

I check the meaning of "28" in altera_avalon_dma.h: 

start = priv->tx_start; 

end = priv->tx_end; 

slot = &priv->tx_buf[end]; 

next = (end + 1) & ALT_AVALON_DMA_NSLOTS_MSK; 

if (next == start) 

return -ENOSPC; 

so I guess that there is no room in memory,but I am not sure which memory has no room and why it has no room,so I delete my signaltapII file so as to let more room off,but the error is still there. 

 

I will keep trying~
0 Kudos
Altera_Forum
Honored Contributor II
311 Views

hi, 

I have solved the above problem,that is ,the data writen into the FIFO can be transfered to the SDRAM by the DMA . 

here I have some feelings which be shared with yours. 

1: DMA transmition ,FIFO (slave port attached into Avalon bus) to SDRAM,because of reading the same address(FIFO base address),so you only need to open received channel(rxchan),and set iocl(mode,RX_only),then ,prepare .  

2:there seems the SOPC can do lots for you,so you need not care about the details too much:) 

 

 

best regards
0 Kudos
Reply