Ethernet Module (HCARDU0028)
Re: Ethernet Module (HCARDU0028)
The WConstants.h is an old file that is no longer included in the Arduino environment. It has now been replaced with Arduino.h. This would hint that the libraries are out of date but they seem to be working fine in my environment. I'm downloading the latest Arduino environment and will I create a clean install to confirm that the libraries are still ok.
Re: Ethernet Module (HCARDU0028)
Hi
Yes blink compiles and works fine.
Let me download the latest arduino and see what happens. I downloaded 1.0.1 in summer last year so thought it was reasonably up to date. but you have a higer version than me so maybe its a versioning issue.
I'll download the latest and report back.
Thanks for your support!
Yes blink compiles and works fine.
Let me download the latest arduino and see what happens. I downloaded 1.0.1 in summer last year so thought it was reasonably up to date. but you have a higer version than me so maybe its a versioning issue.
I'll download the latest and report back.
Thanks for your support!
Re: Ethernet Module (HCARDU0028)
Hi
I've downloaded v1.0.4 like you use and I'm still getting the same errors:
I've downloaded v1.0.4 like you use and I'm still getting the same errors:
Re: Ethernet Module (HCARDU0028)
Yes I can replicate this now with a clean environment. I suspect the libraries may be out of date. I'm going to work on this now and figure out why in my environment they work ok.
Re: Ethernet Module (HCARDU0028)
Ok thanks. IF you find why it works properly on your 1.0.4 (eg you have some special files) any chance you'd help me out with copies? - That would be fab!
Re: Ethernet Module (HCARDU0028)
It appears that this version of the library is no longer maintained. The current maintained version is now called etherCard. There is already a copy of this library posted in our forum with an example sketch:
http://forum.hobbycomponents.com/viewto ... =46&t=1374
Although this was written for a Microduino module, it will work fine with your module as they both use the same ENC28J60 controller. Until I get the sketch posted here to work with the new library could you try the library and sketch at the link above? You will need to make one change to your set up. The new library assumes that the CS pin is connected to D8, not D10. Apart from that it would work fine with your module.
http://forum.hobbycomponents.com/viewto ... =46&t=1374
Although this was written for a Microduino module, it will work fine with your module as they both use the same ENC28J60 controller. Until I get the sketch posted here to work with the new library could you try the library and sketch at the link above? You will need to make one change to your set up. The new library assumes that the CS pin is connected to D8, not D10. Apart from that it would work fine with your module.
Re: Ethernet Module (HCARDU0028)
But the CS pin isn't connected to D9 using the old files? - This is from the sample code you provided for the module:admin wrote:The new library assumes that the CS pin is connected to D8, not D9. Apart from that it would work fine with your module.
CONNECTIONS:
ETHERNET MODULE ARDUINO BOARD
PIN 1 (CLK OUT) N/A
PIN 2 (INT) N/A
PIN 3 (WOL) N/A
PIN 4 (SO) DIO 12
PIN 5 (SI) DIO 11
PIN 6 (SCK) DIO 13
PIN 7 (CS) DIO 10
PIN 8 (RES) N/A
PIN 9 (VCC) +3.3V
PIN 10 (GND) GND
As you can see CS is connected to pin 10!
Now I'm not sure if you mean it should be connected to pin 9 or pin 8 lol
Re: Ethernet Module (HCARDU0028)
Sorry, I spotted the typo and corrected it before your last post. It was connected to D10 but now should be connected to D8.
Re: Ethernet Module (HCARDU0028)
Hi
Sorry I realised after posting the pins were listed in the other topic!
Right, code using EtherCard compiles and uploads without fault. The problem now is that by browsing to the ip I've set (192.168.0.70 with gateway as 192.168.0.1) I get a page timeout.
I know the ethernet module is working as the green light on the lan socket is on and whenever there is activity on the network the orange one lights up so it is seeing traffic but just not responding when it should. I've double checked the connections too
Sorry I realised after posting the pins were listed in the other topic!
Right, code using EtherCard compiles and uploads without fault. The problem now is that by browsing to the ip I've set (192.168.0.70 with gateway as 192.168.0.1) I get a page timeout.
I know the ethernet module is working as the green light on the lan socket is on and whenever there is activity on the network the orange one lights up so it is seeing traffic but just not responding when it should. I've double checked the connections too
Re: Ethernet Module (HCARDU0028)
Right I've got a bit fed up with this so decided to do a quick debug..
The only thing I'm getting from the serial is:
I'm off to bed.. maybe fresh eyes will spot something tomorrow.
Code: Select all
// Present a "Will be back soon web page", as stand-in webserver.
// 2011-01-30 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php
#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,0,70 };
// gateway ip address
static byte gwip[] = { 192,168,0,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
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]");
Serial.println("starting");
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println( "Failed to access Ethernet controller");
Serial.println("0");
if (STATIC)
{
Serial.println("1");
ether.staticSetup(myip, gwip);
}
else
{
Serial.println("2");
if (!ether.dhcpSetup())
Serial.println("DHCP failed");
}
Serial.println("3");
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
}
void loop(){
Serial.println("4");
// 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);
}
}
Nothing else prints to the serial so the code is hanging or crashing somewhere or the module is faulty. Either way it's not getting past this code:
[backSoon]
starting
Code: Select all
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println( "Failed to access Ethernet controller");