Jump to content

evers4

Members
  • Posts

    21
  • Joined

  • Last visited

Reputation Activity

  1. Like
    evers4 got a reaction from artvvb in Implimenting Etherent on the Zybo Z7 development board   
    Great news,
    the original goal has mostly been accomplished at this point, thank you! I'm receiving data over Ethernet from the custom IP in the firmware, and better still, so far it appears correct. In main() I'm sending data once a connection is made via the accept callback.
    My question now is how can I detect an active connection. The accept callback increments the connection variable, but it doesn't decrement it. So I'm wondering how to reliably detect that an active connection exists.
    The way the C code works is it fills a ring buffer with data, from the IP in the firmware, and pushes that out to an active connection as long as new data exists. I'm currently looping on 3 conditions: an active connection, data available, & a state I call sending. I'm using the connection variable in the accept callback to determine if a connection is active. But, this value does seem to track disconnects.
     
    err_t accept_callback(void *arg, struct tcp_pcb *newpcb, err_t err)
    {
        static int connection = 1;
        xil_printf("Echo: c_pcb=%u\n\r",(u32)newpcb);
        /* set the receive callback for this connection */
        tcp_recv(newpcb, recv_callback);
        /* set the sent callback for this connection */
        tcp_sent(newpcb, sent_callback); // <- add this
        /* just use an integer number indicating the connection id as the
           callback argument */
        tcp_arg(newpcb, (void*)(UINTPTR)connection);
        /* increment for subsequent accepted connections */
        connection++;
        return ERR_OK;
    }
  2. Like
    evers4 reacted to artvvb in Implimenting Etherent on the Zybo Z7 development board   
    C sources should include xil_cache.h and call Xil_DCacheInvalidateRange before accessing the memory that the IP has written into. I think what's happening is that the data written on the first pass is being cached and the cached values are being read instead of new stuff in DDR on every subsequent pass. https://github.com/Digilent/Zybo-Z7-SW/blob/c21218c91e7d6dfd2018d35932a5f0d9d38eec9a/src/Zybo-Z7-20-DMA/src/demo.c#L262 is where the audio demo invalidates cache for received data. Your base address and byte count for the call will differ. You might call this in the handler or wherever in your C source you're reading that data.
  3. Like
    evers4 got a reaction from artvvb in Implimenting Etherent on the Zybo Z7 development board   
    Ow wow! That did it, thanks for the easy fix! Side question, is it possible to read from DDR while within an ISR? Does it require any special consideration(s)?
  4. Like
    evers4 got a reaction from artvvb in Implimenting Etherent on the Zybo Z7 development board   
    I connected up a slow 200MHz scope to the custom_int signal in the block design. What I see is distorted pulse that does otherwise appear correct.
    After this, I replaced the single cycle pulse by a slow 4Hz clock, the ISR appears to be working as expected now. I expected some distortion on the probe, but I don't think the interface between the Zynq/IP should be effected by this. I'm cautiously optimistic that the problem has been resolved.
    I'm now attempting to merge this code with the Ethernet Example you provided. I'll follow up with you after making some progress. Thanks!
  5. Like
    evers4 reacted to artvvb in Implimenting Etherent on the Zybo Z7 development board   
    I reproduced this and I think fixed it. Below 1446 bytes, the system only actually sends a single burst, indicated by the sent_callback only being entered once per client request. Above it, multiple callbacks would occur, but some data would be lost. What seems to be happening is that submitting more data to tcp_write than fits in a single segment (typically 1500 bytes, slightly lower for a reason I'm not sure of here) maybe causes the additional data to be lost or ignored. What worked for me to fix it was to replace the tcp_sndbuf(tpcb) calls in the sent and recv callbacks with tcp_mss(tpcb), so that no more data than fits into a single segment is included in a single tcp_write call. "MSS" in the function name stands for max segment size. I've revised the code in the blog post.
    Thanks!
    Arthur
×
×
  • Create New...