Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[AVR] Ethernet connection failure (arduino)

Status
Not open for further replies.

archusvijay1

Member level 3
Joined
Mar 12, 2014
Messages
61
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
553
EThernet connection failure(arduino)

Hello,
I am trying to implement a device which read voltage and current and send the signal to a server.I completed this task using arduino uno and ENC28j60 Ethernet module with the help of UIPEthernet library. I am getting the signal in the server.but some time it fails .It maybe after running half a day,or after one day.also i get continuous signal for 2 days also.after that it will hang or not sending the data to the server. What might be the problem?.please help .

i here by attach the program .

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
void setup(){
 Serial.begin(9600);
  //Serial.println("Starting");
  SPI.begin();
 // watchdogSetup();
  pinMode(Contd,OUTPUT);
  pinMode(NotContd,OUTPUT);
  digitalWrite(Contd,HIGH);
  digitalWrite(NotContd,HIGH);
  delay(2000);
  digitalWrite(Contd,LOW);
  digitalWrite(NotContd,LOW);
  start_ethernet();
}
 
void loop() {
  //wdt_reset();
      reset_millis = millis();
      // put your main code here, to run repeatedly:
  if(reset_millis >= reset_period){
        Resetuno();
    }
   
    dc_volt = 0;
    dc_volt   = analogRead(A5);//*5)/1024);
    dc_volt = dc_volt*0.0363;
    eb_volt   = Measure_Vrms(1,800,0.8759,10);//1.1    4.04///
    inv_curr  = Measure_Irms(4,800,0.039,10); //0.0017
 
 
    client.connect(server, 80);
    delay(1000);
  if (client.connected()){//(server, 80)) {
    Serial.println("-> Connected");
    digitalWrite(Contd,HIGH);
    digitalWrite(NotContd,LOW);
 
    failed_data = 0;
  
    client.print( "GET /index.php/add/add_data?");
    client.print("dc_volt=");
    client.print(dc_volt);
    client.print("&");
    client.print("eb_volt=");
    client.print(eb_volt);
    client.print("&");
    client.print("inv_volt=");
    client.print(inv_volt);
    client.print("&");
    client.print("inv_curr=");
    client.print(inv_curr);
    client.print("&");
    client.println( " HTTP/1.1");
    client.print( "Host: " );
    client.println(server);
    client.println( "Connection: close");//keep-alive" );// close
    client.println();
    client.println();
    client.stop();
   delay(interval);

 
Last edited by a moderator:

aruipksni

Full Member level 6
Joined
May 23, 2013
Messages
346
Helped
68
Reputation
136
Reaction score
66
Trophy points
1,308
Activity points
3,004
Re: EThernet connection failure(arduino)

there are a lot of reasons.
1st thing i would check is if my ethernet is ok.
so i would try to send ping to connected pc, and run it constantly
for a long time to check if the ping doesn't stop.
(there might be some clocking issues in phy/switch for example, or bad cables or terminations).
 

archusvijay1

Member level 3
Joined
Mar 12, 2014
Messages
61
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
553
Re: EThernet connection failure(arduino)

My Ethernet connection is OK. I replace the cable also.
during the debugging time i can notify that it is not come out side from the client.connected() function.
 

aruipksni

Full Member level 6
Joined
May 23, 2013
Messages
346
Helped
68
Reputation
136
Reaction score
66
Trophy points
1,308
Activity points
3,004
Re: EThernet connection failure(arduino)

My Ethernet connection is OK. I replace the cable also.
during the debugging time i can notify that it is not come out side from the client.connected() function.

so it is probebly a software problem with the uipethernet.
so you might check if you got the latest vesion
of this library.
 

archusvijay1

Member level 3
Joined
Mar 12, 2014
Messages
61
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
553
Re: EThernet connection failure(arduino)

so it is probebly a software problem with the uipethernet.
so you might check if you got the latest vesion
of this library.

yes . i am using the latest version.This problem exist some times only.
I think the problem comes from the client.print() or client.stop() function. After connecting the server (ie.client.connected() is true) the net disconnected the system hang.am i right?.

can i use watch dog timer to overcome this problem or any other method to resolve this problem?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top