Sockets of WIZ812MJ is getting hanged

Hello Sir ,

I am trying to place my embedded board which has WIZ812MJ as a ethernet module and acts as a server in a LAN .
For this i have configured all its 4 sockets in listen mode with PORT no 502 for modbus communication , so that it can accept the request from any PC in the LAN and serve it .

Here i am able to connect all the 4 users , accept there request and communicate with them smoothly but, suddenly while communicating with them initially one of the socket stops replying and gets hanged due to this other 3 sockets also gets hanged . During this i am not getting any DISCONNECT/TIMEOUT interrupt so i am unable to find the problem .

From my side i have checked all the flags in IR and Sn_IR are also getting cleared and at this time interrupt line of module is also at HIGH logic level which means no interrupt is pending . So i just wonder what i am missing to take care of , or is there some problem with the module itself . So , please help me out to sort this problem .

Module configuration :

ip_addr = 192.168.1.252
gtw_addr = 192.168.1.1
mac_addr = 10.11.12.13.14.15
subnet = 255.255.255.0

Retry time = 200ms(default)
retry count = 1

port no of all sockets are set to 502 .
all the mask has been enabled .

waiting for reply ,
thank you.

Hi,

When your module is hanged up, check the ethernet-link and ping-request.
If without ping-reply, Maybe IP chagned by unknown reason. Dump the related Register value.

Also, check the sequence of send proccessing as belows.

  1. free buffer size check
  2. data copy
  3. send command with Sn_CR
  4. wait unitl send command is completed. During wait, check the timeout or socket closed.
  5. Sn_TX_WR update as many as sent size.

thanks.

I have followed the sending sequence given in the Datasheet in which it
1 .first increases the Sn_Tx_Wr pointer to the copied size
2.then gives the SEND command .

But,
your suggestion is to reverse this operation , does that makes the difference .

Hi,
I mistaked, You was right. I’m sorry.
After send command is completed, You can read the updated Sn_TX_WR value.

  1. free buffer size check
  2. data copy
  3. update Sn_TX_WR with data copied lenght
  4. send command with Sn_CR
  5. wait unitl send command is completed. During wait, check the timeout or socket closed.

How do your problem?
Can be pinged to your board?

Hi ,

YES i am getting the ping reply from my module when it hangs , also i am getting DISCONNECT request interrupt when i disconnect in this situation but module dosent take any RECV request further .
I have followed the above sequence for writting .
what other tests that i can perform !!

Hi, rashantkumar.

I think there is point hanged in your code somewhere.

Did you mean that 812MJ occurred DISCON(0x08) interrupt but WIZ812MJ doesn’t get any packet??
Or disconnect procedure is not performed??

And post your code and then we will check.

Best regards.

Hi,
If you can receive ping-reply from WIZ812MJ, WIZ812MJ works fine.
Maybe you have some mistake to handle WIZ812MJ.

Most of all, It is important to find where code is hanged-up.
If you can use with debug-tool as jtag, Break code when it hanged-up and Observe code, regsiter and etc.
If without debug-tools, dispaly the log message the serial port for more detail information about it.

Thanks.

Hi ,

I am really thankfull for your help ,
I am trying to debug the problem from last few days and i got a doubt as what happens when two sockets gets the data/ interrupt in a very less time i. e before i clear the corresponding flag in IR REGISTER , bcoz that might be happening in my case
since user on another PC can hit the button before the earlier request interrupt flag generated due to previous user got clear .

Also can my module get the interrupt for 2 sockets at the same time .

Thank you ,

Hi, prashantkumar.

Already you said, interrupt can be occurred in piles but not support pending.
So, received packet could be lost by MCU speed of performance.

I recommend to check only flag in ISR routine when interrupt occurred, handle receive process not at ISR routine.

Best regards.

Hi,

W5200’s interrupts can be overlaped before IR & Sn_IR is cleared. So, I you want to avoid lossing some data noitified by interrupt, Before you do clear IR & Sn_IR, Check whether Sn_RX_RSR > 0 or not.
If Sn_RX_RSR > 0, Repeatly receiving data and procssing it until Sn_RX_RSR > 0, And then Sn_RX_RX beccomes 0, clear IR & Sn_IR.

Thank you.