J'ai arduino micro (oryginal) comme ceci: https://www.arduino.cc/en/Main/ArduinoBoardMicro et clone de bord ethernet avec le jeu de puces ENC28J66.Comment connecter l'Arduino Micro au module Ethernet ENC28J66 et exécuter l'exemple EtherCard BackSoon?
configuration des broches sur carte Ethernet:
- CKOUT
- /INT
- /WOL
- SO
- SI
- SCK
- /CS
- /RESET
- CCV (5 V) (il est également possible d'utiliser 3.3V après soudage un endroit)
- GND
J'ai essayer d'exécuter par exemple BackSoon pour la bibliothèque EtherCard avec quelques combinaison de conection mais cela m'a donné ' Impossible d'accéder au contrôleur Ethernet '
Ensuite, je l'ai défini comme suit: Micro | ENC28J60
- SCK - SCK
- MISO - SO
- MOSI - SI
- SS - CS
- 5V - VCC
- GND - GND
- 10 PIN - INT
Cette configuration ne génère pas d'erreur d'accès, mais DHCP a échoué. La configuration du serveur DHCP est bonne à coup sûr. Même si je définis l'adresse IP statique, il n'y a pas de réponse sur cette adresse IP de http comme dans l'exemple.
code complet de mon essai pour 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);
}
}
réponse série:
[backSoon]
DHCP failed
IP: 0.0.0.0
GW: 0.0.0.0
DNS: 0.0.0.0
que quelqu'un peut me aider à se connecter propellery un à l'autre et exécuter un échantillon (comme BackSoon)?
Est-il possible d'utiliser conjointement Micro et ENC28J60? Est-il possibile d'utiliser la bibliothèque EtherCard pour eux?