Go Down

Topic: Arduino Due with Ethernetshield (Read 1 time) previous topic - next topic


Dear all,
I am working on a Webserver project involving an Arduino Due with Ethernet and SD card. I used examples from various other persons, including Webduinomaster.
There seems to be a probleem addressing the ehternetchip and the SD card when using the DUE. on the Arduino 2560, it works fine.

If I run the code below om the Mega2560, I get very nice lisitngs from the SD and the IP address of the shield. While running on the Due, I still get the nice listing, but the IP address now is Unless I quote the entire SD card section, then I get the correct IP address.

What am I doing wrong?

Code: [Select]

#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <Ethernet.h>
#include <Wire.h>
#include <itoa.h>
#include "WebServer.h"
#include "bmp085.h"
/************ ETHERNET STUFF ************/
byte mac[] = {
  0x90, 0xA2, 0xDA, 0x00, 0x3C, 0xDF };
byte ip[] = {
  192, 168, 0, 220};
byte gateway[] = {
  192, 168, 0, 1 };
byte subnet[] = {
  255, 255, 255, 0 };

Sd2Card card;
SdVolume volume;
SdFile root;
SdFile file;

//******************* SETUP
void setup() {
  PgmPrint("Free RAM: ");

//  pinMode(10, OUTPUT);                       // set the SS pin as an output (necessary!)
//  digitalWrite(10, HIGH);                    // but turn off the W5100 chip!
//  pinMode(4, OUTPUT);                       // set the SS pin as an output (necessary!)
//  digitalWrite(4, HIGH);                    // but turn off the SD card chip!

//   if (!card.init(SPI_SIXTEENTH_SPEED, 4)) error("card.init failed!");
//  if (!card.init(SPI_EIGHTH_SPEED, 4)) error("card.init failed!");
//  if (!card.init(SPI_QUARTER_SPEED, 4)) error("card.init failed!");

  if (!card.init(SPI_DIV6_SPEED,4)) Serial.println("card.init failed!");

  // initialize a FAT volume
  if (!volume.init(&card)) Serial.println("vol.init failed!");

  PgmPrint("Volume is FAT");

  if (!root.openRoot(&volume)) Serial.println("openRoot failed");

  // list file in root with date and size
  PgmPrintln("Files found in root:");
  root.ls(LS_DATE | LS_SIZE);

  // Recursive list of all directories
  PgmPrintln("Files found in all dirs:");


  Serial.println("going to connect");
  // Debugging complete, we start the server!
  //  Ethernet.begin(mac, ip);
  Ethernet.begin(mac, ip, gateway, subnet);
  Serial.print("Ethernet connected "); Serial.println(Ethernet.localIP());
//***************** LOOP ***************************************

void loop()

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131