Forum Discussion
Stream to Memory sgdma problem
I am having two problems with the sg-dma in my system. My first issue is that the sg-dma ready signal goes low after the first element of streaming data, then returns high on the third. This causes the second element to be skipped. I am streaming data at the same rate as the sg-dma clock.
My second issue is that I can not re-use the descriptors. I try to set the hardware owned bit to 1 by the following command: DMA_desc[0].control=128; The sg-dma ready signal goes high when I call the do_async_transfer() function, but it toggles low when it gets streaming data. No data is transferred to memory. Can anyone help?? Thanks.22 Replies
- Altera_Forum
Honored Contributor
Could you describe what was the problem and how you solved it, so that others facing the same problem can find a solution?
- Altera_Forum
Honored Contributor
I build some simple Stream to Memory in 3Mhz then forward to Stream out in 150Mhz, continuously... (DC-FIFO -> SGDMA -> Memory -> SGDMA)
But, I do some debug with "printf" command and became stuck (looks in Nios Console). When I change debug into PIO to drive LEDs, it was runs... I assumed, "printf" tho show debug process in Nios console can't follow interrupt request from SGDMA (in high speed interrupt) - Altera_Forum
Honored Contributor
The printf() function is probably using interruption itself to write to the JTAG UART, so you can't call it from an ISR or a DMA transfer callback function. If this is what you are doing then it could explain why the system hangs.
- Altera_Forum
Honored Contributor
Yes.. I'm agree with you Daixiwen..
Then I use LED PIO to trace the state for debugging purpose.. Thank you.. - Altera_Forum
Honored Contributor
In general I would avoid putting any time consuming code into an ISR. While the processor is in the ISR it can't handle other interrupts or other tasks so you typcially want to keep the amount of work done inside an ISR to a minimum. If you overload an ISR with work it can lead to problems that are hard to predict or reproduce for debug purposes.
- Altera_Forum
Honored Contributor
Hello Guys, I have a problem with SGDMA which occurred recently. I am using SGDMA Module for almost 4 years (Thanks to BadOmen)and so far it worked very well without any problems. recently, we have an application which requires higher data transfer and I used ST-MM SGDMA to write data from ADCs to SDRAM. I did a test for 25 GB of data and it is all ok except 16KB of data. looks like in that particular 16KB, 4th byte is always written zero and after that 16KB it is all ok. this only happens once during that 25GB of data. I have 3 different SGDMAs and the other 2 are ok. the Transfer size is programmed to (16777216 Bytes) and I am transferring the amount of 5191560 Bytes each time. I ma using Packet support and ready latency of 1. I know this problem is looks vague but any idea and comment on that greatly apprecited. Many thanks,
Aidin. - Altera_Forum
Honored Contributor
forgot mentioning that the data width is 8 bit.
- Altera_Forum
Honored Contributor
My suggestion would be to try to capture the event on SignalTap in order to gain better understanding of where the issue is.
Tap signals on: - SDRAM slave port - SGDMA master port - SGDMA Avalon-ST sink (from ADC) and figure out at which stage the 00's are getting introduced. If 00's are never on the Avalon-ST and is reliably there on the SGDMA Avalon-MM Master port, then yes it sounds like a bug in the SGDMA and you would need to dig inside it a bit further. - Altera_Forum
Honored Contributor
If you haven't updated the IP I highly recommend it because I fixed a bug a year or two ago which caused FIFO corruption under some configurations. I forget what configurations are affected but the symptom was that the FIFO inside one of the masters would transistion from empty to full and vice versa which would cause data to be lost or garbage to be written.
The IP is available in Qsys as of 14.0 so if you are using that version I recommend using it instead. Unfortunately the driver isn't available yet so you would have to continue using the old driver. Also if you want to maximize memory bandwidth I recommend making the DMA wider and using a data format adapter to convert the 8-bit data from the ADC to a wider beat so that the DMA can use more of the memory bandwidth each clock cycle (I'm assuming your RAM isn't 8-bit) - Altera_Forum
Honored Contributor
Thanks guys for valuable comments. YES, it was indeed the problem. updated SGDMA and also put adaptor and it fixed the issue. Badomen, our RAM is 16 bit but because of the some complexity issues we have decided to keep that side 8 bit. however, I widened the SGDMA and put an adaptor. Thanks again guys.