SD access with DFR0664 on GDI and Firebeetle: Initialisation error
0 55
Medium
Has anyone successfully written on a SD-card with DFR0664?
I always get an initialisation error on SD.begin(TFT_SD)
My PINs (from the GDI-cable):
#define TFT_DC D2 // data command
#define TFT_CS D6 // screen chip select
#define TFT_RST D3 // Reset
#define TFT_BL D13 // Back light
#define TFT_SD D5 // SD-Card select
I use a 16 GByte SD-Card formatted with FAT32. It is readable on other devices.
I use this libraries:
#include "SD.h"
#include “SPI.h”
#include "DFRobot_UI.h"
#include "DFRobot_GDL.h"
(For using the display and the SD-card-reader)
CODE
// FireBeetle 2 ESP32-E
#include "SD.h"
#include "SPI.h"
#include "DFRobot_UI.h"
#include "DFRobot_GDL.h"
#define TFT_DC D2 // data command
#define TFT_CS D6 // screen chip select
#define TFT_RST D3 // Reset
#define TFT_BL D13 // Back light
#define TFT_SD D5 // SD-Card select
File file;
DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC,TFT_CS,TFT_RST);
DFRobot_UI ui(&screen, NULL);
void setup() {
Serial.begin(115200);
ui.begin();
ui.setTheme(DFRobot_UI::MODERN);
ui.bgColor = COLOR_RGB565_BLACK;
screen.fillScreen(COLOR_RGB565_BLACK);
ui.refresh();
while(1) {
if (SD.begin(TFT_SD)){
Serial.println("SD initialization done.");
break;
} else {
Serial.println("SD initialization failed!");
ui.drawString(10, 60, "SD Error", COLOR_RGB565_RED,ui.bgColor, 3,0);
}
}
File file = SD.open("/protokoll.txt", FILE_WRITE);
if (file) {
file.println("Hello from DFR0664!");
file.close();
Serial.println("File written.");
ui.drawString(10, 90, "Write OK", COLOR_RGB565_WHITE,ui.bgColor, 2,0);
} else {
Serial.println("Error on opening the file.");
ui.drawString(10, 90, "Write FAIL", COLOR_RGB565_RED,ui.bgColor, 2,0);
}
}
void loop() {
}
License 
All Rights
Reserved

0