W5500 hangs when creating the socket

Hello! :slight_smile:
I am using STM32F4 and W5500. I connected to the ioLibrary project. SPI it works fine.
ctlnetwork(CN_SET_NETINFO, (void*)&gWIZNETINFO);
ctlnetwork(CN_GET_NETINFO, (void*)&test);
Network parameters successfully installed and W5500 pinged lossless.
Creates a socket, but when debugging function freezes… :open_mouth:
socket(0, Sn_MR_TCP, 1005, 0);
It hangs on the function close() at line: while( getSn_CR(sn) );
Please tell me what could be the reason? :neutral_face:
Forgive me for my english, I’m from Russia :slight_smile:

I figured, just in write_spi(uint8_t wr_byte); needed to add a function read to read the first byte read differently corresponded previously accepted values.
void write_spi(uint8_t wr_byte)
SPI_I2S_SendData(SPI1, wr_byte);
while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_BSY) == SET);
SPI_I2S_ReceiveData(SPI1); /* that’s what was missing */
Everything is working. :smiley:

1 Like