How to Reset Data In Register RXRSR , RXRD Wiznet W5100 every data is incomming

excuse me, I want to ask.
I’m connecting wiznet w5100 to a microcontroller. here I want every data received from tcp to be displayed to the serial monitor via serial communication. but i have a problem.
example :

  1. when the first data from tcp comes, for example “hello 1”, and the microcontroller will receive it and then display it to the serial monitor “hello 1” and its works.
  2. when the next data comes, for example “hello 2” and as usual the microcontroller will receive data and then display it to the serial monitor, but what I get is “hello 1 hello 2”.even though I already deleted the contents of the buffer variable, but not for value of wiznet register.
    how every new data comes from tcp, then the microcontroller will get new data only and display the latest data to serial monitor, can i reset the values of the RX_RSR register, without having to reset wiznet or close the connection.



Please refer ioLibary recv function code. I think, you should update the RX RD ptr of RXbuf after read rx data.

void wiz_recv_data(uint8_t sn, uint8_t *wizdata, uint16_t len)
uint16_t ptr;
uint16_t size;
uint16_t src_mask;
uint16_t src_ptr;

ptr = getSn_RX_RD(sn);

src_mask = (uint32_t)ptr & getSn_RxMASK(sn);
src_ptr = (getSn_RxBASE(sn) + src_mask);

if( (src_mask + len) > getSn_RxMAX(sn) )
size = getSn_RxMAX(sn) - src_mask;
WIZCHIP_READ_BUF((uint32_t)src_ptr, (uint8_t*)wizdata, size);
wizdata += size;
size = len - size;
src_ptr = getSn_RxBASE(sn);
WIZCHIP_READ_BUF(src_ptr, (uint8_t*)wizdata, size);
WIZCHIP_READ_BUF(src_ptr, (uint8_t*)wizdata, len);

ptr += len;
setSn_RX_RD(sn, ptr);