Strange behaviour after first connect
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: Strange behaviour after first connect
by Coccoliso ·
Yes,
the value is subject to registers Sn_TX_MASK and Sn_TX_BASE as explained on page 33 of datasheet:
[i]Ex) In case of 2048(0x0800) in S0_TX_WR,
0x0424 = 0x08
0x0425 = 0x00
But this value itself is not the physical address to write.
So, the physical address should be calculated as follow.
Address (hereafter we’ll call gSn_TX_MASK) are calculated on TMSR value. Refer to
the psedo code of the Initialization if the detail is needed.
the offset address(hereafter we’ll call get_offset) in TX memory range of the socket.
physical address(hereafter, we’ll call get_start_address).[/i]
… and at page 44 of datasheet (macro language):
RE: Strange behaviour after first connect
by cnoviello ·
Hi Coccoliso,
Thanks for the support.
What It’s not clear to me is that if it is CORRECT that, after the connection is established with the server, S0_TX_WR contains a totally random value, and there is no way to set it to another value unless I do a SEND command.
Carmine
RE: Strange behaviour after first connect
by Coccoliso ·
Hi,
to tell the truth I’ve never read and checked these values but I think you may have a reset problem.
You have connected the reset to MPU or, as happens in Arduino, you rely on the reset with a capacitor?
I think you are using the SPI… after several attempts and with the reset connected to an MPU port this is the reset steps that works for me :
(macro language)
I hope it can serve.
RE: Strange behaviour after first connect
by Coccoliso ·
hi,
I wanted to going down the thing and the two readings after the sequence that I said in the previous post, without making other operations, it is always 0x0000 for both registers.
Try to read the two values after the reset sequence and tell me if you have them to 0 or are random because if it did I think you have an incorrect reset sequence.
It is strange because usually will not work either reading the SPI though …
RE: Strange behaviour after first connect
by cnoviello ·
Hi,
I’m using the arduino ethernet shield mounted on a STM32Nucleo. I had same suspect than you, but when the micro is reset those registers are zero. They become with a random value after the connection is established and they go back to zero only after I do a send.
Could you kindly check the values of the register after a connection is established?
I really appreciate you effort. Thanks
RE: Strange behaviour after first connect
by Coccoliso ·
Hi,
Sn_TX_WR and Sn_TX_RR are random with same value after a SOCK_ESTABLISHED condition and goes 0 after a send.
However after the initialization is always at 0 and without the use it changes then tx buffer is used during the connection process.
Remains to understand why your data spooling … check your program because this not happen to me.
RE: Strange behaviour after first connect
by cnoviello ·
Knowing this helps. I go on try to understand what’s wrong.
I’ll update you soon.
Thanks a lot.
RE: Strange behaviour after first connect
by cnoviello ·
Still can’t understand why it has this behaviour. These debug messages show the whole sequence:
IP Address: 192.168.2.192 Netmask: 255.255.255.0 Gateway: 192.168.2.1 MAC: 0:16:36:de:58:f6 Sn_TX_WR before connect: 0 SocketConnect::SOCK STATUS: 1 SocketConnect::SOCK STATUS: 15 SocketConnect::SOCK STATUS: 17 ESTABLISHED Sn_TX_WR before: ba30 Sn_TX_RR before: ba30 Offset is: 230 Real address is: 4230 Sn_TX_WR should be: ba31 Sn_TX_WR after update: ba30 Sn_TX_RR after update: ba30 SEND Sn_TX_WR after SEND: 31I’m trying to send just one byte to the server, but the server receive a really huge number of bytes.
RE: Strange behaviour after first connect
by cnoviello ·
Hi Coccoliso,
I’m sorry because I caused you waste your time. It was a my fault during conversion of uint16_t to 2 x uint8_t.
My code was:
W5100_Write(&hw5100, 0x0424, (uint8_t)Sn_TX_WR >> 8); W5100_Write(&hw5100, 0x0425, (uint8_t)Sn_TX_WR);But this is wrong since the cast is performed BEFORE the shift. The right code is:
W5100_Write(&hw5100, 0x0424, (uint8_t)(Sn_TX_WR >> 8)); W5100_Write(&hw5100, 0x0425, (uint8_t)Sn_TX_WR);Thanks to who invented the logic analyzer :mrgreen:
Carmine
RE: Strange behaviour after first connect
by Coccoliso ·
Hi Carmine,
I am happy that with a bit of brainstorming could find the bug.
After all you’ve done you all … you asked a question and you gave the answer