1
#include <EtherCard.h>

static byte mymac[] = { 0x7A,0x69,0x69,0x2D,0x30,0x31 };

byte Ethernet::buffer[500];
static uint32_t timer;

const char website[] PROGMEM = "x0201g2.cloudapp.net";

static void my_callback (byte status, word off, word len) {
  delay(1000);
}

void setup () {

  Serial.begin(57600);
  ether.begin(sizeof Ethernet::buffer, mymac, 10);

  ether.dhcpSetup();

  ether.dnsLookup(website);
}

void loop () {

  ether.packetLoop(ether.packetReceive());

  if (millis() > timer) {
    timer = millis() + 5000;
    ether.browseUrl(PSTR("/foo/"), "bar", website, my_callback);
  }
}

The way I tested this is I open up SSH terminal for x0201g2.cloudapp.net to monitor any incoming traffic.

The result is that it works fine, when I have the "serial monitor" (in Arduino IDE) open. I would see that there's a consistent stream of GET requests.

However, when I do not have the serial monitor open nothing ever happen.

Initially I had some Serial println to show response status and IP address, so I thought it might be related to the fact that the MCU's serial controller is waiting for a handshake or some sort of ACK/NACK to happen...if that make sense.

However, that was not the case now because even after I have removed all serial print statements it is behaving in exactly the same way (except that my monitor will show up blank, but I still need to bring it up for it to work).

  • Also, without Serial.begin() nothing will work as well. – 40Plot Nov 16 '15 at 16:35
  • Could it be related to voltage level differences (Nano = 5V) and ENC28J60 wants 3.3V - this particular ethernet board doesn't seem to have a level shifter on it. But if that's true, nothing should work regardless of whether i have serial monitor open or not.. right? – 40Plot Nov 16 '15 at 16:39
  • Maybe it's because it's some unknown cheap clone? You should try it with a genuine one. – Majenko Nov 16 '15 at 18:16
  • 1
    Look at the ATmega reset pin. – Chris Stratton Nov 16 '15 at 19:24
  • 1
    Update: Tried this with Genuine Arduino Nano. Still same behavior. – taiduckman Nov 22 '15 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.