Forum Discussion
Altera_Forum
Honored Contributor
15 years agoSGDMA debug
Hello,
I am trying to learn how to use SGDMA to transfer data to memory. First of all, I am trying to connect SGDMA TX directly to SGDMA RX and check results. You can find the source code ->here<- (http://www.codeupload.com/4051) (I've edited the code found on forum, so thanks the guy who provided it). In order to check what is written to the memory, I've connected the SGDMA modules to ONCHIP memory (size: 32768 bytes) and enabled memory content reader on the on-chip memory options. You can see my connections ->here<- (http://i51.tinypic.com/1zz6fj5.png). The problem is that this dma design doesn't work. The data I get is corrupted. I've tried to disconnect cpu.instruction_master and cpu.data_master from onchip memory, then the memory start address goes to 0x00, but results are the same. If I connect the DMA to the DDR memory, then the data passes correctly, Screenshot is ->here<- (http://i53.tinypic.com/2heak61.png). Now why I get this situation: either I try to read or write from/to onchip memory or DDR memory, the core always tries to read/write from/to address 0x800xxxxx. Obviously when it is connected to DDR ram it works, but when to onchip ram it doesn't. Why is this happening? Nios memory bus bugs? How can I check what is written to the memory? If I use only onchip memory for the whole system and DMA it also works fine, but I want a clear vision without Nios stuff in the memory. Thanks.55 Replies
- Altera_Forum
Honored Contributor
Hi Socrates,
Thank for your reply about my problem! here (http://alterauserforums.net/forum/showthread.php?p=122927#post122927) Now,it has been resovled! For your consideration about the Descriptor Processor circularly executes Descriptor Chain,you can set PARK bit in the register of SGDMA control! Attached is the relational description. - Altera_Forum
Honored Contributor
Ok, I've enabled the PARK bit. There were some problems in the code, so I got error bit up, but now continuous dma transfer works fine. However now it doesn't get into interrupt. How do I know when the full transfer is complete?
- Altera_Forum
Honored Contributor
This is my code.You can register the Callback function like this:
alt_avalon_sgdma_register_callback(SGDMA_TX_DEV, &TX_callback_function, (ALTERA_AVALON_SGDMA_CONTROL_IE_GLOBAL_MSK | ALTERA_AVALON_SGDMA_CONTROL_IE_CHAIN_COMPLETED_MSK | ALTERA_AVALON_SGDMA_CONTROL_PARK_MSK | ALTERA_AVALON_SGDMA_CONTROL_IE_DESC_COMPLETED_MSK ), NULL); - Altera_Forum
Honored Contributor
That was the problem, my callback function wasn't full enough. Thank You!
- Altera_Forum
Honored Contributor
Hi Socrates,
Can i look at your latest version code? i am trying to use SGDMA to transfer ADC data to SRAM, and this is my first time using SGDMA. How do you make your SGDMA to run continuously? Thank you. Regards, Michael - Altera_Forum
Honored Contributor
Hello,
point the current descriptor also as a next descriptor, so it would run around and do the same work. - Altera_Forum
Honored Contributor
--- Quote Start --- Hello, point the current descriptor also as a next descriptor, so it would run around and do the same work. --- Quote End --- Thank you for your quick reply. Could you let me see your code? i really need to look at the final version(should be the 4th version according to the thread) of your code in order to understand what you guys were trying to say in all your previous post on this thread.:) Michael - Altera_Forum
Honored Contributor
--- Quote Start --- I've connected the SGDMA modules to ONCHIP memory (size: 32768 bytes) and enabled memory content reader on the on-chip memory options. Thanks. --- Quote End --- How do you look into the memory? without using IORD of course. Is there a special function in Eclipse or something? Michael - Altera_Forum
Honored Contributor
--- Quote Start --- Could you let me see your code? i really need to look at the final version(should be the 4th version according to the thread) of your code in order to understand what you guys were trying to say in all your previous post on this thread. --- Quote End --- Unfortunately no, I can't. You can take SGDMA example file and do a few simple modifications as described in my posts. --- Quote Start --- How do you look into the memory? --- Quote End --- In Quartus II: Tools -> In-System Memory Content Editor Remember to enable In-System Memory Content Editor in On-Chip memory options: go to SOPC, right click on on-chip memory -> Edit..., then tick "Enable In-System Memory Content Editor feature" and set a desired instance ID. - Altera_Forum
Honored Contributor
Socrates,
Thank you for your reply. I could almost get it to work, except the speed is too slow for SDRAM, and content copied is wrong. Could you answer some of my questions and doubts in http://www.alteraforum.com/forum/showthread.php?t=31915 ? There is not much people that knows well about SGDMA based on all the other threads i found in this forum. I found mostly BadOmen and you that talked about SGDMA here. Thank you. Regards, Michael