Hi,
I was also facing similar problem while using DMA to perform transaction between PCI having 64 bit data width and on-chip memory having 32 bit data width.( Read master of DMA was connected to PCI_Bus_Access module and write master was connected to onchip memory having 32 bit data width. Note that I was using DMA in
burst mode.
When I configured DMA to transfer 256 bytes from PCI to onchip at offset 0x100, first 128 bytes were correctly written to CORRECT offset.But then offset was reset to 0x100 and next 128 bytes overwrote previously written data.Thus all bytes were useless.
We came across one work-around for this.( Many thanks to Joe.) We connected on-chip memory to write master of DMA via Clock crossing bridge.Means now avalon slave of clock crossing bridge is connected to write master of DMA and avalon master of clock crossing bridge was connected to on-chip memory. (Now there is no DIRECT connection between on-chip memory and write master.) With this, DMA transaction was successful!
I know Clock crossing bridge is used when slave and master have different clock. But this is just one way we can used it to overcome our problem.
I noticed following points when using DMA in burst mode: ( This is
not applicable to
non-burst mode)
(1) Read master and write master of DMA must not be connected to slaves having different data width. Means you must not connect write master to slave having 32 bit data width and read master to 64 bit data width. Incase you need to perform DMA transaction between slaves having 32 bit data width and slave having 64 bit data width, please connect 32 bit component via clock crossing bridge. This is one way how you can perform DMA transaction between slaves having different data width.
If you will connect DMA's read and write masters to slaves having different data width and have configured DMA in burst mode, data will not be written/read from/to correct locations.
(2) Control register must be configured to perform transaction based on DMA's full data width.
For example, suppose DMA controller's Read and write ports have been connected to following 3 avalon slaves ( slave having 8 bit and 32 bits must be connected via clock crossing bridge for correct operation as mentioned in 1st point),
Avalon slave with data width = 8 bits,
Avalon slave with data width = 32 bits,
Avalon slave with data width = 64 bits.
In this case, DMA's data width will be 64 bits.
Now even though you wish to perform DMA operation between slave with data width = 8 bits and slave with data width = 32 bits, you must enable DoubleWord (bit 10 in control register) transaction in Control register.If you select, byte transaction (bit 0 in control register), you will get unexpected behaviour.
Please have a look at :
http://www.altera.com/support/kdb/solutions/spr240514.html (3) Transfer length must be in multiple of DMA's full data width.
Considering above example, transfer length must be in multiple of Double words.(i.e 8,16,24,32,....etc)
If you wish to transfer 17 bytes,then you should configure DMA to transfer 16 bytes and last byte needs to be transferred without DMA use.
Hope this information might be useful to somebody.
Again thanks to Joe for his help.
Regards,
Bhaumik