title: Cannot mount SD using FatFS on STM32
body: <p>I'm trying to write to a MicroSD-Card using STM32F405 chip.<br>
  The pins are connected correctly and each pin on the MicroSD-Card slot can be written to by using HAL_GPIO_WritePin. (Messured with ossciloscope) I'm using CubeMX to generate the init code for TrueStudio, so hopefully everything is ok there as well. But when I run the following code, f_mount returns <code>FR_DISK_ERR</code>. The MicroSD-Card can be written to and read from. If I use a different Device number, i.e. "1:", I get <code>FR_INVALID_DRIVE</code>   </p>
  
  <p>So my question is: what could cause <code>FR_DISK_ERR</code> except a faulty MicroSD-Card?</p>
  
  <p>Here is my code so far:</p>
  
  <pre><code>int main(void)
  {
  
    /* USER CODE BEGIN 1 */
  
    /* USER CODE END 1 */
  
    /* MCU Configuration----------------------------------------------------------*/
  
    /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
    HAL_Init();
  
    /* Configure the system clock */
    SystemClock_Config();
  
    /* Initialize all configured peripherals */
    MX_GPIO_Init();
    MX_SDIO_SD_Init();
    MX_FATFS_Init();
  
    /* USER CODE BEGIN WHILE */
    FATFS fileSystem;
    FIL testFile;
    uint8_t testBuffer[16] = "SD write success";
    UINT testBytes;
    FRESULT res;
  
    while((res = f_mount(&amp;fileSystem, SD_MOUNT_PATH, 1)) != FR_OK){
        printf("%d", res); //used to debug res, only for TrueStudio Debugger
    }
  
  
      uint8_t path[13] = "testfile.txt";
      path[12] = '\0';
  
      res = f_open(&amp;testFile, (char*)path, FA_WRITE | FA_CREATE_ALWAYS);
  
      HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_RESET);
      res = f_write(&amp;testFile, testBuffer, 16, &amp;testBytes);
      HAL_GPIO_WritePin(GPIOA, GPIO_PIN_7, GPIO_PIN_RESET);
  
      res = f_close(&amp;testFile);
      HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_RESET);
  
  
  }
  </code></pre>
  
  <p>in <code>MX_FATFS_Init()</code> <code>FATFS_LinkDriver(&amp;SD_Driver, SD_Path)</code> is called and returns 0.</p>