Сan't open socket in MACRAW protocol
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Share projects and connect with makers.
Joined before the site update? first.
New to WIZnet Makers?
We sent a verification link to your address. Open it to activate your account, then log in.
Accounts from this email provider are reviewed by an administrator after verification. Approval usually takes one business day.
Already have an account?
Enter your email address. If it belongs to an account, we'll send a link to set a new password. Members who joined before the site update use this to set their password.
If an account uses that address, we sent a link to set a new password. The link works once and expires in 30 minutes.
Know your password?
Need an account?
RE: Сan't open socket in MACRAW protocol
by becky ·
Hello,
You did not define the S0_SSR and defined the S0_CR twice.
If this is not the case, try the read ID register and tell me about the result.
RE: RE: Сan't open socket in MACRAW protocol
by Alex5577 ·
Thank you for your answer!!!
Just made a mistake when I copying!
In my code:
#define S0_SSR 0x0208
And ID register: 0x5300
RE: Сan't open socket in MACRAW protocol
by becky ·
It looks like there is no problem.
When CR is set and command execution is completed, the CR register is cleared.
Please also check this out.
RE: Сan't open socket in MACRAW protocol
by Alex5577 ·
You are right, the CR register is cleared!
But according to the instruction from the datasheet:
{
START:
/* sets MAC raw mode /
S0_MR = 0x04;
/ sets OPEN command /
S0_CR = OPEN;
/ wait until Sn_SSR is changed to SOCK_MACRAW */
if (Sn_SSR != SOCK_MACRAW) S0_CR = CLOSE; goto START;
}
RE: Сan't open socket in MACRAW protocol
by Alex5577 ·
Sorry, but I still could not run the W5300! Data does not arrive, register S0_RX_RSR2 is clean. Can anyone help me?
RE: Сan't open socket in MACRAW protocol
by Eugeny ·
For data to arrive, you must
RE: Сan't open socket in MACRAW protocol
by Alex5577 ·
I wrote above that ping is working, here’s the code:
void main(void) {
// Hardware reset
RESET(0);
delay_us(10); //delay 10 us
RESET(1);
delay_us (100); //delay 100us
#if 1
while (1) {}
#else
do{
WriteReg(S0_MR, 0x0004); /* sets MACRAW mode *
WriteReg(S0_CR, 0x0001); /* sets OPEN command */
temp1 = ReadReg(S0_SSR);
} while(temp1 != 0x0042);
#endif
}
RE: Сan't open socket in MACRAW protocol
by Eugeny ·
It may mean that W5300 initialized successfully.
However if your application is not startup timing critical, increase this delay to 2 ms as per datasheet.
These settings are not required in for MACRAW mode because they make no sense. They make sense if you use other sockets for IPRAW/TCP/UDP communication.
This algorithm actually is not correct, even if it present in the datasheets for all W5x00 products. The right one is:
I removed
temp1from the code, you may still keep it for debugging purposes. You also must implement some timeout scheme so that code does not stuck in case of something goes wrong.In MACRAW mode chip will receive only packets dedicated for its configured MAC address, and (I guess) MAC broadcast packets (with destination MAC address of FF:FF:FF:FF:FF:FF).
You can see what is going on the network using Wireshark (e.g. installing it on bridge computer), and only then state that W5300 does not get any packets and there’s an issue with W5300 or its configuration. When you ping W5300, I think these ICMP packets are intercepted before socket stack and they will not appear in any socket RX buffer.
It may also happen that you address wrong register to receive RX data size. Not possible to know because you do not detail code
MACRAW_session();you have issue in.RE: Сan't open socket in MACRAW protocol
by Alex5577 ·
Thank you very much for your answers!
I increased the delay to 2 - 10 ms, but it did not help. I checked with an oscilloscope.
I tried your algorithm, but it also did not bring me success.
I also tried the UDP protocol, but it did not work either!
Full program code in the application.
main.zip (2,9 КБ)
RE: Сan't open socket in MACRAW protocol
by Eugeny ·
You must explain how it did not work.
Are you sure your code is not stuck here - that sysinit does not return with 0?
I do not see code of this routine doing things required in datasheet:
RE: Сan't open socket in MACRAW protocol
by Alex5577 ·
Allocating 8 kilobytes of memory for each socket. I did this only for the sake of verification, since I understand that after reset the memory will be distributed in a similar way!
This function is performed correctly! (1)
The program does not reach the function Resive_UDP_pocket() and so I did not understand it yet, because I see that there is no response about setting the desired mode in the register S0_SSR!