[From QnA]Wiznet812MJ register default values

I am using a Wiznet812MJ module with a PIC chip and i have written my own routines to write and read from wiznet registers.
I have reached far enough so that I can send a ping request from a computer and get a response back from the wiznet module.

Now I’m trying to create sockets but I am having problems. I am writing some data to wiznet’s DHAR, DIPR and DPORT registers and when I read them back, I get only default values of those registers instead of the values I wrote. But if I write the same value to RMSR, TMSR or GAR registers then I can read them back later fine.

The reason I’m writing and reading from the above registers is just for diagnostic purposes because I couldnt get the UDP socket to work when I wrote data on Mode Register and command register, so I wanted to see whether I could actually write and read on other registers and that’s what I found out.

Can you tell me why these particular registers are being reset to defaults? Am I missing something here?

Let me put it this way, I am following iEthernet bootcamp for my project and my program’s failing when I do the following:
//SOCKET INTI******************************************************
do{
wr_wiz_reg(Sn_MR_UDP,Sn_MR(0)) //protocol = UDP
wr_wiz_reg(0x00,Sn_PORT0(0)) //well-known ECHO port
wr_wiz_reg(0x07,Sn_PORT1(0))
wr_wiz_reg(Sn_CR_OPEN,Sn_CR(0)) //give the open command
if(rd_wiz_reg(Sn_SR(0)) != SOCK_UDP) //wait for the socket to come online
wr_wiz_reg(Sn_CR_CLOSE,Sn_CR(0))
}while(rd_wiz_reg(Sn_SR(0)) != SOCK_UDP)

My Sn_SR(0) is always showing 0x00 instead of SOCK_UDP. Ping works though.

Hello,
Thank you for your interest to WIZnet and our products.
You had better to use the W5100 driver.
When you write the Sn_CR, you should wait sometime to process.
But your case, read the Sn_SR just after writing the Sn_CR with any waiting time.
That might be always fail.

wr_wiz_reg(Sn_CR_OPEN,Sn_CR(0)) //give the open command
if(rd_wiz_reg(Sn_SR(0)) != SOCK_UDP) //wait for the socket to come online

So insert the belowing code

wr_wiz_reg(Sn_CR_OPEN,Sn_CR(0)) //give the open command
while( IINCHIP_READ(Sn_CR(s)) ) //Wait the process is done
if(rd_wiz_reg(Sn_SR(0)) != SOCK_UDP) //wait for the socket to come online

Thanks.

Hi,
Thanks for your reply. However, it didn’t make any difference. Actually I had tried it earlier too. I am still getting the same results, could there be another reason? I am really stuck in my project as this is a very basic step in setting up the sockets. Help!!

Hello,
Thank you for your interest to WIZnet and our products.
You had better to use the W5100 driver.
When you write the Sn_CR, you should wait sometime to process.
But your case, read the Sn_SR just after writing the Sn_CR with any waiting time.
That might be always fail.

wr_wiz_reg(Sn_CR_OPEN,Sn_CR(0)) //give the open command
if(rd_wiz_reg(Sn_SR(0)) != SOCK_UDP) //wait for the socket to come online

So insert the belowing code

wr_wiz_reg(Sn_CR_OPEN,Sn_CR(0)) //give the open command
while( IINCHIP_READ(Sn_CR(s)) ) //Wait the process is done
if(rd_wiz_reg(Sn_SR(0)) != SOCK_UDP) //wait for the socket to come online

Thanks.

Hello,

We do not know what problem do you have just seeing your question now.
There can be many reason of problem that unable to open a socket.
So if you do not mind, please let me see your register writing code for W5100 and also let me know
your testing environment more detail.
And check reading, writing the registers on W5100 was successful.
Thanks.