Uploading Sketch On Ethernet Board Through Network

Hello, I am trying to figure out how to upload a sketch to my Arduino Ethernet (w/ POE) through an ethernet cable based on steps from Freetronics (url: http://www.freetronics.com/pages/how-to-upload-a-sketch-to-your-arduino-via-a-network#.UdOeAm3hdy8).
My USBTinyISP v3.0 was able to burn the bootloader no problem using the Arduino-TFTPBoot from Github (url: Downloads · freetronics/arduino-tftpboot · GitHub).
The “WriteNetworkSettings” example from that library needs to configure the network. On my Windows 7, I went to the cmd Prompt to get my network addresses:
What the Library Asks For What I Equate it to In cmd
Gateway IP Address Default Gateway
Arduino Device IP Address IPv4 Address
Subnet Mask Subnet Mask

Then I uploaded the WriteNetworkSettings example code, and reburned the bootloader (part of the steps from Freetronics)

#include <EEPROM.h>

uint8_t NetworkSettings[] = {
  0x55, 0xAA, // Signature
  0xFF, // Image Status (bad)
  
  // EEPROM block starts here
  10,1,1,1,                       // Gateway IP address
  255,0,0,0,                      // Subnet mask
  0x12,0x34,0x45,0x78,0x9A,0xBC,  // MAC address
  10,1,1,20,                      // Arduino device IP address
};

void setup() {
  for (int address = 0; address < sizeof(NetworkSettings)/sizeof(uint8_t); address++) {
    EEPROM.write(address, NetworkSettings[address]);
  }
  pinMode(9, OUTPUT);     
}
void loop() {
  digitalWrite(9, HIGH);
  delay(100);
  digitalWrite(9, LOW);
  delay(100);
}

To check that my computer is connecting to the Ethernet board, I pinged the Ethernet board (I believe I’m pinging the correct device. I ping the IP Address my computer uses when I turn off the WiFi and use the Ethernet cord; the same one which I later plug into the Ethernet board).
I then returned to ‘cmd’ and typed in the path to my avr-object and got a list of options:


…and so forth. Which I believe is good since it’s not an error.

From there I put in the path to my test sketch, but I got the following error:

I’m not sure what that error means, but it’s holding me up from moving forward. Thanks

Are you really sure you have configured your network with a network mask of 255.0.0.0? This is quite unusual, no home router I'm aware of uses that as it's default setting.

You have to specify the complete path to your avr-objcopy executable because it's not in the standard executable path. So your command has to look like this:

C:\Users\Arduino\Desktop\Arduino\arduino-1.0.3\hardware\tools\avr\bin\avr-objcopy.exe -j .text -j .data -O binary C:\Users\Arduino\AppData\Local\Temp\build5384361910356812517.tmp\BlinkUploadTest.cpp.elf BlinkUploadTest.bin

You may have to change the paths if you've change anything in the meantime (IDE version, new compile run, etc.).

Are you really sure you have configured your network with a network mask of 255.0.0.0?

You’re correct, my Network Mask is 255.255.255.0. The addresses you saw in my previous post were the default addresses coded into the program, not the addresses that I actually used when trying to upload.

Thank you for the help. You were correct about me needing to specify my complete path. I no longer saw the error. However, after including the pathway, I simply got nothing. Just another prompt to enter more instructions to cmd (C:\Users\Arduino>):

I’m not sure if the command was successful or if it did nothing. Regardless, I moved onto the next step and entered the tftp put request to upload the sketch to the board, but got the following message instead (the IP address in the command is supposed to be the one going into the Ethernet board. I got that address by plugging the Ethernet cord into my laptop, turning the Wifi off, and using the cmd window to read my IP Address. Then I took the Ethernet cable and plugged it into the Ethernet board and turned my Wifi back on):

“The -i switch indicates you want to send the file in binary form” (from Freetronics). I reset my Ethernet board to complete the upload, but the file was not transferred to it.

So I decided to restart the process and go through all the steps up to the tftp put request. At that point, I closed the cmd session and started a new one, immediately trying to use the tftp put request. I did this because the instructions on Freetronics, at the point of using the tftp put, say:

  1. Open a console command line window.

  2. Perform the upload by typing:

tftp -i put .bin

When the first line said to open a console command line window, it sounds to me like it’s implying the previous command line window (cmd session) was closed. But doing that simply gave me a “Connect request failed” line:

I’m not sure if that error is due to the fact that I did not go through the previous steps in the same session, and simply began the session with a tftp put command, or maybe there is a problem trying to connect to the Ethernet board (wrong IP address, etc).

Are you able to ping the Arduino at 192.168.2.211?

Did you press the reset button after issuing the TFTP command (step 4 in the tutorial)? That has to be done within a few seconds after issuing the TFTP command, else it won't work (because the bootloader doesn't get activated).

Artie:

Are you really sure you have configured your network with a network mask of 255.0.0.0?

You’re correct, my Network Mask is 255.255.255.0. The addresses you saw in my previous post were the default addresses coded into the program, not the addresses that I actually used when trying to upload.

Thank you for the help. You were correct about me needing to specify my complete path. I no longer saw the error. However, after including the pathway, I simply got nothing. Just another prompt to enter more instructions to cmd (C:\Users\Arduino>):

I’m not sure if the command was successful or if it did nothing. Regardless, I moved onto the next step and entered the tftp put request to upload the sketch to the board, but got the following message instead (the IP address in the command is supposed to be the one going into the Ethernet board. I got that address by plugging the Ethernet cord into my laptop, turning the Wifi off, and using the cmd window to read my IP Address. Then I took the Ethernet cable and plugged it into the Ethernet board and turned my Wifi back on):

“The -i switch indicates you want to send the file in binary form” (from Freetronics). I reset my Ethernet board to complete the upload, but the file was not transferred to it.

So I decided to restart the process and go through all the steps up to the tftp put request. At that point, I closed the cmd session and started a new one, immediately trying to use the tftp put request. I did this because the instructions on Freetronics, at the point of using the tftp put, say:

  1. Open a console command line window.

  2. Perform the upload by typing:

tftp -i put .bin

When the first line said to open a console command line window, it sounds to me like it’s implying the previous command line window (cmd session) was closed. But doing that simply gave me a “Connect request failed” line:

I’m not sure if that error is due to the fact that I did not go through the previous steps in the same session, and simply began the session with a tftp put command, or maybe there is a problem trying to connect to the Ethernet board (wrong IP address, etc).

Umm - you might want to try the PUT command with your TFTP commandline - otherwise it does not know what it is doing

Also you have jumped around with different addresses etc - i would suggest you provide some info in relation to what your network really looks like so we can make sure all the parameters are correct.

Craig

I’m pretty embarrassed since I now realize that I wasn’t using the correct IP Address for the Ethernet board. Previously I had simply connected the Ethernet cable to my computer, turned off all the WiFi, found the IP Address coming from the Ethernet cable, and used that as my Arduino Ethernet board IP Address (since I would be plugging that same Ethernet cable into it). Then I finally used an example code and found a different IP Address, which I assume gives me the correct Ethernet Board IP Address:

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

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 
  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void setup() {
  // start the serial library:
  Serial.begin(9600);
  // 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:
    for(;;)
      ;
  }
  // print your local IP address:
  Serial.println(Ethernet.localIP());

}

void loop() {

}

Nonetheless I am not getting the program to upload to the Ethernet Board through the network. I will get to the TFTP Put request line, but the connection times out, and ultimately fails. After a number of different attempts, including me pushing the reset button at different times as the program is trying to upload (thank you for the suggestion, pylon), I tried pinging the Ethernet board, and it came back positive that the Ethernet board is detected:

After confirming the detection, I immediately tried to get the program uploading, but ran into the same problems as before.

In your sketch you’re using DHCP to provide an IP address to the Arduino. The TFTP bootloader doesn’t support that. Did you follow the section in the tutorial titled “Storing your network settings”? If you did, provide all the information about your network you used there. Also provide a description of the hardware your network consists of as well as all the parameters you used to configure it. Describe or make a picture of how you connected your Arduino to the network or to the PC.

When I get my new Arduino Ethernet board I will go back through and provide all the information below that you asked for. For some reason my 3.3v and GND have shorted. It happened shortly after I had the PoE and USB connected to the board at the same time. I heard a winding sound when I got the new IP Address and then powered the board with PoE only. I doubt that having the PoE and USB plugged in at the same time caused the short, as I've done that numerous times, but I have no clue why the short exists now (and this isn't the first time it's happened). Thanks for all the help thus far, and I look forward to getting back to this project as soon as possible.