NANO 33 IoT and MKR MEM SHIELD

I can not initialize the SD card. I have NANO 33 IoT and MKR MEM SHIELD. The command SD.begin(4) returns false. I used a SanDisk Ultra SDHC 16 GB card (with A1). The card is new. First I tried the card “as it is”, but when it did not work I formatted it with SD Card Formatter 5.01 from the SD Card Association, but it still does not work. What can be the problem? How do I troubleshoot?

The connections are the following:
NANO 33 IoT - MKR MEM SHIELD
GND - GND
+3V3 - VIN
D13 (SCK) - SCK
D12 (MISO) - MISO
D11 (MOSI) - MOSI
D4 - 4 (SD CS)
D5 - 5 (FLASH CS)

Relevant code:

#include <Arduino.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>

void setup() {
  SD.begin(4)) 
}

I just connected a SD card breakout board to my Arduino Nano 33 IoT. Your code worked. I started with the CardInfo example and that worked with a range of cards from 4 to 16GB from different manufacturers. No issue. So the Nano 33 IoT and the software should be fine.

Looking at the MKRMEMShieldV2.0_sch.pdf the VIN pin of the shield does not seem to be connected. You should use JP4 pin 12 (+3V3) for the power to the SD card.

Oh, dear you are right about that (that the VIN-pin is not connected according to the schematic). As you say the PIN next to it (12) seems to be the one to use. On my shield its marked "VCC". Thanks a lot for seeing this!

I got it to work now, after connecting 3.3 V power to the MKR MEM shield to its "VCC" pin next to "GND", that is pin number 12.

Its strange that I never got any error message when initializing the MKR MEM shield for using flash memory with the faulty power connection. Maybe the SerialFlash-package (SerialFlash.h) does not report that initialization went wrong for the case the MKR MEM is unpowered?