WIZnet Developer Forum

random value in Sn_TX_RD

So I have TCP connection with server but I cannot send data properly:

This is how I send data:
TX_write_pinter[0] = 0x05;
TX_write_pinter[0] = 0x00;
SpiWriteRegister(0x0000, 2, transmit_buffer, 5);
SpiWriteRegister(0x0024, 1, TX_write_pinter, 1);
SpiWriteRegister(0x0001, 1, SEND, 1); //command register receive;

first argument is address and second is block address.
third is buffer and fourth is size.

So, first Tx buffer address is gonna be 0x0000 so I do not read it
then I write data in TX buffer
then I write new data size in TX_Write_Pointer
then I do SEND command;

but when I read TX_Read_pointer it gives me back strange values like 0x3060.

While I execute this code server receives this:!
image|690x351
Which is obviously nothing close that I try to send.

what could be the problem ? I think I mess up with TX_Read_Pointer.
After Send command when I read TX_Write_Pointer it gives me back correct value

image
The procedure for sending data is as above.
You must first read the address via TX_WR and write the data to that address.

Please refer to ioLibrary Driver code.

instead of initial value (0x0000) I get some weird values and thats the problem. The values I get are above my TX buffer free size limit

The pointer registers of socket tx/rx buffer are random.
but it is not problem because socket tx/rx buffer has ring-buffer structure.

so you write/read data to/from Sn_TX_WR or Sn_RX_RD.
And you can get a free/receive size via Sn_TX_FSR or Sn_RX_RSR by calculated W5500.

You just do increase each pointers as write/read data size after you process data.

Refer to ioLibrary.
Thank you.

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