WIZ820io web server hangs

#1

Dear Sir

I am using the module WIZ820io with 18F252-5 from Microchip

I designed a web server,that works nice but after somes http gets (F5) from my notebook

the web server frozen and internet explorer hangs waiting anser from server,this is alleatory.

in the send routine ,like the manual explain, i do :

read Sn_TX_WR

write the bytes to wz5200 taking care of size and border of the socket buffer (2K in this case)

add Sn_TX_WR the size of bytes sended (100 bytes )and update

Sn_TX_WR register(write it)

for debugging I read back the Sn_TX_WR , after write, and when web server hangs

the Sn_TX_WR shows “0000”

Please, can you help me ?

#2

Hi,

Did you perform ‘Send command’??

TX_WR is updated after send is completed.

And I want to know data you want to send and data sent is same.
Check please with like wireshark.

Thanks.

#3

Hi,
Thanks for reply.
Yes I perform send and wait for status of the SnSR becomes 0.
After send TX_WR is updated normally by the W5200 but sometimes (aleattory) the W5200 hangs and in this case TX_WR shows 0000.
The data sent is OK, for example, i send “1234567890”, I see this in the wireshark display e I receive this data correctly many times before W5200 crash.

I tried another ways , after send :
1)wait the interrupt send flag to be 1
2)wait the TX_WR and Sn_TX_RD to be equals
but the same problem again.

below a function send with TX_WR print before e after send command
I am using just one socket, the 0 socket with 2Kbytes large

void W5200_Write_ConstPage(unsigned char SKT_N, const char* TxBuffer, unsigned int SendSize)
{
unsigned int FreeSize;
unsigned int MemPointer;
unsigned int PhisycalAddress;
unsigned int GetOffset;

MemPointer =((unsigned char)W5200_Read_Byte(ADDR_SKT(SKT_N) + SKT_N_TX_WRITE_POINTER_REG));
MemPointer = (MemPointer << 8);
MemPointer = (MemPointer|((unsigned char)W5200_Read_Byte(ADDR_SKT(SKT_N)+SKT_N_TX_WRITE_POINTER_REG + 1)));

//for debugging print TX_WR before
PrintChar(MemPointer);

GetOffset  = (MemPointer & TX_BUF_MASK);
PhisycalAddress = (ADDR_BASE_TX(SKT_N) + GetOffset);

if((GetOffset + SendSize) > (SKT_MEM_SIZE))
{
 FreeSize = (SKT_MEM_SIZE) - GetOffset;
 W5200_ConstWriteTxBuffer(PhisycalAddress,TxBuffer,FreeSize);
 W5200_ConstWriteTxBuffer(ADDR_BASE_TX(SKT_N),TxBuffer + FreeSize,SendSize - FreeSize);
}
else  W5200_ConstWriteTxBuffer(PhisycalAddress,TxBuffer,SendSize);

// update tx write pointer
MemPointer += SendSize;
W5200_Write_Byte(ADDR_SKT(SKT_N) + SKT_N_TX_WRITE_POINTER_REG    ,((unsigned char)(MemPointer  >> 8)));
W5200_Write_Byte(ADDR_SKT(SKT_N) + SKT_N_TX_WRITE_POINTER_REG + 1,((unsigned char)(MemPointer)));

//command send to control register
W5200_Write_Byte(ADDR_SKT(SKT_N) + SKT_N_CMD_REG,SEND_CMD);

//wait untill control register is zero
while(W5200_Read_Byte(ADDR_SKT(SKT_N) + SKT_N_CMD_REG));

//for debugging print TX_WR after send
MemPointer =((unsigned char)W5200_Read_Byte(ADDR_SKT(SKT_N) + SKT_N_TX_WRITE_POINTER_REG));
MemPointer = (MemPointer << 8);
MemPointer = (MemPointer | ((unsigned char)W5200_Read_Byte(ADDR_SKT(SKT_N)+SKT_N_TX_WRITE_POINTER_REG + 1)));
PrintChar(MemPointer);
}

#4

Hi,

It seems fine.

But i want to know what is ‘hang’

w5200 is frozen(can’t read or write register) or send or receive data is impossible???

Thanks.

#5

Hi

I solver the problem. it was a hardware fail.

The manual say that W5200 is 5V tolerant,but it is not completely true

Let me explain:

First I put a 10KR pull up resistor at WZ820IO MISO pin and web server worked a little bit better…

I think, is there a hardware mistake ?

Then i put down the power suply of 18F2525 to 4,3 volts and everithing works nice!!!

I return the power supply to 5 volts and the problem returns

I look in internet by other WIZ820IO 5 V tolerant fails e find this post

blog.peterfeerick.com.au/

from Peter Feerick´s Blog

Thank you very munch for help and interesting

and excuse me my english, when I sad hang i mean freeze

See you

#6

Hi,

I’m glad to hear you solved the problem.
And I have a question.

Did you use DC supply voltage as 5V??
W5200 DC supply voltage is -0.5 to 3.63.
5V tolerant means digital input voltage.

If you use 5V as power supply, WIZ820io could not work normally.

Thanks.

#7

Hi
Only 18F252 microcontroller uses 5V, WIZ820io uses 3,3V, there are two power supply in my project,
but the IO lines from 18F to Wiz820 are 5V in the high level logic(1), and this is the problem i found.
The Wiz module does not support 5V in the IO lines…although the manual confirm this information.
When I reduce the power supply of 18F to 4,3 Volts theirs IO´s lines go to 4,3 V too in the high level logic and so the wiz module works normally
below the circuit in use
Thanks