W6100 Hang issue

Hello genius,

Im facing problem with hang issue.
Im using W6100 with DHCP ip4 code.
Inialization of DHCP and DNS is 100% perfect.
I got 12 device using same firmware, send sampling every 15 minutes to the cloud server.
Device only handle W6100 during sampling time and if failed/success, it will stop handle and wait for the next sampling. If there are any changes of PHY off or disconnection of internet, it will be handle on the sampling time. No issue and my code doesnt have blocking.

Some of the device will hang/blocking after several days of testing.
I saw some blocking code in wiznet and I suspect that’s the issue.
I put some debug print in the main.c and socket.c and found out stuck in

while(getSn_SR(sn) != SOCK_ESTABLISHED)

or

 while(getSn_CR(sn));

im not sure which one whenever I run this function below:-

int8_t connect(uint8_t sn, uint8_t * addr, uint16_t port, uint8_t addrlen);

Please help to give some ideas and solution. Im running out of time.

My resistor is 49.9ohm, not 49.9kohm(for example) for TX wire to send the packet

Thanks in advance.