Wiznet W5300 stuck in TX buffer

Good afternoon, I connected wiznet 5300 with stm32 via FSMC, porting a webserver example with HTTPServer_LPC11E36_LPCXpresso It worked, but when you refresh the page, several times per second, it freezes in:
while(getSn_TX_FSR(s) != (getSn_TXBUF_SIZE(s)*1024))
{
VargetSn_TX_FSR[0]=getSn_TX_FSR(s);
//if((get_httpServer_timecount() - gettime) > 3)
//{
//break;
//}
}
I did not connect a timeout, because me are very importan time(I accept an UDP stream on another socket) and I can not wait about a second until http hangs.

It hangs due to the fact that the buffer is not freed, it is not clear for what reason, usually at the moment of freezing, its size is 2(VargetSn_TX_FSR[0]) bytes instead of 8192, but there are also 7000(VargetSn_TX_FSR[0]) bytes, and also it is not freed , I tried to send SEND commands at the moment of freezing so that it would free, without change.

I added checks to the function wiz_send_data
getTX_FSR=getSn_TX_FSR(sn);
if(getTX_FSR<1000){
while(1){}
}
if(getTX_FSR<len){
while(1){}
}
to make sure that I am writing no more buffer to tx than I have, but everything goes well.
Thought FSMC might not read getSn_TX_FSR correctly
inside it set read ip addresses to be read correctly.

Tell me what else can be the case and how can this be solved?

My init w5300:
WIZCHIP_WRITE (MR, MR_RST);
setSHAR(Network.mac);
setGAR(Network.gw);
setSUBR(Network.sn);
setSIPR(Network.ip);

If W5300 doesn’t get the ACK packet from TCP peer, TX_FSR wouldn’t be changed.
so, I think, how about to check socket status and add exception code during in send() function?

in ioLibrary_Driver/socket.c at master · Wiznet/ioLibrary_Driver · GitHub

   while(1)
   {
      freesize = getSn_TX_FSR(sn);
      tmp = getSn_SR(sn);
      if ((tmp != SOCK_ESTABLISHED) && (tmp != SOCK_CLOSE_WAIT))
      {
         close(sn);
         return SOCKERR_SOCKSTATUS;
      }
      if( (sock_io_mode & (1<<sn)) && (len > freesize) ) return SOCK_BUSY;
      if(len <= freesize) break;
   }

I think that you’ve already known, but please check again in getSn_TX_FSR().
in ioLibrary_Driver/w5300.c at master · Wiznet/ioLibrary_Driver · GitHub

uint32_t getSn_TX_FSR(uint8_t sn)
{
   uint32_t free_tx_size=0;
   uint32_t free_tx_size1=1;
   while(1)
   {
      free_tx_size = (((uint32_t)WIZCHIP_READ(Sn_TX_FSR(sn))) << 16) | 
                     (((uint32_t)WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_FSR(sn),2))) & 0x0000FFFF);                           // read
      if(free_tx_size == free_tx_size1) break;  // if first == sencond, Sn_TX_FSR value is valid.                                                          
      free_tx_size1 = free_tx_size;             // save second value into first                                                   
   }                                                                       
   return free_tx_size;                                                    
}