ENC28j60 ethernet modülü çalışmıyor

ENC28j60 ethernet modülünü “EtherCard.h” kütüphanesi ile kullanıyorum. EtherCard kütüphanesinin BackSoon adlı yazılımı arduino uno ile kusursuz çalışıyor. fakat mega da çalışmıyor. cs pinini 53e aldım olmadı, 10a aldım olmadı, 8e aldım olmadı, programdaki cs pini değiştirdim olmadı. normalde 53 olmadı gerek sanırım cs pini. yardımcı olur musunuz?

Merhaba,
Bu şekilde bağlantınız olması gerekiyor;


Manuel IP almayı unutmayın. Kolay gelsin. :slightly_smiling_face:

Evet ben de böyle yaptım çalışmıyor. Acaba modül veya kullandığım EtherCard.h kütüphanesi Arduino megaya uyumlu değilse…? Böyle bir şey olabilir mi? Ha bir de arduino megayi ch340 cipli olanından kullanıyorum. Sahtesi olduğu için de olabilir mi? Çünkü Arduino UNO da denedim çalışıyor ve Arduino UNO orjinal…

Arduinonun ch340 olması modülü kullanmanıza engel olduğunu zanetmiyorum. Son olarak void setup kısmına bu kodu ekler misiniz? Ayrıda kütüphanelerin güncel olduğundan emin olun.

  {
    Serial.println(P("İnternette Baglanamadi"));
  }
  else
  {
     Serial.println(P("İnternette Baglandi"));
  }
// Present a "Will be back soon web page", as stand-in webserver.
// 2011-01-30 <[email protected]>
//
// License: GPLv2

#include <EtherCard.h>

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

#if STATIC
// ethernet interface ip address
static byte myip[] = { 192,168,1,200 };
// gateway ip address
static byte gwip[] = { 192,168,1,1 };
#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) == 0)
    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);
  }
}



arduino kodu burda. arduino uno da sorunsuz çalışıyor. seri portu açtığımda şunlar gözüküyor(normali de bu):

[backSoon]
IP:  192.168.2.34
GW:  192.168.2.1
DNS: 192.168.2.1

ancak arduino megada seri portta şu gözüküyor:

[backSoon]
Failed to access Ethernet controller
------------------------------------------------------------------------------------

“if (ether.begin(sizeof Ethernet::buffer, mymac, SS) == 0)” kodunda SS yazan yere 53 yazarak denedim sonuç aynı…

söylediğiniz kodu sanırım yanlış attınız başı eksik gibi duruyor.

Merhabalar,
Karta bu kodu özelleştirip atarmısınız bazenleri bu hatayı veren modüller bozuk olabiliyor. :grinning_face_with_smiling_eyes:

#include <EtherCard.h>
// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
static byte myip[] = { 192,168,0,10 };

byte Ethernet::buffer[500];
BufferFiller bfill;

void setup () {
  Serial.begin(57600);
  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
    Serial.println( "Failed to access Ethernet controller");
   
  Serial.println("\n[testDHCP]");

  Serial.print("MAC: ");
  for (byte i = 0; i < 6; ++i) {
    Serial.print(mymac[i], HEX);
    if (i < 5)
      Serial.print(':');
  }
  Serial.println();
 
  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
    Serial.println( "Failed to access Ethernet controller");

  Serial.println("Setting up DHCP");
  if (!ether.dhcpSetup())
    Serial.println( "DHCP failed");
 
  ether.printIp("My IP: ", ether.myip);
  ether.printIp("Netmask: ", ether.mymask);
  ether.printIp("GW IP: ", ether.gwip);
  ether.printIp("DNS IP: ", ether.dnsip);
}

static word homePage() {
  long t = millis() / 1000;
  word h = t / 3600;
  byte m = (t / 60) % 60;
  byte s = t % 60;
  bfill = ether.tcpOffset();
  bfill.emit_p(PSTR(
    "HTTP/1.0 200 OK\r\n"
    "Content-Type: text/html\r\n"
    "Pragma: no-cache\r\n"
    "\r\n"
    "<meta http-equiv='refresh' content='1'/>"
    "<title>RBBB server</title>"
    "<h1>$D$D:$D$D:$D$D</h1>"),
      h/10, h%10, m/10, m%10, s/10, s%10);
  return bfill.position();
}

void loop () {
  word len = ether.packetReceive();
  word pos = ether.packetLoop(len);
 
  if (pos)  // check if valid tcp data is received
    ether.httpServerReply(homePage()); // send web page data
}

denedim, modülü arduino mega ile deneyince seri port şöyle:

[testDHCP]
MAC: 74:69:69:2D:30:31
Failed to access Ethernet controller
Setting up DHCP
DHCP failed
My IP: 0.0.0.0
GW IP: 0.0.0.0
DNS IP: 0.0.0.0

arduino uno ile deneyince seri port şöyle:

[testDHCP]
MAC: 74:69:69:2D:30:31
Setting up DHCP
My IP: 192.168.2.34
GW IP: 192.168.2.1
DNS IP: 192.168.2.1

yani burda şuna dikkat çekiyorum: arduino uno da çalışan modül, arduino mega da çalışmıyor. yani modül normalde çalışıyor sağlıklı bir şekilde

Peki mega daki pin bağlantılarınız doğru mu?çünkü bir modülün unoda çalışıp mega da çalışamaması çok saçma.

ilgilendiğiniz için sağolun ben olayı hallettim. pin bağlantılarım doğruydu. normalde bu modül için 3.3v ile çalışır deniyordu. nitekim arduino uno da çalışıyordu. arduino megada 3.3v ile çalışmıyor. modülü 5v ile çalıştırdım ve oldu. ancak biraz ısınması var. sanırım 3.3v tam sınır voltaj olmalı. arduino uno bu 3.3vyi sağlıyor ama mega tam istikrarlı sağlıyamıyor olmalı. ideal voltaj 4 v muhtemelen

1 Beğeni