Hello to all,
I'm having trouble with the Ethernet library and SDfat lib working together.
I'm using a arduino DUE with ethernet shield rev3 and using arduino software 1.5.2.
If used separate both work, or if I start ethernet my IP services work, or if I start card to read and write my sketch also works.
The problem is that I want to collect IP information inside the card, but if I start ethernet after sdfat , the network does not work.
I'm properly exchanging SS pins for each moment and each access but still no success.
below is my Sketch
#include <SPI.h>
#include <Ethernet.h>
///////////Ethernet Config Initial with no card inserted
static byte arduinoMAC[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
static IPAddress ArduinoIPAddress(192,168,1,230);
static IPAddress ArduinoDns(192,168,1,5);
static IPAddress ArduinoGw(192,168,1,10);
static IPAddress ArduinoMask(255,255,255,0);
EthernetServer telnetServer = EthernetServer(23);
void ethEnable()
{
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
pinMode(10, OUTPUT);
digitalWrite(10, LOW);
}
void sdEnable()
{
pinMode(4, OUTPUT);
digitalWrite(4, LOW);
pinMode(10, OUTPUT);
digitalWrite(10, HIGH);
}
void sdCARD_INIT()
{
//initialize SD card..
Serial.print("Initializing SD card...");
if (!sd.begin(chipSelect, SPI_FULL_SPEED))
{
Serial.println("Error reading SDcard..");
sd.initErrorHalt();
}
else
{
Serial.println("Done");
}
}
void sdCARD_IP_CONFIG()
{
//here I remove the acces to file just for test and insert my new ip directly
ArduinoIPAddress[0] = 192;
ArduinoIPAddress[1] = 168;
ArduinoIPAddress[2] = 1;
ArduinoIPAddress[3] = 100;
delay(150);
Serial.println(ArduinoIPAddress);
Serial.println("\nDone");
configFile.close();
}
setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
sdEnable();
sdCARD_INIT();
sdCARD_IP_CONFIG();
ethEnable();
Ethernet.begin(arduinoMAC, ArduinoIPAddress,ArduinoDns,ArduinoGw,ArduinoMask);
telnetServer.begin();
}
I´ll apreciate any ideas.
tks