안녕하세요.
wiz610io를 사용하고 loopback 예제를 다운 받아서 test 중입니다.
아래와 같이 Chip ID와 Version 레지스터 값을 읽어 보니 CHIP ID(0) = 8383
VERSION(200) = 8383 와 같이 정상적으로 읽어오지 못하고 있습니다.
같은 바이트만 반복되는 걸로 보아 통신이 제대로 되고 있지 않는 것 같은데
초기화 과정 중 어떤 문제도 발생하지 않았습니다.
아래 코드 올립니다.
uint8_t syslock = SYS_NET_LOCK;
spi_set_func(&hspi1);
MX_SPI1_Init();
W6100Initialze();
ctlwizchip(CW_SYS_UNLOCK, &syslock);
ctlnetwork(CN_SET_NETINFO, &gWIZNETINFO);
printf("\r\nCHIP ID(%x) = %.2x", _CIDR_,getCIDR());
printf("\r\nVERSION(%x) = %.2x", _VER_,getVER());
print_network_information();
while (1)
{
loopback_tcps(0, data_buf, 5000, AS_IPV6);
loopback_tcps(1, data_buf, 5001, AS_IPV4);
}
void W6100Initialze(void)
{
W6100Reset();
/* SPI method callback registration */
reg_wizchip_spi_cbfunc(W6100SpiReadByte, W6100SpiWriteByte, W6100SpiReadBurst, W6100SpiWriteBurst);
/* CS function register */
reg_wizchip_cs_cbfunc(W6100CsEnable, W6100CsDisable);
uint8_t temp;
unsigned char W6100_AdrSet[2][8] = {{2, 2, 2, 2, 2, 2, 2, 2}, {2, 2, 2, 2, 2, 2, 2, 2}};
do
{
if (ctlwizchip(CW_GET_PHYLINK, (void *)&temp) == -1)
{
printf("\r\n Unknown PHY link status.");
}
} while (temp == PHY_LINK_OFF);
printf("\r\n PHY OK.");
#if 1
temp = IK_DEST_UNREACH;
if (ctlwizchip(CW_INIT_WIZCHIP, (void *)W6100_AdrSet) == -1)
{
printf("\r\n W6100 initialized fail.");
}
if (ctlwizchip(CW_SET_INTRMASK, &temp) == -1)
{
printf("\r\n W6100 interrupt");
}
//printf("\r\n interrupt mask: %02x",getIMR());
#endif
}