Quantcast
Channel: SparkFun Tutorials
Viewing all articles
Browse latest Browse all 1123

MicroMod Ethernet Function Board - W5500 Hookup Guide

$
0
0

MicroMod Ethernet Function Board - W5500 Hookup Guide a learn.sparkfun.com tutorial

Available online at: http://sfe.io/t2062

Introduction

Integrate your MicroMod project into an Ethernet network including Power-over-Ethernet with the SparkFun MicroMod Ethernet Function Board - W5500. This Function Board uses the W5500 Ethernet control module from WIZnet and a DC/DC converter to configure a MicroMod assembly as a connected and powered device into an Ethernet network with Power-over-Ethernet (PoE) capabilities.

SparkFun MicroMod Ethernet Function Board - W5500

SparkFun MicroMod Ethernet Function Board - W5500

COM-18708
$29.95

The W5500 is a TCI/IP embedded Ethernet controller from WIZnet that uses SPI and supports up to 80 MHz speeds. We designed this Function Board to use the IEEE802.3af Alternative B power scheme which uses the spare pairs for power delivery, isolated from the data pairs. In this guide we'll highlight the capabilities of the W5500 and demonstrate how to use the MicroMod Ethernet Function Board to create an Ethernet network that can also be used for PoE.

Required Materials

Following along with this tutorial requires a few items along with the MicroMod Ethernet Function Board. Depending on what you already have, you may not need all of the items listed below.

MicroMod Processor

All MicroMod systems require a Processor board to operate. SparkFun carries a variety of Processor boards suited for different applications. Select the Processor board that best suits your Ethernet projects' needs:

SparkFun MicroMod STM32 Processor

SparkFun MicroMod STM32 Processor

DEV-17713
$16.50
SparkFun MicroMod SAMD51 Processor

SparkFun MicroMod SAMD51 Processor

DEV-16791
$18.95
1
SparkFun MicroMod ESP32 Processor

SparkFun MicroMod ESP32 Processor

WRL-16781
$16.95
1
SparkFun MicroMod Teensy Processor

SparkFun MicroMod Teensy Processor

DEV-16402
$21.50
2

Note: Currently the Artemis and nRF52840 do not have built in Ethernet libraries in their Arduino cores. An external Arduino Ethernet library may work but at this time Ethernet is not supported on those Processors.

MicroMod Main Board

MicroMod Function Boards require at least one Main Board to work.

SparkFun MicroMod Main Board - Double

SparkFun MicroMod Main Board - Double

DEV-18576
$17.95
SparkFun MicroMod Main Board - Single

SparkFun MicroMod Main Board - Single

DEV-18575
$14.95

Peripheral Items

You'll also need a PoE power supply like a network hub or router, Ethernet cable, network hub/router or endpoint as well as a few other peripheral items to get your MicroMod Ethernet system up and running. If needed, add these items to your cart:

USB 3.1 Cable A to C - 3 Foot

USB 3.1 Cable A to C - 3 Foot

CAB-14743
$5.50
3
Reversible USB A to C Cable - 2m

Reversible USB A to C Cable - 2m

CAB-15424
$8.95
CAT 6 Cable - 3ft

CAT 6 Cable - 3ft

CAB-08915
$2.10

Tools

Assembling MicroMod systems requires a Phillips head screwdriver.

Pocket Screwdriver Set

Pocket Screwdriver Set

TOL-12891
$4.50
5
SparkFun Mini Screwdriver

SparkFun Mini Screwdriver

TOL-09146
$1.05
3

Recommended Reading

The MicroMod ecosystem is a unique way to allow users to customize their project to their needs. If you aren't familiar with the MicroMod system, click on the banner below for more information.

MicroMod Logo


You may also want to read the tutorials below if you are not familiar with the concepts covered in them:

Serial Peripheral Interface (SPI)

SPI is commonly used to connect microcontrollers to peripherals such as sensors, shift registers, and SD cards.

What is an Arduino?

What is this 'Arduino' thing anyway? This tutorials dives into what an Arduino is and along with Arduino projects and widgets.

Installing Arduino IDE

A step-by-step guide to installing and testing the Arduino software on Windows, Mac, and Linux.

Getting Started with MicroMod

Dive into the world of MicroMod - a compact interface to connect a microcontroller to various peripherals via the M.2 Connector!

Hardware Overview

Let's take a closer look at the hardware on the Ethernet Function Board - W5500 and how it interacts with the rest of the MicroMod ecosystem.

WIZnet W5500 Ethernet Controller

The W5500 Ethernet Controller from WIZnet is a TCP/IP embedded Ethernet controller that uses SPI communication protocol to allow up to eight independent sockets operate simultaneously.

Highlighting the W5500 IC
The W5500 supports the following hardwired TCP/IP protocols:
  • TCP
  • UDP
  • ICMP
  • IPv4
  • ARP
  • IGMP
  • PPPoE

The W5500 SPI interface operates at up to 80MHz and supports fast SPI for high speed Ethernet communication. The chip also includes a Wake on Lan (WOL) operation and power down mode to help conserve power. The W5500 operates at 3.3V but has 5V-tolerant I/O. For detailed information on the W5500, refer to the datasheet.

The Function Board includes three solder jumpers connected to the three network mode selection pins to allow users to configure the W5500 network operation mode. By default, the board sets the W5500 to operates in 10/100Base-T with Auto-Negotiation enabled. Read on to the Solder Jumpers portion of this section or refer to the pin descriptions in the datasheet for more information on adjusting the operation mode.

Power

The Ethernet Function Board - W5500 features several power input options including PoE and USB (via the Main Board). By default, the board acts as a PoE Powered Device (PD), receiving voltage over the Ethernet connection using the IEEE802.3af Alternative B power scheme.

Highlighting Power Components and M2 Connector

The Alternate B power scheme uses the spare pairs (pins 4/5 and 7/8) in the Ethernet cable for positive and negative DC voltage, keeping things simple if any troubleshooting is needed. The board includes a pair of PoE isolation jumpers that allows users to isolate these pins from the DC/DC converter input. When opened, the MicroMod assembly can receive power over USB, LiPo battery or through the DC/DC converter input PTH pins. The USB and LiPo power inputs are isolated from the PoE circuit.

DC/DC Converter Circuit

The board uses an Ag9905M Power-over-Ethernet (PoE) DC/DC converter to provide 5V from an Ethernet connection. For complete information on the Ag9905M, refer to the datasheet.

The Ag9905 accepts an input voltage between 36V and 57V but a voltage of 48V or greater is recommended on initial powerup to ensure the module functions properly. After power up, input voltage can be reduced to 36V if needed.

The Ag9905 provides 9 Watts of power for the MicroMod system and any peripheral devices connected to it (i.e. Qwiic breakouts, etc.). The 5V output from the converter is filtered to reduce noise for 5V circuits on the board and is also regulated down to 3.3V.

RJ45 Connector

The RJ45 connector on this function board includes embedded magnetics for PoE applications and is MagJack®-Compatible.

The Function Board uses all pairs on the RJ45 connector by default as the PoE configuration uses the spare pair for power inputs. Users who do not wish to use PoE can isolate these pins for other use by opening the PoE Isolation Jumpers. Reminder, if the PoE pairs are disconnected, power must be supplied from another source, either USB, LiPo battery or via the DC/DC converter input PTH pins on the other side of the PoE Isolation Jumpers.

LEDs

The board has a pair of status LEDs indicating general power and PoE power as well as the pair of LEDs on the RJ45 connector for Link and Activity statuses.

Highlighting LEDs

Solder Jumpers

There are thirteen solder jumpers on the Function Board. The table below outlines their labels and functions:

Highlighting solder jumpers
Having trouble seeing the detail in this image? Click on it for a larger view.
LabelDefault StateFunctionNotes
PWRCLOSEDCompletes Power LED circuit.Open to disable Power LED.
MEASCLOSEDCompletes VCC circuit tying VCC to 5V input.Open to measure current drawn by the Function Board.
WPOPENPulls EEPROM Write Protect pin to 3.3V/HIGHClose to pull this pin to 0V/LOW to disable write protect.
Dummy LoadCLOSEDCreates a dummy load of 100mA on the DC/DC converter output.Open to disable the dummy load.
Power CarrierCLOSEDSelects power configuration (PoE or USB).Open to disable PoE for VCC_In.
LNKCLOSEDCompletes the RJ45 Link LED circuit.Open to disable the Link LED.
ACTCLOSEDCompletes the RJ45 Activity LED circuit.Open to disable the Activity LED.
POECLOSEDCompletes the PoE Status LED circuit.Open to disable the PoE Status LED.
POE Power (Pair)CLOSEDTies the PoE +/- pins to DC/DC converter input.Open both to isolate Ethernet pairs used for PoE from the DC/DC converter input.
PMODE0OPENTies PMODE0 to 3.3V/HIGH.Adjust this in tandem with the other two PMODE jumpers to switch network modes on the W5500.1
PMODE1OPENTies PMODE1 to 3.3V/HIGH.Adjust this in tandem with the other two PMODE jumpers to switch network modes on the W5500.1
PMODE2OPENTies PMODE2 to 3.3V/HIGH.Adjust this in tandem with the other two PMODE jumpers to switch network modes on the W5500.1


1: Refer to the pin description table in section 1.1 of the datasheet for a detailed overview of setting the network mode.

MicroMod Function Board Pinout

This Function Board uses the following pins on a connected Processor Board:

  • 3.3V & VCC
  • Power Enable
  • SPI - W5500 Communication
  • I2C - EEPROM Communication
  • G0 - W5500 Interrupt
  • G1 - W5500 Chip Select (SPI)
  • G2 - W5500 Reset

For the complete MicroMod Pinout and pins used by this function board, take a look at the tables below:

AUDIOUARTGPIO/BUSI2CSDIOSPI0Dedicated
FunctionBottom
Pin
   Top   
Pin
Function
(Not Connected)75GND
3.3V7473G5 / BUS5
RTC_3V_BATT7271G6 / BUS6
SPI_CS1#SDIO_DATA3 (I/O)7069G7 / BUS7
SDIO_DATA2 (I/O)6867G8
SDIO_DATA1 (I/O)6665G9ADC_D- CAM_HSYNC
SPI_CIPO1SDIO_DATA0 (I/O)6463G10ADC_D+CAM_VSYNC
SPI COPI1SDIO_CMD (I/O)6261SPI_CIPO (I)
SPI SCK1SDIO_SCK (O)6059SPI_COPI (O)LED_DAT
AUD_MCLK (O)5857SPI_SCK (O)LED_CLK
CAM_MCLKPCM_OUTI2S_OUTAUD_OUT5655SPI_CS#
CAM_PCLKPCM_INI2S_INAUD_IN5453I2C_SCL1 (I/O)
PDM_DATAPCM_SYNCI2S_WSAUD_LRCLK5251I2C_SDA1 (I/O)
PDM_CLKPCM_CLKI2S_SCKAUD_BCLK5049BATT_VIN / 3 (I - ADC) (0 to 3.3V)
G4 / BUS44847PWM1
G3 / BUS34645GND
G2 / BUS24443CAN_TX
G1 / BUS14241CAN_RX
G0 / BUS04039GND
A13837USBHOST_D-
GND3635USBHOST_D+
A03433GND
PWM03231Module Key
Module Key3029Module Key
Module Key2827Module Key
Module Key2625Module Key
Module Key2423SWDIO
UART_TX2 (O)2221SWDCK
UART_RX2 (I)2019UART_RX1 (I)
CAM_TRIGD11817UART_TX1 (0)
I2C_INT#1615UART_CTS1 (I)
I2C_SCL (I/0)1413UART_RTS1 (O)
I2C_SDA (I/0)1211BOOT (I - Open Drain)
D0109USB_VIN
SWOG1187GND
RESET# (I - Open Drain)65USB_D-
3.3V_EN43USB_D+
3.3V21GND
DescriptionFunctionBottom
Pin
   Top   
Pin
FunctionDescription
(Not Connected)75GND
-74733.3VPower Supply: 3.3-6V
-7271Power ENPower Enable
-7069-
-6665-
-6463-
-6261-
-6059-
-5857-
-5655-.
-5453-
-5251ETH_RSTW5500 Reset.
-5049ETH_CSW5500 Chip Select
-4847ETH_INTW550 Interrupt Pin
-4645GND
-4443-
-4241-
Write protection pin for the EEPROM. Pull low to enable.EEPROM_WP4039GND
-3837-
EEPROM I2C address configuration.EEPROM_A03635-
EEPROM I2C address configuration.EEPROM_A13433GND
EEPROM I2C address configuration.EEPROM_A23231Module Key
Module Key3029Module Key
Module Key2827Module Key
Module Key2625Module Key
Module Key2423-
-2221I2C_SCLI2C - Clock signal for EEPROM
-2019I2C_SDAI2C - Data signal for EEPROM
-1817-
-1615-
-1413-
-1211-
-109-
-87POCISPI Peripheral Output/Controller Input.
-65PICOSPI Peripheral Input/Controller Output.
-43SCKSPI Clock Signal
-21GND
Signal GroupSignalI/ODescriptionVoltage
Power3.3VI3.3V Source3.3V
GNDReturn current path0V
USB_VINIUSB VIN compliant to USB 2.0 specification. Connect to pins on processor board that require 5V for USB functionality4.8-5.2V
RTC_3V_BATTI3V provided by external coin cell or mini battery. Max draw=100μA. Connect to pins maintaining an RTC during power loss. Can be left NC.3V
3.3V_ENOControls the carrier board's main voltage regulator. Voltage above 1V will enable 3.3V power path.3.3V
BATT_VIN/3ICarrier board raw voltage over 3. 1/3 resistor divider is implemented on carrier board. Amplify the analog signal as needed for full 0-3.3V range3.3V
ResetResetIInput to processor. Open drain with pullup on processor board. Pulling low resets processor.3.3V
BootIInput to processor. Open drain with pullup on processor board. Pulling low puts processor into special boot mode. Can be left NC.3.3V
USBUSB_D±I/OUSB Data ±. Differential serial data interface compliant to USB 2.0 specification. If UART is required for programming, USB± must be routed to a USB-to-serial conversion IC on the processor board.
USB HostUSBHOST_D±I/OFor processors that support USB Host Mode. USB Data±. Differential serial data interface compliant to USB 2.0 specification. Can be left NC.
CANCAN_RXICAN Bus receive data.3.3V
CAN_TXO CAN Bus transmit data.3.3V
UARTUART_RX1IUART receive data.3.3V
UART_TX1OUART transmit data.3.3V
UART_RTS1OUART ready to send.3.3V
UART_CTS1IUART clear to send.3.3V
UART_RX2I2nd UART receive data.3.3V
UART_TX2O2nd UART transmit data.3.3V
I2CI2C_SCLI/OI2C clock. Open drain with pullup on carrier board.3.3V
I2C_SDAI/OI2C data. Open drain with pullup on carrier board3.3V
I2C_INT#IInterrupt notification from carrier board to processor. Open drain with pullup on carrier board. Active LOW3.3V
I2C_SCL1I/O2nd I2C clock. Open drain with pullup on carrier board.3.3V
I2C_SDA1I/O2nd I2C data. Open drain with pullup on carrier board.3.3V
SPISPI_PICOOSPI Peripheral Input/Controller Output.3.3V
SPI_POCIISPI Peripheral Output/Controller Input.3.3V
SPI_SCKOSPI Clock.3.3V
SPI_CS#OSPI Chip Select. Active LOW. Can be routed to GPIO if hardware CS is unused.3.3V
SPI/SDIOSPI_SCK1/SDIO_CLKO2nd SPI Clock. Secondary use is SDIO Clock.3.3V
SPI_PICO1/SDIO_CMDI/O2nd SPI Peripheral Input/Controller Output. Secondary use is SDIO command interface.3.3V
SPI_POCI1/SDIO_DATA0I/O2nd SPI Controller Output/Peripheral Input. Secondary use is SDIO data exchange bit 0.3.3V
SDIO_DATA1I/OSDIO data exchange bit 1.3.3V
SDIO_DATA2I/OSDIO data exchange bit 2.3.3V
SPI_CS1/SDIO_DATA3I/O2nd SPI Chip Select. Secondary use is SDIO data exchange bit 3.3.3V
AudioAUD_MCLKOAudio master clock.3.3V
AUD_OUT/PCM_OUT/I2S_OUT/CAM_MCLKOAudio data output. PCM synchronous data output. I2S serial data out. Camera master clock.3.3V
AUD_IN/PCM_IN/I2S_IN/CAM_PCLKIAudio data input. PCM syncrhonous data input. I2S serial data in. Camera periphperal clock.3.3V
AUD_LRCLK/PCM_SYNC/I2S_WS/PDM_DATAI/OAudio left/right clock. PCM syncrhonous data SYNC. I2S word select. PDM data.3.3V
AUD_BCLK/PCM_CLK/I2S_CLK/PDM_CLKOAudio bit clock. PCM clock. I2S continuous serial clock. PDM clock.3.3V
SWDSWDIOI/OSerial Wire Debug I/O. Connect if processor board supports SWD. Can be left NC.3.3V
SWDCKISerial Wire Debug clock. Connect if processor board supports SWD. Can be left NC.3.3V
ADCA0IAnalog to digital converter 0. Amplify the analog signal as needed to enable full 0-3.3V range.3.3V
A1IAnalog to digital converter 1. Amplify the analog signal as needed to enable full 0-3.3V range.3.3V
PWMPWM0OPulse width modulated output 0.3.3V
PWM1OPulse width modulated output 1.3.3V
DigitalD0I/O General digital input/output pin.3.3V
D1/CAM_TRIGI/OGeneral digital input/output pin. Camera trigger.3.3V
General/BusG0/BUS0I/OGeneral purpose pins. Any unused processor pins should be assigned to Gx with ADC + PWM capable pins given priority (0, 1, 2, etc.) positions. The intent is to guarantee PWM, ADC and Digital Pin functionality on respective ADC/PWM/Digital pins. Gx pins do not guarantee ADC/PWM function. Alternative use is pins can support a fast read/write 8-bit or 4-bit wide bus.3.3V
G1/BUS1I/O3.3V
G2/BUS2I/O3.3V
G3/BUS3I/O3.3V
G4/BUS4I/O3.3V
G5/BUS5I/O3.3V
G6/BUS6I/O3.3V
G7/BUS7I/O3.3V
G8I/OGeneral purpose pin3.3V
G9/ADC_D-/CAM_HSYNCI/ODifferential ADC input if available. Camera horizontal sync.3.3V
G10/ADC_D+/CAM_VSYNCI/ODifferential ADC input if available. Camera vertical sync.3.3V
G11/SWOI/OGeneral purpose pin. Serial Wire Output3.3V

Board Dimensions

The MicroMod Ethernet Function Board matches the MicroMod Function Board standard and measures 1.50" x 2.56" (38.1mm x 65.024mm).

Board Dimensions

Hardware Assembly

If you're not familiar with assembling boards using the MicroMod connection system, head over to the Getting Started with MicroMod tutorial for information on inserting and securing your MicroMod Processor and Function Boards to the Main Board:

Getting Started with MicroMod

October 21, 2020

Dive into the world of MicroMod - a compact interface to connect a microcontroller to various peripherals via the M.2 Connector!

PoE Assembly

After securing the Processor and Function Board to the Main Board, connect the MicroMod Main Board to your computer with a USB-C cable to program the Processor. Once programmed, connect the Function Board to your Ethernet hub (router, network switch, etc.) with an Ethernet cable connected to the RJ45 connector.

Completed Assembly

Software Installation

Note: The Ethernet Arduino example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review the following tutorials.

Processor Arduino Board Definitions and Driver

Make sure you go through the Hookup Guide for your chosen Processor Board to install the Arduino board definitions and any necessary drivers:

MicroMod ESP32 Processor Board Hookup Guide

October 21, 2020

A short hookup guide to get started with the SparkFun MicroMod ESP32 Processor Board.

MicroMod STM32 Processor Hookup Guide

May 13, 2021

Get started with the MicroMod Ecosystem and the STM32 Processor Board!

MicroMod Teensy Processor Hookup Guide

July 1, 2021

Add the processing power and versatility of the Teensy to your MicroMod project following this guide for the SparkFun MicroMod Teensy Processor.
Note on Artemis and nRF52840 Processors: Currently the Artemis and nRF52840 do not have built in Ethernet libraries in their Arduino cores. An external Arduino Ethernet library may work but at this time Ethernet is not supported on those Processors. We will update the tutorial in the future if Ethernet support is added to these cores.

Main Board Example - Pin Connection Table

The table below helps show what pins the Function Board connects to depending on the slot it is connected to on a Main Board (Note: The Single Main Board connection is Slot 0):

AUDIOUARTGPIO/BUSI2CSDIOSPI0Dedicated
Function Board
Pin Name
I/O
Direction
Main Board's
Processor Pin
Slot 0Slot 1
VCCInput-
3.3VInput-
GND--
ETH_INTD0D1
CSCS0CS1
ETH_RSTPWM0PWM1

Arduino Example

Now that our MicroMod system is fully assembled, we'll use a slightly modified version of the "Ethernet - Web Client" example included with Arduino to make sure everything is connected and working properly. This modified version simply updates the options for the SPI Chip Select pin to match those used on supported MicroMod Processor Boards:

language:c
void setup() {
  //Ethernet.init(CS); //SAMD51
  Ethernet.init(10); //Teensy
  //Ethernet.init(5); //ESP32
  //Ethernet.init(A4); //STM32    
Note: The code defaults to use the CS pin used with the Function Board connected in Slot 0. If the board is in Slot 1, switch to the CS1 pin on your Processor.

Open the Arduino IDE and either copy the code below or navigate to the example by going to File > Examples > Ethernet > Web Client. Reminder, if you open the default example in Arduino, make sure to set the correct Chip Select pin for the Processor Board used as listed above. Upload the code and open the serial monitor with the baud set to 115200 and you should see the example initialize the W5500 and ping Google.com.

language:c
/*
  Web client
 This sketch connects to a website (http://www.google.com)
 using an Arduino Wiznet Ethernet shield.
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe, based on work by Adrian McEwen
 */

#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[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(74,125,232,128);  // numeric IP for Google (no DNS)
char server[] = "www.google.com";    // name address for Google (using DNS)

// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 0, 177);
IPAddress myDns(192, 168, 0, 1);

// 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;

// Variables to measure the speed
unsigned long beginMicros, endMicros;
unsigned long byteCount = 0;
bool printWebData = false;  // set to false for better speed measurement

void setup() {
  //Ethernet.init(CS); //SAMD51
  Ethernet.init(10); //Teensy
  //Ethernet.init(5); //ESP32
  //Ethernet.init(A4); //STM32

  Serial.begin(115200);

  delay(4000);

  // start the Ethernet connection:
  Serial.println("Initialize Ethernet with DHCP:");
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // Check for Ethernet hardware present
    if (Ethernet.hardwareStatus() == EthernetNoHardware) {
      Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
      while (true) {
        delay(1000);
        Serial.println("Not detected");
        delay(1); // do nothing, no point running without Ethernet hardware
      }
    }
    if (Ethernet.linkStatus() == LinkOFF) {
      Serial.println("Ethernet cable is not connected.");
    }
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip, myDns);
  } else {
    Serial.print("  DHCP assigned IP ");
    Serial.println(Ethernet.localIP());
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.print("connecting to ");
  Serial.print(server);
  Serial.println("...");

  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.print("connected to ");
    Serial.println(client.remoteIP());
    // Make a HTTP request:
    client.println("GET /search?q=arduino HTTP/1.1");
    client.println("Host: www.google.com");
    client.println("Connection: close");
    client.println();
  } else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
  beginMicros = micros();
}

void loop() {
  // if there are incoming bytes available
  // from the server, read them and print them:
  int len = client.available();
  if (len > 0) {
//    byte buffer[80];
    byte buffer[512 * 4];
    if (len > sizeof(buffer)) len = sizeof(buffer);
    client.read(buffer, len);
    if (printWebData) {
      Serial.write(buffer, len); // show in the serial monitor (slows some boards)
    }
    byteCount = byteCount + len;
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    endMicros = micros();
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    Serial.print("Received ");
    Serial.print(byteCount);
    Serial.print(" bytes in ");
    float seconds = (float)(endMicros - beginMicros) / 1000000.0;
    Serial.print(seconds, 4);
    float rate = (float)byteCount / seconds / 1000.0;
    Serial.print(", rate = ");
    Serial.print(rate);
    Serial.print(" kbytes/second");
    Serial.println();

    // do nothing forevermore:
    while (true) {
      delay(1);
    }
  }
}

Troubleshooting

Artemis and nRF52840 Processor Support

Reminder, the Artemis and nRF52840 currently do not have built in Ethernet libraries in their Arduino cores. An external Arduino Ethernet library may work with these Processors but at this time Ethernet is not supported. We will update the tutorial in the future if Ethernet support is added to these cores.

General Troubleshooting

Resources and Going Further

That'll a wrap for this tutorial. By now your MicroMod Ethernet network should be up and running. Take a look at the resources below for more information about the MicroMod Ethernet Function Board - WIZnet W5500:

For more information about the SparkFun MicroMod system, take a look here:

MicroMod Logo


learn.sparkfun.com | CC BY-SA 3.0 | SparkFun Electronics | Niwot, Colorado


Viewing all articles
Browse latest Browse all 1123

Trending Articles