W5500, SPI ok, Sn_SR always 0x00, TCP


#1

hello,

I have completely activate the SPI communication. I can read and write data to W5500 chip. I checked from scope and from keil.
I am going to use this chip for tcp communication. My master is a Freescale KL25 MCU and w5500 is my slave.

I have found the tcp guide for w5500.

For now I am just using socket 0.

I have written the gateway, source IP and read them. They are ok.I can read them.

then for tcp:

1- I adjusted the mode register for TCP usage.( 0x01) (I read this value correctly)
2-I adjusted port adress as 31000 (I read this value correctly)
3- Command register, SN_CR= 0x01 (Open the port)
the problem starts here. I should read 0x13(SOCK_INIT) from the status register. However I cannot read that value.

Then I will have w5500 to go listen mode.

Could you please help me what should I do. Is there anything I should do write or check ?

Thank you


Wiz5500 Sn_SR 레지스터 문의
#2

Hi,

You will check the control byte of SPI frame.

I think that the control byte maybe wrong and you did accesse the other device as memory, instead of W5500.

As you mentioned before,
If the socket registers as Sn_MR, Sn_SPORT is normally write & read, OPEN command in Sn_CR regsiter will change the Sn_CR from SOCK_CLOSED to SOCK_INIT.

Plz, Verify block selected bits in the control byte.

Thank you.


#3

Did you wait command register is cleared??

Plz, check this out.


#4

[quote=“hjjeon0608”]Did you wait command register is cleared??

Plz, check this out.[/quote]

I have seen that the Sn_CR is cleared after Open command.

However still I can not see SOCK_INIT status.


#5

[quote=“midnightcow”]Hi,

You will check the control byte of SPI frame.

I think that the control byte maybe wrong and you did accesse the other device as memory, instead of W5500.

As you mentioned before,
If the socket registers as Sn_MR, Sn_SPORT is normally write & read, OPEN command in Sn_CR regsiter will change the Sn_CR from SOCK_CLOSED to SOCK_INIT.

Plz, Verify block selected bits in the control byte.

Thank you.[/quote]

I have already checked these BSBs. I think there is no problem of SPI frame. Because I can read and write.
For example RTR(retry time register) has default of “0x07D0” which I can read and write via SPI.


#6

Hi,
If you have no problem about spi accessing, try to open all SOCKET with Sn_CR.
If all socket can’t not be opened, check the reset time of W5500.
Thank you.


#7

I have solved the problem. The problem was related with my spi_send function.
I arranged again and with the correct addres values.
Thanks for all replies.


#8

I’m glad to hear you solved problem. :smiley:


#9

Hi,
I’m facing the exact same problem.
Can you elaborate how did you solve it?
what was the problem with the send function?

thanks
Price


#10

Hi,
If the above post is already checked,
Can I show your send function how to implemet?

Thank you.


#11

hi,
my Sn_SR register value always set 0x00, its not change its value from 0x00 to 0x22.
my code:
START:
setMR(Sn_MR_UDP);
setSn_PORT(0, 11000);
setSn_CR(0, Sn_CR_OPEN);
if(getSn_SR(0) !=SOCK_UDP)
{
setSn_CR(0, Sn_CR_CLOSE);
goto START;
}


#12

You must set socket’s MR to this value, not common register block’s MR.