안녕하세요.
W5500으로 개발을 진행하고 있습니다.
첫 보드가 나와서 테스트중 다음과 같은 문제가 발생하였습니다.
회로는 레퍼런스중 트렌스포함 커넥터를 참고로 동일하게 설계 하였습니다.
올려드리고자 했으나 그림 첨부가 안되어 생략합니다.
케이블 및 칩 비교를 위해 WIZ5502E 보드를 구매하여 전원 인가 후 케이블 연결시 LED 동작을 확인 하였습니다.
동일 구성으로 연결부터 확인하기 위하여 테스트 하였으나 반응이 없습니다.
COIDE loopback 예제 및 인터넷 글들을 참고하여 초기 코드 테스트를 진행하였습니다.
사용한 MPU 는 STM32f405 이고 SPI1을 사용하고 있습니다.
iodriver 은 어제 최신버전으로 받아 포팅하였고 워닝 및 에러는 0입니다.
INT는 사용 안해도 기본 동작에는 문제가 없는 것으로 판단되어 연결은 되어 있으나 사용하지 않았습니다.
추가적으로 사용한 소스는 아래와 같습니다.
wiz_NetInfo gWIZNETINFO = { .mac = { 0x00, 0x08, 0xdc, 0x00, 0xab, 0xcd },
.ip = { 192, 168, 1, 123 },
.sn = { 255, 255, 255, 0 },
.gw = { 192, 168, 1, 1 },
.dns = { 0, 0, 0, 0 },
.dhcp = NETINFO_STATIC };
void Spi1Init( void ) // LCD SET INIT
{
GPIO_InitTypeDef GPIO_InitStructure;
SPI_InitTypeDef SPI_InitStructure;
/* Enable the SPI clock */
SPI1_CLK_INIT(SPI1_CLK, ENABLE);
/* Enable GPIO clocks */
RCC_AHB1PeriphClockCmd(SPI1_SCK_GPIO_CLK | SPI1_MISO_GPIO_CLK | SPI1_MOSI_GPIO_CLK, ENABLE);
/* Connect SPI pins to AF5 */
GPIO_PinAFConfig(SPI1_SCK_GPIO_PORT, SPI1_SCK_SOURCE, SPI1_SCK_AF);
GPIO_PinAFConfig(SPI1_MOSI_GPIO_PORT, SPI1_MOSI_SOURCE, SPI1_MOSI_AF);
GPIO_PinAFConfig(SPI1_MISO_GPIO_PORT, SPI1_MISO_SOURCE, SPI1_MISO_AF);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
/* SPI SCK pin configuration */
GPIO_InitStructure.GPIO_Pin = SPI1_SCK_PIN;
GPIO_Init(SPI1_SCK_GPIO_PORT, &GPIO_InitStructure);
/* SPI MOSI pin configuration */
GPIO_InitStructure.GPIO_Pin = SPI1_MOSI_PIN;
GPIO_Init(SPI1_MOSI_GPIO_PORT, &GPIO_InitStructure);
/* SPI MOSI pin configuration */
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Pin = SPI1_MISO_PIN;
GPIO_Init(SPI1_MISO_GPIO_PORT, &GPIO_InitStructure);
/* SPI configuration -------------------------------------------------------*/
SPI_I2S_DeInit(SPI1);
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
SPI_InitStructure.SPI_CPOL = SPI_CPOL_High;
SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge;
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2;
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
SPI_Init(SPI1, &SPI_InitStructure);
/* The Data transfer is performed in the SPI interrupt routine */
/* Enable the SPI peripheral */
SPI_Cmd(SPI1, ENABLE);
}
static void wizchip_Init( void )
{
uint8_t memsize[2][8] = { { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 } };
uint8_t tmp;
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Pin = MULT_TEMP_IO_PIN_W5500_MCO;
GPIO_SetBits(MULT_TEMP_IO_PORT_W5500_MCO, GPIO_InitStructure.GPIO_Pin);
GPIO_Init(MULT_TEMP_IO_PORT_W5500_MCO, &GPIO_InitStructure);
GPIO_PinAFConfig(MULT_TEMP_IO_PORT_W5500_MCO, MULT_TEMP_IO_SOURCE_W5500_MCO, MULT_TEMP_IO_AF_W5500_MCO);
RCC_MCO1Config(RCC_MCO1Source_HSE, RCC_MCO1Div_1);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Pin = MULT_TEMP_IO_PIN_W5500_RSTn;
GPIO_ResetBits(MULT_TEMP_IO_PORT_W5500_RSTn, GPIO_InitStructure.GPIO_Pin);
GPIO_Init(MULT_TEMP_IO_PORT_W5500_RSTn, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = MULT_TEMP_IO_PIN_W5500_CS;
GPIO_SetBits(MULT_TEMP_IO_PORT_W5500_CS, GPIO_InitStructure.GPIO_Pin);
GPIO_Init(MULT_TEMP_IO_PORT_W5500_CS, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = MULT_TEMP_IO_PIN_W5500_PMODE_MASK;
GPIO_SetBits(MULT_TEMP_IO_PORT_W5500_PMODE, GPIO_InitStructure.GPIO_Pin);
GPIO_Init(MULT_TEMP_IO_PORT_W5500_PMODE, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Pin = MULT_TEMP_IO_PIN_W5500_INT;
GPIO_SetBits(MULT_TEMP_IO_PORT_W5500_INT, GPIO_InitStructure.GPIO_Pin);
GPIO_Init(MULT_TEMP_IO_PORT_W5500_INT, &GPIO_InitStructure);
Spi1Init();
tmrDelay_ms(10);
GPIO_ResetBits(MULT_TEMP_IO_PORT_W5500_RSTn, MULT_TEMP_IO_PIN_W5500_RSTn);
tmrDelay_ms(10);
/* Chip selection call back */
#if WIZCHIP_IO_MODE == WIZCHIP_IO_MODE_SPI_VDM
reg_wizchip_cs_cbfunc(wizchip_select, wizchip_deselect);
#elif WIZCHIP_IO_MODE == WIZCHIP_IO_MODE_SPI_FDM
reg_wizchip_cs_cbfunc(wizchip_select, wizchip_select); // CS must be tried with LOW.
#else
#if (WIZCHIP_IO_MODE & WIZCHIP_IO_MODE_SIP) != WIZCHIP_IO_MODE_SIP
#error “Unknown WIZCHIP_IO_MODE”
#else
reg_wizchip_cs_cbfunc(wizchip_select, wizchip_deselect);
#endif
#endif
reg_wizchip_spi_cbfunc(wizchip_read, wizchip_write);
/* W5500 Chip Initialization */
if( ctlwizchip(CW_INIT_WIZCHIP, (void *)memsize) == -1 )
{
printf("WIZCHIP Initialized fail.\r\n");
while( 1 );
}
/* PHY link status check */
do
{
if( ctlwizchip(CW_GET_PHYLINK, (void *)&tmp) == -1 )
{
printf("Unknown PHY Link stauts.\r\n");
}
}while( tmp == PHY_LINK_OFF );
// wizchip_setnetinfo(&gWIZNETINFO);
ctlnetwork(CN_SET_NETINFO, (void *)&gWIZNETINFO);
ctlnetwork(CN_GET_NETINFO, (void *)&gWIZNETINFO_read);
}
/* W5500 Call Back Functions */
static void wizchip_select( void )
{
GPIO_ResetBits(MULT_TEMP_IO_PORT_W5500_CS, MULT_TEMP_IO_PIN_W5500_CS);
}
static void wizchip_deselect( void )
{
GPIO_SetBits(MULT_TEMP_IO_PORT_W5500_CS, MULT_TEMP_IO_PIN_W5500_CS);
}
static uint8_t wizchip_read( void )
{
return Spi1ReadByte();
}
static void wizchip_write( uint8_t wb )
{
Spi1WriteByte(wb);
}
void main( void )
{
…
wizchip_Init();
/* Infinite loop */
while( 1 )
{
process_cnt++;
wiz_ret = loopback_udps(0, udp_buf, 3000);
}
}
상기 함수를 사용하여 초기화 결과입니다.
PMODE 는 전부 HIGH로 출력 하였습니다.
-
/* PHY link status check */ 를 빼고 진행시 Netinfo가 설정되고 읽어지며 비교시 일치하는것으로 확인하였고 이로 미루어 SPI인터페이스는 이상이 없는것으로 보입니다.
-
/* PHY link status check */ 를 진행히 응답이 0로 PHY_LINK_OFF상태가 되어 동작을 안하고 있는것으로 보입니다.
상기 문제 관련하여 하드웨어나 소프트웨어적으로 확인 할 부분을 알려주시면 감사하겠습니다.