Go Down

Topic: SD card shield compatibility with arduino zero (Read 1 time) previous topic - next topic

katesfb

Hi,
Are conventional  SD card shields that that work with the Arduino Uno compatible with the Arduino Zero given that the SPI pins on the Zero come out through the ICSP connector, whereas the SPI pins on the uno are attached to pins 11,12,13.

Cheers.

CrossRoads

SPI is SPI, does not matter where the electrical connection is. You may have to use a wiring harness vs being able to plug a card right onto a board.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

katesfb

Hi, and thanks for the reply.

So i assume this means that if i want to use something like the Adafruit data-logger shield i would have to wire the SPI  pins on the zero to the relevant SPI pins on the data-logger shield to make it work.

Any help is much appreciated.

Cheers.

Urs_Effi

Hi all

I'm using an Arduino Zero with an Adafruit GPS logging shield. Later on I will use an additional shield for audio data acquisition and an RF data transmitter and a WLAN transmitter. Currently I'm working as a volunteer for the non profit organisation  Mérisope (http://www.meriscope.com/) located in Canada, which does scientific studies with minke whales. They would likes to have a sonar buoy to listen to whales and acoustic noise in the St. Laurence bay. The buoy should be able to record acoustic signals and depending on the distance to transmit them in realtime to the station.

For this development I decided to use an Arduino Zero because it works fast with 48 MHz and has several serial communication abilities. I must be able to serial communication to the SD card for the purpose of data logging, to the RF transmitter, to the WLAN circuit and to the analog shield. I started with the Adafruit GPS logging shield.
https://learn.adafruit.com/adafruit-ultimate-gps-logger-shield/overview

Currently I have a big problem in connecting the SD card without doing extra wiring from the SPI connection of the Zero board to the GPS logging shield.  I try to configure one of the other communication abilities to the digital pins 10, 11, 12 and 13. I think it should be possible. The SPI connector of the ZERO will be used for a very fast RF transmission. I read the paper from Lady Ada how to use more serial connections. "Using ATSAMD21 SERCOM for more SPI, I2C and Serial ports"
https://learn.adafruit.com/using-atsamd21-sercom-to-add-more-spi-i2c-serial-ports/overview

I tried to match this to the SD card, but without success. It does not work. I can't get access to the SD card.
I would be pleased if somebody can help me.

Thank you all
Best Regards
 Urs



#include <SD.h>
#include <SPI.h>
#include "wiring_private.h" // pinPeripheral() function

SPIClass mySDCardSPI(&sercom1, 12, 13, 11, SPI_PAD_0_SCK_1, SERCOM_RX_PAD_3);

File myFile;
const int chipSelect = 10;

void setup() {
Serial.begin(115200);
mySDCardSPI.begin();

// Assign pins 11, 12, 13 to SERCOM functionality
pinPeripheral(11, PIO_SERCOM);
pinPeripheral(12, PIO_SERCOM);
pinPeripheral(13, PIO_SERCOM);
mySDCardSPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));

Serial.print("Initializing SD card...");
pinMode(chipSelect, OUTPUT);
SD.begin(chipSelect);

}
boolean once = false;

void loop()
{
if (once == true) {
while(true){}
}
once = true;
if (SD.exists("example.txt")) {
Serial.println("example.txt exists.");
}
else {
Serial.println("example.txt doesn't exist.");
}

// open a new file and immediately close it:
Serial.println("Creating example.txt...");
myFile = SD.open("example.txt", FILE_WRITE);
myFile.close();

// Check to see if the file exists:
if (SD.exists("example.txt")) {
Serial.println("example.txt exists.");
}
else {
Serial.println("example.txt doesn't exist.");
}

// delete the file:
Serial.println("Removing example.txt...");
SD.remove("example.txt");

if (SD.exists("example.txt")) {
Serial.println("example.txt exists.");
}
else {
Serial.println("example.txt doesn't exist.");
}
Serial.println();
}




Urs_Effi

Hi all
I forget to add the following information:
According to the schematic of the GPS Data logging shield, the pin 11, 12, 13 are already connected  as follows:
Pin 13 SDK
Pin 12 MISO
Pin 11 MOSI
I only had to wire Pin 10 to SD_CS

Thank you for your help and
Best Regards
  Urs

Go Up