SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions about carrier boards have here!
User avatar
By Bipman
#240128
Hi

I have the weather board with an esp32 processor. All works OK except the SD slot. I can get the SD slot to initialise using the SD.h library but it will not read or write to the card. For example compiling the 'SD card read/write' example it initialises OK but the opening of the file (the card is blank and re-formatted) gets the "error opening test.txt" text. I've tried reformatting, resetting the board etc. but no luck. I've tried 32GB cards and 2GB cards with the same result. I've read elsewhere that the speed of the SPI connection could be the issue.

Bipman
User avatar
By Bipman
#240145
I believe so. The code that fails is
Code: Select all
/*
  Measure and log the humidity in a room using Sparkfun micromod board and ESP32 processor.
  Also using the PCF8523 rtc breakout board via the Quicc connector.
*/

#include "RTClib.h"     //Adafruit PCF8523 RTC
#include <SPI.h>
#include <SD.h>
#include "SparkFunBME280.h"   //Temp/Humid sensor
#include "SparkFun_AS3935.h"  //Lightening detector to powerdown to save battery
#include <SparkFun_VEML6075_Arduino_Library.h> //UV Detector

File myFile;
BME280 aht;
SparkFun_AS3935 lightning;
VEML6075 uv;
RTC_PCF8523 rtc;


const int chipSelect = 5;

String tem="";

void setup() {
  Serial.begin(115200);
   while (!Serial) {}

  if (!SD.begin(chipSelect)) {
    Serial.println("SD initialization failed!");
    while (1);
  }
  Serial.println("SD initialization done.");

  if (SD.exists("Humid.csv")) SD.remove("Humid.csv");

  myFile = SD.open("Humid.csv", FILE_WRITE);

  if (!myFile)
  {
    Serial.println("Problem creating/opening file, stopping");
    while (1);
  }

It initialises the card OK but always fails at the opening of the file. I've checked it's using the proper SD library for the ESP32 processor and that is OK.

Bipman
User avatar
By Bipman
#240242
Has anyone else had this problem? I'm about to ditch the board and use something else to be honest.

Bipman
User avatar
By Bipman
#240298
It now seems to be working for some reason, maybe a lose connection or something. I'll keep my fingers crossed.
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum