Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

DMA busy

Altera_Forum
Honored Contributor II
2,096 Views

I use a DMA to tranfer 1800 bytes. 

The DMA work. 

I need to make again the tranfert soon after the first transfer, but it took a long time between the 2 transferL. In fact the DMA is always BUSY. 

 

 

 

IOWR_ALTERA_AVALON_DMA_CONTROL(DMA_1_BASE, 0x0); // dma transfer disabled 

IOWR_ALTERA_AVALON_DMA_STATUS(DMA_1_BASE, 0);  

IOWR_ALTERA_AVALON_DMA_LENGTH(DMA_1_BASE, LINE_SIZE); 

IOWR_ALTERA_AVALON_DMA_RADDRESS(DMA_1_BASE, data_written);  

IOWR_ALTERA_AVALON_DMA_WADDRESS(DMA_1_BASE, memory_base);  

IOWR_ALTERA_AVALON_DMA_CONTROL(DMA_1_BASE, 0x2FC);  

 

while((IORD_ALTERA_AVALON_DMA_STATUS(DMA_1_BASE)==(0x2))); 

 

What&#39;s wrong? http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/huh.gif
0 Kudos
11 Replies
Altera_Forum
Honored Contributor II
950 Views

Hi, 

look at the post "Ethernet and DMA ", maybe you haven&#39;t written the correct value in length register...
0 Kudos
Altera_Forum
Honored Contributor II
950 Views

I have read this topic and it&#39;s not the same error because, 

LINE_SIZE=1800,  

 

If I select burst mode or not, nothing change. 

 

In sopc builder I put the DMA length register to 11 bits (->2047 bytes).
0 Kudos
Altera_Forum
Honored Contributor II
950 Views

muffec, it looks like you&#39;re trying to read 1800/4 = 450 words sequentially starting at address "data_written", and write each word to the single location at address "memory_base". What is the nature of the slaves at address "data_written" and "memory_base"? 

 

Have you tried simulating this software in ModelSim?
0 Kudos
Altera_Forum
Honored Contributor II
950 Views

Have you tried using the HAL for doing this? (instead of directly accessing the registers)

0 Kudos
Altera_Forum
Honored Contributor II
950 Views

 

--- Quote Start ---  

originally posted by kero kero keroppi@May 25 2005, 11:14 AM 

muffec, it looks like you&#39;re trying to read 1800/4 = 450 words sequentially starting at address "data_written", and write each word to the single location at address "memory_base".  what is the nature of the slaves at address "data_written" and "memory_base"? 

 

have you tried simulating this software in modelsim? 

--- Quote End ---  

 

thst&#39;s rigth i want to read from the SDRAM to the FIFO interface which i took on the forum in "post your own IP". I write, like you say, 450 words. 

I&#39;m writting on the fifo in stream mode. 

 

I don&#39;t have modelsim.
0 Kudos
Altera_Forum
Honored Contributor II
950 Views

 

--- Quote Start ---  

originally posted by badomen@May 25 2005, 12:47 PM 

have you tried using the hal for doing this?  (instead of directly accessing the registers) 

--- Quote End ---  

 

yes i try, and nothing better.
0 Kudos
Altera_Forum
Honored Contributor II
950 Views

I just have seen the number of word really transmitted wasn&#39;t goog, there were some lost of data. 

I change the control register from 2FC to 28C, it seems to be better. i&#39;ll test it. 

 

Thank you for every one who gives me advice.
0 Kudos
Altera_Forum
Honored Contributor II
950 Views

Ah... I think I know what was happening. Changing from a control register value of 0x2FC to 0x28C turned off the following control register bits: 

 

reen 

ween 

ien 

 

only the last one, ien (IRQ enable), matters. When your DMA transaction completed, the DMA fired off an interrupt, which was handled by the ISR which the DMA HAL driver init routine installed. That ISR was probably getting in the way of proper function. This all assumes that you aren&#39;t using a "freestanding" app (in which you override the initialization code in alt_sys_init.c). Is that true? 

 

The message to take away from all this is, if you want to configure a DMA device with direct register writes (or, presumably, other HAL-driver-equipped component), you should either 

 

1) use a freestanding app, so that HAL driver init for your component can be avoided 

2) disable IRQ-generation in your component 

3) install your own ISR for your component.
0 Kudos
Altera_Forum
Honored Contributor II
950 Views

thank you Kero Kero Keroppi for your technical help.

0 Kudos
Altera_Forum
Honored Contributor II
950 Views

HI, i found your posto on Nios forum, i&#39;m working on same target, a fifo used with DMA.  

Can you tell me as you have solved the problem of busy flag ? 

 

second question.... 

i have configured the dma to work only from dram to fifo, in this case the write address of dmna register, is the sigle location definied into sopc builder ? (i have instantiated the fifo inside the sopc) 

 

regards 

Roberto 

 

roberto.buti@virgilio.it 

 

--------------------------------------------------- 

Please note that Nios Discussion Board has no control over the 

contents of this message. 

--------------------------------------------------- 

 

 

Regards, 

 

The Nios Discussion Board team. 

http://www.niosforum.com/forum/index.php (http://www.niosforum.com/forum/index.php

 

 

 

I had few some problems, because I was waiting to do the transfert on PIO edge and PIO was too long. But the problem on the DMA was the control register, if it hadn&#39;t a good value it can made your system do anything or the doing "printf" not writing to screen. I think that you should care a lot of attention to the control register. 

 

I had try to use the Hal fonction library but in thes case of stream mode, it works only if you change the control register with ioctl. Could you give me the part of code which control the DMA? 

 

 

 

for your second question, I don&#39;t know if the write register is at the base but i tkink yes.
0 Kudos
Altera_Forum
Honored Contributor II
950 Views

I will try to use it with iocontrl routine, i don&#39;t like so much the HAL function for dma. I need one or two days to check the dma, after if is working as i&#39;m expecting i will happy to share the dma use. 

 

roby
0 Kudos
Reply