|
楼主 |
发表于 2016-11-1 16:09:13
|
显示全部楼层
下面是我初始化代码,目前没发现什么问题,你参考一下,14年做的工程,细节忘了
- void W5500_Configuration(unsigned char ethx)
- {
- if(ethx==eth1)
- {
- GPIO_SetBits(GPIO_W5500_1st_RST_PORT, GPIO_W5500_1st_RST_Pin);
- Delay_ms(100);
- /* Reset PHY */
- Write_1_Byte(PHYCFGR, 0, eth1);
- Delay_ms(50);
- Write_1_Byte(PHYCFGR, 0xb8, eth1);
- Delay_ms(50);
- /* Reset all registers */
- Write_1_Byte(MR, RST, eth1);
- Delay_ms(20); /*delay 20ms */
- /* Set Gateway IP */
- Write_Bytes(GAR, eth1_gateway, 4, eth1);
- /* Set Subnet Mask */
- Write_Bytes(SUBR, eth1_netmask, 4, eth1);
- /* Set MAC Address */
- Write_Bytes(SHAR, eth1_MACaddr, 6, eth1);
- /* Set W5500 IP */
- Write_Bytes(SIPR, eth1_IPaddr, 4, eth1);
- /* Enable auto send keep alive packet */
- setkeepalive(0, eth1);
- }
复制代码 |
|