boliganglidemao 发表于 2015-8-22 19:46:17

跪教大神们解决,arduino连enc28j60ping不通

按着论坛里大神的翻译教程连的,不知道哪里出问题了,第一步就做了好几天,依旧ping不通,要被自己蠢哭了……求大神解救
#include <EtherCard.h>
static byte mymac[] = {0x74,0x69,0x69,0x2D,0x30,0x31};
static byte myip[] = {192,168,1,115};
byte Ethernet::buffer;

void setup () {

Serial.begin(57600);
Serial.println("PING Demo");

if (ether.begin(sizeof Ethernet::buffer, mymac, 10) == 0)
    Serial.println( "Failed to access Ethernet controller");

if (!ether.staticSetup(myip))
    Serial.println("Failed to set IP address");
}

void loop() {

ether.packetLoop(ether.packetReceive());
}
串口显示PING Demo
cmd里ping不通,一直显示无法访问到目标主机,跪求大神们帮解决

liuxue4503 发表于 2015-8-23 07:07:34

不会是设置的IP跟你自己的不在同一网段吧?

林定祥 发表于 2015-8-24 06:45:46

连接的对方的ip地址查过吗?

boliganglidemao 发表于 2015-8-26 23:55:44

liuxue4503 发表于 2015-8-23 07:07 static/image/common/back.gif
不会是设置的IP跟你自己的不在同一网段吧?

不会啊,电脑是192.168.1.108,arduino设置的是192.168.1.103

boliganglidemao 发表于 2015-8-26 23:57:51

林定祥 发表于 2015-8-24 06:45 static/image/common/back.gif
连接的对方的ip地址查过吗?

查过的,电脑是108,板子是103,ping家里的另一台电脑也没问题T—T

liuxue4503 发表于 2015-8-27 17:14:08

本帖最后由 liuxue4503 于 2015-8-27 17:16 编辑

boliganglidemao 发表于 2015-8-26 23:55 static/image/common/back.gif
不会啊,电脑是192.168.1.108,arduino设置的是192.168.1.103

这好几天了还没通。。真是有点痛苦。我之前也是按网上那个弄的,一次就通。请再给下你的接线情况,还有。串口有没有其它的什么信息输出呢?刚注意到最个问题,你说的是arduino设置的是192.168.1.103,但是你发出来的程序里面写提192.168.1.115哦

boliganglidemao 发表于 2015-8-27 22:26:45

liuxue4503 发表于 2015-8-27 17:14 static/image/common/back.gif
这好几天了还没通。。真是有点痛苦。我之前也是按网上那个弄的,一次就通。请再给下你的接线情况,还 ...

哦哦,之后改过了,因为103总不通,所以试了试115,ping的显示还是无法访问目标主机,接线是:enc28j60——arduino,5V——power3.3V,GND——powerGND,LNT——2,SO——12,SCK——13,ST——11,RST——RES,CS——10

boliganglidemao 发表于 2015-8-27 22:32:29

本帖最后由 boliganglidemao 于 2015-8-27 22:37 编辑


enc28j60的D1灯是亮黄色的,求教怎么解决啊{:soso_e109:}

Atoney 发表于 2015-8-27 22:33:10

串口信息是什么

boliganglidemao 发表于 2015-8-27 22:34:24

Atoney 发表于 2015-8-27 22:33 static/image/common/back.gif
串口信息是什么

Failed to access Ethernet controller

Atoney 发表于 2015-8-27 22:41:54

static byte myip[] = {192,168,1,115};
删了。
然后 输出本机ip 试试

ether.printIp("IP:", ether.myip);

boliganglidemao 发表于 2015-8-27 23:35:31



改了之后一行一行的自动显示IP:0.0.0.0

boliganglidemao 发表于 2015-8-28 12:17:28

#include <net.h>
#include <EtherCard.h>

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

byte Ethernet::buffer;
static uint32_t timer;

char website[]= "www.vckbase.com/index.php/video";

// called when the client request is complete
static void response_callback (byte status, word off, word len) {

Serial.print((const char*) Ethernet::buffer + off);
}

void setup () {
Serial.begin(9600);
Serial.println("\n");

if (ether.begin(sizeof Ethernet::buffer, mymac,10) == 0)
    Serial.println( "Failed to access Ethernet controller");
if (!ether.dhcpSetup())
    Serial.println("DHCP failed");

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

if (!ether.dnsLookup(website))
    Serial.println("DNS failed");

ether.printIp("SRV: ", ether.hisip);

}

void loop () {
ether.packetLoop(ether.packetReceive());

if (millis() > timer) {
    timer = millis() + 10000;
    Serial.println();
    Serial.print("<<<REQ\n");
    ether.browseUrl(PSTR("/demo/"), "aphorisms.php", website, response_callback);
}
}

这是测试的论坛里的另外一段代码,串口显示

真是要被逼疯了,求大神解救

liuxue4503 发表于 2015-8-29 11:26:14

boliganglidemao 发表于 2015-8-27 22:34 static/image/common/back.gif
Failed to access Ethernet controller

又详细看了一次你的程序和接线,好像也没什么地方不对,最后的出错信息:Failed to access Ethernet controller 说明代码里面的ether.begin(),也就是模块初始化这个环节未完成。
我觉得你可以这样,把现在的线什么的都弄下来,再细细地按那个翻译教程再来一次,程序也直接用示例里面的,只改动下IP。其它可能会出现的问题现在也不好判断。

suoma 发表于 2016-9-4 16:24:04

我的可以正常返回IP
页: [1]
查看完整版本: 跪教大神们解决,arduino连enc28j60ping不通