Adafruit Featherwing WIZ5500 Troubleshooting

I'm integrating a Adafruit Ethernet Featherwing (Adafruit Ethernet FeatherWing : ID 3201 : Adafruit Industries, Unique & fun DIY electronics and kits) into a Photon 2 (OS 5.8.0) project and am having issues.

I have following connections:

Adafruit Photon 2
MOSI MOSI (S0)
MISO MISO (S1)
SCK SCK (S2)
IRQ D4
RST D3
CS D5
3.3V 3.3V
GND GND

I'm running the sample program from https://docs.particle.io/hardware/ethernet/ethernet/ and it isn't working as expected. It fails to find the WIZ5500 chip and dutifully tries to reconfigure the pins (I have the above mapping put into the reconfigure attempt) and it eventually fails after the 3 retries.

Can anyone provide any information about how the P2 tests for the SPI WIZ5500 during it's boot/init sequence and what it might be looking for to help me identify whats broken? With the scope, I do see some activity on the SPI MO/MI/CLK/CS lines at boot, but it appears to be before setup() or loop() run and i'm unsure if thats related to what the device does at bootup when System.enableFeature(FEATURE_ETHERNET_DETECTION) is enabled.

If I put a "waitFor(Serial.isConnected, 10000);" at the beginning of setup to isolate user code from system code, I don't see any activity on the SPI lines during setup/loop. Unsure if this expected if the (presumed) detect fails before they run.

Thanks!

Did you connect jumper wires for reset and IRQ on the FeatherWing itself?

From the factory IRQ and RST are not connected to a GPIO on the Adafruit Ethernet Featherwing but are required to operate correctly when connected to a Particle device.

See this note for more information.

1 Like

ah, yes, sorry i did accidently leave that out of the table, but it is physically connected as per the instructions. I will edit the previous post

edit: wait yes, i do have them in the table (but did forget the power pins!), maybe I'm doing something else wrong. IRQ, CS, and RST pins that are on the short end of the Featherwing are attached to the Photon 2.

(for ~reasons~ all the connections are soldered for testing purposes, jumper wires are going from the featherwing to the photon 2)

Add these to your main source file if you haven't already done so:

// Global
SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(SEMI_AUTOMATIC);

SerialLogHandler logHandler(LOG_LEVEL_TRACE);

void setup() {
    waitFor(Serial.isConnected, 10000);
    delay(2000);
    Particle.connect();

    // Add the rest of your code here
}

and monitor the debug output with particle serial monitor or another USB serial tool and see if there are any useful debugging messages. This will makes sure the network doesn't connect until you have logging started.

1 Like

Attached is my slightly modified code from the Ethernet configuration page

// SAMPLE APPLICATION
#include "Particle.h"
SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(SEMI_AUTOMATIC);
Serial1LogHandler log1Handler(115200, LOG_LEVEL_ALL);
SerialLogHandler LogHandler(LOG_LEVEL_ALL);

uint8_t resetRetry = 0;

void setup() {
    waitFor(Serial.isConnected, 10000);
#if HAL_PLATFORM_WIFI && !HAL_PLATFORM_WIFI_SCAN_ONLY
    // To force Ethernet only, clear Wi-Fi credentials
    Log.info("Clear Wi-Fi credentionals...");
    WiFi.clearCredentials();
#endif // HAL_PLATFORM_WIFI && !HAL_PLATFORM_WIFI_SCAN_ONLY

    // Disable Listening Mode if not required
    if (System.featureEnabled(FEATURE_DISABLE_LISTENING_MODE)) {
        Log.info("FEATURE_DISABLE_LISTENING_MODE enabled");
    } else {
        Log.info("Disabling Listening Mode...");
        System.enableFeature(FEATURE_DISABLE_LISTENING_MODE);
    }

    Log.info("Checking if Ethernet is on...");
    uint8_t macAddrBuf[8] = {};
    uint8_t* macAddr = Ethernet.macAddress(macAddrBuf);
    if (macAddr != nullptr) {
        Log.info("Ethernet MAC: %02x %02x %02x %02x %02x %02x",
                macAddr[0], macAddr[1], macAddr[2], macAddr[3], macAddr[4], macAddr[5]);
    }
    else {
      Log.info("Ethernet MAC is null");
    }
    if (Ethernet.isOn()) {
        Log.info("Ethernet is on");
        Ethernet.connect();
        waitFor(Ethernet.ready, 30000);
        Log.info("Ethernet.ready: %d", Ethernet.ready());
        resetRetry = 0;
    } else if (++resetRetry <= 3) {
        Log.info("Ethernet is off or not detected, attmpting to remap pins: %d/3", resetRetry);

        if_wiznet_pin_remap remap = {};
        remap.base.type = IF_WIZNET_DRIVER_SPECIFIC_PIN_REMAP;

        remap.cs_pin = PIN_INVALID; // default
        remap.reset_pin = PIN_INVALID; // default
        remap.int_pin = PIN_INVALID; // default

        auto ret = if_request(nullptr, IF_REQ_DRIVER_SPECIFIC, &remap, sizeof(remap), nullptr);
        if (ret != SYSTEM_ERROR_NONE) {
            Log.error("Ethernet GPIO config error: %d", ret);
        } else {
            if (System.featureEnabled(FEATURE_ETHERNET_DETECTION)) {
                Log.info("FEATURE_ETHERNET_DETECTION enabled");
            } else {
                Log.info("Enabling Ethernet...");
                System.enableFeature(FEATURE_ETHERNET_DETECTION);
            }
            delay(500);
            System.reset();
        }
    }

    Particle.connect();
}

void loop() {
    static system_tick_t lastPublish = millis();
    static int count = 0;
    static bool reconnect = false;

    if (Particle.connected()) {
        reconnect = false;
        if (millis() - lastPublish >= 10000UL) {
            Particle.publish("mytest", String(++count), PRIVATE, WITH_ACK);
            lastPublish = millis();
        }
    }

    // Detect a network dropout and reconnect quickly
    if (!reconnect && !Ethernet.ready()) {
        Log.info("Particle disconnect...");
        Particle.disconnect();
        waitFor(Particle.disconnected, 5000);
        Log.info("Network disconnect...");
        Network.disconnect();
        Particle.connect();
        reconnect = true;
    }
}

I have modified it slightly to add the waitFor the USB serial, and also to test for the MAC address every boot. Since I'm using the default pins, I set the pin-remap to PIN_INVALID as noted in the docs. I also removed the retained memory bit since it ties 3 times, fails to remap, then never tries again.

Heres the extent of the output:

---- Opened the serial port COM36 ----
0000005504 [app] INFO: Clear Wi-Fi credentionals...
0000005521 [app] INFO: FEATURE_DISABLE_LISTENING_MODE enabled
0000005538 [app] INFO: Checking if Ethernet is on...
0000005553 [app] INFO: Ethernet MAC is null
0000005565 [app] INFO: Ethernet is off or not detected, attmpting to remap pins: 1/3
0000005591 [app] INFO: FEATURE_ETHERNET_DETECTION enabled
---- Closed serial port COM36 due to disconnection from the machine ----
---- Opened the serial port COM36 ----
0000002153 [app] INFO: Clear Wi-Fi credentionals...
0000002170 [app] INFO: FEATURE_DISABLE_LISTENING_MODE enabled
0000002188 [app] INFO: Checking if Ethernet is on...
0000002203 [app] INFO: Ethernet MAC is null
0000002215 [app] INFO: Ethernet is off or not detected, attmpting to remap pins: 1/3
0000002241 [app] INFO: FEATURE_ETHERNET_DETECTION enabled
---- Closed serial port COM36 due to disconnection from the machine ---

Can I expect the Photon 2 to get the MAC address from the module without being connected to a network? I am connected to a switch and activity lights are flashing on the Adafruit device, but unsure what conclusions can be drawn from that.

Here's the breadboard setup to show that it's pretty bare bones.

Appreciate any sanity check on this!

Going to try to use the adafruit lib that only uses bare SPI. If I can get that talking then it must be something with the RST/IRQ pins.

Ahh, i found this thread, and am seeing the same regression in 5.8.0 Photon 2 - 5.8.0 regression - ethernet no longer supported?

If I revert to 5.6.0 my code works as expected. I'll do development in 5.6.0 and await the 5.8.2 that should fix this.

bummer, just tried the hot off the presses 5.8.2, but I'm still not able to initialize the ethernet device.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.