Loading...
  Show Posts
Pages: 1 ... 166 167 [168] 169 170 ... 231
2506  Using Arduino / Networking, Protocols, and Devices / Re: Official Ethernet Shield crashes on: February 26, 2012, 11:03:34 am
OK! Now we are communicating!

It may be a bug in the dhcp routine. Remember, it is brand new.

Does everything you need to work do ok if you use the static ip assignment?
2507  Using Arduino / Networking, Protocols, and Devices / Re: Official Ethernet Shield crashes on: February 26, 2012, 10:59:04 am
Quote
fortunately i've done the cisco ccna course around networks bases

Good. Then it should not be difficult for you to assign a static ip to the Arduino. You should know all about ips, subnets, gateways, and dns. Once you assign a static ip to the shield, can you ping the Arduino ip from a localnet computer?
2508  Using Arduino / Networking, Protocols, and Devices / Re: Official Ethernet Shield crashes on: February 26, 2012, 10:46:24 am
And how long do you wait for the response? I usually do not quote myself, but...

Quote
Is there a dhcp server on the localnet? If the dhcp part is failing, it is not getting an ip from a dhcp server. It may take around a minute to timeout.
2509  Using Arduino / Networking, Protocols, and Devices / Re: Official Ethernet Shield crashes on: February 26, 2012, 10:37:54 am
And what did the serial monitor say?
Failed to configure Ethernet using DHCP
or
Arduino IP address: 192.168.0.22
2510  Using Arduino / Networking, Protocols, and Devices / Re: Uploading file from SD card to remote server? on: February 26, 2012, 09:12:00 am
Update: I have the full package working now. Upload files from the FTP server to the SD card, or download files from the SD card to the FTP server. Right now, I have a define that allows me to compile either upload or download to save program memory.

The code with debugging compiles to 25856 bytes. A little steep for an Uno, but for my Mega2560, not a problem.

If you are interested, let me know. I have a little error checking to do to insure all works ok. If anyone shows interest, I will post the code then.

If you are not interested, at least I'll have it when I need it.  smiley
2511  Using Arduino / Networking, Protocols, and Devices / Re: Connecting Ethernet shield to ICSP header vs Digital pins on: February 25, 2012, 12:37:41 pm
Hum, OK. Is there a reason that the ICSP header pins aren't conencted to the I/O header pins though (that is pins 11, 12, and 13 on the ATMega would conenct to both the 11, 12, 13 I/O pins and the ICSP header)?

I'm not sure what you mean, but the SPI data pins are on each device's digital pins and the ICSP.
The Uno SPI data pins are on the ICSP pins, and digital pins 11-13.
The Mega data pins are on the ICSP pins, and digital pins 50-52. (not connected to the ethernet shield)

The reason most ethernet shields do not connect the SPI to data pins 11-13 is to allow the Mega to use those pins as digital I/O.

I did not vote either way, but I prefer a Mega, so if I had to vote...  smiley-grin
2512  Using Arduino / Networking, Protocols, and Devices / Re: Official Ethernet Shield crashes on: February 25, 2012, 09:48:33 am
Is there a dhcp server on the localnet? If the dhcp part is failing, it is not getting an ip from a dhcp server. It may take around a minute to timeout.

Code:
if(Ethernet.begin(mac) == 0)
{
   Serial.println("No dhcp");
}
2513  Using Arduino / Networking, Protocols, and Devices / Re: Uploading file from SD card to remote server? on: February 25, 2012, 08:22:57 am
Just an update. I have my FTP code reading from and writing to files on my FTP server. I have no SD interface set up yet tho. The test code compiles to 14524 bytes.

Interested?

2514  Using Arduino / Networking, Protocols, and Devices / Re: Connecting Ethernet shield to ICSP header vs Digital pins on: February 25, 2012, 07:07:12 am
By using the ICSP pins, the Mega2560 can use the ethernet shield too. The SPI data pins are not the same on the mega and the uno.
2515  Using Arduino / Networking, Protocols, and Devices / Re: Official Ethernet Shield crashes on: February 25, 2012, 07:04:18 am
Did you try zoomkat's code? Did you see the note in the code about the bug fix? That will cause the Arduino to stay in a "while(client.available())" loop forever.
http://code.google.com/p/arduino/issues/detail?id=605

2516  Using Arduino / Networking, Protocols, and Devices / Re: Uploading file from SD card to remote server? on: February 24, 2012, 04:21:33 pm
If you want to try what I have so far, this connects in passive mode to both the command and data ports. Change network settings and user/password down in the sendFTP function. Press the 'f' key and enter.

It just connects and disconnects to insure it can. See if it works on your ftp server.
Code:
// w5100 FTP passive client
// IDE v1.0 only

#include <SPI.h>
#include <Ethernet.h>

// Set to your network settings
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x59, 0x67 };  
IPAddress ip( 192, 168, 0, 2 );    
IPAddress gateway( 192, 168, 0, 1 );
IPAddress subnet( 255, 255, 255, 0 );

// Change this to the ip of the ftp server
IPAddress server( 192, 168, 0, 3 );

EthernetClient client;
EthernetClient dclient;

char outBuf[128];
char outCount;

void setup()
{
  Serial.begin(9600);
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);
  Ethernet.begin(mac, ip, gateway, gateway, subnet);
  delay(2000);
  Serial.println("Ready. Press f");
}

void loop()
{
  byte inChar;

  inChar = Serial.read();

  if(inChar == 'f')
  {
    if(sendFTP()) Serial.println("FTP OK");
    else Serial.println("FTP failed");
  }
}

byte sendFTP()
{
  if (client.connect(server,21)) {
    Serial.println("Command connected");
  }
  else {
    Serial.println("Connamd connection failed");
    return 0;
  }

  if(!eRcv()) return 0;

// Change to your user and password  
  client.write("USER myusername\r\n");

  if(!eRcv()) return 0;

  client.write("PASS mypassword\r\n");

  if(!eRcv()) return 0;

  client.write("SYST\r\n");

  if(!eRcv()) return 0;

  client.write("PASV\r\n");

  if(!eRcv()) return 0;

  char rtnVal[32];
  
  sscanf(outBuf,"%*s %*s %*s %*s %s",rtnVal);

  unsigned int hiPort,loPort;

  sscanf(rtnVal,"%*c%*d%*c%*d%*c%*d%*c%*d%*c%d%*c%d",&hiPort,&loPort);
  
  Serial.print("Port ");
  hiPort = hiPort << 8;
  loPort = loPort & 255;
  hiPort = hiPort | loPort;
  Serial.println(hiPort);
  

  if (dclient.connect(server,hiPort)) {
    Serial.println("Data connected");
  }
  else {
    Serial.println("Data connection failed");
    client.stop();
    return 0;
  }

  client.write("QUIT\r\n");

  if(!eRcv()) return 0;

  dclient.stop();
  client.stop();
  Serial.println("disconnected");
  return 1;
}

byte eRcv()
{
  byte respCode;
  byte thisByte;

  while(!client.available()) delay(1);

  respCode = client.peek();

  outCount = 0;
  
  while(client.available())
  {  
    thisByte = client.read();    
    Serial.write(thisByte);

    if(outCount < 127)
    {
      outBuf[outCount] = thisByte;
      outCount++;      
      outBuf[outCount] = 0;
    }
  }

  if(respCode >= '4')
  {
    efail();
    return 0;  
  }

  return 1;
}


void efail()
{
  byte thisByte = 0;

  client.write("QUIT\r\n");

  while(!client.available()) delay(1);

  while(client.available())
  {  
    thisByte = client.read();    
    Serial.write(thisByte);
  }

  client.stop();
  dclient.stop();
  Serial.println("disconnected");
}
2517  Using Arduino / Networking, Protocols, and Devices / Re: Uploading file from SD card to remote server? on: February 24, 2012, 12:54:26 pm
Quote
But, you think it is OK to have the Arduino/accelerometer/SD card/boxer out there?
Nobody said anything about high impact! smiley-eek
But why not? If the thing survives, ok with me.

I've already got my ethernet shield connected to my FTP server. I'll let you know how it goes.

edit: I just logged in with a username and password. So far, it works pretty clean, but the difficult part is to come. Will I be able to keep the command connection to port 21 open when I open a data connection to port 20?

2518  Using Arduino / Networking, Protocols, and Devices / Re: Uploading file from SD card to remote server? on: February 24, 2012, 11:33:04 am
Quote
Wouldn't it be simpler to remove the SD card from the Arduino, put it in the PC, and then deal with the data there?
Not always. If I want to retrieve data from my rooftop unit, and the area is being pummeled by lightning, going to the roof of a 22 story building would not be a healthy thing to do.

I can see where FTP would be really helpful. I have not gotten that far along where I need that much data yet, but I can see it coming. Doesn't look that bad to me.

Don't let the thought that "nobody has done it before" is a reason for you not to do it. I took the time to write email sending code. I will post a link to that. It uses a two-way communication like you will need for the FTP protocol. It sends a command, then listens for, and serial.prints, the response.
http://arduino.cc/forum/index.php/topic,69647.15.html

Here is the formats for the commands and responses for FTP.
http://www.w3.org/Protocols/rfc959/8_PortNumber.html

I like the idea!  smiley
2519  Using Arduino / Installation & Troubleshooting / Re: My win7 computer won't recognize my uno on: February 24, 2012, 10:26:38 am
Were all the computers you used to check the uno using Windows 7?

When you unplug the Uno usb cable, does COM3 disappear? And when you plug it back in, you get the Windows "new hardware" sound and COM3 is back?

Do you know anyone who has a computer with Ubuntu 11.10 installed? No drivers needed.
2520  Using Arduino / Installation & Troubleshooting / Re: Quick linux question: where do libraries go? on: February 23, 2012, 05:39:45 pm
If you don't like it, you can always run v0022 just like you do now. Then run the v1.0 shell script to convert your stuff to v1.0 format. I found that comforting in a way. I could upgrade without a total commitment to one version or the other.
Pages: 1 ... 166 167 [168] 169 170 ... 231