chipKIT® Development Platform

Inspired by Arduino™

MAX32 Ethernet Libraries

Created Sun, 16 Dec 2012 19:56:01 +0000 by Mark597


Mark597

Sun, 16 Dec 2012 19:56:01 +0000

I have written a Web server that was working using a UNO32 with an Arduino Ethernet shield. I decided to switch to the MAX32 and MAX ethernet shield to get more speed through the ethernet because the SPI port was kind of slow. After changing the code to use the Digilent ethernet libraries I got it working fairly quickly.

The problem I'm having is that Server.available() stops returning a client after a few successful connections.

I do make sure to run client.stop() to ensure the client get destroyed.

The Ethernet examples do not seem to have this issue.

I also didn't have this issue using the UNO32 and Arduino Ethernet shield.

Has anyone run in to this?

Mark


Jacob Christ

Mon, 17 Dec 2012 21:00:25 +0000

What are you considering a connection? I've done the same and don't seem to have the issue. I'm considering a connection to be each new request from a web browser.

I did have to play with delays before closing the connection to prevent buffered data from getting cut off early. I think the data gets sent to the Ethernet code and its in the middle of transmitting and there is no way (that I'm aware of) to know if all the data has been transmitted. Then if the client stopped the remaining data never makes it to the browser.

Jacob


Mark597

Mon, 17 Dec 2012 22:21:02 +0000

This is part of the code I'm using.

Client client = server.available(); if (client){ <--- The code inside the if statement stops executing.

            code to handle the browser stream and check 
             if there is a support request it can respond to.

            }      

When I refer to a connection I mean when navigating between HTML pages on my Web site or revisiting a previously viewed page. I realize the browser actually connects or requests resources to such as pictures, PDF etc after the initial HTML is loaded but that never seems to be an issue. The pages seem to load completely. But after a few successful connections the server.available() stops returning a Client. This only seems to occur when switching between pages or clicking on a link.

This code had been working using the standard Arduino ethernet shield. #include <ethernet.h>

was changed to for the MAX32

#include <chipKITEthernet.h>


Mark597

Sun, 23 Dec 2012 13:52:55 +0000

I tried creating a very simple HTML web page and made it auto refresh every 5 seconds. It ran for several hours no problem using my web server code.

The HTML is read off an SD card and sent to the client browser. The page is just a few lines of text and it loads in a fraction of a second. My Web site pages have a lot more text, a few links and pictures. Some of the more complex pages may take up to 5 seconds to load. The problem I'm having seems to have something to do with the MAX32 Ethernet libraries. Almost identical code ran fine with the Arduino ethernet shield and libs.

My Problem: Within 10 to 30 seconds of navigating/switching pages the server.available() stops returning a client when one is trying to connect.