tftpboot network settings

The EtherTen combines an Uno-equivalent Arduino-compatible board and Wiznet-based Ethernet support, along with a microSD card slot and Power-over-Ethernet support. [Product page]
andrewjfox
Posts: 14
Joined: Tue Feb 04, 2014 1:12 am

tftpboot network settings

Post by andrewjfox » Tue Mar 24, 2015 10:53 pm

Hi All,

I'm about to try getting the tftp bootloader working on my system (EtherTen), but was wondering if I can program the network settings to EEPROM from within my application.

- What are the EEPROM addresses used by the bootloader and what is the format of the data?

I want to know if the following would work, or if uploading my sketch would overwrite the EEPROM;

1. program Etherten with tftp bootloader as per tutorial (very much appreciated by the way)
2. in my application sketch, reserve the EEPROM addresses used by the bootloader,
3. upload my application sketch, using the tftpboot default network settings
4. from within my application, write the new network settings I want to use for bootloader
5. on subsequent resets, the bootloader will use the updated network settings

Thanks in advance
Andrew

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: tftpboot network settings

Post by angusgr » Wed Mar 25, 2015 4:14 am

Hi Andrew,

This should be very possible. Probably the easiest way is to read through the WriteNetworkSettings sketch in the ArduinoFTP library (comes with the bootloader). You can find it under File > Examples > ArduinoFTP > WriteNetworkSettings.

If you copy the relevant parts of the code from there into your sketch, you'll be able to update the bootloader settings programmatically.

Angus

andrewjfox
Posts: 14
Joined: Tue Feb 04, 2014 1:12 am

Re: tftpboot network settings

Post by andrewjfox » Tue Mar 31, 2015 2:17 am

Hi,

Thanks for reply. I'm in the process of testing this out but am having lots of trouble getting bootloader to work. Would you be able to do an updated tutorial covering the changes required for latest IDE 1.6.1 (or even 1.5 or later).

I'm using Etherten board with freetronics USBasp programmer.

I found a link covering the changes required to get the goldilocks board recognized and followed steps to get the TFTP bootloader (no board) recognized

- transferred the arduino-tftpboot folder to the hardware folder under Program Files (x86)\Arduino\hardware\
- renamed arduino-tftpboot to freetronics so it looks like c:\Program Files (x86)\Arduino\hardware\freetronics\avr\bootloaders\arduno-tftpboot\*.hex
- copied and modified the platform and programmers txt files

### changed following line in platform.txt
name=Freetronics

## deleted contents of programmers.txt

- copied the boards.txt from original arduino-tftpboot

This finally got the board to appear in the tools->boards list, however when I tried to burm bootloader it stopped on error with lock bits. I had to uncomment both the lock/unlock bits lines so my boards.txt now looks like following (complete)

##############
arduino-tftpboot.name = TFTP Bootloader ATmega328 (No Upload)

arduino-tftpboot.build.mcu = atmega328p
arduino-tftpboot.build.f_cpu = 16000000L
arduino-tftpboot.build.core = arduino:arduino
arduino-tftpboot.build.variant = arduino:standard

arduino-tftpboot.upload.maximum_size = 28672

arduino-tftpboot.bootloader.tool=avrdude
arduino-tftpboot.bootloader.low_fuses=0xFF
arduino-tftpboot.bootloader.high_fuses=0xD0
arduino-tftpboot.bootloader.extended_fuses=0x05
arduino-tftpboot.bootloader.file=arduino-tftpboot\arduino-tftpboot-bootloader-m328.hex
arduino-tftpboot.bootloader.unlock_bits=0x3F
arduino-tftpboot.bootloader.lock_bits=0x0F

###############

Now it burns the bootloader ok, but I can't see the device on the network. I'm using a static network (just my PC connected to Arduino), and have set my PC to static settings compatible with tftpboot default settings

I've verified that programmer works ok by reverting board back to Uno (optiboot) which worked fine

Any suggestions?

andrewjfox
Posts: 14
Joined: Tue Feb 04, 2014 1:12 am

Re: tftpboot network settings

Post by andrewjfox » Wed Apr 01, 2015 3:30 am

Alright, things are getting weird now.

All following is on etherten with USBasp from freetronics. I have direct network cable between my PC and etherten with static IP settings on PC.
I've tried many different combinations of tftp/network bootloader trying to get it to work, in all cases bootloader burns ok and verifies, but cannot ping device, however I know device-PC setup works because if I reprogram Uno Optiboot and upload a sketch that sets the same network settings, I can ping device no problems.

Freetronics tftp booloader
- tried burning bootloader both from within IDE and directly with AVRDUDESS (avrdude gui)
- checked that EEPROM is erased so uses default settings
- also tried loading network settings directly into EEPROM using avrdude

Original TFTP Bootloader from arduino playground, http://playground.arduino.cc/Code/TFTPBootloader1
- tried burning bootloader directly with AVRDUDESS (avrdude gui)
- checked that EEPROM is erased so uses default settings
- also tried loading network settings directly into EEPROM using avrdude

Ariadne network bootloader, https://github.com/codebendercc/Ariadne-Bootloader
- tried burning directly using avrdude, as well as tried using board settings in Arduino IDE (1.6.1)

Nothing, nada, zip!

Does anyone have any similar experiences?
Is there some setting or hardware difference on the etherten vs uno + shield that might cause these bootloaders to not work?

Any and all suggestions would be welcome.

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: tftpboot network settings

Post by angusgr » Tue Apr 07, 2015 11:18 pm

andrewjfox wrote: Does anyone have any similar experiences?
Is there some setting or hardware difference on the etherten vs uno + shield that might cause these bootloaders to not work?
Hi Andrew,

Sorry, I can't explain this. The experience with the EtherTen should be basically identical to Uno+Shield.

There is sometimes a need to briefly delay after startup to allow the W5100 to start up (as noted here, but this isn't unique to the EtherTen and the TFTP bootloaders already include this delay so that's not the problem.

Are there any other quirks you experience when connecting the EtherTen via a normal Ethernet sketch? Are you certain the EEPROM is being erased/set correctly?

Angus

andrewjfox
Posts: 14
Joined: Tue Feb 04, 2014 1:12 am

Re: tftpboot network settings

Post by andrewjfox » Thu Apr 09, 2015 12:13 am

Hi,

I've rechecked everything and all seems ok. If I reload the Uno bootloader and an ethernet sketch, I'm able to ping the device ok.

I'm now using AVRDUDESS to load bootloaders in case I haven't setup the Arduino IDE correctly. I totally erase flash and eeprom, then load the tftpboot bootloader (as intel hex file). This programs and verifies ok. I also read back the eeprom to a file to check and it is totally erased. I have a LED on pin9 which is flashing once booloader programmed, and the ethernet status lights are flashing. I see both Rx and Tx flashing but I also tried wireshark and there's no activity from the device. The device just doesn't want to respond to anything, even though it appears to be working as expected.

I'm running the board from USB power just in case that makes any difference

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: tftpboot network settings

Post by angusgr » Thu Apr 09, 2015 10:11 pm

andrewjfox wrote: I'm running the board from USB power just in case that makes any difference
Some people have found this to be a problem, so we recommend running from DC when using the Ethernet. That said, if normal Ethernet sketches work with the same power configuration then I can't explain why the bootloader ethernet would fail.

andrewjfox
Posts: 14
Joined: Tue Feb 04, 2014 1:12 am

Re: tftpboot network settings

Post by andrewjfox » Mon Apr 13, 2015 11:11 pm

Yes it does appear to be the power. Using a 7V plugpack solved the problem. Can't believe I went round in circles for days. When I tested with a normal ethernet sketch it must have been a different USB port, or maybe it was just borderline.

Thanks for the replies and advice

andrewjfox
Posts: 14
Joined: Tue Feb 04, 2014 1:12 am

Re: tftpboot network settings

Post by andrewjfox » Tue Apr 14, 2015 2:28 am

Ok, 1 step forward, 1 step back.

I can now ping device on the network, however having trouble opening tftp connection. When I look at connection on wireshark the Etherten is responding to the tftp request with destination unreachable (port unreachable)

I'm using windows 7 tftp client, which is trying to send file using Write Request to the Etherten bootloader over UDP to destination port 69. The etherten is responding with ICMP message that port is unreachable. Do I need to reconfigure anything for the TFTP client on a different port or protocol. I read that port 69 is the default port used by the tftp bootloader so it should be responding ok.

andrewjfox
Posts: 14
Joined: Tue Feb 04, 2014 1:12 am

Re: tftpboot network settings

Post by andrewjfox » Tue Apr 14, 2015 3:52 am

sorry for post without due diligence. turns out it was a firewall problem. Now all seems to be working ok

- can ping device
- can download new bin file over network using tftp client

Andrew

Post Reply