Forum >Replies by Al Pacifico
userhead Al Pacifico
Replies (2)
  • You Reply: While looking into this, I found the following change to the standard SD library's CardInfo example ([url=http://arduino.cc/en/Tutorial/CardInfo]http://arduino.cc/en/Tutorial/CardInfo[/url]) was neccessary to access the SD card on my DFRobot Ethernet Shield v2.0 ([url=https://www.dfrobot.com/wiki/index.php?title=DFRduino_Ethernet_Shield_(SKU:DFR0125)]https://www.dfrobot.com/wiki/index.php?title=DFRduino_Ethernet_Shield_(SKU:DFR0125)[/url]) :

    I added digitalWrite(10, HIGH) after setting the mode for the SS pin and it worked.

    (BTW I am using Arduino 1.0).

    [code]diff -u /tmp/CardInfo.ino ../CardInfo/CardInfo.ino
    --- /tmp/CardInfo.ino 2012-05-02 05:01:26.297364339 -0700
    +++ ../CardInfo/CardInfo.ino 2012-05-01 20:20:23.440696937 -0700
    @@ -42,7 +42,7 @@
      // (10 on most Arduino boards, 53 on the Mega) must be left as an output
      // or the SD library functions will not work.
      pinMode(10, OUTPUT);    // change this to 53 on a mega
    -
    +  digitalWrite(10, HIGH);

      // we'll use the initialization code from the utility libraries
      // since we're just testing if the card is working!
    [/code]

    I spent a while scouring the web to figure this out, so I'm posting it here in hopes of saving time for those that follow. This should be enough to get you started in solving problems with the other SD card access issues with this version of the Ethernet shield.
    -Al
  • You Reply: Will the standard UdpNtpClient sketch included with Arduino 22 Ethernet library execute using this board?

    I compiled it and tried it with both an Arduino Uno and an Arduino Mega. For unclear reasons, the setup function repeatedly executes. I demonstrated that with the following patch which includes code specific to my network: and longer delay between sending the NTP packet and checking for a response in case there is some sort of latency problem:


    [i]diff -u /usr/share/arduino/libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.pde UdpNtpClient/UdpNtpClient.pde[/i]

    [tt]--- /usr/share/arduino/libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.pde2011-07-15 12:45:24.000000000 -0700
    +++ UdpNtpClient/UdpNtpClient.pde 2012-02-21 11:09:51.013474267 -0800
    @@ -25,8 **5,9 @@
    byte mac[] = { 
      0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
    byte ip[] = {
    -  192,168,1,177 };
    -
    +  192,168,123,11 };
    +byte gateway[] = {
    +  192, 168, 123, 254 };

    unsigned int localPort = 8888;      // local port to listen for UDP packets

    @@ -39,11 +40,11 @@

    void setup()
    {
    +  Serial.begin(9600);
    +  Serial.println("Starting up....");
      // start Ethernet and UDP
    -  Ethernet.begin(mac,ip);
    +  Ethernet.begin(mac,ip,gateway);
      Udp.begin(localPort);
    -
    -  Serial.begin(9600);
    }

    void loop()
    @@ -51,7 +52,7 @@
      sendNTPpacket(timeServer); // send an NTP packet to a time server

        // wait to see if a reply is available
    -  delay(1000); 
    +  delay(3000); 
      if ( Udp.available() ) { 
        Udp.readPacket(packetBuffer,NTP_PACKET_SIZE);  // read the packet into the buffer
    [/tt]