WIZnet Developer Forum

Updating the Sn_TX_WR0 and Sn_TX_WR1

Hi,

I am trying to update the writing pointer of my TX buffer. If I understand correctly, I have to:

1- read the current pointer location
2- have data starting from the current pointer location
3- Add the size of the data to the current pointer location
4- send the new location to TX_WR0 and TX_WR1.

However, when I check the pointer value, it only update after I send the command Send to the Sn_CR. Therefore, my Data isn’t transmitted. What should I do.

Also, when I send the command Open, bot pointer for read and write are initialized to 0X0000 as expected. However, Their values change after sending the command connect in TCP mode to arbitrary values. Shouldn’t they but stay at 0X0000 until I change the pointer for writing and use command Send which change the pointer for reading?

Note: I am using 8-bit micro-controller. Therefore, I can’t use the current library.

Hello Embedded,
from datasheet …

{
/* first, get the free TX memory size */
FREESIZE:
freesize = Sn_TX_FSR;
if (freesize<len) goto FREESIZE; // len is send size
/* select TX memory, refer to Datasheet 14 page */
cntl_byte = Socket_n_TX_Buffer
/* Get offset address */
dst_ptr = Sn_TX_RD;
/* set memory copy len bytes of source_ptr to destination_address */
for (i=0; i<len; i++)
{
W5500_WRITE(addr, cntl_byte, dst_ptr+i);
}
/* increase Sn_TX_WR as length of len */
Sn_TX_WR += send_size;
/* set SEND command */
Sn_CR = SEND;
/* return real packet size */
return len;
}

with “read the current pointer location” is location pointed by Sn_TX_RD right ?
For the transmission buffer has two pointers, one to read and the other for writing which took place at the send.

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.