Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

How to access W5100 registers

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP
View previous topic :: View next topic  
Author Message
747driver

Bascom Member



Joined: 25 Jul 2009
Posts: 17
Location: East of 30W

luxembourg.gif
PostPosted: Thu Mar 28, 2013 7:01 pm    Post subject: How to access W5100 registers Reply with quote

Used hardware: Arduino UNO with ethernet shield.
Intention: use an interrupt service routine to handle UDP messages.

Started by changing "Config Tcpip = NOINT" into "Config Tcpip = Int0"
In the same Config added "Int = 1"
Added "Dim _tcp_intflags As Byte" as per Config Tcpip Helpfile.
Added TCP_INT label which serves as ISR.

Somehow the program jumps to TCP_INT label all the time as I do not see a way to clear the reason for the interrupt.
I guess I should read the W5100 interrupt register and before leaving the ISR I should clear the interrupt bits.
But How?

_________________
Aircraft should have 2 engines........on each wing!
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Thu Mar 28, 2013 8:09 pm    Post subject: Reply with quote

i used the wiznet api as a reference.
the NOINT option will poll the W5xxx chip. When you define an interrupt, the status register is filled in the interrupt. and this status is used by functions to determine the state. but since most functions need a certain state, i wonder how useful this is because these block too. i could not see the benefit but it is some time ago i implemented the wiz chips.
IMO you can best use NOINT, and the use some interrupt pin to flag that the chip status changed. you can then check if you received new data and read it.

to access the various registers there are special commands , there is a sample too that demonstrates setting/reading any register in the chip. the sample just changes the IP number.

_________________
Mark
Back to top
View user's profile Visit poster's website
747driver

Bascom Member



Joined: 25 Jul 2009
Posts: 17
Location: East of 30W

luxembourg.gif
PostPosted: Thu Mar 28, 2013 9:23 pm    Post subject: Reply with quote

Thanks.
That polling, is that done by the Socketstat command?
I that is the case it would be useless for me as I have a Waitms 750 in the mail program loop.
Meaning it would poll only once every 750ms.

Found the Gettcpregs and Settcpregs commands.
With Settcpregs I should be able to write a mask to the Interrupt Mask Register.
For the time being I only want to get an interrupt on 1 of the possible interrupts, "Occurence of Socket 3" (IM_IR3 bit).
Will see if that works.

Just found out that the Gettcpregs and Settcpregs commands only work for chips with builtin tcp support...

_________________
Aircraft should have 2 engines........on each wing!
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Thu Mar 28, 2013 9:34 pm    Post subject: Reply with quote

no, socketstat only returns the status of the specified registers.
but when you send something using tcp, the socket status is polled to see if the data has been sent, or that there is a time out.

_________________
Mark
Back to top
View user's profile Visit poster's website
747driver

Bascom Member



Joined: 25 Jul 2009
Posts: 17
Location: East of 30W

luxembourg.gif
PostPosted: Thu Mar 28, 2013 10:36 pm    Post subject: Reply with quote

Ok, in my project I'm more interested in the receiving part.
As soon as a message is received the program should store the data including the details of the sender (peeraddress and peerport).
That's why I need an ISR, in case the messages are received during the Waitms in the mail program loop.
Will try to write to the W5100 with SPIOUT.

_________________
Aircraft should have 2 engines........on each wing!
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum