Show Posts
Pages: 1 2 3 [4] 5 6 ... 408
46  Using Arduino / Networking, Protocols, and Devices / Re: Arduino UNO + Ethernet Shield Hangs on: September 04, 2014, 07:48:50 pm
How often are you sending these requests? It appears to be every three seconds. Are you certain the server is not refusing the connection? If you have sockets available, and the connection is failing, I would look at the server logs for a cause.

Have you tried the same type connection from a computer every three seconds?
47  Using Arduino / Networking, Protocols, and Devices / Re: Arduino UNO + Ethernet Shield Hangs on: September 04, 2014, 07:35:08 pm
It appears you may be running out of sockets, but you shouldn't be. Add this code to your sketch and call it just before the client.connect() call.
Code:
#include <utility/w5100.h>

byte socketStat[MAX_SOCK_NUM];

void ShowSockStatus()
{
  for (int i = 0; i < MAX_SOCK_NUM; i++) {
    Serial.print(F("Socket#"));
    Serial.print(i);
    uint8_t s = W5100.readSnSR(i);
    socketStat[i] = s;
    Serial.print(F(":0x"));
    Serial.print(s,16);
    Serial.print(F(" "));
    Serial.print(W5100.readSnPORT(i));
    Serial.print(F(" D:"));
    uint8_t dip[4];
    W5100.readSnDIPR(i, dip);
    for (int j=0; j<4; j++) {
      Serial.print(dip[j],10);
      if (j<3) Serial.print(".");
    }
    Serial.print(F("("));
    Serial.print(W5100.readSnDPORT(i));
    Serial.println(F(")"));
  }
}
A socket status list:
0x0 = available.
0x14 = socket waiting for a connection
0x17 = socket connected to a client if a server, or a server if a client.
0x22 = UDP socket.

If you have no sockets with a status of 0x0 just before the client.connect() call, you have no more sockets, and that is causing the connection fail.
48  Using Arduino / Networking, Protocols, and Devices / Re: Arduino UNO + Ethernet Shield Hangs on: September 04, 2014, 06:40:39 pm
You are not waiting for a response from the server, so it will be tough to troubleshoot. All of my examples wait for and display the response from the server.

Are you certain you tried my examples from the playground?
http://playground.arduino.cc/Code/WebClient

You must be more specific about where the code fails. What is the last message displayed on the serial monitor when it fails? I prefer you test with my examples from the playground, since they have all my latest bug fixes and fault tolerance.

I don't recommend this code. That is a character array, and will use dns to resolve.
Code:
  if (client.connect("10.0.0.7", 80)) {

If using an IP address, I use this:
Code:
  IPAddress server(10,0,0,7);

  if (client.connect(server, 80)) {
49  Using Arduino / Networking, Protocols, and Devices / Re: Unreadable Characters in Serial Monitor from Android app on: September 04, 2014, 02:01:07 pm
If you are using SoftwareSerial with a Bluetooth device, it is more likely you have the incorrect baud rate set in the SoftwareSerial.begin() function for the Bluetooth.
50  Using Arduino / Networking, Protocols, and Devices / Re: read data from SPI on: September 04, 2014, 01:41:45 pm
I would stick with mode 0 after examining the SPI timing. The SCK line should be LOW when the WS line goes LOW. That is mode 0. The timing diagram was a bit misleading at first glance.

I would try this code. It builds a long variable using the byte values returned in my suggested code above. It shifts left 8 bit places three times, then shifts right 7 bit places once. It will be a 24 bit value in a 32 bit variable.
Code:
long LeftChannel = LeftOne;
LeftChannel = LeftChannel << 8;
LeftChannel = LeftChannel | LeftTwo;
LeftChannel = LeftChannel << 8;
LeftChannel = LeftChannel | LeftThree;
LeftChannel = LeftChannel << 8;
LeftChannel = LeftChannel | LeftFour;
LeftChannel = LeftChannel >> 7;
Same with the right channel.
51  Using Arduino / Programming Questions / Re: Sketch compiles on PC but not on Raspberry Pi on: September 04, 2014, 01:31:35 pm
I believe it is the IDE version for RPi that is your problem. What IDE version are they using now?

The newer IDE versions on the Arduino website have their own gcc compiler and libraries included in the download. I'm not sure how the IDE in the RPi repository gets the compiler and libraries.

I tried downloading a current Linux IDE from the Arduino website onto my RPi, and could not get it to compile.  smiley-sad
52  Using Arduino / Networking, Protocols, and Devices / Re: read data from SPI on: September 04, 2014, 08:59:25 am
I did not notice the SPI mode was incorrect. You should use mode 3. Clock HIGH and pulsed LOW, capturing data on the rising edge.
Code:
  SPI.setDataMode(SPI_MODE3);  
http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus

edit: It may still be OK with MODE0 according to the timing. Print the values returned from these SPI.transfer() calls to see how the data is transferred.

You must do an extra "shift left one bit" to align those bits into a 24 bit value.
53  Using Arduino / Programming Questions / Re: How to detect new WifiClient? on: September 04, 2014, 08:34:58 am
PaulS can be a bit blunt to put it mildly, but he does know what he is talking about. You are not the first to notice by a long shot.

Add the function I posted earlier, and call it just before you call the server.available() function. See if the server socket is still listening.
54  Using Arduino / Networking, Protocols, and Devices / Re: read data from SPI on: September 04, 2014, 07:29:49 am
Did you see my edit/code addition to reply#1 above?

The Arduino SPI may be too fast if not slowed up a bit. See CrossRoads post above.
http://arduino.cc/en/Reference/SPISetClockDivider
Code:
   SPI.setClockDivider(SPI_CLOCK_DIV8);
// or even down to
    SPI.setClockDivider(SPI_CLOCK_DIV32);

edit: The max frequency in the datasheet for SCK is 3.2MHz. You are trying 4MHz. That is too fast.

55  Using Arduino / Programming Questions / Re: How to detect new WifiClient? on: September 04, 2014, 07:07:22 am
Am I correct that you are trying to implement a server and a client in that code? Where in the code is it failing? Does it fail (freeze) or just keep going and fails to detect new client requests?

I used this code to troubleshoot my code. It shows the status of the sockets on the wifi shield. Maybe this will help you.
Code:
#include <utility/server_drv.h>

void ShowSockStatus() {
  for(int x = 0; x < MAX_SOCK_NUM; x++) {
    Serial.print(WiFi._state[x]);    
    Serial.print("  ");
    Serial.print(WiFi._server_port[x]);    
    Serial.print("  s=");
    Serial.print(serverDrv.getServerState(x));    
    Serial.print("  c=");
    Serial.print(serverDrv.getClientState(x));    
    Serial.print("  d=");
    Serial.println(serverDrv.availData(x));    
 }
}

ps: PaulS is helping you indirectly here. He loaned me his WiFi shield to troubleshoot the firmware. Thanks again, PaulS!  smiley
56  Using Arduino / Networking, Protocols, and Devices / Re: UDP Network Slow Responding on: September 03, 2014, 08:28:40 pm
You are complaining about the UDP packet send and receive time interval, but there are other devices involved with your code. Take a look at the Serial.println() calls I have inserted into your loop function below. Add these lines, start your code, and open the serial monitor. If your code is sending only one packet every 10 seconds, then some line or lines will show a delay.
Code:
void loop() {
   
    // read the packet into packetBufffer
   Serial.println(F("Get packet"));
   receiveData();
   // send the packet into the packetBuffer
   Serial.println(F("Send packet"));
    sendFiles(Udp.remoteIP(), Udp.remotePort());
 
   //execute the digital/PWM functions
   
   // UP_DOWN();
    //F_R_L_R();
   
   
     //set the currentMillis for the various analog functions
    unsigned long currentMillis0 = millis(); // for temp and voltageSense (60 seconds)
    unsigned long currentMillis1 = millis(); // for depthSense and compass (10 seconds)

    if(currentMillis0 - previousMillis0 > (5L*1000L)) {
    previousMillis0 = currentMillis0;
    //execute the Digital functions

   Serial.println(F("Lights"));
    lights();
   
     //execute the Analog functions
   Serial.println(F("Depth sensor"));
     depthSensor(); // exectute depthSensor function  - will not cause latency in network running alone (will cause when running with voltageSense)

   Serial.println(F("Compass"));
     LSM303compass(); //execture compass function  - running this function causes major latency in network

   Serial.println(F("Temp"));
     tempSensor();  // execute tempSensor function

   Serial.println(F("Voltage"));
     voltageSense(); //excecute voltage sensing function  - will not cause latency in network running alone
    }
   
   /*if(currentMillis1 - previousMillis1 > (5L*1000L))
     previousMillis1 = currentMillis1; */
 
}
57  Using Arduino / Installation & Troubleshooting / Re: Ethernet shield,Arduino UNO and 3 problems :) on: September 03, 2014, 08:20:30 am
I missed this:
Quote
I try it with LCD and lcd.print but no result.
What LCD are you using? How is it connected? Is it connected when the fail happens? Have you tried the ethernet shield with the LCD removed?

58  Using Arduino / Installation & Troubleshooting / Re: Ethernet shield,Arduino UNO and 3 problems :) on: September 03, 2014, 08:05:29 am
If that is the case, I will guess the 5 volt bus or the MOSI line is shorted on the shield. I can't think of anything else that would cause that fail. If you want to try one more thing, attach the shield with the ICSP pins connected and check the voltage on the 5v pin.
59  Using Arduino / Installation & Troubleshooting / Re: Ethernet shield,Arduino UNO and 3 problems :) on: September 03, 2014, 07:45:58 am
That is a very good idea. If you see "server is at 192.168.1.177", then your w5100 SPI is working ok. If you get any other iP, like "server is at 0.0.0.0", then your w5100 is failing.

60  Using Arduino / Installation & Troubleshooting / Re: Ethernet shield,Arduino UNO and 3 problems :) on: September 03, 2014, 07:18:24 am
But i am also having same solder bridge in shield . I am not getting any error.
Then you are lucky the solder bridges are not causing a fail. There should be no solder bridges on your IC.
Pages: 1 2 3 [4] 5 6 ... 408