# How to debug when I got stuck at "DMA wait()"

**URL:** <https://discuss.pynq.io/t/how-to-debug-when-i-got-stuck-at-dma-wait/576>\
**Category:** Support\
**Created:** [October 20, 2019, 1:34pm UTC](https://discuss.pynq.io/t/how-to-debug-when-i-got-stuck-at-dma-wait/576 "2019-10-20T13:34:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jia-Ming\_Lin](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/jia-ming_lin/32/338_2.png) [@Jia-Ming\_Lin](https://discuss.pynq.io/u/Jia-Ming_Lin)\
**Post date:** [October 20, 2019, 1:34pm UTC](https://discuss.pynq.io/t/how-to-debug-when-i-got-stuck-at-dma-wait/576/1 "2019-10-20T13:34:55Z")

</div>

I use AXI streaming in the Sobel filter implementation, but I got stuck at the `dma.recvchannel.wait()`. And I need some suggestions to help me debug. My board is PYNQ-Z2, and input data is grayscale image in 1080x1920

My C++ code in HLS:

```auto
void video_2dfilter(wide_stream* input_stream, wide_stream* output_stream) {
#pragma HLS INTERFACE axis depth=20000 port=input_stream bundle=INPUT_STREAM
#pragma HLS INTERFACE axis port=output_stream bundle=OUTPUT_STREAM

#pragma HLS INTERFACE s_axilite port=return bundle=CONTROL_BUS

	uint8_t window[3][3];
	uint8_t line_buffer[2][MAX_WIDTH];
#pragma HLS ARRAY_PARTITION variable=line_buffer complete dim=1

	int8_t filter_horizontal[3][3] = {{-1,-2,-1},{0,0,0},{1,2,1}};
	int8_t filter_vertical[3][3] = {{-1,0,1},{-2,0,2},{-1,0,1}};

	row_loop: for (int row = 0; row < MAX_HEIGHT; row++) {
		col_loop: for (int col = 0; col < MAX_WIDTH; col++) {

#pragma HLS pipeline
			for (int i = 0; i < 3 ; i++){
				window[i][0] = window[i][1];
				window[i][1] = window[i][2];
			}

			window[0][2] = (line_buffer[0][col]);
			window[1][2] = (line_buffer[0][col] = line_buffer[1][col]);
			window[2][2] = (line_buffer[1][col] = input_stream->data);
			++input_stream;

			// handle boundary
			if (row == 0 || col == 0 || row == (MAX_WIDTH - 1) || col == (MAX_WIDTH - 1)) {
				output_stream->data = 0;
			} else{
				output_stream->data = ABS(filter(window, filter_horizontal)) + ABS(filter(window, filter_vertical));
			}

			// streaming attr setup
			output_stream->user = (row == 0 && col == 0)? 1: 0;
			output_stream->last = (row == MAX_HEIGHT-1 && col == MAX_WIDTH-1)? 1: 0;
			++output_stream;
		}
	}
}

```

My Block Design and DMA configurations, where I add AXI Stream Interconnection to control dataflow route to various convolution kernels I will include in the future.

 ![Screenshot%20from%202019-10-20%2021-08-41](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/1X/f9b5e2036e72f8ca7ee98030cffdbd420b72900a.png)  
 ![Screenshot%20from%202019-10-20%2021-09-09](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/1X/1ee0001656f10f6d2b05a0dba2e09fa746d3cb5e.png)

My Python code on Jupyternotebook:

 ![Screenshot%20from%202019-10-20%2021-31-57](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/1X/f260c9b9ff78abf2d132908de0b2c681a1e0e129.png)

---

<div class="post-metadata">

**Author:** ![cathalmccabe](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/cathalmccabe/32/3348_2.png) [@cathalmccabe](https://discuss.pynq.io/u/cathalmccabe)\
**Post date:** [October 21, 2019, 7:16am UTC](https://discuss.pynq.io/t/how-to-debug-when-i-got-stuck-at-dma-wait/576/2 "2019-10-21T07:16:28Z")

</div>

What size is your input\_buffer?

Buffer length register is 2^14. This is the max amount of data you can transfer in one transaction. You probably want to make this bigger.

Why are you using the AXI stream interconnects? You could connect directly to the DMA.

Cathal
