View previous topic :: View next topic |
Author |
Message |
747driver
Joined: 25 Jul 2009 Posts: 17 Location: East of 30W
|
Posted: Thu Mar 28, 2013 7:01 pm Post subject: How to access W5100 registers |
|
|
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 |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Mar 28, 2013 8:09 pm Post subject: |
|
|
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 |
|
|
747driver
Joined: 25 Jul 2009 Posts: 17 Location: East of 30W
|
Posted: Thu Mar 28, 2013 9:23 pm Post subject: |
|
|
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 |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Mar 28, 2013 9:34 pm Post subject: |
|
|
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 |
|
|
747driver
Joined: 25 Jul 2009 Posts: 17 Location: East of 30W
|
Posted: Thu Mar 28, 2013 10:36 pm Post subject: |
|
|
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 |
|
|
|