---
title: "IOT-Basisstation"
url: "https://maker.wiznet.io/WIZnet/resellers/iot-basisstation/"
markdown_url: "https://maker.wiznet.io/WIZnet/resellers/iot-basisstation/md"
type: "VAR: Value-Added Reseller Products"
author: "Sebastian Wangnick"
author_url: "http://github.com/wangnick/httpboot"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Sebastian Wangnick"
original_url: "http://github.com/wangnick/httpboot"
published: "2023-04-26"
language: "en"
hardware: ["WIZnet W5500"]
likes: 0
views: 188
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# IOT-Basisstation

> IOT-Basisstation

Original author: Sebastian Wangnick (source: http://github.com/wangnick/httpboot)

## Components

- **WIZnet W5500** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5500))

WIZnet parts: W5500 ([Datasheet](https://docs.wiznet.io/Product/Chip/Ethernet/W5500/datasheet?utm_source=maker&utm_medium=project&utm_campaign=w5500), [product hub](https://maker.wiznet.io/products/w5500/))

## Article

**DETAILS**

> ### ***IoT base station ***
>
> *The author has posted a very interesting idea used W5500. Unlike other open source approaches loads the bootloader software not using TFTP from the local network, but via HTTP from the Internet. Below is the post content.*

#### **Idea**

A universal [Atmega1284P](http://www.atmel.com/devices/atmega1284p.aspx) board with Ethernet and an Internet bootloader, more compact than an [Arduino Ethernet](http://arduino.cc/en/Main/ArduinoBoardEthernet) and using the more recent [W5500](http://www.wiznet.co.kr/w5500) from WizNet (obtainable in Europe for instance from [TME](http://www.tme.eu/de/details/w5500)) which allows faster transmissions than the previous W5100.

#### **Hardware-Design Version V02**

| Schematics | [![](https://maker.wiznet.io/upload/mirror/body/9f1625277f210c245efc.png)](http://s.wangnick.de/lib/exe/fetch.php?media=w5500-mega-v02-final-sch.png) | Layout | [![](http://s.wangnick.de/lib/exe/fetch.php?w=200&tok=b6628b&media=w5500-mega-v02-final-brd.png)](http://s.wangnick.de/lib/exe/fetch.php?media=w5500-mega-v02-final-brd.png) |
| --- | --- | --- | --- |
| Frontside | [![](https://maker.wiznet.io/upload/mirror/body/a8b97df5497e64b37f77.jpg)](http://s.wangnick.de/lib/exe/fetch.php?media=dsc_1428_w5500_mega_v02.jpg) | Backside | [![](http://s.wangnick.de/lib/exe/fetch.php?w=200&tok=49af99&media=dsc_1429_w5500_mega_v02.jpg)](http://s.wangnick.de/lib/exe/fetch.php?media=dsc_1429_w5500_mega_v02.jpg) |
| Assembly | [![](http://s.wangnick.de/lib/exe/fetch.php?w=200&tok=265aa4&media=dsc_1431_w5500_mega_v02.jpg)](http://s.wangnick.de/lib/exe/fetch.php?media=dsc_1431_w5500_mega_v02.jpg) | Assembled PCBs | [![](http://s.wangnick.de/lib/exe/fetch.php?w=200&tok=5994c7&media=dsc_1485.jpg)](http://s.wangnick.de/lib/exe/fetch.php?media=dsc_1485.jpg) |

#### **Corrections and lessons learned**

This was my first attempt to design a PCB, and obviously I made quite a few mistakes. Lessons learned include:

Check for zero *airwires*. The connection from the ISP reset header to the push button was accidentally left unrouted, and had to be bridged with 0.2mm enameled copper wire on the backside.

Positioning the *silkscreen*. Bad mistake. I left all silkscreen print as defaulted by Eaglem and promptly confused two parts when soldering. Took quite some time to find the mistake.

*VCC headers* would be helpful.

*JTAG headers* are missing, and the Atmega1284P does not allow to debug by ISP via DebugWire.

Check the *footprint*. First select the components, check the prices and the delivery status, and order, and only then complete the footprint layout. Micro-SD sockets are not all similar regarding footprint, and the push button also barely matched its footprint.

*DTR reset*. Using the Arduino Ethernet libraries, it makes sense to remain compatible with the Arduino IDE deployment mechanism, which requires a header for the DTR line that connects to !RESET via a capacitor.

*GND→NC.* In case someone notices the cutaway pins 38-42 of the W5500: Datasheets can change, and where these pins we declared as “must be tied to GND” in version 1.0, version 1.0.2 declares them “NC”. Tieing to GND would probably still work fine, though …

*SD-SPI.* According to the [SD card specification](http://www.sdcard.org/downloads/pls/simplified_specs/part1_410.pdf) every SD card powers on in *SD* bus mode. However, we have to switch to the *SPI* bus mode. Worse: In SD bus mode the connectors of the SD card have different usage, and therefore any newly plugged in SD card (in SD bus mode) will disrupt both SPI communication with the W5500 as well as reprogramming via ISP.

#### **Internet bootloader**

Different from other open source approaches ([Sowerbutts](http://sowerbutts.com/optiboot-w5100), [Ariadne](http://github.com/codebendercc/Ariadne-Bootloader), [Ethernut](http://www.ethernut.de/), [Ethersex](http://www.ethersex.de/), and miscellaneous others at [http://www.mikrocontroller.net](http://www.mikrocontroller.net/)), my bootloader obtains the application software not via TFTP from a local server, but rather via HTTP from any given server on the Internet. This allows remote deployment and software upgrade. Please note that the current bootloader is not resilient against [MitM-Attacks](http://en.wikipedia.org/wiki/Man-in-the-middle_attack) etc.

How does it work? The Eeprom contains, in addition to a MAC address, also the URL of the boot server. Upon every reset the bootloader starts, retrieves new software from the boot server as necessary and programs it into flash memory, activates the watchdog, and starts the application software. Flash pages that did not change are not overwritten (in order to protect the flash lifetime in case of reboot loops). The application software must regularily feed the watchdog, otherwise a reset is triggered which reactivates the bootloader.

The bootloader can retrieve the startup IP addresses (own, gateway, DNS server) and the netmask either from the Eeprom as well, or via [DHCP](http://en.wikipedia.org/wiki/DHCP); the IP address of the boot server is retrieved via [DNS](http://en.wikipedia.org/wiki/DNS).

[![](http://s.wangnick.de/lib/exe/fetch.php?w=200&tok=51fa8d&media=phpmyadmin.png)](http://s.wangnick.de/lib/exe/fetch.php?media=phpmyadmin.png)The URL should contain a unique system id (`hwid`) as parameter, in order to allow the boot server to maintain a mapping between systems and their current application software, for instance via MqSQL/phpmyadmin (see screen dump). Within the URL the bootloader also transmits its own identifier (`loaderid`, composed from `__FILE__ " " __DATE__ " " __TIME__`) and the cause of the reset. The bootloader expects to receive an [Intel_HEX](http://en.wikipedia.org/wiki/Intel_HEX) file in the body of the reply to the HTTP GET request. It supports type 00, 01 and 02 records, which are exactly those produced by avr-gcc (Atmel Studio, Arduino).

The complete source code of the bootloader can be found at <http://github.com/wangnick/httpboot>.

#### **Internet boot server**

The [Internet boot server](http://s.wangnick.de/doku.php?id=internet-bootserver) is a simple Python script in my case, connected to a MySQL database, and a file system containing application software in Intel HEX format. The boot server also registers and stores every boot request (in order to detect and debug reboot loops) in a dedicated database table.

#### **Respective discussions in www.mikrocontroller.net**

<http://www.mikrocontroller.net/topic/313426>

<http://www.mikrocontroller.net/topic/318844>

<http://www.mikrocontroller.net/topic/323208>

<http://www.mikrocontroller.net/topic/325077>

---

Source: https://maker.wiznet.io/WIZnet/resellers/iot-basisstation/
