2016-11-17 7 views
1

私はこのようなarduinoマイクロ(oryginal)を持っています:https://www.arduino.cc/en/Main/ArduinoBoardMicroとENC28J66チップセットのイーサネットbordのクローン。イーサネットボード上のArduino MicroをEthernetモジュールENC28J66に接続し、EtherCard BackSoonの例を実行するには?

ピン構成:

  1. CKOUT
  2. /INT
  3. /WOL
  4. SO
  5. SI
  6. SCK
  7. /CS
  8. /
  9. をリセット
  10. VCC(5V)(一つの場所をはんだ付けした後、3.3Vを使用することも可能である)
  11. GND

私がたっ数の組み合わせでイーサカードライブラリの例BackSoonを実行しようとしているが、これは「私を与えましたイーサネットコントローラへのアクセスに失敗しました

次に、このように設定します: Micro | ENC28J60

  • SCK - SCK
  • MISO - SO
  • MOSI - SI
  • SS - CS
  • 5V - VCC
  • GND - GND
  • 10 PIN - INT

この設定はアクセスエラーを生成しませんが、DHCPは失敗します。 DHCPサーバーの設定は確かに良いです。 静的IPアドレスを設定しても、例のようにhttpからこのIP上の応答はありません。

DHCPのための私の試みの全コード:

#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[] = { 172,16,10,222 }; 
// gateway ip address 
static byte gwip[] = { 172,16,10,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); 
    while (!Serial) ; 
    Serial.println("\n[backSoon]"); 

    if (ether.begin(sizeof Ethernet::buffer, mymac,10) == 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())) { 
    Serial.println("got one!"); 
    memcpy_P(ether.tcpOffset(), page, sizeof page); 
    ether.httpServerReply(sizeof page - 1); 
    } 
} 

シリアルレスポンス:

[backSoon] 
DHCP failed 
IP: 0.0.0.0 
GW: 0.0.0.0 
DNS: 0.0.0.0 

誰かが別のものを接続し、(BackSoonなどの)任意のサンプルを実行propelleryために私を助けることができますか?

MicroとENC28J60を一緒に使用することは可能ですか? EtherCardライブラリを使用するのは可能ですか?

答えて

0

あなたの質問から長い時間がかかりますが、これが誰かを助けてくれることを願っています。

  • マイクロ - イーサネット
  • SCK - SCK
  • MISO - SO
  • MOSI - SI
  • PIN 8 - CS(8は、あなたのコード内で10イーサネットカードのデフォルト値です)
  • 5V - VCC
  • GND - GND
関連する問題