#define DATA_BUF_SIZE 1024
+static uint32_t tcp_modbus_st = 0;
static uint8_t tcp_rx_buf[DATA_BUF_SIZE];
static uint16_t tcp_rx_sz = 0;
uint16_t port = g_mbport;
int32_t ret;
uint16_t size = 0;
+ uint8_t phycfg_r =0;
switch(getSn_SR(sn))
{
tcp_rx_sz = (uint16_t) ret;
prvxMBTCPPortReceive_cb( tcp_rx_buf, tcp_rx_sz );
}
+ else
+ {
+ phycfg_r = getPHYCFGR();
+ if( !(phycfg_r & PHYCFGR_LNK_ON) ){
+ //W5500 PHY: Link down
+ //网线断开, 复位modbus连接
+ tcp_modbus_st = 0; //reset modbus
+ }
+ }
break;
case SOCK_CLOSE_WAIT :
if((ret = disconnect(sn)) != SOCK_OK) return ret;
int ret;
eMBErrorCode xStatus;
- static uint32_t tcp_modbus_st = 0;
if( tcp_modbus_st == 0 ){