Best SD to PC solution

I'm planning to build a IP67 Device, that contains Atmel SAMD21 MCU, ublox Nina, UbloxM8 and a few peripheral ic's. The device will have a LEMO usb connector that is waterproof. The USB Port of SAMD21 will be for use with C software on PC to edit device config and stuff.

The device needs to save data so an sd card (files for each used day, eg AB190307.csv). Since the SD card needs to be inside the device, and the enclosure is to small for a IP67 sd slot, it would be neccessary to dismantle the enclosure to remove sd an plug into pc.

Is there any nice way to extract data from the SD to the pc? I already searched for USB-SD card reader ic and connect via hub along with the SAMD21, but these ic's are hardly available.

Has anyone made something like this? What could be a solution ? Is there any else type of storage that could be used?

this could be the solution

Juraj:
this could be the solution
GitHub - markmal/MSD: Arduino SAMD USB MSC device

I'm not sure, but it looks like this actually changes the USB Port to mass storage, so UART+Mass Storage would not work...

sgt_johnny:
I'm not sure, but it looks like this actually changes the USB Port to mass storage, so UART+Mass Storage would not work...

in readme: "The MSC interface can be compiled as composite interface together with CDC interface. It can be helpful if you need to see debug output in console."

Is there any nice way to extract data from the SD to the pc?

Have you considered using a radio link ?

Juraj:
in readme: "The MSC interface can be compiled as composite interface together with CDC interface. It can be helpful if you need to see debug output in console."

So CDC = USB to Serial?

UKHeliBob:
Have you considered using a radio link ?

I was, i know that there were a project where a ESP8266 was used to make a FTP Server out of a SD, but it doesn't seem to work on ublox Nina, which is ESP32, and the ESP8266 would have interfaced the SD directly, no other MCU present

CDC is composite type

I was focused on SAMD. With WiFiNina you can read the files over network.

btw: do you know that you can upload the sketch over network with SAMD and WiFiNina with ArduinoOTA library? (not that one for the esp)

Juraj:
With WiFiNina you can read the files over network.

How? Is there a example or library?

...
#include <StreamLib.h>
...
WiFiServer webServer(80);

void setup() {
 ...
  webServer.begin();
}

void loop() {
...
  WiFiClient client = webServer.available();
  if (client && client.connected()) {
    if (client.find(' ')) { // GET /fn HTTP/1.1
      char fn[20];
      int l = client.readBytesUntil(' ', fn, sizeof(fn));
      fn[l] = 0;
      while (client.read() != -1);
      char buff[1024];
      BufferedPrint bp(client, buff, sizeof(buff));
      File dataFile = SD.open(fn);
      if (dataFile) {
        char* ext = strchr(fn, '.');
        bp.println("HTTP/1.1 200 OK");
        bp.println("Connection: close");
        bp.print("Content-Length: ");
        bp.println(dataFile.size());
        bp.println("Content-Type: application/x-download");
        while (dataFile.available()) {
          bp.write(dataFile.read());
        }
        dataFile.close();
        bp.flush();
      } else {
        bp.println("HTTP/1.1 404 Not Found");
        bp.printf("Content-Length: ");
        bp.println(12 + strlen(fn));
        bp.println();
        bp.printf("\"%s\" not found", fn);
        bp.flush();
      }
      client.stop();
    }
  }
}

call