Skip to content

Commit

Permalink
Support for Teensy 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vjmuzik committed May 8, 2020
1 parent 0c22c08 commit 76ddb39
Show file tree
Hide file tree
Showing 37 changed files with 933 additions and 984 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

.DS_Store
71 changes: 8 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,14 @@
# Improved Performance Ethernet Library
# Native Ethernet Library For Teensy 4.1

Wiznet chips W5100, W5200 and W5500 are automatically detected.
Teensy 4.1 is automatically configured for Ethernet use.
This library uses my FNET fork and is a required download.
https://github.com/vjmuzik/FNET

Efficient block mode of W5200 & W5500 are used for data and multi-byte register access.

Wiznet socket registers are cached, which greatly reduces SPI communication overhead, at the cost of a small increase in RAM usage. TCP connections and UDP packets accessed in small chunks typically see a substantial performance boost.
Just change <Ethernet.h> to <NativeEthernet.h> to use this library and the rest is taken care of.
The API is a direct replacement for the normal Ethernet.h library aside from sketches that use direct calls to w5100.h

Adafruit's Ethernet.init(CSPIN) extension is supported, to allow use of different pins for the chip select signal. Optimized direct register I/O is used for most Arduino compatible boards.

http://www.pjrc.com/teensy/td_libs_Ethernet.html

![](http://www.pjrc.com/store/wiz820_assem5.jpg)

### Tested Hardware
I've done quite a bit of testing to ensure compatibility as much as possible, but if you find any issues please report them.


| Board | Chip | Shield / Module | Internet | Local (LAN) |
| --------------------- | :---: | :-------------------: | ------------: | ------------: |
| Teensy 3.6 | W5500 | WIZ850io | 212.59 | 1143.58 |
| Teensy 3.6 | W5200 | WIZ820io | 202.44 | 1102.71 |
| Teensy 3.6 | W5100 | WIZ812MJ | 180.76 | 274.14 |
| ESP32 Feather | W5500 | Featherwing Ethernet | 211.06 | 965.76 |
| Teensy 3.2 | W5500 | WIZ850io | 205.37 | 958.06 |
| Teensy 3.2 | W5200 | WIZ820io | 215.44 | 914.78 |
| Teensy 3.2 | W5100 | WIZ812MJ | 170.07 | 234.55 |
| ChipKit Uno32 | W5500 | Seeed Ethernet W5500 | 177.19 | 858.81 |
| ChipKit Uno32 | W5200 | WIZ820io | 188.31 | 837.56 |
| ChipKit Uno32 | W5100 | Ethernet R2 (clone) | 159.72 | 272.18 |
| Arduino Due | W5500 | Seeed Ethernet | 214.44 | 689.69 |
| Arduino Due | W5200 | WIZ820io | 206.51 | 670.88 |
| Arduino Due | W5100 | Arduino Ethernet R3 | 105.98 | 109.73 |
| ESP8266 Feather | W5500 | Featherwing Ethernet | fail (dns) | 583.31 |
| Teensy LC | W5500 | WIZ850io | 200.51 | 479.73 |
| Teensy LC | W5200 | WIZ820io | 199.62 | 471.95 |
| Teensy LC | W5100 | WIZ812MJ | 126.40 | 137.77 |
| Arduino 101 (Intel) | W5500 | Seeed Ethernet W5500 | 168.96 | 359.32 |
| Arduino 101 (Intel) | W5200 | WIZ820io | 169.37 | 349.35 |
| Arduino 101 (Intel) | W5100 | Arduino Ethernet R3 | 42.39 | 43.60 |
| Teensy 2.0 | W5100 | WIZ812MJ | 81.07 | 84.85 |
| Arduino Uno R3 | W5500 | Seeed Ethernet W5500 | 185.44 | 329.00 |
| Arduino Uno R3 | W5500 | Arduino.org Ethernet2 | 195.32 | 329.60 |
| Arduino Uno R3 | W5200 | WIZ820io | 191.85 | 331.27 |
| Arduino Uno R3 | W5100 | Arduino Ethernet R3 | 79.11 | 82.66 |
| Arduino Uno R3 | W5100 | Ethernet R2 (clone) | 79.27 | 82.66 |
| Arduino Leonardo | W5500 | Seeed Ethernet W5500 | 179.98 | 328.14 |
| Arduino Leonardo | W5200 | WIZ820io | 183.69 | 330.30 |
| Arduino Leonardo | W5100 | Ethernet R2 (clone) | 78.75 | 82.28 |
| Mega 2560 (clone) | W5500 | Seeed Ethernet W5500 | 179.58 | 323.36 |
| Mega 2560 (clone) | W5200 | WIZ820io | 172.73 | 325.44 |
| Mega 2560 (clone) | W5100 | Ethernet R2 (clone) | 74.31 | 77.44 |
| Arduino Zero | W5500 | Seeed Ethernet W5500 | 183.13 | 305.26 |
| Arduino Zero | W5500 | Arduino.org Ethernet2 | 181.60 | 305.28 |
| Arduino Zero | W5200 | WIZ820io | 177.53 | 298.53 |
| Arduino Zero | W5100 | Arduino Ethernet R3 | 91.33 | 96.64 |
| Arduino Zero | W5100 | Ethernet R2 (clone) | 91.42 | 96.64 |
| Arduino MKR1000 | W5500 | MKR ETH | 181.27 | 298.93 |
| Arduino MKR1000 | W5200 | WIZ820io | 125.20 | 291.98 |
| Arduino Uno Wifi Rev2 | W5500 | Seeed Ethernet W5500 | 163.86 | 213.36 |
| Arduino Uno Wifi Rev2 | W5500 | Arduino.org Ethernet2 | 169.72 | 212.88 |
| Arduino Uno Wifi Rev2 | W5200 | WIZ820io | 161.94 | 212.19 |
| Arduino Uno Wifi Rev2 | W5100 | Arduino.org Ethernet2 | 69.50 | 72.23 |
| Arduino Uno Wifi Rev2 | W5100 | Ethernet R2 (clone) | 69.55 | 72.30 |

For more information about these benchmarks:
https://www.pjrc.com/arduino-ethernet-library-2-0-0/

ESP32 may require edit to SPI.h to add SPI.transfer(data, size)
https://github.com/espressif/arduino-esp32/issues/1623
http://www.pjrc.com/teensy/td_libs_Ethernet.html
2 changes: 1 addition & 1 deletion examples/AdvancedChatServer/AdvancedChatServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/

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

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
by Tom Igoe
*/

#include <Ethernet.h>
#include <NativeEthernet.h>
// the sensor communicates using SPI, so include the library:
#include <SPI.h>

Expand Down
2 changes: 1 addition & 1 deletion examples/ChatServer/ChatServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

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

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network.
Expand Down
2 changes: 1 addition & 1 deletion examples/DhcpAddressPrinter/DhcpAddressPrinter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

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

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
Expand Down
2 changes: 1 addition & 1 deletion examples/DhcpChatServer/DhcpChatServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

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

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network.
Expand Down
2 changes: 1 addition & 1 deletion examples/LinkStatus/LinkStatus.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

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

void setup() {
// You can use Ethernet.init(pin) to configure the CS pin
Expand Down
2 changes: 1 addition & 1 deletion examples/PachubeClient/PachubeClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/

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

#define APIKEY "YOUR API KEY GOES HERE" // replace your pachube api key here
#define FEEDID 00000 // replace your feed ID
Expand Down
2 changes: 1 addition & 1 deletion examples/PachubeClientString/PachubeClientString.ino
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/

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


#define APIKEY "YOUR API KEY GOES HERE" // replace your Pachube api key here
Expand Down
2 changes: 1 addition & 1 deletion examples/TelnetClient/TelnetClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

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

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
Expand Down
2 changes: 1 addition & 1 deletion examples/TwitterClient/TwitterClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
#include <SPI.h>
#include <Ethernet.h>
#include <NativeEthernet.h>


// Enter a MAC address and IP address for your controller below.
Expand Down
4 changes: 2 additions & 2 deletions examples/UDPSendReceiveString/UDPSendReceiveString.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
*/


#include <Ethernet.h>
#include <EthernetUdp.h>
#include <NativeEthernet.h>
#include <NativeEthernetUdp.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
Expand Down
4 changes: 2 additions & 2 deletions examples/UdpNtpClient/UdpNtpClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/

#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <NativeEthernet.h>
#include <NativeEthernetUdp.h>

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
Expand Down
2 changes: 1 addition & 1 deletion examples/WebClient/WebClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

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

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
Expand Down
2 changes: 1 addition & 1 deletion examples/WebClientRepeating/WebClientRepeating.ino
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

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

// assign a MAC address for the ethernet controller.
// fill in your address here:
Expand Down
2 changes: 1 addition & 1 deletion examples/WebServer/WebServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

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

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
Expand Down
2 changes: 1 addition & 1 deletion examples/XivelyClient/XivelyClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/

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

#define APIKEY "YOUR API KEY GOES HERE" // replace your xively api key here
#define FEEDID 00000 // replace your feed ID
Expand Down
2 changes: 1 addition & 1 deletion examples/XivelyClientString/XivelyClientString.ino
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/

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


#define APIKEY "YOUR API KEY GOES HERE" // replace your Xively api key here
Expand Down
6 changes: 3 additions & 3 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "Ethernet",
"name": "NativeEthernet",
"keywords": "http, web, server, ethernet",
"description": "Ethernet Library for Teensy",
"description": "Native Ethernet Library for Teensy 4.1",
"repository":
{
"type": "git",
"url": "https://github.com/PaulStoffregen/Ethernet.git"
"url": "https://github.com/vjmuzik/NativeEthernet.git"
},
"frameworks": "arduino",
"platforms": "teensy"
Expand Down
12 changes: 6 additions & 6 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name=Ethernet
version=2.0.0
name=NativeEthernet
version=1.0.0
author=Various (see AUTHORS file for details)
maintainer=Paul Stoffregen <paul@pjrc.com>, Arduino <info@arduino.cc>
sentence=Enables network connection (local and Internet) using the Arduino Ethernet Board or Shield.
paragraph=With this library you can use the Arduino Ethernet (shield or board) to connect to Internet. The library provides both Client and server functionalities. The library permits you to connect to a local network also with DHCP and to resolve DNS.
maintainer=Tino Hernandez <vjmuzik1@gmail.com>
sentence=Enables network connection (local and Internet) using the Native Ethernet on Teensy 4.1.
paragraph=With this library you can use the Native Ethernet (builtin) to connect to the Internet. The library provides both Client and server functionalities. The library permits you to connect to a local network also with DHCP and to resolve DNS.
category=Communication
url=http://www.arduino.cc/en/Reference/Ethernet
architectures=*
includes=Ethernet.h
includes=NativeEthernet.h
Loading

0 comments on commit 76ddb39

Please sign in to comment.