Code Monkey home page Code Monkey logo

ntruchsess / arduino_uip Goto Github PK

View Code? Open in Web Editor NEW
488.0 488.0 213.0 454 KB

UIPEthernet: A plugin-replacement of the stock Arduino Ethernet library for ENC28J60 shields and breakout boards. Full support for persistent (streaming) TCP-connections and UDP (Client and Server each), ARP, ICMP, DHCP and DNS. Build around Adam Dunkels uIP Stack. Further developed version can be found on https://github.com/UIPEthernet/UIPEthernet

C++ 38.92% C 58.26% Perl 1.25% Objective-C 1.57%

arduino_uip's People

Contributors

brunnels avatar frolswe avatar nilrog avatar ntruchsess avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino_uip's Issues

Max data transfer

Hi, first, thanks a lot for this awesome library that help us a lot.
Here a noob question, i want to know what is the max amount of data(Kb) that is able to send the arduino using this library to the browser.
I mean html + css + js
I read in the datasheet something about 8Kb of buffer, but i dont know how the enc and library handle this.
Im using enc28j60
Thanks

client.connect() won't return if cable is removed

Great library but unfortunately I hit some issues.

One of them (the easiest to reproduce) is this:

I have a client that sens http requests every few seconds to a server. If I remove the ethernet cable the program won't return from client.connect() function (even after I plug it back in). Here it is the sketch I use (with an Arduino Nano).

--------------------------------------------- Sketch

include <UIPEthernet.h>

EthernetClient client;

int cntSuccess = 0;
int cntFailure = 0;
int retry = 0;
uint8_t mac[6] = {0x00,0x01,0x02,0x03,0x04,0x05};

void setup() {

Serial.begin(9600);
Serial.println("Start...");
resetEthernet();
}

void resetEthernet()
{
Ethernet.begin(mac);

Serial.print("localIP: ");
Serial.println(Ethernet.localIP());
Serial.print("subnetMask: ");
Serial.println(Ethernet.subnetMask());
Serial.print("gatewayIP: ");
Serial.println(Ethernet.gatewayIP());
Serial.print("dnsServerIP: ");
Serial.println(Ethernet.dnsServerIP());
}

void loop() {

// --- SEND REQUEST ------------------------------------------------------------------------------
if (client.connect(IPAddress(157,166,226,26), 80)) {
Serial.print("connected ");
Serial.println(cntSuccess++);

retry = 0;

// Submit HTTP request:
client.println("GET /?hpt=sitenav HTTP/1.1");

client.println("Host: www.cnn.com");
client.println("User-Agent: arduino-ethernet");
client.println("Connection: close");
client.println();
client.flush();
client.stop();
delay(3000);

}
else {
Serial.print("connection failed ");
Serial.println(cntFailure++);
retry ++;
if(retry == 3)
{
resetEthernet();
retry = 0;
}
delay(1000);
}
}

---------------------- Output
Start...
localIP: 192.168.1.118
subnetMask: 255.255.255.0
gatewayIP: 192.168.1.1
dnsServerIP: 208.122.23.22
connected 0
connected 1
connected 2


At this point I removed the cable and I plugged it back after a few seconds and nothing happened forward.

Pinout arduino ENC28j60

-hello, I downloaded the library, however I was testing it with the pinout connection from the ether library which has the 8 (arduino pin number) for CS, could I use the same config out of the box? or better if I change it to the pin 10?

-btw I was using arduino 1.0.1, but I noticed in the properties it uses arduino 1.5.5?

-other question, I am using an arduino 328, is this ok for this library?

Greetings!

Arduino UNO (mega328p) and ENC28J60-H

Hi,

I'm trying to get arduino_uip working with an ENC28J60-H dev board from Olimex ( https://www.olimex.com/Products/Modules/Ethernet/ENC28J60-H/resources/ENC28J60-H.pdf ).

As for issue #2, it works with ethercard (dhcp request) but I can't make it work with arduino_uip (I tried with dynamic or static ip).

I hooked up a logic analyzer on it and I see some exchanges on the MOSI and MISO channels but not long after the mac address is set, the dialog stop.

No packet seems to be sent over the network.

All the best,

Sam

Compiler warning: 'tabptr' may be used uninitialized in this function

When compiling UIPEthernet these two warnings comes up:

/Users/nilrog/Documents/Arduino/libraries/UIPEthernet/utility/uip_arp.c: In function 'uip_arp_update':
/Users/nilrog/Documents/Arduino/libraries/UIPEthernet/utility/uip_arp.c:160: warning: 'tabptr' may be used uninitialized in this function

And this one:

/Users/nilrog/Documents/Arduino/libraries/UIPEthernet/utility/uip_arp.c: In function 'uip_arp_out':
/Users/nilrog/Documents/Arduino/libraries/UIPEthernet/utility/uip_arp.c:356: warning: 'tabptr' may be used uninitialized in this function

REST example

Hi,

Do you have any examples of how a REST service can be implemented?

Great job by the way, I am new to arduino and originally found the EtherCard library but glad I have stumbled across your lib.

This is the example I have been looking at of a REST service, but the EtherCard libary has been updated since and so the code no longer runs: https://github.com/thiseldo/EtherCardExamples

Many thanks,

Andy

Memory leak when running tcp client example

Manipulation :

  • Launch the perl tcp server.
  • Add MemoryFree library in the example sketch
  • Add this code in the sketch
    ...
    Serial.print("freeMemory()=");
    Serial.println(freeMemory());
    Serial.println("Client connect");
    ...

Result ;

localIP: 192.168.14.50
subnetMask: 255.255.255.0
gatewayIP: 192.168.14.1
dnsServerIP: 192.168.14.1
freeMemory()=5593
Client connect
Client connect failed
freeMemory()=5593
Client connect
Client connect failed
freeMemory()=5593
Client connect
Client connect failed
freeMemory()=5593
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5578
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5578
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5578
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5563
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5548
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5548
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5533
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5518
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5518
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5518
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5518
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5518
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5503
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5488
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5488
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5473
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5473
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5473
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5473
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5458
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5458
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5443
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5428
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5428
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5428
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5428
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5428
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5413
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5398
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5398
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5383
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5368
Client connect
Client connected
DATA from Server
Client disconnect
freeMemory()=5368
Client connect
Client connected
DATA from Server
Client disconnect

Problem with transmitting multiple packets

Hi, first of all, thanks for the great work. I've been playing with the library to make a simple Arduino-based web server, and found a problem when transmitting multiple packets. I used the Arduino Ethernet library's WebServer.ino example as a starting point. By changing the include file from Ethernet.h to UIPEthernet.h it works fine on my ENC28J60 shield. Next, I want to print out more data, so I added a loop to print out the same values many times. Up to 10 times it still works fine, but at 20 times (see below), the returned webpage always has missing / scrambled data. Not sure what causes the problem, but I suspect it has to do with the way multiple packets are transmitted. I've used WireShark to monitor the web traffic and found a bunch of 'TCP ZeroWindow' messages. Any idea what may have caused the problem? (I've verified that the same code works fine on the standard Ethernet shield with W5100, so I don't think it's a problem with my modification below.)

/* Ethernet -> Examples -> WebServer.ino , around line 73 */
for(int pass=0;pass < 20;pass ++) {
client.print("pass: ");
client.print(pass);
client.println("< br />");
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
int sensorReading = analogRead(analogChannel);
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(sensorReading);
client.println("< br />");
}
}

Add mega compatibility

Tried changing the SPI pins in enc28j60.c to the mega pins. I've also tried setting both static address and DHCP. With the code below I eventually get 0.0.0.0 for all values printed to serial once the DHCP times out. Same board and setup works with EtherCard libraries.

enc28j60.c changes:

#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
#define ENC28J60_CONTROL_CS     53
#define SPI_MOSI        51
#define SPI_MISO        50
#define SPI_SCK         52
#else;
#define ENC28J60_CONTROL_CS     10
#define SPI_MOSI        11
#define SPI_MISO        12
#define SPI_SCK         13
#endif;

Example code:

#include <UIPEthernet.h>
#include <UIPServer.h>
#include <UIPClient.h>

UIPServer server = UIPServer(80);

//The setup function is called once at startup of the sketch
void setup()
{
  Serial.begin(57600);
  UIPEthernet.set_uip_callback(&UIPClient::uip_callback);
  IPAddress myIP(10,0,0,38);
  IPAddress myGateway(10,0,0,254);
  IPAddress mySubnet(255,255,255,0);
  IPAddress myDNS(10,0,0,254);
  //uint8_t mac[6] = {0x74,0x69,0x69,0x2D,0x30,0x31};
  uint8_t mac[6] = {0x00,0x01,0x02,0x03,0x04,0x05};
  //UIPEthernet.begin(mac, myIP, myDNS, myGateway, mySubnet);
  UIPEthernet.begin(mac);
  server.begin();

  Serial.print("IP Address: ");
  Serial.println(UIPEthernet.localIP());
  Serial.print("Default Gateway: ");
  Serial.println(UIPEthernet.gatewayIP());
  Serial.print("DNS Server: ");
  Serial.println(UIPEthernet.dnsServerIP());
}

TcpServer hangs with typical client code, needs delays.

I have an ATMega328p with an enc28J60 module that I use to read data from a couple of sensors (mostly, a DHT22). I use the same code as for the TcpServer.ino example, only modified so as to read the sensor and transmit the information.

On the other hand, I use Python on a RaspberryPI as a client to collect the data.

If I use the following python code without the sleep calls, the server hangs. However, with the sleep() call, everything is OK.

Here is the python code :

import socket, time

def communicate (hostname, port, content):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((hostname, port))
s.sendall(content)
time.sleep(1) # This is needed to avoid crashing the server.
s.shutdown(socket.SHUT_WR)
while 1:
data = s.recv(1024)
if data == "":
break
print "Received:", repr(data)
print "Connection closed."
s.close()

Arduino won't accept DHCP Address

I'm using the latest code with the tcpclient example and for some reason the arduino refuses to accept the offered DHCP address. The IP is not used on the network.

Any ideas?

If I use static IP then everything works fine. This problem is occuring if I use either my dlink as a dhcp server or my opensuse server as dhcp server:

2014-02-28T15:07:40.824662+00:00 suse dhcpd: DHCPDISCOVER from 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:07:41.825520+00:00 suse dhcpd: DHCPOFFER on 192.168.1.161 to 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:07:44.835220+00:00 suse dhcpd: DHCPDISCOVER from 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:07:44.836263+00:00 suse dhcpd: DHCPOFFER on 192.168.1.161 to 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:07:48.849468+00:00 suse dhcpd: DHCPDISCOVER from 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:07:48.850504+00:00 suse dhcpd: DHCPOFFER on 192.168.1.161 to 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:07:52.861034+00:00 suse dhcpd: DHCPDISCOVER from 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:07:52.862221+00:00 suse dhcpd: DHCPOFFER on 192.168.1.161 to 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:07:56.872516+00:00 suse dhcpd: DHCPDISCOVER from 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:07:56.873738+00:00 suse dhcpd: DHCPOFFER on 192.168.1.161 to 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:08:00.883975+00:00 suse dhcpd: DHCPDISCOVER from 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:08:00.885016+00:00 suse dhcpd: DHCPOFFER on 192.168.1.161 to 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:08:04.895486+00:00 suse dhcpd: DHCPDISCOVER from 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:08:04.896527+00:00 suse dhcpd: DHCPOFFER on 192.168.1.161 to 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:08:08.907229+00:00 suse dhcpd: DHCPDISCOVER from 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:08:08.908261+00:00 suse dhcpd: DHCPOFFER on 192.168.1.161 to 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:08:12.920170+00:00 suse dhcpd: DHCPDISCOVER from 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:08:12.921374+00:00 suse dhcpd: DHCPOFFER on 192.168.1.161 to 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:08:16.931677+00:00 suse dhcpd: DHCPDISCOVER from 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:08:16.932787+00:00 suse dhcpd: DHCPOFFER on 192.168.1.161 to 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:08:20.946559+00:00 suse dhcpd: DHCPDISCOVER from 00:01:02:03:04:05 (ENC28J030405) via eth0
2014-02-28T15:08:20.947682+00:00 suse dhcpd: DHCPOFFER on 192.168.1.161 to 00:01:02:03:04:05 (ENC28J030405) via eth0

Intermittent connections

Running this program with the lastest code as of a few hours ago:

include <UIPEthernet.h>

include <SPI.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

EthernetClient client;
char server[] = "suse.home"; // Google

void setup()
{

Serial.begin(57600);

Serial.println("Start");

Ethernet.begin(mac);

Serial.print("Revision Number: ");
Serial.println(Enc28J60.getrev());

Serial.print("localIP: ");
Serial.println(Ethernet.localIP());
Serial.print("subnetMask: ");
Serial.println(Ethernet.subnetMask());
Serial.print("gatewayIP: ");
Serial.println(Ethernet.gatewayIP());
Serial.print("dnsServerIP: ");
Serial.println(Ethernet.dnsServerIP());

delay(1000);

Serial.println("connecting...");

if (client.connect(server, 80)) {
Serial.println("connected");
client.println("GET /search?q=arduino HTTP/1.0");
client.println();
} else {
Serial.println("connection failed");
}
}

void loop()
{
Ethernet.maintain();

if (client.available()) {
char c = client.read();
Serial.print(c);
}

if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}

When I run it the first time it connects, rerunning a second time causes a connection failure. Running it a third time and it connects again.

Start
Revision Number: 6
localIP: 192.168.1.130
subnetMask: 255.255.255.0
gatewayIP: 192.168.1.1
dnsServerIP: 192.168.1.202
connecting...
connection failed

disconnecting.

Here is the tcpdump from suse.home.

Working: http://www.cloudshark.org/captures/c17d6623fb45
Failed: http://www.cloudshark.org/captures/3d67eed70388

Can't get library to work on Windows 7 or XP IDE

Am having the same issue described here: #20 when using the zip to install the library, but the proposed solution doesn't work for me.

Have tried everything (different IDE version, install paths etc etc etc), on 3 PCs, no joy...

The library doesn't show up in the available list and trying to manually add the directory results in a message "A Library called UIPEthernet does not exist" (translated from German) after selecting the directory, even though all necessary files seem to be in that directory. And the names seem to be correct.

Any help would be greatly appreciated.

Thanks

udp broadcast

Wie kann ich den Empfang von Broadcast-Paketen aktivieren?
How to enable "receiving broadcast packages"?

Adjusting timeouts

Hi,

Thanks for your work on this, it's a fantastic library and I've been using it on tiny, low cost pro mini's and it runs great.

I have read a few threads around regarding adaptations for non-blocking, while that would be great, until such a time that becomes part of the standard release would anyone be able to direct me to the appropriate places to alter the default timeout(s)?

I've had a look through the library source code but due to limited knowledge of C I'm struggling to see what to change. I did spot that there is a timeout parameter but can't see how or where to be setting that.

int DhcpClass::beginWithDHCP(uint8_t *mac, unsigned long timeout, unsigned long responseTimeout)

Many thanks,
Sam

Unable to compile TcpServer example in Arduino 1.5.4 and 1.5.5

Compiles fine in Arduino 1.0.5, but not the newer releases.

TcpServer (and others) -

Arduino: 1.5.5 (Mac OS X), Board: "Arduino Pro or Pro Mini, ATmega328 (5V, 16 MHz)"

TcpServer:23: error: 'EthernetServer' does not name a type
TcpServer.ino: In function 'void setup()':
TcpServer:30: error: 'IPAddress' was not declared in this scope
TcpServer:30: error: expected ;' before 'myIP' TcpServer:32: error: 'Ethernet' was not declared in this scope TcpServer:32: error: 'myIP' was not declared in this scope TcpServer:34: error: 'server' was not declared in this scope TcpServer.ino: In function 'void loop()': TcpServer:41: error: 'EthernetClient' was not declared in this scope TcpServer:41: error: expected)' before 'client'
TcpServer:43: error: 'client' was not declared in this scope
TcpServer:50: error: 'client' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

Can't get DNS lookups working

I've taken an example from the ethernet library and trying to get the sketch to do a simple google search.

I"m using this sketch:

include <UIPEthernet.h>

include <SPI.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

EthernetClient client;

void setup()
{
Ethernet.begin(mac);
Serial.begin(57600);

Serial.print("localIP: ");
Serial.println(Ethernet.localIP());
Serial.print("subnetMask: ");
Serial.println(Ethernet.subnetMask());
Serial.print("gatewayIP: ");
Serial.println(Ethernet.gatewayIP());
Serial.print("dnsServerIP: ");
Serial.println(Ethernet.dnsServerIP());

delay(1000);

Serial.println("connecting...");

if (client.connect("www.google.com", 80)) {
Serial.println("connected");
client.println("GET /search?q=arduino HTTP/1.0");
client.println();
} else {
Serial.println("connection failed");
}
}

void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}

if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}

The DNS Server is set via DHCP but when I run the program it can't connect to google. I've run a tcpdump on my dns server and don't even see the arduino trying to do a dns query for the IP.

If I use the ip address instead of www.google.com it works.

Anyone else experiencing problems with dns lookups? Or is something off in my example?

Can arduino_uip work with ATmega644?

Hello and, first of all, thanks for this library :-)
I'm trying to get it work with an ATMega644 chip

I've changed Enc28J60Network.h file in this way, according to 644's pin

if defined(AVR_ATmega2560) || defined(AVR_ATmega1280)

define ENC28J60_CONTROL_CS 53

define SPI_MOSI 51

define SPI_MISO 50

define SPI_SCK 52

else;

define ENC28J60_CONTROL_CS 10

define SPI_MOSI 5

define SPI_MISO 6

define SPI_SCK 7

endif;

on ATmega644 pins are:
pin5= MOSI
pin6=MISO
pin7=SCK
pin10= CS

but doesn't works... do have any advice?
thanks in advance

PS:
(the underscores in "if defined" are parsed by system...)

Expose DNS to third party programs

Hi,
As my enc28j60 is dead, I continue my devs on the w5100.
I've translated any include names and i'm facing a problem :
I can't access to the Dns client outside of UIPEthernet.
I move it from utility into main directory and update the references, and it works fine.
In Ethernet official, the DNS client is available.
Hope this help

ARP not working for first UDP-packet

When UIPEthernet (both version 1.05 and 1.52) is initialized with static ip first outgoing UDP-packet is automatically preceedet with an ARP-request to discover the ethernet-address of the target (or router). The ARP-packet generated in this case is invalid, so it is never answered and the UDP-packet not be sent until the arp-table is updated e.g. by pinging the arduino.
(When initializing UIPEthernet by dhcp arp of router is allready resolved if this is the same ip as dhcp-server)

Compiler warning: comparison between signed and unsigned integer expressions

When compiling UIPEthernet this warning comes up:

/Users/nilrog/Documents/Arduino/libraries/UIPEthernet/UIPClient.cpp: In member function 'virtual int UIPClient::read(uint8_t*, size_t)':
/Users/nilrog/Documents/Arduino/libraries/UIPEthernet/UIPClient.cpp:253: warning: comparison between signed and unsigned integer expressions

Library stops to work after a while

Hi, please help I'm becoming mad :)

After a lot of programming, I realized that the webserver I made with ArduinoUIP hangs after a while. I use an Arduino Mega + mini enc28j60 (this one: http://ecx.images-amazon.com/images/I/51PyexKAiSL._SY300_.jpg). Everything works fine for a while, then the webserver stops to answer: sometimes after some seconds, sometimes after 20 minutes. It happens with my code but also with the "hello world" one.

I tried to enable debug and it seems that after the webserver hangs, the enc28j60 still manage correctly arp requests: I get those:


receivePacket: 255
readPacket type ARP, uip_len: 60
network_send uip_buf (uip_len): 42, packet: 1

freeing packet: 255

receivePacket: 255
readPacket type ARP, uip_len: 60
network_send uip_buf (uip_len): 42, packet: 1

freeing packet: 255

receivePacket: 255
readPacket type ARP, uip_len: 60
network_send uip_buf (uip_len): 42, packet: 1
freeing packet: 255

... but this code line:
EthernetClient web_client = web_server.available();

passes without entering the "if (web_client)" statement.

I tried a similar webserver with ethercard library and it works fine, so I think it's not hardware fault.

I use arduino 1.5.5-r2 with last ArduinoUIP library but I also tried arduino 1.0.5 and older ArduinoUIP libraries: no difference.

I also try to make "hardware" changes: external power supply for enc28j60, change ethernet cable and router, but nothing changes. So I think it's a software fault, but I can't understand the cause.

Please help!

Thanks in advance

Garo

Does not work inside Interrupt or even if Timer interrupts are used.

I try to use UIPEthernet with code that works OK on Arduino UNO R3 with WIZ5100 (Ethernet Shield). Unfortunately the code does not run. It uses an Interrupt to decode wireless temperature and humidity sensors (3 pieces). Without the interrupt code the sketch works, but there will be no usefull data updates :-(

The original running (Arduino UNO+Ethershield) code is at https://github.com/hjgode/homewatch/tree/master/arduino/SketchBook/WebClientTemperature.

Is there anything preventing UIPEthernet to work in conjunction with hardware/timer interrupts?

Unable to call php script

I've got a internal suse website I am calling and trying to push some data to it.I know the website/script works as the code is working with another arduino with ethercard.h.

I am trying to convert all the arduino code to work with uip.

I have run tcpdump and can see the syn/ack/synack handshake, but thereafter only see 3 tcp retranmissions.

Here is the code I am using:

include <UIPEthernet.h>

include <SPI.h>

byte mac[] = { 0x56, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

EthernetClient client;
char server[] = "suse.local";

void setup()
{
Serial.begin(57600);
Serial.println("Start");

Ethernet.begin(mac);

Serial.print("localIP: ");
Serial.println(Ethernet.localIP());
Serial.print("subnetMask: ");
Serial.println(Ethernet.subnetMask());
Serial.print("gatewayIP: ");
Serial.println(Ethernet.gatewayIP());
Serial.print("dnsServerIP: ");
Serial.println(Ethernet.dnsServerIP());

delay(1000);

Serial.println("connecting...");

if (client.connect(server, 80)) {
Serial.println("connected");
client.println("GET /arduino_data.php?test=1 HTTP/1.1");
client.println("Host: suse.local");
client.println();

} else {
Serial.println("connection failed");
}
}

void loop()
{
}

Here is the tcpdump:
http://www.cloudshark.org/captures/79ae2c8b9aed

UIPEthernet stops working after some time

I have a sketch, written for the stock Ethernet library, that posts information to http://emoncms.org with 30 secs interval. When I run this sketch on an Uno + Ethernet shield it justs keeps posting every 30 secs.

But when I recompile this sketch for UIPEthernet and run in to a Nano + ENC28J60 shield it has so far been running for at most 20 hours, but the track record is down as low as < 1 hour. I have had to add additional error handling and timeout handling to the sketch to improve stability with UIPEthernet. With the stock Ethernet library it "just worked".

What happens is that the sketch just stops posting. I not yet had the possibility to see this lockup when the Nano was connected to my Mac. Because where I have it wired up for longterm testing I have no possibility to log serial out.

I am currently running the lastest "master".

I know this is a bit vague, but I will try to gather more info. I just wanted to toss this out here since you have way more knowledge of the internals in UIPEthernet and might have a clue about what is happening :)

/Roger

slip support

If I understand there is no support for slip protocol.
It will bee very useful for wireless communications with *bee board or others.
There is any plan about this ?

how to check if internet is available

Hi, i've been trying your library, specially udpserver example and works perfectly. I have one question:
There is any function or something in your library to check if you have access to the internet (just to know anytime if lost it).
Actually I'm using DHCP to get IP and when return 0.0.0.0 I assume that Internet is not available, but if I lose connection after initiating I don't know what to do.
Thanks in advance and sorry for my English!

error: call of overloaded 'UIPClient(int)' is ambiguous

as of http://forum.arduino.cc/index.php?topic=178024.msg1608596#msg1608596

when trying to compile the arduino sketch for the 'arduinoconnect' iOS app,
I get errors shown as soon as I try to compile using your lib.

this is the sketch I am talking about (I have not modified it at all yet):
https://github.com/milocreek/ArduinoConnectServer/archive/master.zip

thats the error log:

In file included from ArduinoConnectServer.ino:9:
/WebServer.h: In constructor 'WebServer::WebServer(const char*, int)':
WebServer.h:332: error: call of overloaded 'UIPClient(int)' is ambiguous
C:\arduinoIDE\libraries\UIPEthernet/UIPClient.h:81: note: candidates are: UIPClient::UIPClient(uip_userdata_t*) <near match>
C:\arduinoIDE\libraries\UIPEthernet/UIPClient.h:80: note:                 UIPClient::UIPClient(uip_conn*) <near match>
C:\arduinoIDE\libraries\UIPEthernet/UIPClient.h:59: note:                 UIPClient::UIPClient(const UIPClient&) <near match>
/WebServer.h: In member function 'virtual size_t WebServer::write(const char*)':
WebServer.h:367: error: invalid conversion from 'const char*' to 'uint8_t'
WebServer.h:367: error: initializing argument 1 of 'virtual size_t UIPClient::write(uint8_t)'
/WebServer.h: In member function 'int WebServer::read()':
WebServer.h:650: error: ambiguous overload for 'operator==' in '((WebServer*)this)->WebServer::m_client == 0'
/WebServer.h:650: note: candidates are: operator==(int, int) <built-in>
C:\arduinoIDE\libraries\UIPEthernet/UIPClient.h:69: note:                 virtual bool UIPClient::operator==(const UIPClient&)

DHCP ignoring replies

Hello,

First I would like to thank you for your work, checking the datasheet of the ENC chip I was very glad to find a library available for this module, considering the time it requires to implement all this, this is more than helpfull.

I am facing an issue while using the DHCP feature of the library: DHCP requests are sent perfectly and well-formed, but the replies seem to be simply ignored.

My setup if fairly simple:

---------            ---------
| ATMega|            |  DHCP |
---------            ---------
    |                     |
----|--              -----|----                ---------------
| ENC |--------------| Router |----------------| workstation |
-------              ----------                ---------------

I would like to exchange data between my workstation and the ATMega328 (not an Arduino, simply the µC running at 8MHz).

When observing traffic from my workstation, I get all requests emitted by the ENC28 module, and all replies coming from the DHCP box, but they are all ignored.
Here is the tcpdump log of this:
sudo tcpdump -ni eth0 ! ip6 and (port bootpc or bootps)
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
04:02:29.597422 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:01:02:03:04:05, length 275
04:02:29.601458 IP 192.168.1.254.67 > 255.255.255.255.68: BOOTP/DHCP, Reply, length 300
04:02:29.754674 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:01:02:03:04:05, length 287
04:02:33.764545 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:01:02:03:04:05, length 275
04:02:36.599097 IP 192.168.1.254.67 > 255.255.255.255.68: BOOTP/DHCP, Reply, length 300
04:02:36.603527 IP 192.168.1.254.67 > 255.255.255.255.68: BOOTP/DHCP, Reply, length 300
[...]
04:03:16.187336 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:01:02:03:04:05, length 287
04:03:20.199941 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:01:02:03:04:05, length 275
04:03:22.820244 IP 192.168.1.254.67 > 255.255.255.255.68: BOOTP/DHCP, Reply, length 300
04:03:22.824750 IP 192.168.1.254.67 > 255.255.255.255.68: BOOTP/DHCP, Reply, length 300
04:03:23.063464 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:01:02:03:04:05, length 287

And this is going on until the client timeouts.

While running the TcpClient example, and modifying just one line to look like this "Ethernet.begin(mac, IPAddress(192,168,1,65));", it works like a charm and I receive data:
netcat -l -p 5000
DATA from Client

I am running the library from this commit: 160df53 (tag UIPEthernet_v1.06).
My arduino is "arduino-core 1:1.0.1+dfsg-7" from Debian Wheezy repositories.

If you need any more informations I may have forgotten, I'll be glad to provide them.

Regards,

Hugo

How to check if UIPClient got disconnected?

Hello,
I'm trying to establish a persistent connection to a telnet server and I need a way to detect if the client was disconnected (because cable connection interrupted or server closed the connection, etc..) and then need to reconnect.

I tried using client.connected() return value in a while loop to detect if the client is still connected but even if I unplug the network cable it's still returning 1.

Could you please give me a hint how to check if the client is still connected?

Thanks

simple UIPEthernet EchoServer example do not work

I get the last git for arduino 1.05
with this diff:

git diff 
diff --git a/UIPEthernet.cpp b/UIPEthernet.cpp
index ca59e93..30f527b 100644
--- a/UIPEthernet.cpp
+++ b/UIPEthernet.cpp
@@ -403,7 +403,7 @@ UIPEthernetClass::upper_layer_chksum(uint8_t proto)
       Serial.print(UIP_IPH_LEN + UIP_LLH_LEN + upper_layer_memlen);
       Serial.print(F("-"));
       Serial.print(UIP_IPH_LEN + UIP_LLH_LEN + upper_layer_len);
-      Serial.print(F"]: "));
+      Serial.print(F("]: "));
       Serial.println(htons(sum),HEX);
 #endif
     }
diff --git a/UIPEthernet.h b/UIPEthernet.h
index 94502f1..17d91a9 100644
--- a/UIPEthernet.h
+++ b/UIPEthernet.h
@@ -35,10 +35,10 @@ extern "C"
 #include "utility/uip.h"
 }

-//#define UIPETHERNET_DEBUG
-//#define UIPETHERNET_DEBUG_CHKSUM
-//#define UIPETHERNET_DEBUG_UDP
-//#define UIPETHERNET_DEBUG_CLIENT
+#define UIPETHERNET_DEBUG
+#define UIPETHERNET_DEBUG_CHKSUM
+#define UIPETHERNET_DEBUG_UDP
+#define UIPETHERNET_DEBUG_CLIENT

 #define UIPETHERNET_FREEPACKET 1
 #define UIPETHERNET_SENDPACKET 2

This is like the EchoServer example program:

#include <UIPEthernet.h>
#include <UIPServer.h>
#include <UIPClient.h>

EthernetServer server = EthernetServer(1000);

void setup()
{
  Serial.begin(9600);
  Serial.println("Started");

  uint8_t mac[6] = {0x00,0x01,0x02,0x03,0x04,0x05};
  IPAddress myIP(192,168,1,6);

  Ethernet.begin(mac,myIP);

  server.begin();
  Serial.println("Started server");
}

void loop()
{
  size_t size;
  if (EthernetClient client = server.available())
    {
      if (client)
        {
          while((size = client.available()) > 0)
            {
              uint8_t* msg = (uint8_t*)malloc(size);
              client.read(msg,size);
              Serial.write(msg,size);
              //client.write(msg,size);
          free(msg);
            }
        }
    }
}

the size and memory seems ok:

avr-size -C --mcu=atmega328p .build/nano328/firmware.elf
AVR Memory Usage
----------------
Device: atmega328p
Program:   23300 bytes (71.1% Full)
(.text + .data + .bootloader)

Data:       1227 bytes (59.9% Full)
(.data + .bss + .noinit)

Run it and I get this in the serial terminal:

Terminal ready
Started
Started server
--------------
              receivePacket: 255
readPacket type IP, uip_len: 60
chksum uip_buf[34-54]: FFFF
chksum uip_buf[34-54]: 9B3D
network_send uip_buf (uip_len): 54, packet: 1
freeing packet: 255
--------------
              receivePacket: 255
readPacket type IP, uip_len: 74
chksum uip_buf[34-74]: FFFF
chksum uip_buf[34-58]: 5D93
network_send uip_buf (uip_len): 58, packet: 1
freeing packet: 255
--------------
              receivePacket: 255
readPacket type IP, uip_len: 60
chksum uip_buf[34-54]: FFFF
UIPClient uip_connected
UIPClient allocated state: 16
freeing packet: 255
--------------
              receivePacket: 255
readPacket type IP, uip_len: 62
chksum uip_buf[34-54]: B9C2
chksum uip_packet(255)[54-62]: FFFF
UIPClient uip_newdata, uip_len:8
chksum uip_buf[34-54]: 5C7F
network_send uip_buf (uip_len): 54, packet: 2
freeing packet: 255
eatblock(1): 1 0 0 0 0 -> 1 0 0 0 0 
ciccio
--------------
              receivePacket: 255
readPacket type IP, uip_len: 61
chksum uip_buf[34-54]: 2DCE
chksum uip_packet(255)[54-61]: FFFF
UIPClient uip_newdata, uip_len:7
chksum uip_buf[34-54]: 637F
network_send uip_buf (uip_len): 54, packet: 2
freeing packet: 255
eatblock(1): 1 1 0 0 0 -> 1 1 0 0 0 
eatblock(1): 1 1 0 0 0 -> 1 1 0 0 0 
eatblock(1): 1 1 0 0 0 -> 1 1 0 0 0 
eatblock(1): 1 1 0 0 0 -> 1 1 0 0 0 
eatblock(1): 1 1 0 0 0 -> 1 1 0 0 0 
eatblock(1): 1 1 0 0 0 -> 1 1 0 0 0 
eatblock(1): 1 1 0 0 0 -> 1 1 0 0 0 
eatblock(1): 1 1 0 0 0 -> 1 1 0 0 0 
eatblock(1): 1 1 0 0 0 -> 1 1 0 0 0 
eatblock(1): 1 1 0 0 0 -> 1 1 0 0 0 
eatblock(1): 1 1 0 0 0 -> 1 1 0 0 0 
eatblock(1): 1 1 0 0 0 -> 1 1 0 0 0 
eatblock(1): 1 1 0 0 0 -> 1 1 0 0 0
.... 

and so on for infinite time

Compiler warning: 'upper_layer_memlen' may be used uninitialized in this function

When compiling UIPEthernet this warning comes up:

/Users/nilrog/Documents/Arduino/libraries/UIPEthernet/UIPEthernet.cpp: In member function 'uint16_t UIPEthernetClass::upper_layer_chksum(uint8_t)':
/Users/nilrog/Documents/Arduino/libraries/UIPEthernet/UIPEthernet.cpp:372: warning: 'upper_layer_memlen' may be used uninitialized in this function

UIPClient::connect(const char *host, uint16_t port) return value invalid

connect() returns the DNS-error-codes (negative values) of DNS cannot resolve the hostname. If being used as a boolean value this results in unespected behaviour:

const char* host = "www.arduino.cc";
if (connect(host,80)) {
// your code would be called even when dns didn't succeed.
}

(this is related to #17)

Can't compile with visual Micro

Hi, I'm using the visual Micro plugin for visual studio (AtmelStudio) http://www.visualmicro.com and can't compile anything with the uip lib...

Using the Arduino IDE (1.0.4 and 1.0.5) everything works fine, btw great work. Saved a lot of time and frustration compared to the etherCard lib.

I tried to include the ethernet_comp_h direct and renaming the ethernetclient to UIPClient but it's still not working...

hausbus.ino:53: error: variable or field 'XML_response' declared void
hausbus.ino:53: error: 'EthernetClient' was not declared in this scope
hausbus.ino:71: error: 'IPAddress' does not name a type
hausbus.ino:72: error: 'EthernetServer' does not name a type
hausbus.ino:In function 'void setup()'
hausbus.ino:116: error: 'Ethernet' was not declared in this scope
hausbus.ino:116: error: 'ip' was not declared in this scope
hausbus.ino:117: error: 'server' was not declared in this scope

Compiler warning: operation on 'block' may be undefined

When compiling UIPEthernet this warning comes up.

/Users/nilrog/Documents/Arduino/libraries/UIPEthernet/UIPClient.cpp: In static member function 'static void UIPClient::_eatBlock(memhandle*)':
/Users/nilrog/Documents/Arduino/libraries/UIPEthernet/UIPClient.cpp:513: warning: operation on 'block' may be undefined

Installation / error messages

Hi,

First of all, I wanted to say I read a lot of good things about this library, so I decided to go for it. :-)
Anyway, I am still quite a newbee in this Arduino-stuf, but have some experience in programming in Pascal (delphi).

The issue I have, even if I use the examples is that I get type errors. Now I tested it in Arduino sketch 1.05 and in 1.55 / 1.54, nd get the same errors everywhere.

Some example I get when i try to compile the example echoserver is ::
'UIPServer' does not name a type.

Is there anyone that understands what I am doing wrong? I mean the example should be a matter of loading it, and it should compile right?

Thanks sofar,

Ruud

Compiler warning: 'UIPEthernetClass::packetstate' will be initialized after...

I think all these warnings belong together, but i'm not sure.

/Users/nilrog/Documents/Arduino/libraries/UIPEthernet/UIPEthernet.h: In constructor 'UIPEthernetClass::UIPEthernetClass()':
/Users/nilrog/Documents/Arduino/libraries/UIPEthernet/UIPEthernet.h:93: warning: 'UIPEthernetClass::packetstate' will be initialized after
/Users/nilrog/Documents/Arduino/libraries/UIPEthernet/UIPEthernet.h:86: warning:   'DhcpClass* UIPEthernetClass::_dhcp'
/Users/nilrog/Documents/Arduino/libraries/UIPEthernet/UIPEthernet.cpp:47: warning:   when initialized here

Printing revision no?

I''m trying to get my enc28j60 working and not having any luck (It works with the ethercard.h library)

I'm not even sure its being detected. If there a way to print off the revision number using arduino_uip as shown here in a ethercard.h example:


include "EtherShield.h"

static uint8_t mymac[6] = {0x54,0x55,0x58,0x10,0x00,0x25};

EtherShield es=EtherShield();

void setup(){

Serial.begin(9600);
es.ES_enc28j60Init(mymac);

}

void loop(){
Serial.println(es.ES_enc28j60Revision(),HEX);
delay(500);
}


That way I can at least see if its being detected?

arduino_uip do not work every times with mqtt library PubSubClient

I try to use mqtt library PubSubClient with arduino_uip https://github.com/knolleary/pubsubclient
this is the ino file:

/*
 Basic MQTT example 

  - connects to an MQTT server
  - publishes "hello world" to the topic "outTopic"
  - subscribes to the topic "inTopic"
*/

#include <UIPEthernet.h>
// The connection_data struct needs to be defined in an external file.
#include <UIPServer.h>
#include <UIPClient.h>

#include <PubSubClient.h>

// Update these with values suitable for your network.
byte mac[]    = {  0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
byte server[] = { 192, 168, 1, 172 };
byte ip[]     = { 192, 168, 1, 6 };


#if UIP_LOGGING == 1
void uip_log(char *msg){
  Serial.println(msg);
}
#endif

void callback(char* topic, byte* payload, unsigned int length) {
  // handle message arrived
}

EthernetClient ethClient;
PubSubClient client(server, 1883, callback, ethClient);

void setup()
{
  Serial.begin(9600);
  delay(2000);
  Serial.println("Started");
  Ethernet.begin(mac, ip);
  if (client.connect("arduinoClient")) {
    Serial.println("connected");
    client.publish("outTopic","hello world");
    client.subscribe("inTopic");
  }
}

void loop()
{
  client.loop();
}

some time it works and I get:

Started
chksum uip_buf[34-58]: 83F5
network_send uip_buf (uip_len): 42, packet: 1
--------------
              receivePacket: 255
readPacket type ARP, uip_len: 60
freeing packet: 255
chksum uip_buf[34-58]: 83F5
network_send uip_buf (uip_len): 58, packet: 1
--------------
              receivePacket: 255
readPacket type IP, uip_len: 215
freeing packet: 255
chksum uip_buf[34-58]: 83F5
network_send uip_buf (uip_len): 58, packet: 1
chksum uip_buf[34-58]: 83F5
network_send uip_buf (uip_len): 58, packet: 1
--------------
              receivePacket: 255
readPacket type IP, uip_len: 60
chksum uip_buf[34-54]: FFFF
chksum uip_buf[34-54]: 89E1
network_send uip_buf (uip_len): 54, packet: 1
freeing packet: 255
--------------
              receivePacket: 255
readPacket type IP, uip_len: 60
chksum uip_buf[34-54]: FFFF
chksum uip_buf[34-54]: 4DE4
network_send uip_buf (uip_len): 54, packet: 1
freeing packet: 255
--------------
              receivePacket: 255
readPacket type IP, uip_len: 215
freeing packet: 255

but a second time do not work and I get:

Started
chksum uip_buf[34-58]: 83F5
network_send uip_buf (uip_len): 42, packet: 1
--------------
              receivePacket: 255
readPacket type ARP, uip_len: 60
freeing packet: 255
chksum uip_buf[34-58]: 83F5
network_send uip_buf (uip_len): 58, packet: 1
--------------
              receivePacket: 255
readPacket type IP, uip_len: 60
chksum uip_buf[34-58]: FFFF
UIPClient uip_connected
UIPClient allocated state: 16
UIPClient uip_newdata, uip_len:0
chksum uip_buf[34-54]: 4FCA
network_send uip_buf (uip_len): 54, packet: 1
freeing packet: 255
connected, state: 16, first packet in: 0
arduinoClient'e: writePacket(1) pos: 0, buf[0-29]: '���MQIsdp��
chksum uip_buf[34-54]: 74CA
chksum uip_packet(2)[54-83]: 5ABD
network_send uip_packet: 2, hdrlen: 54
--------------
              receivePacket: 255
readPacket type IP, uip_len: 60
chksum uip_buf[34-54]: FFFF
UIPClient uip_acked
eatblock(1): 1 0 0 0 0 -> 0 0 0 0 0 
freeing packet: 255
--------------
              receivePacket: 255
readPacket type IP, uip_len: 60
chksum uip_buf[34-54]: FDDF
chksum uip_packet(255)[54-58]: FFFF
UIPClient uip_newdata, uip_len:4
chksum uip_buf[34-54]: 70CA
network_send uip_buf (uip_len): 54, packet: 2
freeing packet: 255
eatblock(1): 1 0 0 0 0 -> 0 0 0 0 0 
connected
UIPClient.write: writePacket(1) pos: 0, buf[0-23]: '0outTopichello world'
UIPClient.write: writePacket(1) pos: 23, buf[0-14]: '�
                                                      �inTopic'
chksum uip_buf[34-54]: 9DCA
chksum uip_packet(2)[54-91]: 3AA6
network_send uip_packet: 2, hdrlen: 54
--------------
              receivePacket: 255
readPacket type IP, uip_len: 60
chksum uip_buf[34-54]: FA6F
chksum uip_packet(255)[54-59]: FFFF
UIPClient uip_newdata, uip_len:5
UIPClient uip_acked
eatblock(1): 1 0 0 0 0 -> 0 0 0 0 0 
chksum uip_buf[34-54]: 9ACA
network_send uip_buf (uip_len): 54, packet: 1
freeing packet: 255
eatblock(2): 2 0 0 0 0 -> 0 0 0 0 0 
--------------
              receivePacket: 255
readPacket type IP, uip_len: 215
freeing packet: 255

on the mosquitto mqtt server:

Feb 13 16:54:36 asus-pat1 mosquitto[4646]: 1392306876: New connection from 192.168.1.6 on port 1883.
Feb 13 16:54:36 asus-pat1 mosquitto[4646]: 1392306876: New client connected from 192.168.1.6 as arduinoClient (c1, k15).
Feb 13 16:54:36 asus-pat1 mosquitto[4646]: 1392306876: Sending CONNACK to arduinoClient (0)
Feb 13 16:54:37 asus-pat1 mosquitto[4646]: 1392306877: Received PUBLISH from arduinoClient (d0, q0, r0, m0, 'outTopic', ... (11 bytes))
Feb 13 16:54:37 asus-pat1 mosquitto[4646]: 1392306877: Sending PUBLISH to mosqsub/4782-asus-pat1 (d0, q0, r0, m0, 'outTopic', ... (11 bytes))
Feb 13 16:54:37 asus-pat1 mosquitto[4646]: 1392306877: Received SUBSCRIBE from arduinoClient
Feb 13 16:54:37 asus-pat1 mosquitto[4646]: 1392306877: #011inTopic (QoS 0)
Feb 13 16:54:37 asus-pat1 mosquitto[4646]: 1392306877: Sending SUBACK to arduinoClient
Feb 13 16:54:43 asus-pat1 mosquitto[4646]: 1392306883: Socket read error on client arduinoClient, disconnecting.
Feb 13 16:54:54 asus-pat1 mosquitto[4646]: 1392306894: New connection from 192.168.1.6 on port 1883.
Feb 13 16:54:54 asus-pat1 mosquitto[4646]: 1392306894: New client connected from 192.168.1.6 as arduinoClient (c1, k15).
Feb 13 16:54:54 asus-pat1 mosquitto[4646]: 1392306894: Sending CONNACK to arduinoClient (0)
Feb 13 16:54:55 asus-pat1 mosquitto[4646]: 1392306895: Received PUBLISH from arduinoClient (d0, q0, r0, m0, 'outTopic', ... (11 bytes))
Feb 13 16:54:55 asus-pat1 mosquitto[4646]: 1392306895: Sending PUBLISH to mosqsub/4782-asus-pat1 (d0, q0, r0, m0, 'outTopic', ... (11 bytes))
Feb 13 16:54:55 asus-pat1 mosquitto[4646]: 1392306895: Received SUBSCRIBE from arduinoClient
Feb 13 16:54:55 asus-pat1 mosquitto[4646]: 1392306895: #011inTopic (QoS 0)
Feb 13 16:54:55 asus-pat1 mosquitto[4646]: 1392306895: Sending SUBACK to arduinoClient
Feb 13 16:54:57 asus-pat1 mosquitto[4646]: 1392306897: Received PINGREQ from mosqsub/4782-asus-pat1
Feb 13 16:54:57 asus-pat1 mosquitto[4646]: 1392306897: Sending PINGRESP to mosqsub/4782-asus-pat1
Feb 13 16:55:02 asus-pat1 mosquitto[4646]: 1392306902: Socket read error on client mosqsub/4782-asus-pat1, disconnecting.
Feb 13 16:55:10 asus-pat1 mosquitto[4646]: 1392306910: Received PINGREQ from arduinoClient
Feb 13 16:55:10 asus-pat1 mosquitto[4646]: 1392306910: Sending PINGRESP to arduinoClient

Problem accessing ENC28J60

Hello,
first of all: thank you for making this nice library and sorry, if this is a simple fault...

I´m unable to reproduce any of your examples.
In Wireshark I didn´t even see a difference between connecting the arduino with blink-sketch and with one of your examples.
Neither arduino1.0.3 nor 1.0.5r2 worked.

I added "debugging-prints"

while(_dhcp_state != STATE_DHCP_LEASED)
{
Serial.println("helloDHCP16");
if(_dhcp_state == STATE_DHCP_START)
{
Serial.println("helloDHCP17");
_dhcpTransactionId++;

They print a dozen times "helloDHCP16 \n helloDHCP17".
...and after some time:
helloDHCP17
helloDHCP16
localIP: 0.0.0.0
subnetMask: 0.0.0.0
gatewayIP: 0.0.0.0
dnsServerIP: 0.0.0.0

So it doesn´t get a _dhcp_state == STATE_DHCP_REREQUEST ?!?

With the ethercard-library it worked out of the box so i don´t think it´s a wiring problem.
I´m using an orig.Uno Rev.3 with this pinning:
http://hofmannsven.com/2013/laboratory/arduino-ethernet-module/

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.