"Sn_TX_RD", "Sn_TX_WR" and "Sn_TX_FSR" reading problem [W5500]
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: "Sn_TX_RD", "Sn_TX_WR" and "Sn_TX_FSR" reading problem [W5500]
by Mxyxixptlick ·
What software is acting as a server on your PC, and how do you know the problem isn’t there?
RE: RE: "Sn_TX_RD", "Sn_TX_WR" and "Sn_TX_FSR" reading problem [W5500]
by e sh ·
The problem solved!
A little mistake in writing to tx buffer.
But i wondering why W5500 returns an arbitrary numbers for Sn_TX_RD and Sn_Tx_WR registers after connecting to server?
Server software on pc is a simple c code downloaded from internet and has been tested.
Thanks for your reply.
RE: "Sn_TX_RD", "Sn_TX_WR" and "Sn_TX_FSR" reading problem [W5500]
by Dan1 ·
Hi, I have same problem now…!
When sending string to a server I get a lot of “garbage” with the string.
Reading getSn_TX_FSR before sending give 800h (2048) as expected but after sending the value is “strange” and not what I expect (2048 - string lengh)…
What was the writing mistake? can you share it?
Any Idea?
Dan Groswirth
cellkey.tech.gmail.com
RE: RE: "Sn_TX_RD", "Sn_TX_WR" and "Sn_TX_FSR" reading problem [W5500]
by e sh ·
Hello Dan1.
I done the following steps to send data to my pc:
1- Reading start address of free space of TX buffer (Sn_TX_RD0 & Sn_TX_RD1).
2- Writing data to socket0 TX buffer in address which reads from previous step.
3- Updating S0_TX_WR register as follow:
4- Running socket send command.
I hope this be useful. I will be glad if i can help you.
RE: "Sn_TX_RD", "Sn_TX_WR" and "Sn_TX_FSR" reading problem [W5500]
by cellkey ·
Hello e_sh:
Thanks for your response. The way you suggest to update pointer is not documented as far as I know. I have not seen it in any of the examples I have seen.
Dont understand the " (Sn_TX_RD0 & Sn_TX_RD1)" that you mentioned. I use Sn_Tx_WR to get the pointer to writing location, as done at the send() rutine in socket.c file.
Please explain your idea .
Thanks
Dan
RE: RE: "Sn_TX_RD", "Sn_TX_WR" and "Sn_TX_FSR" reading problem [W5500]
by e sh ·
hi
I wrote my code without any library hence i manipulate registers directly.
According to datasheet “Sn_TX_RD0 & Sn_TX_RD1” are high byte and low byte of pointer, respectively.
More details on what i do:
I read the registers 0x0022 and 0x0023 in socket register block. These registers indicate the start address for writing your data in TX buffer.
Then i saved my data (for testing purpose i saved chatacter ‘a’) in TX buffer at address “Sn_TX_RD”.
After these the Sn_TX_WR pointer must be updated as i mentioned in previous post.
finally i issued the send command.
what i discribed is mentioned in pages 54 and 55 of W5500 datasheet version1.0.9.
Following is the piece of code related to these steps:
Best regards.
RE: "Sn_TX_RD", "Sn_TX_WR" and "Sn_TX_FSR" reading problem [W5500]
by Dan1 ·
Hello e_sh:
Thanks again for your support.
I am getting into your code in order to understand the lower level of the handling of the appropriate registers…
You read TX_RD to set the writing address while W5500 library show reading TX_WR
as in that code:
//writing data to TX buffer
void wiz_send_data(uint8_t sn, uint8_t *wizdata, uint16_t len)
{
uint16_t ptr = 0;
uint32_t addrsel = 0;
if(len == 0) return;
ptr = getSn_TX_WR(sn); //<<<<<<setting the pointer
addrsel = ((uint32_t)ptr << 8) + (WIZCHIP_TXBUF_BLOCK(sn) << 3);
WIZCHIP_WRITE_BUF(addrsel,wizdata, len);
ptr += len;
setSn_TX_WR(sn,ptr);
}
I still confused about handling the TX_WR and TX_RD pointers as I have problem
that data I send is seen on server wrapped by “endless” garbage bytes and written several times…
Regards
Dan
RE: "Sn_TX_RD", "Sn_TX_WR" and "Sn_TX_FSR" reading problem [W5500]
by e sh ·
Hi Dan1.
Yes. The code is written for W5500.
According to description of Sn_TX_RD in datasheet (page 54):
Hence, i think in the “wiz_send_data” routine, at line :
the Sn_TX_RD and Sn_TX_WR registers have the same value.
Are you sure about your code on server side?
Thank you.
RE: RE: "Sn_TX_RD", "Sn_TX_WR" and "Sn_TX_FSR" reading problem [W5500]
by cellkey ·
Hi:
Thanks, a little late…
I got it now alright. I have read both pointer at every step and learnt the way it treated…
Regards
Dan