loathingKernel / ariadne-bootloader

A little less unfinished TFTP bootloader for Arduino Ethernet or Arduino with Ethernet Shield
45 stars 18 forks source link

No ethernet connection after burning bootloader #32

Closed buzzik closed 5 years ago

buzzik commented 5 years ago

Hi, I have mega2560 + W5100 ethernet shield. And I testing some sketches for personal project. After I burning your bootloader throug Arduino ISP my mega+w5100 cant connetct to my network. I'v setted correct IP and gateway trugh WriteNetworkSettings sketch, and verifing it with ReadNetworkSettings . There is the output of this sketch

--- Network Settings ---
    MAC: 0x0.0xAA.0xBB.0xCC.0xDE.0x2
Address: 192.168.31.135
Gateway: 192.168.31.1
 Subnet: 255.255.255.0
--- Tftp Settings ---
Data Port: 46969
(Default)
--- Reset Server Settings ---
Password: 123123123
  Length: 9

(all is correct, 192.168.31.1 is my gateway(router))

there is testing sketch that also dont want to connect to lan

//zoomkat 2-13-12
//DNS and DHCP-based web client test code
//for use with IDE 1.0
//open serial monitor and send an e to test
//and to see test result
//for use with W5100 based ethernet shields
//browser equivelant URL: 
// http://web.comporium.net/~shb/arduino.txt
//note that the below bug fix may be required
// http://code.google.com/p/arduino/issues/detail?id=605 

#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
char serverName[] = "web.comporium.net"; // zoomkat's test web page server
EthernetClient client;

//////////////////////

void setup(){
  Serial.begin(9600); 
  Serial.println("DNS and DHCP-based web client test 2/13/12"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }
  // print your local IP address:
  Serial.print("Arduino IP address: ");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(Ethernet.localIP()[thisByte], DEC);
    Serial.print("."); 
  }
  Serial.println();
  Serial.println();
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
  {
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
    {
      sendGET(); // call sendGET function below when byte is an e
    }
  }  
} 

//////////////////////////

void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.0"); //download text
    client.println(); //end of get request
  } 
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor 
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop(); //stop client

}

How can I fix problem or restore previous condition of mega and w5100 ? Thank you, sory for my english

P.S. I'v tried connect my w5100 to another board, arduino uno with same scetch. And that not work to, send me same "Failed to configure Ethernet using DHCP".

loathingKernel commented 5 years ago

If I understand correctly, the bootloader works correctly, meaning you can upload a sketch to your mega, but the sketch itself fails to run afterwards. Is that correct?

If so, can you try to hardcode your network settings instead of using DHCP to get them? I am not sure what Ethernet library might be doing, but when your sketch runs, the network settings are already set in W5100, and Ethernet might bail out because of that.

buzzik commented 5 years ago

Sorry, I found the solution. That was a bug of w5100 our chienes friends put wrong resistors and w5100 didnt work with network switches. https://forum.mysensors.org/topic/9345/ethernet-gateway-w5100-not-working-on-an-ethernet-switch/12

Thank you for your answer )))

buzzik commented 5 years ago

Problem solved, bootloader not guilty :)