We are using sia1110, and now we've noticed that when both TCP client and server are running simultaneously, one of them will randomly disconnect after some time. The client can reconnect successfully by clicking the reconnect button on the host machine, but the server cannot.
The same procedure does not have this problem on different platforms. Could you please explain to me the reason for this?
My current idea is to use MDIO to monitor the status between the MCU and the switch, but I'm currently facing some problems.
status_t Dwmac_LLD_Mii_Read_Reg(volatile DwmacReg *dwmac_reg, uint32_t phy_addr, uint32_t reg_addr, uint32_t *reg_data)
{
while (dwmac_reg->MAC_MDIO_ADDRESS.B.GB != 0U) {; }
dwmac_reg->MAC_MDIO_DATA.B.RA = reg_addr;
dwmac_reg->MAC_MDIO_DATA.B.GD = 0;
dwmac_reg->MAC_MDIO_ADDRESS.B.PA = phy_addr;
dwmac_reg->MAC_MDIO_ADDRESS.B.RDA = reg_addr;
dwmac_reg->MAC_MDIO_ADDRESS.B.GOC = 2U;
dwmac_reg->MAC_MDIO_ADDRESS.B.CR = 0xB;
dwmac_reg->MAC_MDIO_ADDRESS.B.GB = 1U;
while (dwmac_reg->MAC_MDIO_ADDRESS.B.GB != 0U) {; }
*reg_data = (uint16_t) (dwmac_reg->MAC_MDIO_DATA.R & 0x0000FFFFU);
return STATUS_SUCCESS;
}
Dwmac_LLD_Mii_Read_Reg(ÐERNET_0, 0x1B, 0x2U, ®_val);
The underlying function being used here, in which reg_val remains 0 all the time.