SD cards no more radable by PC/MAC after using it with SD shield

I am writing here in order to have some help with this very strange issue that i have.
on my UNO I have connected an SD shield (ebay purchased) and i have tried to store some GPS data into files inside some cards.

I have used 2 SD of 32gb and 1gb FAT32 formatted and everything seemed working fine until I have decided to transfer all the data on my laptop.

Inserting the SD does nothing anymore. no drives came up. gparted does not show anything, even discutil in my macbook ignores the card.

I have tried with another one (1gb). same result.

The funny thing?
If I insert those cards back again into the shield… they work! but only in that damn shield… =(

Anyone has a clue of what is the reason? Is it related to the SPI interface used by arduino?
More important… How can I prevent to waste other cards and safely use the remaining SD that I have?

by the way here’s the code I’ve written:

#include "Adafruit_FONA.h"
#include <SPI.h>
#include <SD.h>

// standard pins for the shield, adjust as necessary
#define FONA_RX 6
#define FONA_TX 5
#define FONA_RST 4

// We default to using software serial.
#include <SoftwareSerial.h>
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
SoftwareSerial *fonaSerial = &fonaSS;

// Fona
Adafruit_FONA_3G fona = Adafruit_FONA_3G(FONA_RST);

// Password
String password = "culo";

// Buffer for replies
char replybuffer[255];

// inizializzo le variabili
float latitude, longitude, speed_kph, heading, speed_mph, altitude;
char * myNumber = "+393280746290";
// this is a large buffer for replies
uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout = 0);
int someVariable = 0;
const int chipSelect = 10;

void setup() {

  // Start Serial
  while (! Serial);
  Serial.println(F("Initializing FONA... (May take a few seconds)"));

  // Init FONA
  if (! fona.begin(*fonaSerial)) {
    Serial.println(F("Couldn't find FONA"));
    while (1);
  Serial.println(F("FONA is OK"));

  // Print SIM card IMEI number.
  char imei[15] = {0}; // MUST use a 16 character buffer for IMEI!
  uint8_t imeiLen = fona.getIMEI(imei);
  if (imeiLen > 0) {
    Serial.print("SIM card IMEI: "); Serial.println(imei);

  // Try to enable GPRS
  Serial.println(F("Enabling GPS..."));

  Serial.print("Initializing SD card...");
  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
  Serial.println("card initialized.");


void loop() {
  if (someVariable > 50)
    // Enable incoming call notification
    Serial.println(F("Enabling incoming call notification..."));
    fona.sendCheckReply(F("AT+CLIP=1"), F("ok!"));
    // get call status
    int8_t callstat = fona.getCallStatus();
    switch (callstat) {
      case 0: Serial.println(F("Ready")); break;
      case 1: Serial.println(F("Could not get status")); break;
      case 3: Serial.println(F("Ringing (incoming)")); break;
      case 4: Serial.println(F("Ringing/in progress (outgoing)")); break;
      default: Serial.println(F("Unknown")); break;
    // Check for an incoming call.  Will return true if a call is incoming.
    if (callstat == 3) {
      if (! fona.hangUp()) {
      } else {
      // invia un messaggio con la posizione
      Serial.println(F("mando SMS con posizione GPS"));
      boolean gps_success = fona.getGPS(&latitude, &longitude, &speed_kph, &heading, &altitude);

    // if you ask for an altitude reading, getGPS will return false if there isn't a 3D fix
    boolean gps_success = fona.getGPS(&latitude, &longitude, &speed_kph, &heading, &altitude);

    if (gps_success) {

      Serial.print(F("GPS lat:"));
      Serial.println(latitude, 6);
      Serial.print(F("GPS long:"));
      Serial.println(longitude, 6);
      Serial.print(F("GPS speed KPH:"));
      Serial.print(F("GPS heading:"));
      Serial.print(F("GPS altitude:"));

      // read the time
      char buffer[23];
      fona.getTime(buffer, 23);  // make sure replybuffer is at least 23 bytes!
      Serial.print(F("Time = ")); Serial.println(buffer);

      String dataString;
      //dataString += F("time: ");
      dataString += (String(buffer).substring(1, 21));
      dataString += F(", ");
      dataString += String(latitude, 6);
      dataString += F(", ");
      dataString += String(longitude, 6);
      dataString += F(", speed: ");
      dataString += String(speed_kph, 6);
      dataString += F(", heading: ");
      dataString += String(heading, 6);
      dataString += F(", altitude: ");
      dataString += String(altitude, 6);

      // filename come la data del giorno
      char filename2[] = "xxxxxx.txt";
      sprintf(filename2, "%c%c%c%c%c%c.txt", buffer[1], buffer[2], buffer[4], buffer[5], buffer[7], buffer[8]);

      File dataFile =, FILE_WRITE);
      // if the file is available, write to it:
      if (dataFile) {
        // print to the serial port too:
      // if the file isn't open, pop up an error:
      else {
        Serial.println("error opening/creating TXT file");


    } else {
      Serial.println("Waiting for FONA GPS 3D fix...");


void delays() {
  Serial.println("60 counting");

void sendSMS() {
  // send an SMS!
  char messageToSend[140];
  String message;
  message += F("Current GPS location:");
  message += String(latitude, 6);
  message += F(",");
  message += String(longitude, 6);
  message.toCharArray(messageToSend, message.length());
  if (!fona.sendSMS(myNumber, messageToSend)) {
  } else {

void flushSerial() {
  while (Serial.available());

for the records:

  • i have tried also to format the cards but since it is not detected (via SD adaptor or USB or by a camera) I cannot perform the task (maybe there is a way to format them through arduino?);

thank you

(maybe there is a way to format them through arduino?);

The only way to format SD is by using the proper formatting programme - not the Windows OS. There is a sticky to that effect at the head of this forum. You actually do this on the PC, not Arduino. Failure to do this may be what your your problem is about.

There is a sticky to that effect at the head of this forum.

You mean that my same issue is already explained and solved somewhere in this forum? can you past me the link, i did not find any related topic...

Beside that, I do not think that the problem was in the formatting method, the largest card (32gb Kingston) was a brand new and already formatted one.

Now I cannot use the suggested software nether (SD card formatter 5.0), the laptop couldn't sense any device attached, therefore, it does not know what to format...


Ah, that one... of course I've read it, thank you!.
Unfortunately It doesn't include my problem even if it strongly suggest (in general) to format properly the SD card.

My issue is that the card is indeed working, but only with arduino...