Arduino Uno i ENC28J60

0

Witajcie,

Mam problem z połączeniem Arduino Uno i modułu ENC28J60, a mianowicie. Podpiąłem moduł do Arduino zgodnie z poniższym schematem:

VCC - 3,3V
GND - GND
SCK - PIN 13
SO - PIN 12
SI - PIN 11
CS - PIN 10

Do Arduino dołączyłem bibliotekę EtherCard.
I wgrałem kod:

// Present a "Will be back soon web page", as stand-in webserver.
// 2011-01-30 <[email protected]>
//
// License: GPLv2

#include <EtherCard.h>

#define STATIC 1  // set to 1 to disable DHCP (adjust myip/gwip values below)

#if STATIC
// ethernet interface ip address
static byte myip[] = { 192,168,1,123 };
// gateway ip address
static byte gwip[] = { 192,168,1,122 };
#endif

// ethernet mac address - must be unique on your network
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };

byte Ethernet::buffer[500]; // tcp/ip send and receive buffer

const char page[] PROGMEM =
"HTTP/1.0 503 Service Unavailable\r\n"
"Content-Type: text/html\r\n"
"Retry-After: 600\r\n"
"\r\n"
"<html>"
  "<head><title>"
    "Service Temporarily Unavailable"
  "</title></head>"
  "<body>"
    "<h3>This service is currently unavailable</h3>"
    "<p><em>"
      "The main server is currently off-line.<br />"
      "Please try again later."
    "</em></p>"
  "</body>"
"</html>"
;

void setup(){
  Serial.begin(57600);
  Serial.println("\n[backSoon]");

  // Change 'SS' to your Slave Select pin, if you arn't using the default pin
  if (ether.begin(sizeof Ethernet::buffer, mymac, SS) == 2)
    Serial.println( "Failed to access Ethernet controller");
#if STATIC
  ether.staticSetup(myip, gwip);
#else
  if (!ether.dhcpSetup())
    Serial.println("DHCP failed");
#endif

  ether.printIp("IP:  ", ether.myip);
  ether.printIp("GW:  ", ether.gwip);
  ether.printIp("DNS: ", ether.dnsip);
}

void loop(){
  // wait for an incoming TCP packet, but ignore its contents
  if (ether.packetLoop(ether.packetReceive())) {
    memcpy_P(ether.tcpOffset(), page, sizeof page);
    ether.httpServerReply(sizeof page - 1);
  }
}

jak ustawiam na statyczne IP to monitor portu wykazuje że jest niby ok, wchodze w przeglądarkę pod to IP a nic nie wyświetla (Arduino jest podpięte do routera, a laptop przez wifi do tej samej sieci).

Natomiast, kiedy ustawie IP dynamiczne to wyświetla mi na monitorze tylko 0.0.0.0

Mieliście coś podobnego? Macie jakiś pomysł ?

0

wchodze w przeglądarkę pod to IP a nic nie wyświetla

Możesz wrzucić screenshota przeglądarki?

0

monitor
przegladarka

0

A na pewno masz wewnetrzna siec na 192 ? a moze masz 10.0.0.1 albo 172.0.0. zaloguj sie do rutera i zobacz jakie ip ma twoj laptop. Jak rozwiazles ten problemos ?

1 użytkowników online, w tym zalogowanych: 0, gości: 1