(My Specs)
→ Controller - esp32-s3-wroom-2-n32r8v
→ IDE - Platformio
→ Adafruit flash - XTSD04GLGEAG
→ Operating system - UBUNTU
I am trying to implement usb msc with esp32s3-wroom2 controller with Adafruit flash(XTSD04GLGEAG). Below is the listed Platform.ini file and Code for the same.
According to the given code , the flash is appearing as mass storage class , but my files are getting corrupted and after unplugging and plugging it again , I am not able to open those files .
What I want is to run this code to open my adafruit flash as msc and I should be able to drag , drop , open and delete files , without the files getting corrupted.
I have also attached image to provide more insights on that.
- img1 shows the files , that are being stored in adafruit flash.
- img2 show the img file that I have opened showing source file is missing.
(My Platform.ini file)
[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
board_build.flash_mode = dio
build_flags =
-D ARDUINO_USB_MODE=0
-D ARDUINO_USB_CDC_ON_BOOT=0
lib_deps = chegewara/ESP32TinyUSB@^2.0.2
(My Platformio Code)
#include <Arduino.h>
/**
* Simple MSC device with SD card
* author: chegewara
*/
#include "sdusb.h"
#if CFG_TUD_MSC
#define SD_MISO 13
#define SD_MOSI 11
#define SD_SCK 12
#define SD_CS 10
SDCard2USB dev;
void setup()
{
Serial.begin(115200);
if(dev.initSD(SD_SCK, SD_MISO, SD_MOSI, SD_CS))
{
if(dev.begin()) {
Serial.println("MSC lun 1 begin");
} else log_e("LUN 1 failed");
} else Serial.println("Failed to init SD");
// test();
}
void loop()
{
delay(1000);
}
#endif
RCvJs5bGxruh1NYJcW7mM7.png)