Pages: [1]   Go Down
Author Topic: strange ethernet action  (Read 896 times)
0 Members and 1 Guest are viewing this topic.
Buena Vista, CO
Offline Offline
Full Member
***
Karma: 0
Posts: 181
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm working on an ethernet program. I'm using Windows 7 and Arduino 1.0.1. Hardware is a Mega 2560 and an official ethernet shield. After going through a random(<10) number of iterations the downloading hangs. Usually when it does the message area says downloading and the download symbol is orange but the rx/tx lights don't blink. Closing the IDE and re-starting gives error comX in use. The only way out is to reboot the computer, which is very time consuming. Is this normal?

Jim
Logged

8000ft above the average

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is this normal?
No.

If you showed the code, and explained what "the message area" means, and what "the download symbol" you are talking about is, perhaps a longer version of "no" could be posted, instead.
Logged

Buena Vista, CO
Offline Offline
Full Member
***
Karma: 0
Posts: 181
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is this normal?
No.

If you showed the code, and explained what "the message area" means, and what "the download symbol" you are talking about is, perhaps a longer version of "no" could be posted, instead.

Code has varied wildly as i run different examples. Message bar is the blue bar at the bottom which says "compiling" and then "downloading", just above the area where errors are displayed. The download symbol is the round symbol at top right that turns orange when you click it and starts the download process, just below the menu bar. Now you can post "no"!
Jim

Jim
Logged

8000ft above the average

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So, your problem, despite the thread title, has nothing to do with ethernet. Right?

Still, the behavior is not normal. You'll have to remove the randomness. That is, you'll need to determine what the pattern is. What other serial devices do you have? Are you running any kind of bluetooth software? Something that tries to connect to all the serial ports to see if there are bluetooth devices connected?
Logged

Buena Vista, CO
Offline Offline
Full Member
***
Karma: 0
Posts: 181
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So, your problem, despite the thread title, has nothing to do with ethernet. Right?

Still, the behavior is not normal. You'll have to remove the randomness. That is, you'll need to determine what the pattern is. What other serial devices do you have? Are you running any kind of bluetooth software? Something that tries to connect to all the serial ports to see if there are bluetooth devices connected?
I have experienced this problem with the webserver, webclient, telnet client in the examples with the ethernet library, also with SDwebbrowse.ino from the Adafruit site. I have a Windows 7 PC, Arduino 1.0.1 IDE, Mega, Ethernet shield and a LCD. It happens both with and without the LCD attached and with and without the LCD required libraries. When the Ethernet shield is not attached it does not happen. The program I'm working now is an extension of the SDwebbrowse program. I can add something as insignificant as lcd.print statement, go to reload and it happens. I save the program, reboot and reload the program, it will recompile and download correctly. The attached libraries are:
#include <SPI.h>
#include <Ethernet.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SdFat.h>
#include <SdFatUtil.h>
Logged

8000ft above the average

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can try the below server code and see if the meta refreshing hangs.

Code:
// zoomkat meta refresh server test code
// arduino IDE 1.0
// for W5100 ethernet shield
// the IP address will be dependent on your local network/router
// port 80 is default for HTTP, but can be changed as needed
// use IP address like http://192.168.1.102:84 in your brouser
// or http://zoomkat.no-ip.com:84 with dynamic IP service
// use the \ slash to escape the " in the html
// meta refresh set for 2 seconds

#include <SPI.h>
#include <Ethernet.h>

int x=0; //set refresh counter to 0
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1,102); // ip in lan
EthernetServer server(84); //server is using port 84

void setup()
{
  // start the server
  Ethernet.begin(mac, ip);
  server.begin();
}

void loop()
{
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
     while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        // see if HTTP request has ended with blank line
        if (c == '\n') {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
         
          //meta-refresh page every 2 seconds
          x=x+1; //page upload counter
          client.println("<HTML>");
          client.print("<HEAD>");
          client.print("<meta http-equiv=\"refresh\" content=\"2\">");
          client.print("<TITLE />Zoomkat's meta-refresh test</title>");
          client.print("</head>");
          client.println("<BODY>");
          client.print("Zoomkat's meta-refresh test IDE 1.0");
          client.println("<br />");
                   
          client.print("page refresh number ");
          client.println(x); //current refresh count
          client.println("<br />");
          client.println("<br />");
         
          client.print("Zoomkat's arduino analog input values:");
          client.println("<br />");
          client.println("<br />");
         
          // output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            client.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(analogRead(analogChannel));
            client.println("<br />");
            }
           break;
          client.println("</BODY>");
          client.println("</HTML>");
         }
        }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
  }
}
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm working on an ethernet program. I'm using Windows 7 and Arduino 1.0.1. Hardware is a Mega 2560 and an official ethernet shield. After going through a random(<10) number of iterations the downloading hangs. Usually when it does the message area says downloading and the download symbol is orange but the rx/tx lights don't blink. Closing the IDE and re-starting gives error comX in use. The only way out is to reboot the computer, which is very time consuming. Is this normal?

As I read this it appears the problem is that the "reset" of the Mega is not starting the code upload after the compile is completed.

I had a similar problem with a Mega2560 and Ethernet shield when the hardware was powered ONLY from the usb connection. I used a plug pack to supply power to the Mega and the problem was solved. The resets and uploads are then reliable.
Logged

Pages: [1]   Go Up
Jump to: