Trying to work with Adafruit CC3000 WiFi Shield with Onboard Ceramic Antenna with a Mega 1280. I soldered the pins and icsp header. The MOSI, SCK and MISO pads have been solder on the bottom. Tried to run a simple SD sketch(sdfat library) to test its functionality, chipSelect set for pin 4. No dice, I get an error. If I run this same sketch with the "Ethernet shield with SD" and the Mega 1280 it works fine. Do you know what I could be doing wrong? Is there another step that I should take? Do you have a schematic for the wifi shield?
Here is the sketch.
Code: Select all
// Ported to SdFat from the native Arduino SD library example by Bill Greiman
// On the Ethernet Shield, CS is pin 4. SdFat handles setting SS
const int chipSelect = 4;
/*
SD card read/write
This example shows how to read and write data to and from an SD card file
The circuit:
* SD card attached to SPI bus as follows:
** MOSI - pin 11
** MISO - pin 12
** CLK - pin 13
** CS - pin 4
created Nov 2010
by David A. Mellis
updated 2 Dec 2010
by Tom Igoep
modified by Bill Greiman 11 Apr 2011
This example code is in the public domain.
*/
#include <SdFat.h>
SdFat sd;
SdFile myFile;
void setup() {
//digitalWrite(53,HIGH);
Serial.begin(9600);
while (!Serial) {} // wait for Leonardo
Serial.println("Type any character to start");
while (Serial.read() <= 0) {}
delay(400); // catch Due reset problem
// Initialize SdFat or print a detailed error message and halt
// Use half speed like the native library.
// change to SPI_FULL_SPEED for more performance.
if (!sd.begin(chipSelect, SPI_HALF_SPEED)) sd.initErrorHalt();
// open the file for write at end like the Native SD library
if (!myFile.open("test.txt", O_RDWR | O_CREAT | O_AT_END)) {
sd.errorHalt("opening test.txt for write failed");
}
// if the file opened okay, write to it:
Serial.print("Writing to test.txt...");
myFile.println("testing 1, 2, 3.");
// close the file:
myFile.close();
Serial.println("done.");
// re-open the file for reading:
if (!myFile.open("test.txt", O_READ)) {
sd.errorHalt("opening test.txt for read failed");
}
Serial.println("test.txt:");
// read from the file until there's nothing else in it:
int data;
while ((data = myFile.read()) >= 0) Serial.write(data);
// close the file:
myFile.close();
}
void loop() {
// nothing happens after setup
}
Here is the error.
Can't access SD card. Do not reformat.
No card, wrong chip select pin, or SPI problem?
SD errorCode: 0X1,0X0