cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
1,875 Views
Registered: ‎02-12-2018

how to transfer video data with lwIP bare metal ethernet

Jump to solution

- Vivado, SDK: 2017.4
- Device: Zynq-7000

details

I have image data stored in VDMA frame buffer that I'd like to transfer to my PC for debugging purposes.
I chose 1GbE as interface for this, on the PS. I am able to transfer simple commands via HTTP POST messages between client and host and individual image frames. Performance is currently not optimized.

The size of my ethernet frame buffer is 1kB. To overcome this limitation I am pointing to the image frame buffer, instead.
Since lwIP is taking care of packet splitting to meet MTU I am assuming that I can provide any number of bytes to be send using tcp_write().

 

// create a HTTP header POST message, store in memory right before frame
len = generate_http_header((char *)(frameBufferStartAddress-headerLength), "js", length);

// update length of payload, in bytes
len += framelength;

// create TCP packets from bytes in memory
if (tcp_write(pcb, (char *)(frameBufferStartAddress-headerLength), len, 1) != ERR_OK) {
    xil_printf("error writing http POST response to socket\n\r");
    xil_printf("http header = %s\r\n", buf);
    return -1;
}

Doupts

This approach worked for me only for a small amount of data, relatively spoken. tcp_write() failes to send more data at once. Is it a good practive to call tcp_write() multiple times, if so which size should I choose?

Documents read:

- XAPP1026
- https://stackoverflow.com/questions/15384518/how-many-bytes-can-i-write-at-once-on-a-tcp-socket

 

Can you comment on my current approach or provide helpful references to solve such problems.

 

thank you

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Explorer
Explorer
2,108 Views
Registered: ‎08-21-2013

You will need to write in chunks. Look at the documentation of tcp_write here:

 

http://lwip.wikia.com/wiki/Raw/TCP

 

It says:

 

The tcp_write() function will fail and return ERR_MEM if the length of the data exceeds the current send buffer size or if the length of the queue of outgoing segment is larger than the upper limit defined in lwipopts.h (TCP_SND_QUEUELEN). If the function returns ERR_MEM, the application should wait until some of the currently enqueued data has been successfully received by the other host and try again.

 

 

View solution in original post

1 Reply
Highlighted
Explorer
Explorer
2,109 Views
Registered: ‎08-21-2013

You will need to write in chunks. Look at the documentation of tcp_write here:

 

http://lwip.wikia.com/wiki/Raw/TCP

 

It says:

 

The tcp_write() function will fail and return ERR_MEM if the length of the data exceeds the current send buffer size or if the length of the queue of outgoing segment is larger than the upper limit defined in lwipopts.h (TCP_SND_QUEUELEN). If the function returns ERR_MEM, the application should wait until some of the currently enqueued data has been successfully received by the other host and try again.

 

 

View solution in original post