ESP32: SDcard and blynk not functional at the same time

Hi, I need help solving a problem I’m having getting BlynkEdgent and SDCard to work at the same time.

I am using a TTGO Lora32 Board that has an ESP32 built in and the SDCard slot.

The program works perfectly, but if I connect the SDCard, Blynk can’t connect:

Error message: Secure connection failed.

SDCard works or Blynk works, but not both at the same time

Thank you

Post your whole sketch so we can take a look at it.

There are lots of different versions of TTGO ESP32 LoRa boards, all with different pinouts and internal connections.
I’d start by finding a pinout diagram for your particular board, and make sure that the diagram makes sense - no mislabelling or duplication of pins.

Then study the pins that are used for the SD card and ensure that there are no pin conflicts with the pins that are used by Edgent. The Edgent pins are defined by a combination of the board type that is chosen in the .ino file, and the corresponding pin definitions in the Settings.h file.

The “Defining your physical switch and LED” section of this topic explains more about how this works…

Pete.

Hello @John93 and @PeteKnight, thanks for replying.

This is the diagram and the board version is LILYGO T3_V1.6.1. I think it’s important to clarify that in the project I only use virtual pins from Blynk. I don’t need to control any physical pin of LILYGO T3_V1.6.1 board.

These are the pins that are declared on the board.

#elif defined(LILYGO_T3_V1_6)
#define I2C_SDA 21
#define I2C_SCL 22
#define OLED_RST UNUSE_PIN

#define RADIO_SCLK_PIN 5
#define RADIO_MISO_PIN 19
#define RADIO_MOSI_PIN 27
#define RADIO_CS_PIN 18
#define RADIO_DI0_PIN 26
#define RADIO_RST_PIN 23
#define RADIO_DIO1_PIN 33
#define RADIO_BUSY_PIN 32

#define SDCARD_MOSI 15
#define SDCARD_MISO 2
#define SDCARD_SCLK 14
#define SDCARD_CS 13

#define BOARD_LED 25
#define LED_ON HIGH

#define ADC_PIN 35

#define HAS_SDCARD
#define HAS_DISPLAY

The code for void setup() and void loop() is as follows.

voidsetup()
{
  Serial.begin(115200);
  pinMode(SDCARD_MISO, INPUT_PULLUP);
  SDSPI.begin(SDCARD_SCLK, SDCARD_MISO, SDCARD_MOSI, SDCARD_CS);
  if (!SD.begin(SDCARD_CS, SDSPI)) {
    Serial.println("SD Card FAIL");
  } else {
    uint32_t cardSize = SD.cardSize() / (1024 * 1024);
    Serial.print("SD Card= ");
    Serial.print(cardSize / 1024.0);
    Serial.println("GB");
    Serial.printf("Total space: %lluMB\n", SD.totalBytes() / (1024 * 1024));
    Serial.printf("Used space: %lluMB\n", SD.usedBytes() / (1024 * 1024));
  }
  BlynkEdgent.begin();

}
void loop()
{
  BlynkEdgent.run();
}

@Yonierv310 based on those comments, and the info you’ve posted, I’m guessing that you didn’t study the link I provided.

Also, posting snippets of code really doesn’t help, because you’ve omitted the important parts as far as we are concerned.

Pete.