Ethernet Shield does not obtain IP adress


hey guys,

i started working arduino , coming more rudementary platforms pic , stm, amazed intuitive , easy handling of hard- , software.

anyway, still stuck ;)
i using arduino mega 2560 ethernet shield.
my first sketch looks this:

code: [select]

// including libraries:
#include <spi.h>
#include <ethernet.h>
#include <streaming.h>
#include <memoryfree.h>
#include <skaarhojpgmspace.h>

byte mac[] = { 0x90, 0xa2, 0xda, 0x0d, 0x6b, 0xb9 };    // <= setup!  mac address of arduino
ipaddress clientip(192, 168, 10, 101);                  // <= setup!  ip address of arduino
ipaddress switcherip(192, 168, 10, 100);                // <= setup!  ip address of atem switcher

// include atembase library , make instance:
// port number chosen randomly among high numbers.
#include <atembase.h>
#include <atemstd.h>
atemstd atemswitcher;



void setup() {

  randomseed(analogread(5));  // random port selection
 
  // start ethernet, serial , udp:
  ethernet.begin(mac,clientip);
  serial.begin(9600);
  serial << f("\n- - - - - - - -\nserial started\n");
  serial.println(ethernet.localip());

  // initialize connection switcher:
  atemswitcher.begin(switcherip);
  atemswitcher.serialoutput(0x80);
  atemswitcher.connect();

  // shows free memory: 
  serial << f("freememory()=") << freememory() << "\n";
}

void loop() {
  // check packets, respond them etc. keeping connection alive!
    atemswitcher.runloop();
}


the output getting serial monitor after compiling , flashing arduino this:
code: [select]

- - - - - - - -
serial started
0.216.216.216


obviously ethernet shield not obtain ip adress intending obtain.
i connected external 12v power supply in addition usb cable rule out lack of current , measured connection arduino ethernet shield every pin (including icsp).
the mac adress using made up, there no sticker on ethernet shield allthough looks 1 has been there once removed. should not problem, it?


every bit of appreciated!
cheers
mark

have @ example : https://www.arduino.cc/en/reference/ethernetlocalip

i suggest create new test sketch, , test ethernet , ip things now.
start serial.begin, , print message, know sketch has started.
then ethernet.begin() , check return value in example.
after that, print ethernet.localip.

start without ip number. use dhcp, with: "ethernet.begin(mac) ;"
some routers block range of mac numbers, try few others. there online mac number generators.

if dhcp works, try own static clientip number.
some routers might block arduino ip if arduino sketch has not normal behaviour.


Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Ethernet Shield does not obtain IP adress


arduino

Comments