title: Having Difficulty configuring FatFs for flash memory
body: <p>I am but a lowly intern, cast into the unforgiving fires of firmware development. I have been tasked with implementing a file system onto an STM32 chip, using a w25qxx through SPI. I have been able to successfully read and write to the w25q through SPI, and have a class created to handle the basic i/o with the chip.</p>
  <p>I have decided on using FatFS as it is partially built into STM32CubeID, and it seemed to be the best for what our needs are. I have seen quite a few people implement FatFS through on SD cards, but an SD card would be more complexity that we need. In all of the tutorials I saw you need to edit the methods of <em>user_diskio.c</em> to be consistent with the storage you are using. However, when I do this I find that my code never actually uses <em>user_diskio.c</em>, nor does it use <em>diskio.c</em>. I have a line of code set up in these to set an LED to tell if the program ever actually reaches these points in the code, and it appears that it does not.</p>
  <p>Method from my <em>user_diskio.cpp</em></p>
  <pre class="lang-cpp prettyprint-override"><code>DRESULT USER_read (
      BYTE pdrv,      /* Physical drive nmuber to identify the drive */
      BYTE *buff,     /* Data buffer to store read data */
      DWORD sector,   /* Sector address in LBA */
      UINT count      /* Number of sectors to read */
  )
  {
    /* USER CODE BEGIN READ */
      HAL_GPIO_WritePin(GPIOE, GPIO_PIN_10, GPIO_PIN_SET); // 
      w25-&gt;sectorRead(sector, (char*)buff, count);
      return RES_OK;
    /* USER CODE END READ */
  }
  </code></pre>
  <p>In my <em>main.cpp</em>, I am trying to create a file, write a string to it, close it, and then open it again to read the string.</p>
  <pre class="lang-cpp prettyprint-override"><code>  f_getfree(&quot;&quot;, &amp;fre_clust, &amp;pfs);
  
    total = (uint32_t)((pfs-&gt;n_fatent - 2) * pfs-&gt;csize * 0.5);
    free_space = (uint32_t)(fre_clust * pfs-&gt;csize * 0.5);
  
    fresult = f_open(&amp;fil, &quot;file67.txt&quot;, FA_OPEN_ALWAYS | FA_READ | FA_WRITE);
    f_puts(&quot;This data is from the FILE1.txt. And it was written using ...f_puts... &quot;, &amp;fil);
    fresult = f_close(&amp;fil);
  
    fresult = f_open(&amp;fil, &quot;file67.txt&quot;, FA_READ);
    f_gets(buffer, f_size(&amp;fil), &amp;fil);
    f_close(&amp;fil);
  </code></pre>
  <p><code>fresult</code> returns <code>FR_NOT_ENABLED</code> when I go to open the file, and returns <code>FR_INVALID_OBJECT</code> when I got to close. Attempting to read the file into buffer results in the first byte in the buffer being read as a null char. Is there any additional information I should add?</p>