Arduino constantly "screams" ARP broadcast


hi everyone,

since bought me arduino 2560 w5100 ethernet-shield measure stuff home-automation, network has become totally laggy , unstable.

i have used wireshark going on there , figured out arduino "yelling" arp 192.168.1.248 in fixed intervall.
this device homematic-control-unit, provides connection server.

when arduino disconnected network, devices answer pretty fast (<10ms) ping request. after powered, goes random devices not showing or answering after 200ms.

in opinion broadcasts source of problem.
the overall network contain 2 wifi-ap's, 2 switches , firewall , ton more of components.


so question - since arduino gets ip dhcp reservation device a.m. ip (...248) - how can teach arduino mac-address of homematic-device or use arp-table.

from other posts, have seen using arp-table might problem w5100 shield.

any ideas how solve this?
regards,
maeffjus


btw: here code use:
(only first few lines should interesting problem, ccu homematic-device)

code: [select]

#include <spi.h>
#include <ethernet.h>
#include <wire.h>      // comes arduino ide
#include <onewire.h>   //für temperatursensoren ds18b20 http://www.hacktronics.com/code/onewire.zip
#include <newping.h>   //für ultraschallsensoren sr04 https://arduino-new-ping.googlecode.com/files/newping_v1.5.zip
#include "dht.h"       //für temperatursensoren sht22 https://github.com/adafruit/dht-sensor-library/archive/master.zip
#include <as_bh1750.h> //für i2c-luxmeter https://github.com/hexenmeister/as_bh1750/archive/master.zip
#include <sfe_bmp180.h>//für i2c-barometer https://github.com/sparkfun/bmp180_breakout/archive/master.zip
#include <lcd.h>
#include <liquidcrystal_i2c.h>


#define i2c_addr    0x27 // define i2c address pcf8574a is
#define backlight_pin     3
#define en_pin  2
#define rw_pin  1
#define rs_pin  0
#define d4_pin  4
#define d5_pin  5
#define d6_pin  6
#define d7_pin  7

int n = 1;

liquidcrystal_i2c lcd(i2c_addr,en_pin,rw_pin,rs_pin,d4_pin,d5_pin,d6_pin,d7_pin);

byte ccu[] = { 192, 168, 1, 248 };                   //das ist die ip der ccu                                    <<user-eingabe<<
byte mac[] = { 0xac, 0xcc, 0xbc, 0xcc, 0xcc, 0xcc };  //muss nur bei mehreren homeduinos geändert werden !        <<user-eingabe<<
byte homeduino[] = { 192, 168, 1, 250 };             //das ist die feste ip des homeduino, wenn dhcp versagt     <<user-eingabe<<
const byte board = 54;       //"14" = uno/duemilanove;  "54" = mega2560                                           <<user-eingabe<<
string homeduino_nummer = "x";  // indiv. bezeichnung für diese homeduino-box                                     <<user-eingabe<<
string hm_systemvariable = "homeduino_" + homeduino_nummer +"_";
 
//input-kennung: hier wird die funktion der eingänge d0 bis d9 festgelegt
byte iomodus_d[10] = {0, 0,
                      0,   //d2  :"0" = digital_in; "1" = 1wire; "3" = shtxx; "4" = ultraschall; "2" = infrarot;  <<user-eingabe<<
                      0,   //d3  :"0" = digital_in; "1" = 1wire; "3" = shtxx; "4" = ultraschall; "2" = 433mhz-rx; <<user-eingabe<<
                      4,   //d4  :"0" = digital_in; "1" = 1wire; "3" = shtxx; "4" = ultraschall;                  <<user-eingabe<<
                      3,   //d5  :"0" = digital_in; "1" = 1wire; "3" = shtxx; "4" = ultraschall;                  <<user-eingabe<<
                      0,   //d6  :"0" = digital_in; "1" = 1wire; "3" = shtxx; "4" = ultraschall;                  <<user-eingabe<<
                      0,   //d7  :"0" = digital_in; "1" = 1wire; "3" = shtxx; "4" = ultraschall;                  <<user-eingabe<<
                      0,   //d8  :"0" = digital_in; "1" = 1wire; "3" = shtxx; "4" = ultraschall;                  <<user-eingabe<<
                      0    //d9  :"0" = digital_in; "1" = 1wire; "3" = shtxx; "4" = ultraschall;                  <<user-eingabe<<
                       };                                      
 
byte iomodus_baro  = 1;   //"0" = n.c.;  "1" = bmp180                     <<user-eingabe<<
byte iomodus_lux  = 1;   //"0" = n.c.; "1" = bh1750;                      <<user-eingabe<<
 
 
 
//hier werden die zuletzt gesendeten sytemvariablen gespeichert
boolean last_digitalin_value_d[10];
float last_digital_value_d[10];
boolean last_digitalin_value_a[6];
float last_analogin_value_a[6];
float last_ir_value;
float last_rf_value;
float last_lux_value;
double last_baro_value;
double last_barot_value;
 
boolean complete_loop =1;  // wenn 1, dann einmal komplett durchlaufen
 
boolean value;
string befehl;
string i;
int analogwert;
 
float tempntc;
float b_wert = 3950;
float tn = 298.15;
float rv = 10000;
float rn = 10000;
float rt ;
float temp_tur;
float humidity;
 
float delta_onewire = 0.4;
float delta_sht = 0.2;    
float delta_us = 2;
float delta_analog = 2;
float delta_ntc = 0.2;
float delta_lux = 20;
double delta_baro = 0.2;
double delta_barot = 0.5;
 
long duration, cm;
 
unsigned long next_full_loop = 0;
unsigned long delta_time = 1800000;
unsigned long delta_tx = 500;  
unsigned long next_tx = 0;
//*********************************  
ethernetclient client;  // initialize ethernet client library
 
as_bh1750 sensor;   //initialize bh1750 luxmeter library
 
#define altitude 299.0 // seehoehe in metern
sfe_bmp180 pressure;
char status;
double t,p,p0;
 
 
void setup()
{serial.begin(9600); // start ethernet connection:
 if (ethernet.begin(mac) == 0)
   {serial.println("failed configure ethernet using dhcp"); ethernet.begin(mac, homeduino);}
 delay(1000);// give ethernet shield second initialize:
 serial.println("connecting..."); // if connection, report via serial:
 if (client.connect(ccu, 8181)) {}
   else {serial.println("connection failed");} // if didn't connection server:
 client.stop();
 char myipstring[24];  //ip auslesen
 ipaddress myip = ethernet.localip();
 sprintf(myipstring, "%d.%d.%d.%d", myip[0], myip[1], myip[2], myip[3]);  
 i = myipstring;
 befehl = "get /xy.exe?antwort=dom.getobject('" + hm_systemvariable + "ip" + "').state('" + + "')";
 set_sysvar();
   lcd.begin (16,2);
  lcd.setbacklightpin(backlight_pin,positive);
  lcd.setbacklight(high);
  lcd.home ();                   // go home
 wire.begin ();
  twbr = 72;  
  twsr |= bit (twps0);
}
 
//***************
void loop()
{if (millis() > next_full_loop)     //mindestens jede stunde eine komplette aktualisierung
   {complete_loop = 1; next_full_loop = millis() + delta_time;
    if (next_full_loop < millis()) {complete_loop = 0;}  
   }
 //***************  
 for (int = 2; < 10; i++)  //behandlung digitaleingänge d2 bis d9
   {if (iomodus_d[i] == 0)
     {pinmode(i, input);
      value =digitalread(i);
      if ((!value == last_digitalin_value_d[i]) || complete_loop)
        {i = string(i);
         befehl = "get /xy.exe?antwort=dom.getobject('" + hm_systemvariable + "d" + + "').state(" + value + ")";
         set_sysvar();
         last_digitalin_value_d[i] = value;
        }
     }
  }

//******************
 complete_loop = 0;
}
//##############
// subroutine http request absetzen:
void set_sysvar()
{ //while (millis() < next_tx) {} //warten bis time > next_tx oder timeout
 next_tx = millis() +delta_tx;
 if (client.connect(ccu, 8181))
   {serial.println(befehl);
    client.println(befehl);
    client.println();
    client.stop();
   }
}

the ethernet shield doesn't "scream".

the ethernet shield doesn't store arp settings, every time attempts connection, arp broadcast. reason in code:
code: [select]
void set_sysvar()
{ //while (millis() < next_tx) {} //warten bis time > next_tx oder timeout
 next_tx = millis() +delta_tx;

// here reason
 if (client.connect(ccu, 8181))
   {serial.println(befehl);
    client.println(befehl);
    client.println();
    client.stop();
   }
}


Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Arduino constantly "screams" ARP broadcast


arduino

Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code