Hi,
I got the following error on dma transaction.
I found similar issue in this forum but for my design it didn’t help.
I double clicked on the DMA block and checked the box allowing unaligned transfers.
Detailes" PYNQ v.3.0.1, Board ZCU208, jupyter notebook
RuntimeError:
dma.sendchannel.transfer(tx_buffer)
dma.sendchannel.wait()
File dma.py:154, in _SDMAChannel.transfer(self, array, start, nbytes)
148 raise RuntimeError( 149 "DMA does not support unaligned transfers; "
150 "Starting address must be aligned to "
151 “{} bytes.”.format(self._align)
Hi,
The definition is correct, this DMA reads the data from the memory and transfer it to the next module at the axi stream port.
The Write channel is not used here.
Thanks
As you said DMA “READ” from data so are you suppose to use receive rather than transfer?
While DMA transfer it to next module aka next module received data from DMA aka DMA write to next module?
Thanks for your help, I hope it will be more clear:
The DMA (axi_dma_tx) reads the DATA at the “Read Channel” (Using port M_AXI_MM2S) and transfer it to the next module (enc_hier) at AXI STREAM protocol using port M_AXIS_MM2S.
I have to mention that the design works fine and the transaction ended successfully (verified by chipscope) but it get stuck after the RuntimeError at the jupyter notebook.
Now this has become very confused:
Chipscope or System-ILA?
Why two DMAs signals are not aligned with the image you had post from beginning?
Transaction ended successfully aka signals are what states?
Let’s wait @cathalmccabe answer. They are better on these questions.
But I will highly suggest u look from most common FIR DMA example:
Thanks.
System-ILA.
I meant successfully by the meaning of the expected data at the M_AXI_S2MM port of axi_dma_tx_2.
The image at the beginning of the post is just for axi_dma_tx.
The right dma (axi_dma_tx_2) is settings are:
Solution from Feb’21: “Did you create your own overlay? I created my own with the DMA controller and I think I received the same error the first. I double clicked on the DMA block and checked the box allowing unaligned transfers and it worked for me. I hope this helps”
As you proposed, you do used System-ILA to debug.
While there are no debug capture here and the script body itself only show 1 line and no clue to know what is above and how the data is being transfer.
Meanwhile, you do mention design “works fine” and TX ended.
We can only use what info you provide to logically point out the possible issue.
Try use aligned transfer and zero padding to simply the behavior first.
If this return no issue then very sure unaligned transfer is what causing the issue.
Hi Brian,
I’ll do the test again and provide detailed System-ILA debug info.
Can you please provide example of aligned transfer and zero padding?
The DMA itself should support unaligned transfers (Accord the settings).
I think that the RuntimeError is not with the unaligned transfer because it notifies for the starting address.
How can I control the starting address? 149 "DMA does not support unaligned transfers; " 150 "Starting address must be aligned to " 151 “{} bytes.”.format(self._align)
Thanks
Hi,
It seems that the problem is with the
The problem is with the flush but not the alignment.
RuntimeError Traceback (most recent call last)
Input In [12], in <cell line: 1>()
----> 1 drivers.send_data(dma_tx_send, input_buffer)
2 drivers.receive_data(dma_tx_receive, data_len)
File /home/xilinx/jupyter_notebooks/yhm_0x22113001_update/ed_drivers.py:55, in send_data(self, tx_buffer)
52 def send_data(self, tx_buffer):
53 # Trigger the DMA transfer and wait for the result
54 start_time = time.time()
—> 55 self.sendchannel.transfer(tx_buffer)
56 self.sendchannel.wait()
57 #self.register_map.MM2S_DMASR.IOC_Irq = 1
File /usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/lib/dma.py:154, in _SDMAChannel.transfer(self, array, start, nbytes)
148 raise RuntimeError(
149 "DMA does not support unaligned transfers; "
150 "Starting address must be aligned to "
151 “{} bytes.”.format(self._align)
152 )
153 if self._flush_before:
→ 154 array.flush()
155 self.transferred = 0
156 self._mmio.write(
157 self._offset + 0x18, (array.physical_address + start) & 0xFFFFFFFF
158 )
File /usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/buffer.py:107, in PynqBuffer.flush(self)
105 “”“Flush the underlying memory if necessary”“”
106 if not self.coherent:
→ 107 self.device.flush(self.bo, self.offset, self.virtual_address, self.nbytes)
File /usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/pl_server/xrt_device.py:392, in XrtDevice.flush(self, bo, offset, ptr, size)
384 ret = xrt.xclSyncBO(
385 self.handle,
386 bo,
(…)
389 offset,
390 )
391 if ret >= 0x80000000:
→ 392 raise RuntimeError("Flush Failed: " + str(ret))
Can you elaborate on what would you like to accomplish?
Reading the code, it seems that you want to transfer element by element from the array. Having 32-bit elements in the array and the addressing being 64-bit it makes sense that you have aliment problems.
You typically want to use the DMA to transfer a large array to maximize performance. If you haven’t done it yet. I suggest you check out the DMA tutorial series here
Hi @marioruiz ,
Thanks for the code review.
I’m using now the Python code just for debug and send short arrays.
My problem now is with the rx_buffer.freebuffer().
Do you think that the freebuffer() error is related to the alignment issue?