Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

WebServer not functioning on Teensy 4.1 #33

Closed
protoface opened this issue May 21, 2021 · 4 comments
Closed

WebServer not functioning on Teensy 4.1 #33

protoface opened this issue May 21, 2021 · 4 comments
Labels
invalid This doesn't seem right Support Library support

Comments

@protoface
Copy link

Describe the bug

When the advanced functionality of this library is used on a Teensy 4.1, requests are never handled and time out.
It also stops going trough the loop until the request is cancelled.

Steps to Reproduce

  1. Setup EthernetWebServer with advanced functions, like in AWS-example
  2. Run it on a Teensy 4.1
  3. Call the webpage

Expected behavior

Teensy sending "Hello World" as a response.

Actual behavior

The request is never handled by Teensy.

Serial Output

10.0.0.3
..........

Code used for testing

#include <EthernetWebServer.h>
#include <NativeEthernet.h>

#define _ETHERNET_WEBSERVER_LOGLEVEL_ 4
#define USE_NATIVE_ETHERNET true
#define USE_THIS_SS_PIN 10

byte mac[6] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};

IPAddress ip(10, 0, 0, 3);
IPAddress gateway(10, 0, 0, 1);
IPAddress submask(255, 255, 255, 0);

EthernetWebServer server(80);

void setup()
{
    Serial.begin(115200);
    while (!Serial)
        ;

    Ethernet.init(USE_THIS_SS_PIN);
    Ethernet.begin(mac, ip, gateway, submask);

    Serial.println(Ethernet.localIP());

    server.on("/", []()
              { server.send(200, "text/html", "Hello World"); });

    server.onNotFound([]()
                      { server.send(404, "Content not found"); });

    server.begin();
}
int lastBeat = 0;
void loop()
{
    if (millis() - lastBeat >= 5000)
    {
        Serial.print(".");
        lastBeat = millis();
    }
    server.handleClient();
}
@khoih-prog
Copy link
Owner

Hi

Thanks for using the library.

I suggest you start with the working and more complex Server examples as follows, I just tested OK and running reliably. Then modify then according to your requirements.

We're sorry We certainly don't have time to spend on your issue, unless you use those examples and prove they're not working.

  1. AdvancedWebServer

Starting AdvancedWebServer on TEENSY 4.1 with Custom Ethernet using Teensy 4.1 NativeEthernet Library
EthernetWebServer v1.5.0
[EWS] ======== USE_NATIVE_ETHERNET ========
[EWS] Default SPI pinout:
[EWS] MOSI: 11
[EWS] MISO: 12
[EWS] SCK: 13
[EWS] SS: 10
[EWS] =========================
[EWS] Board : TEENSY 4.1 , setCsPin: 10
=========================
Currently Used SPI pinout:
MOSI:11
MISO:12
SCK:13
SS:10
=========================
Using mac index = 14
Connected! IP address: 192.168.2.97
HTTP EthernetWebServer is @ IP : 192.168.2.97

Selection_810


  1. WebServer_NativeEthernet

Selection_809


@khoih-prog khoih-prog added invalid This doesn't seem right Support Library support labels May 21, 2021
@m0r13
Copy link

m0r13 commented Dec 2, 2021

Hey,

I can confirm the above issue on a Teensy 4.1 using the AdvancedWebserverExample.
The Teensy does not accept any connections but is running / prints the heartbeats.
As a difference to @MoosKarneval181, Ethernet.localIP() is always 0.0.0.0, whether static IP or DHCP.
I'm using Arduino 1.8.16, Teensyduino 1.55, and I have applied the patches necessary for the library.

Interestingly, it works on a different PC with Arduino 1.8.15 and Teensyduino 1.54.
I have already tried a fresh install of Arduino 1.8.16 and patching only Stream.h manually (in case that the patches are out-of-date...).
Please let me know how we can debug this.

I would actually like to use the library with platformio but there I run into the same issue.
I hope that finding out what the issue is will help fixing it there as well.

Best regards
Moritz

@khoih-prog
Copy link
Owner

I suggest you first trying the better QNEthernet instead of NativeEthernet library.

I've just tested and added support to UPnP_Generic for Teeensy 4.1 + QNEthernet several hours ago.

The result in T41_QNEthernet_SimpleServer on TEENSY 4.1

Interestingly, it works on a different PC with Arduino 1.8.15 and Teensyduino 1.54.

I'm afraid only you can find out what is the issue, such as installation, missing files, etc.

Good Luck,

@m0r13
Copy link

m0r13 commented Dec 3, 2021

Thanks, it works with QNEthernet. With platformio as well... must be some issue with the current Arduino distribution or NativeEthernet then.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right Support Library support
Projects
None yet
Development

No branches or pull requests

3 participants